mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-18 11:19:28 +00:00
Make ItemScoop an ItemForestryTool and work in Adventure Mode
This commit is contained in:
1 parent
d510e121eb
commit
955ae9640a
4 files changed
+10
-39
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user