View Issue Details

IDProjectCategoryView StatusLast Update
0001806Industrial-Craft²crossmod-compatibility / submodules / APIpublic2016-02-16 01:03
Reporterequod Assigned Toestebes  
PrioritynormalSeverityminorReproducibilityN/A
Status acknowledgedResolutionopen 
Summary0001806: FR: Crops should use Oredict when checking for required blocks
DescriptionInstead 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.
TagsNo tags attached.
Minecraft Version

Activities

estebes

2016-02-12 18:56

developer   ~0004368

Ore dictionary handling for isBlockBelow was added in build 805. What build are you using?

equod

2016-02-12 23:16

reporter   ~0004371

Last edited: 2016-02-12 23:36

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

estebes

2016-02-12 23:38

developer   ~0004372

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.

equod

2016-02-13 05:31

reporter   ~0004373

Last edited: 2016-02-13 05:32

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

equod

2016-02-14 06:58

reporter   ~0004378

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));

Aroma1997

2016-02-15 19:05

developer   ~0004381

Remeber pickBlock() is @SideOnly(Side.Client) so it can't be used for that.

equod

2016-02-15 19:27

reporter   ~0004382

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.

estebes

2016-02-15 19:32

developer   ~0004383

I think i have a solution. Will work on it later.

estebes

2016-02-16 01:03

developer   ~0004384

My new solution still doesnt work with gregtech's ores so i'll postpone this and find another solution in the future.

Issue History

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