From a04827be396adcbc19bb2f4dacc9874511ed9c16 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Fri, 12 Jul 2013 09:39:11 +1000 Subject: [PATCH] Wild carrot blocks now give their respective item when using pick block --- src/minecraft/biomesoplenty/api/Items.java | 2 +- .../biomesoplenty/blocks/BlockBOPFoliage.java | 4 ++-- .../biomesoplenty/blocks/BlockBOPPlant.java | 24 +++++++++++++++++-- .../configuration/BOPConfiguration.java | 4 ++-- .../configuration/BOPCrafting.java | 10 ++++---- .../biomesoplenty/configuration/BOPItems.java | 2 +- .../integration/ThaumcraftIntegration.java | 2 +- 7 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/minecraft/biomesoplenty/api/Items.java b/src/minecraft/biomesoplenty/api/Items.java index 7d830f2a0..9c10b1997 100644 --- a/src/minecraft/biomesoplenty/api/Items.java +++ b/src/minecraft/biomesoplenty/api/Items.java @@ -39,7 +39,7 @@ public class Items public static Optional ancientStaff = Optional.absent(); public static Optional enderporter = Optional.absent(); - public static Optional berries = Optional.absent(); + public static Optional food = Optional.absent(); public static Optional miscItems = Optional.absent(); public static Optional mudball = Optional.absent(); public static Optional poison = Optional.absent(); diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java b/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java index a748b0966..1cc28a866 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java @@ -115,7 +115,7 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable break; case 8: - ret.add(new ItemStack(Items.berries.get(), 1, 0)); + ret.add(new ItemStack(Items.food.get(), 1, 0)); break; } @@ -316,7 +316,7 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable if (meta == 8) { world.setBlock(x, y, z, blockID, 4, 3); - EntityItem entityitem = new EntityItem(world, x, y, z, new ItemStack(Items.berries.get(), 1, 0)); + EntityItem entityitem = new EntityItem(world, x, y, z, new ItemStack(Items.food.get(), 1, 0)); if (!world.isRemote) { world.spawnEntityInWorld(entityitem); if (!(player instanceof FakePlayer)) diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPPlant.java b/src/minecraft/biomesoplenty/blocks/BlockBOPPlant.java index ab1b7e2a3..4afb84a26 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPPlant.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPPlant.java @@ -214,14 +214,34 @@ public class BlockBOPPlant extends BlockFlower implements IShearable entity.attackEntityFrom(DamageSource.cactus, 1); } } + + @Override + public int idPicked(World world, int x, int y, int z) + { + int blockID = world.getBlockId(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + + if (meta == 11) + { + return Items.food.get().itemID; + } + + return this.blockID; + } @Override public int getDamageValue(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); - if (meta == CATTAILTOP || meta == CATTAILBOTTOM) { + if (meta == CATTAILTOP || meta == CATTAILBOTTOM) + { meta = 7; } + else if (meta == 11) + { + meta = 2; + } + return meta; } @@ -234,7 +254,7 @@ public class BlockBOPPlant extends BlockFlower implements IShearable } else if (par1 == 11) { - return Items.berries.get().itemID; + return Items.food.get().itemID; } else { diff --git a/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java b/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java index a2c392b0a..22c873a3f 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java +++ b/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java @@ -211,7 +211,7 @@ public class BOPConfiguration { public static int graveID; //Item IDs - public static int berriesID; + public static int foodID; public static int ancientStaffID; public static int enderporterID; @@ -783,7 +783,7 @@ public class BOPConfiguration { graveID = config.getBlock("Grave ID", 1981, null).getInt(); // Get Item ID's - berriesID = config.getItem("Food ID", 21003, null).getInt(); + foodID = config.getItem("Food ID", 21003, null).getInt(); ancientStaffID = config.getItem("Ancient Staff ID", 21006).getInt(); enderporterID = config.getItem("Enderporter ID", 21007).getInt(); diff --git a/src/minecraft/biomesoplenty/configuration/BOPCrafting.java b/src/minecraft/biomesoplenty/configuration/BOPCrafting.java index ac57919c2..60bdb2805 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPCrafting.java +++ b/src/minecraft/biomesoplenty/configuration/BOPCrafting.java @@ -40,7 +40,7 @@ public class BOPCrafting GameRegistry.addShapelessRecipe(new ItemStack(Items.miscItems.get(), 2, 7), new Object[] {new ItemStack(Blocks.moss.get(),1,0)}); GameRegistry.addShapelessRecipe(new ItemStack(Items.miscItems.get(), 2, 8), new Object[] {new ItemStack(Blocks.flowers.get(),1,9)}); GameRegistry.addShapelessRecipe(new ItemStack(Items.miscItems.get(), 2, 9), new Object[] {new ItemStack(Blocks.flowers.get(),1,2)}); - GameRegistry.addShapelessRecipe(new ItemStack(Items.berries.get(), 4, 3), new Object[] {new ItemStack(Blocks.flowers.get(),1,13)}); + GameRegistry.addShapelessRecipe(new ItemStack(Items.food.get(), 4, 3), new Object[] {new ItemStack(Blocks.flowers.get(),1,13)}); //Brick stairs and slabs GameRegistry.addRecipe(new ItemStack(Blocks.stoneSingleSlab.get(), 6, 0), new Object[] {"RRR", 'R', new ItemStack(Blocks.redRock.get(),1,1)}); @@ -248,11 +248,11 @@ public class BOPCrafting GameRegistry.addShapelessRecipe(new ItemStack(Item.dyePowder, 12, 15), new Object[] {new ItemStack(Blocks.bones.get(), 1, 2)}); //Plants - GameRegistry.addShapelessRecipe(new ItemStack(Items.berries.get(), 2, 1), new Object[] {new ItemStack(Blocks.mushrooms.get(),1,0)}); + GameRegistry.addShapelessRecipe(new ItemStack(Items.food.get(), 2, 1), new Object[] {new ItemStack(Blocks.mushrooms.get(),1,0)}); GameRegistry.addShapelessRecipe(new ItemStack(Items.miscItems.get(), 1, 3), new Object[] {new ItemStack(Blocks.foliage.get(),1,7)}); - GameRegistry.addShapelessRecipe(new ItemStack(Items.berries.get(), 1, 4), new Object[] {Item.bowlEmpty, new ItemStack(Items.berries.get(), 1, 0), Item.appleRed, Item.melon}); - GameRegistry.addShapelessRecipe(new ItemStack(Items.berries.get(), 1, 5), new Object[] {Item.bowlEmpty, new ItemStack(Items.berries.get(), 1, 2), Item.carrot, Item.potato}); - GameRegistry.addShapelessRecipe(new ItemStack(Items.berries.get(), 1, 6), new Object[] {Item.bowlEmpty, new ItemStack(Blocks.mushrooms.get(), 1, 0), new ItemStack(Blocks.mushrooms.get(), 1, 1), new ItemStack(Blocks.mushrooms.get(), 1, 2)}); + GameRegistry.addShapelessRecipe(new ItemStack(Items.food.get(), 1, 4), new Object[] {Item.bowlEmpty, new ItemStack(Items.food.get(), 1, 0), Item.appleRed, Item.melon}); + GameRegistry.addShapelessRecipe(new ItemStack(Items.food.get(), 1, 5), new Object[] {Item.bowlEmpty, new ItemStack(Items.food.get(), 1, 2), Item.carrot, Item.potato}); + GameRegistry.addShapelessRecipe(new ItemStack(Items.food.get(), 1, 6), new Object[] {Item.bowlEmpty, new ItemStack(Blocks.mushrooms.get(), 1, 0), new ItemStack(Blocks.mushrooms.get(), 1, 1), new ItemStack(Blocks.mushrooms.get(), 1, 2)}); //Glass GameRegistry.addRecipe(new ItemStack(Blocks.glass.get(), 1, 0), new Object [] {"GGG", "GGG", "GGG", Character.valueOf('G'), Block.glass}); diff --git a/src/minecraft/biomesoplenty/configuration/BOPItems.java b/src/minecraft/biomesoplenty/configuration/BOPItems.java index a4a7a8e22..0e461e74f 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPItems.java +++ b/src/minecraft/biomesoplenty/configuration/BOPItems.java @@ -98,7 +98,7 @@ public class BOPItems { private static void initializeItems() { // Item declaration - Items.berries = Optional.of(new ItemBOPFood(BOPConfiguration.berriesID).setUnlocalizedName("bop.food")); + Items.food = Optional.of(new ItemBOPFood(BOPConfiguration.foodID).setUnlocalizedName("bop.food")); Items.miscItems = Optional.of(new ItemBOP(BOPConfiguration.miscItemsID).setUnlocalizedName("bop.miscItems")); Items.mudball = Optional.of(new ItemBOPMudball(BOPConfiguration.mudballID).setUnlocalizedName("bop.mudball")); Items.dartBlower = Optional.of(new ItemDartBlower(BOPConfiguration.dartBlowerID).setUnlocalizedName("bop.dartblower")); diff --git a/src/minecraft/biomesoplenty/integration/ThaumcraftIntegration.java b/src/minecraft/biomesoplenty/integration/ThaumcraftIntegration.java index 7e2a0ed12..ae35f7a2d 100644 --- a/src/minecraft/biomesoplenty/integration/ThaumcraftIntegration.java +++ b/src/minecraft/biomesoplenty/integration/ThaumcraftIntegration.java @@ -161,7 +161,7 @@ public class ThaumcraftIntegration { /*Poison Dart*/ThaumcraftApi.registerObjectTag(Items.dart.get().itemID, 1, (new ObjectTags()).add(EnumTag.PLANT, 2).add(EnumTag.WEAPON, 2)); /*Spring Water Bucket*/ThaumcraftApi.registerObjectTag(Fluids.bopBucket.get().itemID, 0, (new ObjectTags()).add(EnumTag.METAL, 13).add(EnumTag.VOID, 1).add(EnumTag.WATER, 4).add(EnumTag.LIFE, 2).add(EnumTag.HEAL, 4)); /*Liquid Poison Bucket*/ThaumcraftApi.registerObjectTag(Fluids.bopBucket.get().itemID, 1, (new ObjectTags()).add(EnumTag.METAL, 13).add(EnumTag.VOID, 1).add(EnumTag.WATER, 2).add(EnumTag.WEAPON, 4).add(EnumTag.POISON, 4)); - ThaumcraftApi.registerObjectTag(Items.berries.get().itemID, 0, (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.LIFE, 1)); + ThaumcraftApi.registerObjectTag(Items.food.get().itemID, 0, (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.LIFE, 1)); //ThaumcraftApi.registerObjectTag(Items.sunflowerSeeds.get().itemID, 0, (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.EXCHANGE, 1)); ThaumcraftApi.registerObjectTag(Items.mudball.get().itemID, 0, (new ObjectTags()).add(EnumTag.WATER, 1).add(EnumTag.EARTH, 2)); //ThaumcraftApi.registerObjectTag(Items.shroomPowder.get().itemID, -1, (new ObjectTags()).add(EnumTag.FUNGUS, 2).add(EnumTag.DESTRUCTION, 1));