From 955ae9640ad74a857bebfdcbb2bee4e9138401db Mon Sep 17 00:00:00 2001 From: mezz Date: Sun, 5 Oct 2014 21:12:06 -0700 Subject: [PATCH] Make ItemScoop an ItemForestryTool and work in Adventure Mode --- .../forestry/core/items/ItemForestryTool.java | 4 +- .../java/forestry/core/items/ItemScoop.java | 39 ++----------------- .../forestry/plugins/PluginApiculture.java | 4 ++ .../java/forestry/plugins/PluginCore.java | 2 - 4 files changed, 10 insertions(+), 39 deletions(-) diff --git a/src/main/java/forestry/core/items/ItemForestryTool.java b/src/main/java/forestry/core/items/ItemForestryTool.java index 9df1d7e1a..f5735de0a 100755 --- a/src/main/java/forestry/core/items/ItemForestryTool.java +++ b/src/main/java/forestry/core/items/ItemForestryTool.java @@ -26,7 +26,7 @@ import forestry.core.proxy.Proxies; public class ItemForestryTool extends ItemForestry { private final ItemStack remnants; - private final float efficiencyOnProperMaterial; + protected float efficiencyOnProperMaterial; private final Block[] blocksEffectiveAgainst; public ItemForestryTool(Block[] blocksEffectiveAgainst, ItemStack remnants) { @@ -58,7 +58,7 @@ public class ItemForestryTool extends ItemForestry { if (event.original == null || event.original.getItem() != this) return; - if (Proxies.common.isSimulating(event.entityPlayer.worldObj)) { + if (Proxies.common.isSimulating(event.entityPlayer.worldObj) && remnants != null) { EntityItem entity = new EntityItem(event.entityPlayer.worldObj, event.entityPlayer.posX, event.entityPlayer.posY, event.entityPlayer.posZ, remnants.copy()); event.entityPlayer.worldObj.spawnEntityInWorld(entity); diff --git a/src/main/java/forestry/core/items/ItemScoop.java b/src/main/java/forestry/core/items/ItemScoop.java index 6f63db870..726d559b8 100755 --- a/src/main/java/forestry/core/items/ItemScoop.java +++ b/src/main/java/forestry/core/items/ItemScoop.java @@ -10,22 +10,15 @@ ******************************************************************************/ package forestry.core.items; -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import net.minecraftforge.common.ForgeHooks; - import forestry.api.core.IToolScoop; import forestry.api.core.Tabs; +import forestry.core.config.ForestryBlock; +import net.minecraft.block.Block; -public class ItemScoop extends ItemForestry implements IToolScoop { - - private final float efficiencyOnProperMaterial; +public class ItemScoop extends ItemForestryTool implements IToolScoop { public ItemScoop() { - super(); + super(new Block[]{ ForestryBlock.beehives.block()}, null); this.maxStackSize = 1; efficiencyOnProperMaterial = 4.0F; setMaxDamage(10); @@ -33,30 +26,6 @@ public class ItemScoop extends ItemForestry implements IToolScoop { setMaxStackSize(1); } - @Override - public float func_150893_a(ItemStack itemstack, Block block) { - return 1.0F; - } - - @Override - public float getDigSpeed(ItemStack itemstack, Block block, int md) { - if (ForgeHooks.isToolEffective(itemstack, block, md)) - return efficiencyOnProperMaterial; - - return func_150893_a(itemstack, block); - } - - @Override - public boolean onBlockDestroyed(ItemStack itemstack, World world, Block block, int j, int k, int l, EntityLivingBase entityliving) { - itemstack.damageItem(1, entityliving); - return true; - } - - /*@Override - public float getDamageVsEntity(Entity entity, ItemStack itemstack) { - return 1; - }*/ - @Override public boolean isFull3D() { return true; diff --git a/src/main/java/forestry/plugins/PluginApiculture.java b/src/main/java/forestry/plugins/PluginApiculture.java index 2b3769e93..f064ba617 100644 --- a/src/main/java/forestry/plugins/PluginApiculture.java +++ b/src/main/java/forestry/plugins/PluginApiculture.java @@ -132,6 +132,7 @@ import forestry.core.items.ItemForestry; import forestry.core.items.ItemForestryBlock; import forestry.core.items.ItemOverlay; import forestry.core.items.ItemOverlay.OverlayInfo; +import forestry.core.items.ItemScoop; import forestry.core.proxy.Proxies; import forestry.core.render.EntitySnowFX; import forestry.core.triggers.Trigger; @@ -421,6 +422,9 @@ public class PluginApiculture extends ForestryPlugin { ForestryItem.apiaristLegs.registerItem(new ItemArmorApiarist(2), "apiaristLegs"); ForestryItem.apiaristBoots.registerItem(new ItemArmorApiarist(3), "apiaristBoots"); + // TOOLS + ForestryItem.scoop.registerItem(new ItemScoop(), "scoop"); + ForestryItem.scoop.item().setHarvestLevel("scoop", 3); } @Override diff --git a/src/main/java/forestry/plugins/PluginCore.java b/src/main/java/forestry/plugins/PluginCore.java index 339d561a4..df490c682 100755 --- a/src/main/java/forestry/plugins/PluginCore.java +++ b/src/main/java/forestry/plugins/PluginCore.java @@ -171,8 +171,6 @@ public class PluginCore extends ForestryPlugin { // / TOOLS ForestryItem.wrench.registerItem((new ItemWrench()), "wrench"); ForestryItem.pipette.registerItem(new ItemPipette(), "pipette"); - ForestryItem.scoop.registerItem(new ItemScoop(), "scoop"); - ForestryItem.scoop.item().setHarvestLevel("scoop", 3); // / MACHINES ForestryItem.sturdyCasing.registerItem((new ItemForestry()), "sturdyMachine");