diff --git a/dependencies.gradle b/dependencies.gradle index 8fdfdb5..c149c10 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,13 +1,13 @@ // Add your dependencies here dependencies { - compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.56:dev') {transitive=false} + compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.140:dev') {transitive=false} compile('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') - compile('com.github.GTNewHorizons:CodeChickenLib:1.2.1:dev') + compile('com.github.GTNewHorizons:CodeChickenLib:1.3.0:dev') compile('com.github.GTNewHorizons:DummyCore:1.19.0:dev') - runtimeOnly("com.github.GTNewHorizons:NotEnoughItems:2.6.11-GTNH:dev") + runtimeOnly("com.github.GTNewHorizons:NotEnoughItems:2.6.22-GTNH:dev") runtimeOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') - runtimeOnly('com.github.GTNewHorizons:CodeChickenCore:1.2.1:dev') // Required to allow dummycore to run in dev + runtimeOnly('com.github.GTNewHorizons:CodeChickenCore:1.3.6:dev') // Required to allow dummycore to run in dev } diff --git a/src/main/java/tb/common/block/BlockTBPlant.java b/src/main/java/tb/common/block/BlockTBPlant.java index 7e9ae0b..8f22fd9 100644 --- a/src/main/java/tb/common/block/BlockTBPlant.java +++ b/src/main/java/tb/common/block/BlockTBPlant.java @@ -7,6 +7,8 @@ import net.minecraft.block.BlockBush; import net.minecraft.block.IGrowable; import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -27,6 +29,7 @@ public class BlockTBPlant extends BlockBush implements IGrowable { public IIcon[] growthIcons; public ItemStack dropItem; public ItemStack dropSeed; + private boolean pRightClick = false; public BlockTBPlant(int stages, int delay, boolean isCrop) { super(); @@ -140,6 +143,43 @@ public void func_149853_b(World w, Random r, int x, int y, int z) { 3); } + @Override + public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float pX, + float pY, float pZ) { + int aMeta = aWorld.getBlockMetadata(aX, aY, aZ); + // check for Growth Stage + if (aMeta >= growthStages - 1) { + // eval fortune on rightclick + int fortune = 0; + ItemStack heldItem = aPlayer.getHeldItem(); + if (heldItem != null) { + if (heldItem.getEnchantmentTagList() != null) { + for (int i = 0; i < heldItem.getEnchantmentTagList() + .tagCount(); ++i) { + if (heldItem.getEnchantmentTagList() + .getCompoundTagAt(i) + .getInteger("id") == Enchantment.fortune.effectId) { + fortune = heldItem.getEnchantmentTagList() + .getCompoundTagAt(i) + .getInteger("lvl"); + + // Damage fortune item on crop break? + // heldItem.setItemDamage(heldItem.getItemDamage() + 1); + break; + } + } + } + } + + this.pRightClick = true; + this.dropBlockAsItem(aWorld, aX, aY, aZ, aMeta, fortune); + this.pRightClick = false; + + aWorld.setBlock(aX, aY, aZ, this, 0, 2); + } + return false; + } + @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister reg) { growthIcons = new IIcon[growthStages]; @@ -192,7 +232,7 @@ public ArrayList getDrops(World world, int x, int y, int z, int metad ret.add(drop); } } - if (dropSeed != null) ret.add(dropSeed.copy()); + if (dropSeed != null && !pRightClick) ret.add(dropSeed.copy()); return ret; }