View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001806 | Industrial-Craft² | crossmod-compatibility / submodules / API | public | 2016-02-11 20:37 | 2016-02-16 01:03 |
Reporter | equod | Assigned To | estebes | ||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | acknowledged | Resolution | open | ||
Summary | 0001806: FR: Crops should use Oredict when checking for required blocks | ||||
Description | Instead of hardcoding the vanilla or IC2 version of a metal or ore block, crops should check for a block with a matching Oredict name. With mods that change World generation, especially Ore generation (like GregTech) the vanilla/IC2 ore blocks may not be available, making it impossible to grow crops that require them. | ||||
Tags | No tags attached. | ||||
Minecraft Version | |||||
|
Ore dictionary handling for isBlockBelow was added in build 805. What build are you using? |
|
807 after a bit of testing I found out GT Oredict names change according to the surrounding stone. Taking Gold as an example, vanilla and "normal" GT Overworld ore is registered as oreGold, but there are also blocks with oreNetherrackGold, oreEndstoneGold, oreBlackgraniteGold or oreRedgrantieGold as their single oredict entry, which obviously will be rejected when searching for oreGold. So... maybe check for an entry matching ore*Gold? edit: I'm using GT 5.09.19 |
|
Do overworld ores work though? Gregtech's ores are quite different from other mods ores so it is harder to make them work but if gregtech's overworld ores are working making the other ore types work shouldn't be to hard. |
|
They don't. Looking at a decompile, this is because isBlockBelow uses Block + Metadata for comparison. I remember a discussion in the Gregtech thread mentioning a way that works for "classic" and GT blocks, but can't find those posts again. Will ask Greg or BloodyAsp when I see them again. edit: typo |
|
Turns out the Code GT5 uses is only working for GT Ores and not a general solution: https://github.com/Blood-Asp/GT5-Unofficial/blob/experimental/src/main/java/gregtech/api/util/GT_BaseCrop.java#L178 However, I noticed the "pick block" function ((creative) middleclick) working properly on them and went sourcediving... Using net.minecraft.block.Block.getPickBlock() as a starting point, the following should give you the correct ItemStack: Block block = world.getBlock(x, y, z); // insert isAir check here? Item Item.getItemFromBlock(block); if (item == null) {/* either return false or continue */} Block block2 = (item instanceof ItemBlock && !block.isFlowerPot())? Block.getBlockFromItem(item) : block; ItemStack itemStackOfBlockUnderCrop = new ItemStack(item, 1, block2.getDamageValue(world, x, y, z)); |
|
Remeber pickBlock() is @SideOnly(Side.Client) so it can't be used for that. |
|
It is, that's why I said "starting point". While the code above is more or less a copy of that function, it should avoid client-only functions. |
|
I think i have a solution. Will work on it later. |
|
My new solution still doesnt work with gregtech's ores so i'll postpone this and find another solution in the future. |
Date Modified | Username | Field | Change |
---|---|---|---|
2016-02-11 20:37 | equod | New Issue | |
2016-02-12 18:56 | estebes | Note Added: 0004368 | |
2016-02-12 18:56 | estebes | Assigned To | => estebes |
2016-02-12 18:56 | estebes | Status | new => feedback |
2016-02-12 23:16 | equod | Note Added: 0004371 | |
2016-02-12 23:16 | equod | Status | feedback => assigned |
2016-02-12 23:36 | equod | Note Edited: 0004371 | |
2016-02-12 23:38 | estebes | Note Added: 0004372 | |
2016-02-12 23:39 | estebes | Status | assigned => feedback |
2016-02-13 05:31 | equod | Note Added: 0004373 | |
2016-02-13 05:31 | equod | Status | feedback => assigned |
2016-02-13 05:32 | equod | Note Edited: 0004373 | |
2016-02-14 06:58 | equod | Note Added: 0004378 | |
2016-02-15 19:05 | Aroma1997 | Note Added: 0004381 | |
2016-02-15 19:27 | equod | Note Added: 0004382 | |
2016-02-15 19:32 | estebes | Note Added: 0004383 | |
2016-02-16 01:03 | estebes | Note Added: 0004384 | |
2016-02-16 01:03 | estebes | Status | assigned => acknowledged |