fix block harvest tools
This commit is contained in:
parent
3bdc5fb4a0
commit
1272f87ea0
16 changed files with 173 additions and 119 deletions
|
@ -176,11 +176,12 @@ public class Block {
|
|||
private boolean sumBrightness;
|
||||
private boolean axeHarvest;
|
||||
private boolean shovelHarvest;
|
||||
private boolean shearsHarvest;
|
||||
private boolean swordHarvest;
|
||||
private boolean ticked;
|
||||
private int opacity;
|
||||
private int light;
|
||||
private int miningLevel;
|
||||
private int shearsEfficiency;
|
||||
private int encouragement;
|
||||
private int flammability;
|
||||
private float hardness;
|
||||
|
@ -363,7 +364,9 @@ public class Block {
|
|||
public Block(Material material) {
|
||||
this.miningLevel = (material == Material.SOLID || material == Material.HEAVY) ? 0 : -1;
|
||||
this.axeHarvest = material == Material.WOOD || material == Material.PLANT || material == Material.BUSH || material == Material.SOFT;
|
||||
this.shearsEfficiency = (material == Material.LEAVES || material == Material.FLUFF) ? 3 : -1;
|
||||
this.shovelHarvest = material == Material.POWDER || material == Material.DIGGABLE;
|
||||
this.shearsHarvest = material == Material.LEAVES;
|
||||
this.swordHarvest = material == Material.FLUFF;
|
||||
this.sound = SoundType.STONE;
|
||||
this.slipperiness = 0.6F;
|
||||
this.material = material;
|
||||
|
@ -442,8 +445,13 @@ public class Block {
|
|||
return this;
|
||||
}
|
||||
|
||||
public final Block setShearsEfficiency(int efficiency) {
|
||||
this.shearsEfficiency = efficiency;
|
||||
public final Block setShearsHarvestable() {
|
||||
this.shearsHarvest = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Block setSwordHarvestable() {
|
||||
this.swordHarvest = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -593,8 +601,12 @@ public class Block {
|
|||
return this.shovelHarvest;
|
||||
}
|
||||
|
||||
public final int getShearsEfficiency() {
|
||||
return this.shearsEfficiency;
|
||||
public final boolean canShearsHarvest() {
|
||||
return this.shearsHarvest;
|
||||
}
|
||||
|
||||
public final boolean canSwordHarvest() {
|
||||
return this.swordHarvest;
|
||||
}
|
||||
|
||||
public final float getRadiation() {
|
||||
|
|
|
@ -2415,7 +2415,7 @@ public abstract class Entity
|
|||
|
||||
public final String getColoredName(Color reset)
|
||||
{
|
||||
return Color.DARK_GRAY + "[" + this.getName() + Color.DARK_GRAY + "]" + reset;
|
||||
return Color.DARK_GRAY + "[" + this.getName() + Color.DARK_GRAY + "]" + (reset == null ? Color.RESET : reset);
|
||||
}
|
||||
|
||||
// public Text formatComponent(Text comp) {
|
||||
|
|
|
@ -351,7 +351,7 @@ public abstract class BlockRegistry {
|
|||
|
||||
|
||||
for(BlockTallGrass.EnumType type : BlockTallGrass.EnumType.values()) {
|
||||
register(type.getName(), (new BlockTallGrass(type)).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay(type.getDisplay()).setShearsEfficiency(0));
|
||||
register(type.getName(), (new BlockTallGrass(type)).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay(type.getDisplay()).setShearsHarvestable());
|
||||
}
|
||||
register("deadbush", (new BlockDeadBush()).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("Toter Busch"));
|
||||
for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) {
|
||||
|
@ -363,8 +363,8 @@ public abstract class BlockRegistry {
|
|||
Block cactus = (new BlockCactus()).setHardness(0.4F).setSound(SoundType.CLOTH).setDisplay("Kaktus");
|
||||
register("cactus", cactus);
|
||||
register("reeds", (new BlockReed()).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS));
|
||||
register("vine", (new BlockVine(false)).setHardness(0.2F).setSound(SoundType.GRASS).setDisplay("Ranken").setShearsEfficiency(0));
|
||||
register("swamp_vine", (new BlockVine(true)).setHardness(0.2F).setSound(SoundType.GRASS).setDisplay("Sumpfranken").setShearsEfficiency(0));
|
||||
register("vine", (new BlockVine(false)).setHardness(0.2F).setSound(SoundType.GRASS).setDisplay("Ranken").setShearsHarvestable());
|
||||
register("swamp_vine", (new BlockVine(true)).setHardness(0.2F).setSound(SoundType.GRASS).setDisplay("Sumpfranken").setShearsHarvestable());
|
||||
register("waterlily", (new BlockLilyPad()).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("Seerosenblatt"));
|
||||
|
||||
|
||||
|
@ -425,7 +425,7 @@ public abstract class BlockRegistry {
|
|||
|
||||
for(Color color : Color.values()) {
|
||||
register(color.getName() + "_wool", (new BlockWool(color)).setHardness(0.8F).setSound(SoundType.CLOTH).setDisplay(color.getSubject(-1) + " Wolle")
|
||||
.setShearsEfficiency(1));
|
||||
.setShearsHarvestable());
|
||||
}
|
||||
for(Color color : Color.values()) {
|
||||
register(color.getName() + "_carpet", (new BlockCarpet(color)).setHardness(0.1F).setSound(SoundType.CLOTH).setDisplay(color.getSubject(1) + " Teppich").setOpacity(0));
|
||||
|
@ -672,7 +672,7 @@ public abstract class BlockRegistry {
|
|||
.setDisplay("Lampe").setTab(CheatTab.TECHNOLOGY));
|
||||
register("lit_lamp", (new BlockToggleableLight(true)).setHardness(0.3F).setSound(SoundType.GLASS).setDisplay("Lampe"));
|
||||
register("tripwire_hook", (new BlockTripWireHook()).setDisplay("Haken"));
|
||||
register("string", (new BlockTripWire()).setDisplay("Stolperdraht").setShearsEfficiency(0).setTab(CheatTab.TECHNOLOGY));
|
||||
register("string", (new BlockTripWire()).setDisplay("Stolperdraht").setTab(CheatTab.TECHNOLOGY));
|
||||
|
||||
register("iron_door", (new BlockDoor(Material.SOLID)).setHardness(5.0F).setSound(SoundType.STONE).setDisplay("Eisentür"));
|
||||
for(WoodType wood : WoodType.values()) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package common.init;
|
|||
import common.util.Color;
|
||||
|
||||
public enum MetalType {
|
||||
IRON("iron", 26, "Fe", "Eisen", 0, new ToolMaterial(2, 8.0f, 0.0f, 250, 6.0F, 2, 14, true, 15, 9, 2, 6, 5, 2).setMagnetic()),
|
||||
IRON("iron", 26, "Fe", "Eisen", 0, new ToolMaterial(2, 8.0f, 0.0f, 250, 6, 2, 14, true, 15, 9, 2, 6, 5, 2).setMagnetic()),
|
||||
COPPER("copper", 29, "Cu", "Kupfer", 0),
|
||||
TIN("tin", 50, "Sn", "Zinn", 0),
|
||||
|
||||
|
@ -30,7 +30,7 @@ public enum MetalType {
|
|||
VANADIUM("vanadium", 23, "V", "Vanadium", 4),
|
||||
CHROME("chrome", 24, "Cr", "Chrom", 4),
|
||||
PLATINUM("platinum", 78, "Pt", "Platin", 4),
|
||||
GOLD("gold", 79, "Au", "Gold", 4, new ToolMaterial(0, 15.0f, 1.0f, 32, 12.0F, 0, 22, true, 7, 25, 2, 5, 3, 1)),
|
||||
GOLD("gold", 79, "Au", "Gold", 4, new ToolMaterial(0, 15.0f, 1.0f, 32, 12, 0, 22, true, 7, 25, 2, 5, 3, 1)),
|
||||
|
||||
MANGANESE("manganese", 25, "Mn", "Mangan", 5),
|
||||
COBALT("cobalt", 27, "Co", "Cobalt", 5),
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package common.init;
|
||||
|
||||
public enum OreType {
|
||||
DIAMOND("diamond", "Diamant", new ToolMaterial(3, 12.0f, 2.0f, 1561, 8.0F, 3, 10, true, 33, 10, 3, 8, 6, 3), "diamond", 3, 1, 0),
|
||||
THETIUM("thetium", "Thetium", "Thi-Fragment", new ToolMaterial(4, 20.0f, 4.0f, 3451, 11.0F, 7, 12, false, 59, 12, 4, 9, 7, 4), "thi_fragment", 5, 1, 0),
|
||||
ARDITE("ardite", "Ardit", "Ahrd-Fragment", new ToolMaterial(5, 30.0f, 12.0f, 7320, 11, 12, 86, 12, 6, 12, 9, 5), "ahrd_fragment", 7, 1, 0),
|
||||
GYRIYN("gyriyn", "Gyriyn", "Ghi-Fragment", new ToolMaterial(5, 7320, 15.0F, 11, 12, false), "ghi_fragment", 7, 1, 0),
|
||||
NICHUN("nichun", "Nichun", "Nieh-Fragment", new ToolMaterial(6, 50.0f, 40.0f, 21300, 20.0F, 18, 15, false, 172, 15, 12, 23, 14, 11), "nieh_fragment", 10, 1, 0),
|
||||
DIAMOND("diamond", "Diamant", new ToolMaterial(3, 12.0f, 2.0f, 1561, 8, 3, 10, true, 33, 10, 3, 8, 6, 3), "diamond", 3, 1, 0),
|
||||
THETIUM("thetium", "Thetium", "Thi-Fragment", new ToolMaterial(4, 20.0f, 4.0f, 3451, 11, 7, 12, false, 59, 12, 4, 9, 7, 4), "thi_fragment", 5, 1, 0),
|
||||
ARDITE("ardite", "Ardit", "Ahrd-Fragment", new ToolMaterial(5, 30.0f, 12.0f, 7320, 15, 11, 12, 86, 12, 6, 12, 9, 5), "ahrd_fragment", 7, 1, 0),
|
||||
GYRIYN("gyriyn", "Gyriyn", "Ghi-Fragment", new ToolMaterial(5, 7320, 15, 11, 12, false), "ghi_fragment", 7, 1, 0),
|
||||
NICHUN("nichun", "Nichun", "Nieh-Fragment", new ToolMaterial(6, 50.0f, 40.0f, 21300, 20, 18, 15, false, 172, 15, 12, 23, 14, 11), "nieh_fragment", 10, 1, 0),
|
||||
RUBY("ruby", "Rubin", new ToolMaterial(3), "ruby", 3, 1, 0),
|
||||
CINNABAR("cinnabar", "Zinnober", new ToolMaterial(2), "cinnabar", 2, 1, 1);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ public class ToolMaterial {
|
|||
|
||||
private final int harvestLevel;
|
||||
private final int durability;
|
||||
private final float efficiency;
|
||||
private final int efficiency;
|
||||
private final int damage;
|
||||
private final float radiationResistance;
|
||||
private final float magicResistance;
|
||||
|
@ -29,7 +29,7 @@ public class ToolMaterial {
|
|||
private boolean magnetic;
|
||||
private int defColor = 0xffffffff;
|
||||
|
||||
private ToolMaterial(float rad, float mag, int level, int uses, float efficiency, int damage, int ench, boolean tools, boolean weapons,
|
||||
private ToolMaterial(float rad, float mag, int level, int uses, int efficiency, int damage, int ench, boolean tools, boolean weapons,
|
||||
boolean extras, int auses, int aench, int r1, int r2, int r3, int r4) {
|
||||
this.harvestLevel = level;
|
||||
this.durability = uses;
|
||||
|
@ -47,22 +47,22 @@ public class ToolMaterial {
|
|||
}
|
||||
|
||||
protected ToolMaterial(int level) {
|
||||
this(0.0f, 0.0f, level, 0, 0.0f, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0);
|
||||
this(0.0f, 0.0f, level, 0, 0, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
protected ToolMaterial(int level, int uses, float efficiency, int damage, int ench, boolean weapons) {
|
||||
protected ToolMaterial(int level, int uses, int efficiency, int damage, int ench, boolean weapons) {
|
||||
this(0.0f, 0.0f, level, uses, efficiency, damage, ench, true, weapons, false, 0, ench, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
protected ToolMaterial(int level, float rad, float mag, int uses, int damage, int ench, int auses, int aench, int r1, int r2, int r3, int r4) {
|
||||
this(rad, mag, level, uses, 0.0F, damage, ench, false, true, false, auses, aench, r1, r2, r3, r4);
|
||||
protected ToolMaterial(int level, float rad, float mag, int uses, int efficiency, int damage, int ench, int auses, int aench, int r1, int r2, int r3, int r4) {
|
||||
this(rad, mag, level, uses, efficiency, damage, ench, false, true, false, auses, aench, r1, r2, r3, r4);
|
||||
}
|
||||
|
||||
protected ToolMaterial(int level, float rad, float mag, int auses, int aench, int r1, int r2, int r3, int r4) {
|
||||
this(rad, mag, 0, 0, 0.0F, 0, 0, false, false, false, auses, aench, r1, r2, r3, r4);
|
||||
this(rad, mag, 0, 0, 0, 0, 0, false, false, false, auses, aench, r1, r2, r3, r4);
|
||||
}
|
||||
|
||||
protected ToolMaterial(int level, float rad, float mag, int uses, float efficiency, int damage, int ench, boolean extras, int auses, int aench,
|
||||
protected ToolMaterial(int level, float rad, float mag, int uses, int efficiency, int damage, int ench, boolean extras, int auses, int aench,
|
||||
int r1, int r2, int r3, int r4) {
|
||||
this(rad, mag, level, uses, efficiency, damage, ench, true, true, extras, auses, aench, r1, r2, r3, r4);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class ToolMaterial {
|
|||
return this.durability;
|
||||
}
|
||||
|
||||
public float getEfficiency() {
|
||||
public int getEfficiency() {
|
||||
return this.efficiency;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package common.init;
|
||||
|
||||
public enum ToolType {
|
||||
WOOD("wood", "Holz", new ToolMaterial(0, 59, 2.0F, 0, 15, true), WoodType.getNames("planks")),
|
||||
STONE("stone", "Stein", new ToolMaterial(1, 131, 4.0F, 1, 5, true), "cobblestone"),
|
||||
WOOD("wood", "Holz", new ToolMaterial(0, 59, 2, 0, 15, true), WoodType.getNames("planks")),
|
||||
STONE("stone", "Stein", new ToolMaterial(1, 131, 4, 1, 5, true), "cobblestone"),
|
||||
LEATHER("leather", "Leder", new ToolMaterial(0, 2.0f, 0.0f, 5, 15, 1, 3, 2, 1).setDyeable(0xa06540), "leather"),
|
||||
CHAIN("chain", "Ketten", new ToolMaterial(0, 0.5f, 0.25f, 15, 12, 2, 5, 4, 1).setMagnetic(), "chain"),
|
||||
CLOTH("cloth", null, new ToolMaterial(0, 0.0f, 0.0f, 10, 0, 0, 0, 0, 0).setDyeable(0xffffff), "string");
|
||||
|
|
|
@ -12,4 +12,8 @@ public class ItemAxe extends ItemTool {
|
|||
public boolean canUseOn(ItemStack stack, Block block) {
|
||||
return block.canAxeHarvest();
|
||||
}
|
||||
|
||||
public boolean canHarvestBlock(Block block) {
|
||||
return block.canAxeHarvest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
package common.item.tool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.ToolMaterial;
|
||||
import common.item.ItemStack;
|
||||
import common.util.Clientside;
|
||||
import common.util.Color;
|
||||
|
||||
public class ItemPickaxe extends ItemTool {
|
||||
public ItemPickaxe(ToolMaterial material) {
|
||||
|
@ -16,4 +21,11 @@ public class ItemPickaxe extends ItemTool {
|
|||
public boolean canUseOn(ItemStack stack, Block block) {
|
||||
return block.getMiningLevel() >= 0;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||
{
|
||||
tooltip.add(Color.VIOLET + "Level " + (this.getToolMaterial().getHarvestLevel() + 1));
|
||||
super.addInformation(stack, playerIn, tooltip);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
package common.item.tool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.block.tech.BlockWire;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.ToolMaterial;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.WieldType;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.Color;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemShears extends Item
|
||||
|
@ -28,31 +30,31 @@ public class ItemShears extends Item
|
|||
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLiving playerIn)
|
||||
{
|
||||
if (blockIn.getShearsEfficiency() < 0) // blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool)
|
||||
{
|
||||
if (!blockIn.canShearsHarvest())
|
||||
return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn);
|
||||
}
|
||||
else
|
||||
{
|
||||
stack.damage(1, playerIn);
|
||||
return true;
|
||||
}
|
||||
stack.damage(1, playerIn);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canHarvestBlock(Block blockIn)
|
||||
{
|
||||
return blockIn.getMaterial() == Material.FLUFF || blockIn instanceof BlockWire || blockIn == Blocks.string;
|
||||
return blockIn.canShearsHarvest();
|
||||
}
|
||||
|
||||
public float getStrVsBlock(ItemStack stack, Block state)
|
||||
{
|
||||
return state.getShearsEfficiency() <= 0 ? 1.0F : (((float)state.getShearsEfficiency()) * (this.material.getEfficiency() - 1.0F));
|
||||
// state != Blocks.web && state.getMaterial() != Material.leaves ? (state == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, state)) : 15.0F;
|
||||
return !state.canShearsHarvest() ? 1.0F : (float)this.material.getEfficiency();
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||
{
|
||||
tooltip.add(Color.DARK_GREEN + "+ " + (this.material.getEfficiency() - 1) + " Abbaueffizienz");
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
||||
{
|
||||
return this.material.isRepairItem(repair.getItem()) ? true : super.getIsRepairable(toRepair, repair);
|
||||
return this.material.isRepairItem(repair.getItem());
|
||||
}
|
||||
|
||||
public WieldType getWieldType() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package common.item.tool;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.init.ToolMaterial;
|
||||
import common.item.ItemStack;
|
||||
|
||||
|
@ -15,6 +14,6 @@ public class ItemShovel extends ItemTool {
|
|||
}
|
||||
|
||||
public boolean canHarvestBlock(Block block) {
|
||||
return block.getMaterial() == Material.POWDER || block.getMaterial() == Material.DIGGABLE;
|
||||
return block.canShovelHarvest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package common.item.tool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.ToolMaterial;
|
||||
import common.item.CheatTab;
|
||||
|
@ -8,17 +11,17 @@ import common.item.Item;
|
|||
import common.item.ItemStack;
|
||||
import common.item.WieldType;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.Color;
|
||||
import common.world.World;
|
||||
|
||||
public abstract class ItemTool extends Item {
|
||||
private final float efficiency;
|
||||
private final int damage;
|
||||
private final ToolMaterial material;
|
||||
|
||||
public ItemTool(int damage, ToolMaterial material) {
|
||||
this.material = material;
|
||||
this.setMaxDamage(material.getDurability());
|
||||
this.efficiency = material.getEfficiency();
|
||||
this.damage = damage + material.getDamage();
|
||||
this.setTab(CheatTab.TOOLS);
|
||||
if(this.material.isMagnetic())
|
||||
|
@ -28,9 +31,15 @@ public abstract class ItemTool extends Item {
|
|||
public abstract boolean canUseOn(ItemStack stack, Block block);
|
||||
|
||||
public float getStrVsBlock(ItemStack stack, Block block) {
|
||||
return !this.canUseOn(stack, block) ? 1.0F : this.efficiency;
|
||||
return !this.canUseOn(stack, block) ? 1.0F : (float)this.material.getEfficiency();
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||
{
|
||||
tooltip.add(Color.DARK_GREEN + "+ " + (this.material.getEfficiency() - 1) + " Abbaueffizienz");
|
||||
}
|
||||
|
||||
public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker) {
|
||||
stack.damage(2, attacker);
|
||||
return true;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package common.item.weapon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.ToolMaterial;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
|
@ -12,6 +12,8 @@ import common.item.ItemAction;
|
|||
import common.item.ItemStack;
|
||||
import common.item.WieldType;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.Color;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemSword extends Item
|
||||
|
@ -44,15 +46,18 @@ public class ItemSword extends Item
|
|||
|
||||
public float getStrVsBlock(ItemStack stack, Block state)
|
||||
{
|
||||
if (state == Blocks.web)
|
||||
{
|
||||
return 15.0F;
|
||||
}
|
||||
else
|
||||
{
|
||||
Material material = state.getMaterial();
|
||||
return material != Material.PLANT && material != Material.BUSH && material != Material.LEAVES && material != Material.SOFT ? 1.0F : 1.5F;
|
||||
}
|
||||
return state.canSwordHarvest() ? (float)this.material.getEfficiency() : 1.0f;
|
||||
}
|
||||
|
||||
public boolean canHarvestBlock(Block blockIn)
|
||||
{
|
||||
return blockIn.canSwordHarvest();
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||
{
|
||||
tooltip.add(Color.DARK_GREEN + "+ " + (this.material.getEfficiency() - 1) + " Abbaueffizienz");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -111,14 +116,6 @@ public class ItemSword extends Item
|
|||
return itemStackIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this Item can harvest the given Block
|
||||
*/
|
||||
public boolean canHarvestBlock(Block blockIn)
|
||||
{
|
||||
return blockIn == Blocks.web;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the enchantability factor of the item, most of the time is based on material.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue