change tools

This commit is contained in:
Sen 2025-07-31 16:13:40 +02:00
parent 1272f87ea0
commit 37f912cb6d
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
26 changed files with 194 additions and 435 deletions

View file

@ -1176,16 +1176,8 @@ public class Client implements IThreadListener {
Block block = state.getBlock(); Block block = state.getBlock();
if(block != Blocks.air) { if(block != Blocks.air) {
desc = block.getDisplay(); desc = block.getDisplay();
if(block.getMiningLevel() >= 0) if(block.getMiningTool() != null)
line2 = "Werkzeug: Spitzhacke Level " + (block.getMiningLevel() + 1); line2 = "Werkzeug: " + block.getMiningTool().getDisplay() + (block.getMiningTool().isLevelled() ? "Level " + (block.getMiningLevel() + 1) : "");
else if(block.canAxeHarvest())
line2 = "Werkzeug: Axt";
else if(block.canShovelHarvest())
line2 = "Werkzeug: Schaufel";
else if(block.canShearsHarvest())
line2 = "Werkzeug: Schere";
else if(block.canSwordHarvest())
line2 = "Werkzeug: Schwert";
} }
} }
else if(this.pointed != null && this.pointed.type == ObjectType.ENTITY && this.pointed.entity != null) { else if(this.pointed != null && this.pointed.type == ObjectType.ENTITY && this.pointed.entity != null) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

View file

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

View file

@ -46,6 +46,7 @@ import common.util.BlockPos;
import common.util.BoundingBox; import common.util.BoundingBox;
import common.util.Clientside; import common.util.Clientside;
import common.util.Facing; import common.util.Facing;
import common.util.HarvestTool;
import common.util.HitPosition; import common.util.HitPosition;
import common.util.Vec3; import common.util.Vec3;
import common.util.HitPosition.ObjectType; import common.util.HitPosition.ObjectType;
@ -174,10 +175,6 @@ public class Block {
private boolean fullBlock; private boolean fullBlock;
private boolean sumBrightness; private boolean sumBrightness;
private boolean axeHarvest;
private boolean shovelHarvest;
private boolean shearsHarvest;
private boolean swordHarvest;
private boolean ticked; private boolean ticked;
private int opacity; private int opacity;
private int light; private int light;
@ -198,6 +195,7 @@ public class Block {
private String display; private String display;
private CheatTab tab; private CheatTab tab;
private SoundType sound; private SoundType sound;
private HarvestTool miningTool;
private Item item; private Item item;
private static <T> Iterable<List<T>> cartesianProduct(Iterable<? extends Iterable<? extends T>> sets) { private static <T> Iterable<List<T>> cartesianProduct(Iterable<? extends Iterable<? extends T>> sets) {
@ -362,11 +360,8 @@ public class Block {
} }
public Block(Material material) { public Block(Material material) {
this.miningLevel = (material == Material.SOLID || material == Material.HEAVY) ? 0 : -1; this.miningTool = material.getTool();
this.axeHarvest = material == Material.WOOD || material == Material.PLANT || material == Material.BUSH || material == Material.SOFT; this.miningLevel = material.getTool() != null && material.getTool().isLevelled() ? 0 : -1;
this.shovelHarvest = material == Material.POWDER || material == Material.DIGGABLE;
this.shearsHarvest = material == Material.LEAVES;
this.swordHarvest = material == Material.FLUFF;
this.sound = SoundType.STONE; this.sound = SoundType.STONE;
this.slipperiness = 0.6F; this.slipperiness = 0.6F;
this.material = material; this.material = material;
@ -430,28 +425,19 @@ public class Block {
return this; return this;
} }
public final Block setMiningLevel(int level) { public final Block setMiningTool(HarvestTool tool, int level) {
if(!tool.isLevelled())
throw new IllegalArgumentException("Abbauwerkzeug " + tool.getDisplay() + " muss Levels besitzen");
this.miningTool = tool;
this.miningLevel = level; this.miningLevel = level;
return this; return this;
} }
public final Block setAxeHarvestable() { public final Block setMiningTool(HarvestTool tool) {
this.axeHarvest = true; if(tool.isLevelled())
return this; throw new IllegalArgumentException("Abbauwerkzeug " + tool.getDisplay() + " darf keine Levels besitzen");
} this.miningTool = tool;
this.miningLevel = -1;
public final Block setShovelHarvestable() {
this.shovelHarvest = true;
return this;
}
public final Block setShearsHarvestable() {
this.shearsHarvest = true;
return this;
}
public final Block setSwordHarvestable() {
this.swordHarvest = true;
return this; return this;
} }
@ -592,21 +578,9 @@ public class Block {
public final int getMiningLevel() { public final int getMiningLevel() {
return this.miningLevel; return this.miningLevel;
} }
public final boolean canAxeHarvest() { public final HarvestTool getMiningTool() {
return this.axeHarvest; return this.miningTool;
}
public final boolean canShovelHarvest() {
return this.shovelHarvest;
}
public final boolean canShearsHarvest() {
return this.shearsHarvest;
}
public final boolean canSwordHarvest() {
return this.swordHarvest;
} }
public final float getRadiation() { public final float getRadiation() {

View file

@ -1,5 +1,7 @@
package common.block; package common.block;
import common.util.HarvestTool;
public enum Material { public enum Material {
NONE {{ NONE {{
this.setNonSolid().setReplaceable(); this.setNonSolid().setReplaceable();
@ -8,13 +10,13 @@ public enum Material {
; ;
}}, }},
WOOD {{ WOOD {{
this.setBurning(); this.setBurning().setTool(HarvestTool.AXE);
}}, }},
SOLID {{ SOLID {{
this.setRequiresTool(); this.setRequiredTool(HarvestTool.PICKAXE);
}}, }},
DIGGABLE {{ // can harvest with shovel DIGGABLE {{ // can harvest with shovel
this.setRequiresTool(); this.setRequiredTool(HarvestTool.SHOVEL);
}}, }},
TRANSLUCENT {{ TRANSLUCENT {{
this.setTranslucent(); this.setTranslucent();
@ -23,16 +25,16 @@ public enum Material {
this.setBurning(); this.setBurning();
}}, }},
SOFT {{ // can break faster with sword, can't connect to fences+walls SOFT {{ // can break faster with sword, can't connect to fences+walls
this.setNoPushMobility(); this.setNoPushMobility().setTool(HarvestTool.AXE);
}}, }},
PISTON {{ PISTON {{
this.setImmovableMobility(); this.setImmovableMobility();
}}, }},
HEAVY {{ HEAVY {{
this.setRequiresTool().setImmovableMobility(); this.setRequiredTool(HarvestTool.PICKAXE).setImmovableMobility();
}}, }},
PLANT {{ // can break faster with sword PLANT {{ // can break faster with sword
this.setNonSolid().setNoPushMobility(); this.setNonSolid().setNoPushMobility().setTool(HarvestTool.AXE);
}}, }},
SMALL {{ // can be placed more easily SMALL {{ // can be placed more easily
this.setNonSolid().setNoPushMobility(); this.setNonSolid().setNoPushMobility();
@ -62,19 +64,19 @@ public enum Material {
this.setLiquid(true).setReplaceable().setNoPushMobility(); this.setLiquid(true).setReplaceable().setNoPushMobility();
}}, }},
LEAVES {{ // can break faster with sword, precipitation block, special treatment in some worldgen LEAVES {{ // can break faster with sword, precipitation block, special treatment in some worldgen
this.setBurning().setTranslucent().setNoPushMobility(); this.setBurning().setTranslucent().setNoPushMobility().setTool(HarvestTool.SHEARS);
}}, }},
BUSH {{ // can break faster with sword, can be replaced by small tree leaves BUSH {{ // can break faster with sword, can be replaced by small tree leaves
this.setNonSolid().setBurning().setNoPushMobility().setReplaceable(); this.setNonSolid().setBurning().setNoPushMobility().setReplaceable().setTool(HarvestTool.AXE);
}}, }},
FIRE {{ FIRE {{
this.setNonSolid().setReplaceable().setNoPushMobility(); this.setNonSolid().setReplaceable().setNoPushMobility();
}}, }},
POWDER {{ // can harvest with shovel, precipitation block POWDER {{ // can harvest with shovel, precipitation block
this.setNonSolid().setReplaceable().setRequiresTool().setNoPushMobility(); this.setNonSolid().setReplaceable().setRequiredTool(HarvestTool.SHOVEL).setNoPushMobility();
}}, }},
FLUFF {{ // can harvest with shears FLUFF {{ // can harvest with shears
this.setPassable().setRequiresTool().setNoPushMobility(); this.setPassable().setRequiredTool(HarvestTool.SWORD).setNoPushMobility();
}}; }};
private boolean solid = true; private boolean solid = true;
@ -89,6 +91,7 @@ public enum Material {
private boolean requiresTool; private boolean requiresTool;
// 0 - normal; 1 - can't push other blocks; 2 - can't be pushed // 0 - normal; 1 - can't push other blocks; 2 - can't be pushed
private int mobility; private int mobility;
private HarvestTool tool;
protected Material setTranslucent() { protected Material setTranslucent() {
this.opaque = false; this.opaque = false;
@ -121,8 +124,14 @@ public enum Material {
return this; return this;
} }
protected Material setRequiresTool() { protected Material setRequiredTool(HarvestTool tool) {
this.requiresTool = true; this.requiresTool = true;
this.tool = tool;
return this;
}
protected Material setTool(HarvestTool tool) {
this.tool = tool;
return this; return this;
} }
@ -189,4 +198,8 @@ public enum Material {
public int getMobility() { public int getMobility() {
return this.mobility; return this.mobility;
} }
public HarvestTool getTool() {
return this.tool;
}
} }

View file

@ -8,7 +8,6 @@ import common.entity.types.EntityLiving;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.material.ItemArmor; import common.item.material.ItemArmor;
import common.item.tool.ItemAxe; import common.item.tool.ItemAxe;
import common.item.tool.ItemShears;
import common.rng.Random; import common.rng.Random;
import common.util.Displayable; import common.util.Displayable;
import common.util.ExtMath; import common.util.ExtMath;
@ -313,11 +312,6 @@ public enum Enchantment implements Displayable, Identifyable
{ {
return 5; return 5;
} }
public boolean canApply(ItemStack stack)
{
return stack.getItem() instanceof ItemShears ? true : super.canApply(stack);
}
}, },
SILK_TOUCH("silk_touch", 1, EnchantmentType.DIGGER, "Behutsamkeit") { SILK_TOUCH("silk_touch", 1, EnchantmentType.DIGGER, "Behutsamkeit") {
public int getMinEnchantability(int enchantmentLevel) public int getMinEnchantability(int enchantmentLevel)
@ -339,11 +333,6 @@ public enum Enchantment implements Displayable, Identifyable
{ {
return super.canApplyTogether(ench) && ench != FORTUNE; return super.canApplyTogether(ench) && ench != FORTUNE;
} }
public boolean canApply(ItemStack stack)
{
return stack.getItem() instanceof ItemShears ? true : super.canApply(stack);
}
}, },
UNBREAKING("unbreaking", 5, EnchantmentType.BREAKABLE, "Haltbarkeit") { UNBREAKING("unbreaking", 5, EnchantmentType.BREAKABLE, "Haltbarkeit") {
public int getMinEnchantability(int enchantmentLevel) public int getMinEnchantability(int enchantmentLevel)

View file

@ -63,9 +63,7 @@ import common.item.ItemAction;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.consumable.ItemPotion; import common.item.consumable.ItemPotion;
import common.item.material.ItemArmor; import common.item.material.ItemArmor;
import common.item.tool.ItemHoe;
import common.item.tool.ItemKey; import common.item.tool.ItemKey;
import common.item.tool.ItemShears;
import common.item.tool.ItemTool; import common.item.tool.ItemTool;
import common.item.weapon.ItemBow; import common.item.weapon.ItemBow;
import common.item.weapon.ItemGunBase; import common.item.weapon.ItemGunBase;
@ -630,8 +628,7 @@ public abstract class EntityNPC extends EntityLiving
public boolean interact(EntityNPC player) public boolean interact(EntityNPC player)
{ {
ItemStack stack = player.inventory.getCurrentItem(); ItemStack stack = player.inventory.getCurrentItem();
boolean flag = stack != null && !(stack.getItem() instanceof ItemTool || stack.getItem() instanceof ItemSword || boolean flag = stack != null && !(stack.getItem() instanceof ItemTool);
stack.getItem() instanceof ItemHoe || stack.getItem() instanceof ItemShears);
if (stack != null && !this.isPlayer() && this.isBreedingItem(stack) && this.getGrowingAge() == 0 && !this.isMating()) if (stack != null && !this.isPlayer() && this.isBreedingItem(stack) && this.getGrowingAge() == 0 && !this.isMating())
{ {
@ -1324,8 +1321,8 @@ public abstract class EntityNPC extends EntityLiving
ItemSword itemsword = (ItemSword)stack.getItem(); ItemSword itemsword = (ItemSword)stack.getItem();
ItemSword itemsword1 = (ItemSword)old.getItem(); ItemSword itemsword1 = (ItemSword)old.getItem();
if(itemsword.getDamageVsEntity() != itemsword1.getDamageVsEntity()) { if(itemsword.getAttackDamageBonus() != itemsword1.getAttackDamageBonus()) {
flag = itemsword.getDamageVsEntity() > itemsword1.getDamageVsEntity(); flag = itemsword.getAttackDamageBonus() > itemsword1.getAttackDamageBonus();
} }
else { else {
flag = stack.getItemDamage() > old.getItemDamage() || stack.isItemEnchanted() && !old.isItemEnchanted(); flag = stack.getItemDamage() > old.getItemDamage() || stack.isItemEnchanted() && !old.isItemEnchanted();

View file

@ -135,6 +135,7 @@ import common.model.TextureAnimation;
import common.properties.Property; import common.properties.Property;
import common.util.PortalType; import common.util.PortalType;
import common.util.Color; import common.util.Color;
import common.util.HarvestTool;
import common.util.Util; import common.util.Util;
import common.world.State; import common.world.State;
@ -243,7 +244,7 @@ public abstract class BlockRegistry {
Block stone = (new BlockStone()).setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE).setDisplay("Stein"); Block stone = (new BlockStone()).setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE).setDisplay("Stein");
register("stone", stone); register("stone", stone);
register("bedrock", (new BlockBedrock()).setHardness(1000.0F).setResistance(100000.0F).setSound(SoundType.STONE) register("bedrock", (new BlockBedrock()).setHardness(1000.0F).setResistance(100000.0F).setSound(SoundType.STONE)
.setDisplay("Grundgestein").setTab(CheatTab.ROCK).setMiningLevel(6)); .setDisplay("Grundgestein").setTab(CheatTab.ROCK).setMiningTool(HarvestTool.PICKAXE, 6));
register("rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE).setDisplay("Felsen").setTab(CheatTab.ROCK)); register("rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE).setDisplay("Felsen").setTab(CheatTab.ROCK));
register("smooth_rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE).setDisplay("Glatter Felsen").setTab(CheatTab.ROCK)); register("smooth_rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE).setDisplay("Glatter Felsen").setTab(CheatTab.ROCK));
register("hellrock", (new BlockHellRock()).setHardness(0.4F).setSound(SoundType.STONE).setDisplay("Höllenstein")); register("hellrock", (new BlockHellRock()).setHardness(0.4F).setSound(SoundType.STONE).setDisplay("Höllenstein"));
@ -262,8 +263,8 @@ public abstract class BlockRegistry {
register("smooth_sandstone", (new BlockSandStone("smooth")).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Glatter Sandstein")); register("smooth_sandstone", (new BlockSandStone("smooth")).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Glatter Sandstein"));
register("carved_sandstone", (new BlockSandStone("carved")).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Gemeißelter Sandstein")); register("carved_sandstone", (new BlockSandStone("carved")).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Gemeißelter Sandstein"));
register("obsidian", (new BlockObsidian()).setHardness(50.0F).setResistance(2000.0F).setSound(SoundType.STONE) register("obsidian", (new BlockObsidian()).setHardness(50.0F).setResistance(2000.0F).setSound(SoundType.STONE)
.setDisplay("Obsidian").setMiningLevel(3)); .setDisplay("Obsidian").setMiningTool(HarvestTool.PICKAXE, 3));
register("clay", (new BlockClay()).setHardness(0.6F).setSound(SoundType.GRAVEL).setDisplay("Ton").setShovelHarvestable()); register("clay", (new BlockClay()).setHardness(0.6F).setSound(SoundType.GRAVEL).setDisplay("Ton").setMiningTool(HarvestTool.SHOVEL));
register("hardened_clay", (new BlockHardenedClay()).setHardness(1.25F).setResistance(7.0F).setSound(SoundType.STONE).setDisplay("Gebrannter Ton")); register("hardened_clay", (new BlockHardenedClay()).setHardness(1.25F).setResistance(7.0F).setSound(SoundType.STONE).setDisplay("Gebrannter Ton"));
for(Color color : Color.values()) { for(Color color : Color.values()) {
register(color.getName() + "_clay", (new BlockColoredClay(color)).setHardness(1.25F).setResistance(7.0F) register(color.getName() + "_clay", (new BlockColoredClay(color)).setHardness(1.25F).setResistance(7.0F)
@ -271,17 +272,16 @@ public abstract class BlockRegistry {
} }
register("coal_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F) register("coal_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F)
.setSound(SoundType.STONE).setDisplay("Kohleblock").setTab(CheatTab.NATURE).setFlammable(5, 5)); .setSound(SoundType.STONE).setDisplay("Kohleblock").setTab(CheatTab.NATURE).setFlammable(5, 5));
register("sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.SAND).setDisplay("Sand").setShovelHarvestable().setTab(CheatTab.NATURE)); register("sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.SAND).setDisplay("Sand").setMiningTool(HarvestTool.SHOVEL).setTab(CheatTab.NATURE));
register("red_sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.SAND).setDisplay("Roter Sand").setShovelHarvestable().setTab(CheatTab.NATURE)); register("red_sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.SAND).setDisplay("Roter Sand").setMiningTool(HarvestTool.SHOVEL).setTab(CheatTab.NATURE));
register("gravel", (new BlockGravel()).setHardness(0.6F).setSound(SoundType.GRAVEL).setDisplay("Kies").setShovelHarvestable()); register("gravel", (new BlockGravel()).setHardness(0.6F).setSound(SoundType.GRAVEL).setDisplay("Kies").setMiningTool(HarvestTool.SHOVEL));
register("ash", (new BlockFalling(Material.LOOSE)).setHardness(0.2F).setSound(SoundType.SAND).setDisplay("Asche") register("ash", (new BlockFalling(Material.LOOSE)).setHardness(0.2F).setSound(SoundType.SAND).setDisplay("Asche")
.setTab(CheatTab.NATURE).setShovelHarvestable()); .setTab(CheatTab.NATURE).setMiningTool(HarvestTool.SHOVEL));
register("snow_layer", (new BlockSnow()).setHardness(0.1F).setSound(SoundType.SNOW).setDisplay("Schnee").setOpacity(0) register("snow_layer", (new BlockSnow()).setHardness(0.1F).setSound(SoundType.SNOW).setDisplay("Schnee").setOpacity(0).setMiningTool(HarvestTool.SHOVEL));
.setShovelHarvestable()); register("snow", (new BlockSnowBlock()).setHardness(0.2F).setSound(SoundType.SNOW).setDisplay("Schnee").setMiningTool(HarvestTool.SHOVEL));
register("snow", (new BlockSnowBlock()).setHardness(0.2F).setSound(SoundType.SNOW).setDisplay("Schnee").setShovelHarvestable()); register("ice", (new BlockIce()).setHardness(0.5F).setOpacity(3).setSound(SoundType.GLASS).setDisplay("Eis").setMiningTool(HarvestTool.PICKAXE, 0));
register("ice", (new BlockIce()).setHardness(0.5F).setOpacity(3).setSound(SoundType.GLASS).setDisplay("Eis").setMiningLevel(0)); register("packed_ice", (new BlockPackedIce()).setHardness(0.5F).setSound(SoundType.GLASS).setDisplay("Packeis").setMiningTool(HarvestTool.PICKAXE, 0));
register("packed_ice", (new BlockPackedIce()).setHardness(0.5F).setSound(SoundType.GLASS).setDisplay("Packeis").setMiningLevel(0)); register("soul_sand", (new BlockSoulSand()).setHardness(0.5F).setSound(SoundType.SAND).setDisplay("Seelensand").setMiningTool(HarvestTool.SHOVEL));
register("soul_sand", (new BlockSoulSand()).setHardness(0.5F).setSound(SoundType.SAND).setDisplay("Seelensand").setShovelHarvestable());
register("glowstone", (new BlockGlowstone(Material.TRANSLUCENT)).setHardness(0.3F).setSound(SoundType.GLASS).setLight(1.0F) register("glowstone", (new BlockGlowstone(Material.TRANSLUCENT)).setHardness(0.3F).setSound(SoundType.GLASS).setLight(1.0F)
.setDisplay("Glowstone")); .setDisplay("Glowstone"));
register("blackened_stone", (new BlockBlackenedStone()).setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE).setDisplay("Schwarzstein")); register("blackened_stone", (new BlockBlackenedStone()).setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE).setDisplay("Schwarzstein"));
@ -307,35 +307,35 @@ public abstract class BlockRegistry {
register("coal_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE).setDisplay("Steinkohle")); register("coal_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE).setDisplay("Steinkohle"));
register("lapis_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE) register("lapis_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE)
.setDisplay("Lapislazulierz").setMiningLevel(1)); .setDisplay("Lapislazulierz").setMiningTool(HarvestTool.PICKAXE, 1));
register("emerald_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE) register("emerald_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE)
.setDisplay("Smaragderz").setMiningLevel(2)); .setDisplay("Smaragderz").setMiningTool(HarvestTool.PICKAXE, 2));
register("quartz_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE) register("quartz_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE)
.setDisplay("Quarzerz")); .setDisplay("Quarzerz"));
register("black_quartz_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE) register("black_quartz_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE)
.setDisplay("Schwarzes Quarzerz")); .setDisplay("Schwarzes Quarzerz"));
register("charge_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE) register("charge_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE)
.setDisplay("Geladenes Erz").setMiningLevel(2)); .setDisplay("Geladenes Erz").setMiningTool(HarvestTool.PICKAXE, 2));
for(MetalType metal : MetalType.values()) { for(MetalType metal : MetalType.values()) {
// String loc = metal.name.substring(0, 1).toUpperCase() + metal.name.substring(1); // String loc = metal.name.substring(0, 1).toUpperCase() + metal.name.substring(1);
register(metal.name + "_ore", (new BlockMetalOre(metal)).setHardness(3.0F).setResistance(5.0F) register(metal.name + "_ore", (new BlockMetalOre(metal)).setHardness(3.0F).setResistance(5.0F)
.setDisplay(metal.display + "erz").setMiningLevel(1)); .setDisplay(metal.display + "erz").setMiningTool(HarvestTool.PICKAXE, 1));
} }
for(OreType ore : OreType.values()) { for(OreType ore : OreType.values()) {
// String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1); // String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1);
register(ore.name + "_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE) register(ore.name + "_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE)
.setDisplay(ore.display + "erz").setMiningLevel(ore.material.getHarvestLevel() - 1)); .setDisplay(ore.display + "erz").setMiningTool(HarvestTool.PICKAXE, ore.material.getHarvestLevel() - 1));
} }
register("dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Erde").setShovelHarvestable().setTab(CheatTab.NATURE)); register("dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Erde").setMiningTool(HarvestTool.SHOVEL).setTab(CheatTab.NATURE));
register("grass", (new BlockGrass()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Gras").setShovelHarvestable()); register("grass", (new BlockGrass()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Gras").setMiningTool(HarvestTool.SHOVEL));
register("coarse_dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Grobe Erde").setShovelHarvestable().setTab(CheatTab.NATURE)); register("coarse_dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Grobe Erde").setMiningTool(HarvestTool.SHOVEL).setTab(CheatTab.NATURE));
register("podzol", (new BlockPodzol()).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Podsol").setShovelHarvestable()); register("podzol", (new BlockPodzol()).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Podsol").setMiningTool(HarvestTool.SHOVEL));
register("mycelium", (new BlockMycelium()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Myzel").setShovelHarvestable()); register("mycelium", (new BlockMycelium()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Myzel").setMiningTool(HarvestTool.SHOVEL));
register("tian", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE) register("tian", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE)
.setDisplay("Tian").setTab(CheatTab.NATURE)); .setDisplay("Tian").setTab(CheatTab.NATURE));
register("tian_soil", (new BlockTianSoil()).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE) register("tian_soil", (new BlockTianSoil()).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE)
@ -343,15 +343,15 @@ public abstract class BlockRegistry {
register("moon_cheese", (new BlockTreasure(Material.SOFT)).setHardness(1.5F).setResistance(5.0F) register("moon_cheese", (new BlockTreasure(Material.SOFT)).setHardness(1.5F).setResistance(5.0F)
.setSound(SoundType.CLOTH).setDisplay("Mondkäse").setTab(CheatTab.NATURE)); .setSound(SoundType.CLOTH).setDisplay("Mondkäse").setTab(CheatTab.NATURE));
register("slime_block", (new BlockSlime()).setDisplay("Schleimblock").setSound(SoundType.SLIME)); register("slime_block", (new BlockSlime()).setDisplay("Schleimblock").setSound(SoundType.SLIME));
register("blackened_dirt", (new BlockBlackenedDirt()).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Schwarzerde").setShovelHarvestable()); register("blackened_dirt", (new BlockBlackenedDirt()).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Schwarzerde").setMiningTool(HarvestTool.SHOVEL));
register("blackened_soil", (new BlockBlackenedSoil()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Schwarzgrund").setShovelHarvestable()); register("blackened_soil", (new BlockBlackenedSoil()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Schwarzgrund").setMiningTool(HarvestTool.SHOVEL));
register("swamp", (new BlockSwamp()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Sumpf").setShovelHarvestable()); register("swamp", (new BlockSwamp()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Sumpf").setMiningTool(HarvestTool.SHOVEL));
for(BlockTallGrass.EnumType type : BlockTallGrass.EnumType.values()) { for(BlockTallGrass.EnumType type : BlockTallGrass.EnumType.values()) {
register(type.getName(), (new BlockTallGrass(type)).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay(type.getDisplay()).setShearsHarvestable()); register(type.getName(), (new BlockTallGrass(type)).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay(type.getDisplay()).setMiningTool(HarvestTool.SHEARS));
} }
register("deadbush", (new BlockDeadBush()).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("Toter Busch")); register("deadbush", (new BlockDeadBush()).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("Toter Busch"));
for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) { 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"); Block cactus = (new BlockCactus()).setHardness(0.4F).setSound(SoundType.CLOTH).setDisplay("Kaktus");
register("cactus", cactus); register("cactus", cactus);
register("reeds", (new BlockReed()).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS)); 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").setShearsHarvestable()); register("vine", (new BlockVine(false)).setHardness(0.2F).setSound(SoundType.GRASS).setDisplay("Ranken").setMiningTool(HarvestTool.SHEARS));
register("swamp_vine", (new BlockVine(true)).setHardness(0.2F).setSound(SoundType.GRASS).setDisplay("Sumpfranken").setShearsHarvestable()); register("swamp_vine", (new BlockVine(true)).setHardness(0.2F).setSound(SoundType.GRASS).setDisplay("Sumpfranken").setMiningTool(HarvestTool.SHEARS));
register("waterlily", (new BlockLilyPad()).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("Seerosenblatt")); register("waterlily", (new BlockLilyPad()).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("Seerosenblatt"));
@ -407,9 +407,9 @@ public abstract class BlockRegistry {
register("lapis_block", (new Block(Material.SOLID)).setHardness(3.0F).setResistance(5.0F) register("lapis_block", (new Block(Material.SOLID)).setHardness(3.0F).setResistance(5.0F)
.setSound(SoundType.STONE).setDisplay("Lapislazuliblock").setTab(CheatTab.GEMS).setMiningLevel(1)); .setSound(SoundType.STONE).setDisplay("Lapislazuliblock").setTab(CheatTab.GEMS).setMiningTool(HarvestTool.PICKAXE, 1));
register("emerald_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F) register("emerald_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F)
.setSound(SoundType.STONE).setDisplay("Smaragdblock").setTab(CheatTab.GEMS).setMiningLevel(2)); .setSound(SoundType.STONE).setDisplay("Smaragdblock").setTab(CheatTab.GEMS).setMiningTool(HarvestTool.PICKAXE, 2));
register("charged_block", (new BlockMagnetic(Material.SOLID)).setHardness(5.0F).setResistance(10.0F) register("charged_block", (new BlockMagnetic(Material.SOLID)).setHardness(5.0F).setResistance(10.0F)
.setSound(SoundType.STONE).setDisplay("Geladener Block").setTab(CheatTab.GEMS)); .setSound(SoundType.STONE).setDisplay("Geladener Block").setTab(CheatTab.GEMS));
@ -424,8 +424,7 @@ public abstract class BlockRegistry {
for(Color color : Color.values()) { for(Color color : Color.values()) {
register(color.getName() + "_wool", (new BlockWool(color)).setHardness(0.8F).setSound(SoundType.CLOTH).setDisplay(color.getSubject(-1) + " Wolle") register(color.getName() + "_wool", (new BlockWool(color)).setHardness(0.8F).setSound(SoundType.CLOTH).setDisplay(color.getSubject(-1) + " Wolle").setMiningTool(HarvestTool.SHEARS));
.setShearsHarvestable());
} }
for(Color color : Color.values()) { 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)); register(color.getName() + "_carpet", (new BlockCarpet(color)).setHardness(0.1F).setSound(SoundType.CLOTH).setDisplay(color.getSubject(1) + " Teppich").setOpacity(0));
@ -434,7 +433,7 @@ public abstract class BlockRegistry {
register(color.getName() + "_bed", (new BlockBed(color)).setSound(SoundType.WOOD).setHardness(0.2F).setDisplay(color.getSubject(0) + " Bett")); register(color.getName() + "_bed", (new BlockBed(color)).setSound(SoundType.WOOD).setHardness(0.2F).setDisplay(color.getSubject(0) + " Bett"));
} }
register("ladder", (new BlockLadder()).setHardness(0.4F).setSound(SoundType.LADDER).setDisplay("Leiter").setAxeHarvestable()); register("ladder", (new BlockLadder()).setHardness(0.4F).setSound(SoundType.LADDER).setDisplay("Leiter").setMiningTool(HarvestTool.AXE));
register("bookshelf", (new BlockBookshelf()).setHardness(1.5F).setSound(SoundType.WOOD).setDisplay("Bücherregal")); register("bookshelf", (new BlockBookshelf()).setHardness(1.5F).setSound(SoundType.WOOD).setDisplay("Bücherregal"));
register("cake", (new BlockCake()).setHardness(0.5F).setSound(SoundType.CLOTH).setDisplay("Kuchen").setTab(CheatTab.DECORATION)); register("cake", (new BlockCake()).setHardness(0.5F).setSound(SoundType.CLOTH).setDisplay("Kuchen").setTab(CheatTab.DECORATION));
register("dragon_egg", (new BlockDragonEgg()).setHardness(3.0F).setResistance(15.0F).setSound(SoundType.STONE) register("dragon_egg", (new BlockDragonEgg()).setHardness(3.0F).setResistance(15.0F).setSound(SoundType.STONE)
@ -467,8 +466,7 @@ public abstract class BlockRegistry {
register("portal_frame", (new BlockPortalFrame()).setSound(SoundType.GLASS).setLight(0.125F).setHardness(5.0F) register("portal_frame", (new BlockPortalFrame()).setSound(SoundType.GLASS).setLight(0.125F).setHardness(5.0F)
.setDisplay("Portalrahmen").setResistance(2000.0F).setTab(CheatTab.TECHNOLOGY)); .setDisplay("Portalrahmen").setResistance(2000.0F).setTab(CheatTab.TECHNOLOGY));
register("farmland", (new BlockFarmland()).setHardness(0.6F).setSound(SoundType.GRAVEL).setDisplay("Ackerboden") register("farmland", (new BlockFarmland()).setHardness(0.6F).setSound(SoundType.GRAVEL).setDisplay("Ackerboden").setMiningTool(HarvestTool.SHOVEL).setTab(CheatTab.PLANTS));
.setShovelHarvestable().setTab(CheatTab.PLANTS));
register("wheats", (new BlockCrops()).setDisplay("Getreide")); register("wheats", (new BlockCrops()).setDisplay("Getreide"));
register("carrots", (new BlockCarrot()).setDisplay("Karotten")); register("carrots", (new BlockCarrot()).setDisplay("Karotten"));
register("potatoes", (new BlockPotato()).setDisplay("Kartoffeln")); register("potatoes", (new BlockPotato()).setDisplay("Kartoffeln"));
@ -480,13 +478,12 @@ public abstract class BlockRegistry {
for(MetalType metal : MetalType.values()) { for(MetalType metal : MetalType.values()) {
// String loc = metal.name.substring(0, 1).toUpperCase() + metal.name.substring(1); // String loc = metal.name.substring(0, 1).toUpperCase() + metal.name.substring(1);
register(metal.name + "_block", (new BlockMetalBlock(metal)).setHardness(5.0F).setResistance(10.0F) register(metal.name + "_block", (new BlockMetalBlock(metal)).setHardness(5.0F).setResistance(10.0F)
.setDisplay(metal.display + "block").setMiningLevel(1)); .setDisplay(metal.display + "block").setMiningTool(HarvestTool.PICKAXE, 1));
} }
for(OreType ore : OreType.values()) { for(OreType ore : OreType.values()) {
// String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1); // String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1);
register(ore.name + "_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F).setSound(SoundType.STONE) register(ore.name + "_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F).setSound(SoundType.STONE)
.setDisplay(ore.display + "block").setTab(CheatTab.GEMS) .setDisplay(ore.display + "block").setTab(CheatTab.GEMS).setMiningTool(HarvestTool.PICKAXE, ore.material.getHarvestLevel() - 1));
.setMiningLevel(ore.material.getHarvestLevel() - 1));
} }
@ -639,7 +636,7 @@ public abstract class BlockRegistry {
register("hopper", (new BlockHopper()).setHardness(3.0F).setResistance(8.0F).setSound(SoundType.STONE).setDisplay("Trichter")); register("hopper", (new BlockHopper()).setHardness(3.0F).setResistance(8.0F).setSound(SoundType.STONE).setDisplay("Trichter"));
register("tian_reactor", (new BlockTianReactor()).setHardness(3.0F).setResistance(8.0F).setSound(SoundType.STONE).setDisplay("Tianreaktor")); register("tian_reactor", (new BlockTianReactor()).setHardness(3.0F).setResistance(8.0F).setSound(SoundType.STONE).setDisplay("Tianreaktor"));
register("rail", (new BlockRail()).setHardness(0.7F).setSound(SoundType.STONE).setDisplay("Schiene").setMiningLevel(0)); register("rail", (new BlockRail()).setHardness(0.7F).setSound(SoundType.STONE).setDisplay("Schiene").setMiningTool(HarvestTool.PICKAXE, 0));
register("lever", (new BlockLever()).setHardness(0.5F).setSound(SoundType.WOOD).setDisplay("Hebel")); register("lever", (new BlockLever()).setHardness(0.5F).setSound(SoundType.WOOD).setDisplay("Hebel"));

View file

@ -23,7 +23,7 @@ import common.util.Color;
public abstract class CraftingRegistry public abstract class CraftingRegistry
{ {
private static final String[][] TOOLS = new String[][] { private static final String[][] TOOLS = new String[][] {
{"XXX", " # ", " # "}, {"X", "#", "#"}, {"XX", "X#", " #"}, {"XX", " #", " #"} {"XXX", " # ", " # "}, {"X", "#", "#"}, {"XX", "X#", " #"}
}; };
private static final String[][] WEAPONS = new String[][] {{"X", "X", "#"}}; private static final String[][] WEAPONS = new String[][] {{"X", "X", "#"}};
private static final String[][] ARMOR = new String[][] { private static final String[][] ARMOR = new String[][] {
@ -49,7 +49,6 @@ public abstract class CraftingRegistry
add(new ItemStack(ItemRegistry.byName(ore.name + "_pickaxe")), TOOLS[0], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(ore.name + "_pickaxe")), TOOLS[0], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.byName(ore.name + "_shovel")), TOOLS[1], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(ore.name + "_shovel")), TOOLS[1], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.byName(ore.name + "_axe")), TOOLS[2], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(ore.name + "_axe")), TOOLS[2], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.byName(ore.name + "_hoe")), TOOLS[3], '#', Items.stick, 'X', item);
} }
if(ore.material.hasExtras()) { if(ore.material.hasExtras()) {
add(new ItemStack(ItemRegistry.byName(ore.name + "_shears")), " #", "# ", '#', item); add(new ItemStack(ItemRegistry.byName(ore.name + "_shears")), " #", "# ", '#', item);
@ -75,7 +74,6 @@ public abstract class CraftingRegistry
add(new ItemStack(ItemRegistry.byName(metal.name + "_pickaxe")), TOOLS[0], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(metal.name + "_pickaxe")), TOOLS[0], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.byName(metal.name + "_shovel")), TOOLS[1], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(metal.name + "_shovel")), TOOLS[1], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.byName(metal.name + "_axe")), TOOLS[2], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(metal.name + "_axe")), TOOLS[2], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.byName(metal.name + "_hoe")), TOOLS[3], '#', Items.stick, 'X', item);
} }
if(metal.material != null && metal.material.hasExtras()) { if(metal.material != null && metal.material.hasExtras()) {
add(new ItemStack(ItemRegistry.byName(metal.name + "_shears")), " #", "# ", '#', item); add(new ItemStack(ItemRegistry.byName(metal.name + "_shears")), " #", "# ", '#', item);
@ -101,7 +99,6 @@ public abstract class CraftingRegistry
add(new ItemStack(ItemRegistry.byName(tool.name + "_pickaxe")), TOOLS[0], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(tool.name + "_pickaxe")), TOOLS[0], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.byName(tool.name + "_shovel")), TOOLS[1], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(tool.name + "_shovel")), TOOLS[1], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.byName(tool.name + "_axe")), TOOLS[2], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(tool.name + "_axe")), TOOLS[2], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.byName(tool.name + "_hoe")), TOOLS[3], '#', Items.stick, 'X', item);
} }
if(tool.material.hasExtras()) { if(tool.material.hasExtras()) {
add(new ItemStack(ItemRegistry.byName(tool.name + "_shears")), " #", "# ", '#', item); add(new ItemStack(ItemRegistry.byName(tool.name + "_shears")), " #", "# ", '#', item);
@ -117,7 +114,8 @@ public abstract class CraftingRegistry
} }
} }
} }
add(new ItemStack(Items.hoe), "XX", " #", " #", '#', Items.stick, 'X', Items.cobblestone);
add(new ItemStack(Items.bow, 1), " #X", "# X", " #X", 'X', Items.string, '#', Items.stick); add(new ItemStack(Items.bow, 1), " #X", "# X", " #X", 'X', Items.string, '#', Items.stick);
add(new ItemStack(Items.arrow, 4), "X", "#", "Y", 'Y', Items.feather, 'X', Items.flint, '#', Items.stick); add(new ItemStack(Items.arrow, 4), "X", "#", "Y", 'Y', Items.feather, 'X', Items.flint, '#', Items.stick);

View file

@ -134,7 +134,6 @@ public abstract class ItemRegistry {
register(name + "_shovel", (new ItemShovel(material)).setDisplay(prefix + "schaufel")); register(name + "_shovel", (new ItemShovel(material)).setDisplay(prefix + "schaufel"));
register(name + "_pickaxe", (new ItemPickaxe(material)).setDisplay(prefix + "spitzhacke")); register(name + "_pickaxe", (new ItemPickaxe(material)).setDisplay(prefix + "spitzhacke"));
register(name + "_axe", (new ItemAxe(material)).setDisplay(prefix + "axt")); register(name + "_axe", (new ItemAxe(material)).setDisplay(prefix + "axt"));
register(name + "_hoe", (new ItemHoe(material)).setDisplay(prefix + "hacke"));
} }
if(material.hasExtras()) { if(material.hasExtras()) {
register(name + "_shears", (new ItemShears(material)).setDisplay(prefix + "schere")); register(name + "_shears", (new ItemShears(material)).setDisplay(prefix + "schere"));
@ -219,6 +218,7 @@ public abstract class ItemRegistry {
register("lighter", (new ItemFire(Blocks.fire)).setDisplay("Feuerzeug")); register("lighter", (new ItemFire(Blocks.fire)).setDisplay("Feuerzeug"));
register("burning_soul", (new ItemFire(Blocks.soul_fire)).setDisplay("Brennende Seele")); register("burning_soul", (new ItemFire(Blocks.soul_fire)).setDisplay("Brennende Seele"));
register("dark_lighter", (new ItemFire(Blocks.black_fire)).setDisplay("Verdunkelndes Feuerzeug")); register("dark_lighter", (new ItemFire(Blocks.black_fire)).setDisplay("Verdunkelndes Feuerzeug"));
register("hoe", (new ItemHoe()).setDisplay("Hacke"));
register("apple", (new ItemFood(4, false)).setDisplay("Apfel").setMaxAmount(StackSize.L)); register("apple", (new ItemFood(4, false)).setDisplay("Apfel").setMaxAmount(StackSize.L));
register("bow", (new ItemBow()).setDisplay("Bogen")); register("bow", (new ItemBow()).setDisplay("Bogen"));
register("boltgun", (new ItemBoltgun()).setDisplay("Bolter")); register("boltgun", (new ItemBoltgun()).setDisplay("Bolter"));

View file

@ -306,7 +306,6 @@ public abstract class Items {
public static final ItemArmor diamond_boots = get("diamond_boots"); public static final ItemArmor diamond_boots = get("diamond_boots");
public static final ItemArmor diamond_chestplate = get("diamond_chestplate"); public static final ItemArmor diamond_chestplate = get("diamond_chestplate");
public static final ItemArmor diamond_helmet = get("diamond_helmet"); public static final ItemArmor diamond_helmet = get("diamond_helmet");
public static final ItemHoe diamond_hoe = get("diamond_hoe");
public static final ItemHorseArmor diamond_horse_armor = get("diamond_horse_armor"); public static final ItemHorseArmor diamond_horse_armor = get("diamond_horse_armor");
public static final ItemArmor diamond_leggings = get("diamond_leggings"); public static final ItemArmor diamond_leggings = get("diamond_leggings");
public static final Item diamond_ore = get("diamond_ore"); public static final Item diamond_ore = get("diamond_ore");
@ -363,7 +362,6 @@ public abstract class Items {
public static final ItemArmor gold_boots = get("gold_boots"); public static final ItemArmor gold_boots = get("gold_boots");
public static final ItemArmor gold_chestplate = get("gold_chestplate"); public static final ItemArmor gold_chestplate = get("gold_chestplate");
public static final ItemArmor gold_helmet = get("gold_helmet"); public static final ItemArmor gold_helmet = get("gold_helmet");
public static final ItemHoe gold_hoe = get("gold_hoe");
public static final ItemHorseArmor gold_horse_armor = get("gold_horse_armor"); public static final ItemHorseArmor gold_horse_armor = get("gold_horse_armor");
public static final ItemMetal gold_ingot = get("gold_ingot"); public static final ItemMetal gold_ingot = get("gold_ingot");
public static final ItemArmor gold_leggings = get("gold_leggings"); public static final ItemArmor gold_leggings = get("gold_leggings");
@ -392,7 +390,6 @@ public abstract class Items {
public static final Item gunpowder = get("gunpowder"); public static final Item gunpowder = get("gunpowder");
public static final ItemAxe gyriyn_axe = get("gyriyn_axe"); public static final ItemAxe gyriyn_axe = get("gyriyn_axe");
public static final Item gyriyn_block = get("gyriyn_block"); public static final Item gyriyn_block = get("gyriyn_block");
public static final ItemHoe gyriyn_hoe = get("gyriyn_hoe");
public static final Item gyriyn_ore = get("gyriyn_ore"); public static final Item gyriyn_ore = get("gyriyn_ore");
public static final ItemPickaxe gyriyn_pickaxe = get("gyriyn_pickaxe"); public static final ItemPickaxe gyriyn_pickaxe = get("gyriyn_pickaxe");
public static final ItemShovel gyriyn_shovel = get("gyriyn_shovel"); public static final ItemShovel gyriyn_shovel = get("gyriyn_shovel");
@ -415,7 +412,6 @@ public abstract class Items {
public static final ItemArmor iron_chestplate = get("iron_chestplate"); public static final ItemArmor iron_chestplate = get("iron_chestplate");
public static final Item iron_door = get("iron_door"); public static final Item iron_door = get("iron_door");
public static final ItemArmor iron_helmet = get("iron_helmet"); public static final ItemArmor iron_helmet = get("iron_helmet");
public static final ItemHoe iron_hoe = get("iron_hoe");
public static final ItemHorseArmor iron_horse_armor = get("iron_horse_armor"); public static final ItemHorseArmor iron_horse_armor = get("iron_horse_armor");
public static final ItemMetal iron_ingot = get("iron_ingot"); public static final ItemMetal iron_ingot = get("iron_ingot");
public static final ItemArmor iron_leggings = get("iron_leggings"); public static final ItemArmor iron_leggings = get("iron_leggings");
@ -518,7 +514,6 @@ public abstract class Items {
public static final ItemArmor nichun_boots = get("nichun_boots"); public static final ItemArmor nichun_boots = get("nichun_boots");
public static final ItemArmor nichun_chestplate = get("nichun_chestplate"); public static final ItemArmor nichun_chestplate = get("nichun_chestplate");
public static final ItemArmor nichun_helmet = get("nichun_helmet"); public static final ItemArmor nichun_helmet = get("nichun_helmet");
public static final ItemHoe nichun_hoe = get("nichun_hoe");
public static final ItemArmor nichun_leggings = get("nichun_leggings"); public static final ItemArmor nichun_leggings = get("nichun_leggings");
public static final Item nichun_ore = get("nichun_ore"); public static final Item nichun_ore = get("nichun_ore");
public static final ItemPickaxe nichun_pickaxe = get("nichun_pickaxe"); public static final ItemPickaxe nichun_pickaxe = get("nichun_pickaxe");
@ -690,7 +685,6 @@ public abstract class Items {
public static final Item stone = get("stone"); public static final Item stone = get("stone");
public static final ItemAxe stone_axe = get("stone_axe"); public static final ItemAxe stone_axe = get("stone_axe");
public static final Item stone_button = get("stone_button"); public static final Item stone_button = get("stone_button");
public static final ItemHoe stone_hoe = get("stone_hoe");
public static final ItemPickaxe stone_pickaxe = get("stone_pickaxe"); public static final ItemPickaxe stone_pickaxe = get("stone_pickaxe");
public static final Item stone_pressure_plate = get("stone_pressure_plate"); public static final Item stone_pressure_plate = get("stone_pressure_plate");
public static final ItemShovel stone_shovel = get("stone_shovel"); public static final ItemShovel stone_shovel = get("stone_shovel");
@ -713,7 +707,6 @@ public abstract class Items {
public static final ItemArmor thetium_boots = get("thetium_boots"); public static final ItemArmor thetium_boots = get("thetium_boots");
public static final ItemArmor thetium_chestplate = get("thetium_chestplate"); public static final ItemArmor thetium_chestplate = get("thetium_chestplate");
public static final ItemArmor thetium_helmet = get("thetium_helmet"); public static final ItemArmor thetium_helmet = get("thetium_helmet");
public static final ItemHoe thetium_hoe = get("thetium_hoe");
public static final ItemArmor thetium_leggings = get("thetium_leggings"); public static final ItemArmor thetium_leggings = get("thetium_leggings");
public static final Item thetium_ore = get("thetium_ore"); public static final Item thetium_ore = get("thetium_ore");
public static final ItemPickaxe thetium_pickaxe = get("thetium_pickaxe"); public static final ItemPickaxe thetium_pickaxe = get("thetium_pickaxe");
@ -794,7 +787,6 @@ public abstract class Items {
public static final Item white_tulip = get("white_tulip"); public static final Item white_tulip = get("white_tulip");
public static final Item white_wool = get("white_wool"); public static final Item white_wool = get("white_wool");
public static final ItemAxe wood_axe = get("wood_axe"); public static final ItemAxe wood_axe = get("wood_axe");
public static final ItemHoe wood_hoe = get("wood_hoe");
public static final ItemPickaxe wood_pickaxe = get("wood_pickaxe"); public static final ItemPickaxe wood_pickaxe = get("wood_pickaxe");
public static final ItemShovel wood_shovel = get("wood_shovel"); public static final ItemShovel wood_shovel = get("wood_shovel");
public static final ItemSword wood_sword = get("wood_sword"); public static final ItemSword wood_sword = get("wood_sword");
@ -1072,6 +1064,7 @@ public abstract class Items {
public static final Item cocoa_powder = get("cocoa_powder"); public static final Item cocoa_powder = get("cocoa_powder");
public static final Item ink_sack = get("ink_sack"); public static final Item ink_sack = get("ink_sack");
public static final Item lapis_lazuli = get("lapis_lazuli"); public static final Item lapis_lazuli = get("lapis_lazuli");
public static final ItemHoe hoe = get("hoe");
private static <T extends Item> T get(String id) { private static <T extends Item> T get(String id) {
T item = (T)ItemRegistry.byName(id); T item = (T)ItemRegistry.byName(id);

View file

@ -1,19 +1,10 @@
package common.item.tool; package common.item.tool;
import common.block.Block;
import common.init.ToolMaterial; import common.init.ToolMaterial;
import common.item.ItemStack; import common.util.HarvestTool;
public class ItemAxe extends ItemTool { public class ItemAxe extends ItemTool {
public ItemAxe(ToolMaterial material) { public ItemAxe(ToolMaterial material) {
super(3, material); super(material, HarvestTool.AXE);
}
public boolean canUseOn(ItemStack stack, Block block) {
return block.canAxeHarvest();
}
public boolean canHarvestBlock(Block block) {
return block.canAxeHarvest();
} }
} }

View file

@ -3,7 +3,6 @@ package common.item.tool;
import common.block.Block; import common.block.Block;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.init.Blocks; import common.init.Blocks;
import common.init.ToolMaterial;
import common.item.CheatTab; import common.item.CheatTab;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
@ -15,22 +14,12 @@ import common.world.World;
public class ItemHoe extends Item public class ItemHoe extends Item
{ {
protected ToolMaterial theToolMaterial; public ItemHoe()
public ItemHoe(ToolMaterial material)
{ {
this.theToolMaterial = material; this.setMaxDamage(131);
this.setMaxDamage(material.getDurability());
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
if(this.theToolMaterial.isMagnetic())
this.setMagnetic();
} }
/**
* Called when a Block is right-clicked with this Item
*/
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
{ {
if (!playerIn.canPlayerEdit(pos.offset(side), side, stack)) if (!playerIn.canPlayerEdit(pos.offset(side), side, stack))
@ -80,28 +69,6 @@ public class ItemHoe extends Item
return true; return true;
} }
} }
// /**
// * Returns True is the item is renderer in full 3D when hold.
// */
// public boolean isFull3D()
// {
// return true;
// }
// /**
// * Returns the name of the material this tool is made from as it is declared in EnumToolMaterial (meaning diamond
// * would return "EMERALD")
// */
// public String getMaterialName()
// {
// return this.theToolMaterial.toString();
// }
public ToolMaterial getToolMaterial()
{
return this.theToolMaterial;
}
public WieldType getWieldType() { public WieldType getWieldType() {
return WieldType.TOOL; return WieldType.TOOL;

View file

@ -1,31 +1,10 @@
package common.item.tool; package common.item.tool;
import java.util.List;
import common.block.Block;
import common.entity.npc.EntityNPC;
import common.init.ToolMaterial; import common.init.ToolMaterial;
import common.item.ItemStack; import common.util.HarvestTool;
import common.util.Clientside;
import common.util.Color;
public class ItemPickaxe extends ItemTool { public class ItemPickaxe extends ItemTool {
public ItemPickaxe(ToolMaterial material) { public ItemPickaxe(ToolMaterial material) {
super(2, material); super(material, HarvestTool.PICKAXE);
} }
public boolean canHarvestBlock(Block block) {
return block.getMiningLevel() >= 0 && this.getToolMaterial().getHarvestLevel() >= block.getMiningLevel();
}
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);
}
} }

View file

@ -1,63 +1,10 @@
package common.item.tool; 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.init.ToolMaterial;
import common.item.CheatTab; import common.util.HarvestTool;
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 public class ItemShears extends ItemTool {
{ public ItemShears(ToolMaterial material) {
private final ToolMaterial material; super(material, HarvestTool.SHEARS);
}
public ItemShears(ToolMaterial material)
{
this.setMaxDamage(material.getDurability() - 12);
this.setTab(CheatTab.TOOLS);
this.material = material;
if(this.material.isMagnetic())
this.setMagnetic();
}
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLiving playerIn)
{
if (!blockIn.canShearsHarvest())
return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn);
stack.damage(1, playerIn);
return true;
}
public boolean canHarvestBlock(Block blockIn)
{
return blockIn.canShearsHarvest();
}
public float getStrVsBlock(ItemStack stack, Block state)
{
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());
}
public WieldType getWieldType() {
return WieldType.TOOL;
}
} }

View file

@ -1,19 +1,10 @@
package common.item.tool; package common.item.tool;
import common.block.Block;
import common.init.ToolMaterial; import common.init.ToolMaterial;
import common.item.ItemStack; import common.util.HarvestTool;
public class ItemShovel extends ItemTool { public class ItemShovel extends ItemTool {
public ItemShovel(ToolMaterial material) { public ItemShovel(ToolMaterial material) {
super(1, material); super(material, HarvestTool.SHOVEL);
}
public boolean canUseOn(ItemStack stack, Block block) {
return block.canShovelHarvest();
}
public boolean canHarvestBlock(Block block) {
return block.canShovelHarvest();
} }
} }

View file

@ -8,40 +8,46 @@ import common.entity.types.EntityLiving;
import common.init.ToolMaterial; import common.init.ToolMaterial;
import common.item.CheatTab; import common.item.CheatTab;
import common.item.Item; import common.item.Item;
import common.item.ItemAction;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.WieldType; import common.item.WieldType;
import common.util.BlockPos; import common.util.BlockPos;
import common.util.Clientside; import common.util.Clientside;
import common.util.Color; import common.util.Color;
import common.util.HarvestTool;
import common.world.World; import common.world.World;
public abstract class ItemTool extends Item { public abstract class ItemTool extends Item {
private final int damage;
private final ToolMaterial material; private final ToolMaterial material;
private final HarvestTool type;
public ItemTool(int damage, ToolMaterial material) { public ItemTool(ToolMaterial material, HarvestTool type) {
this.material = material; this.material = material;
this.type = type;
this.setMaxDamage(material.getDurability()); this.setMaxDamage(material.getDurability());
this.damage = damage + material.getDamage(); this.setTab(this.type.isMelee() ? CheatTab.WEAPONS : CheatTab.TOOLS);
this.setTab(CheatTab.TOOLS);
if(this.material.isMagnetic()) if(this.material.isMagnetic())
this.setMagnetic(); this.setMagnetic();
} }
public abstract boolean canUseOn(ItemStack stack, Block block); public boolean canHarvestBlock(Block block) {
return block.getMiningTool() == this.type && (!this.type.isLevelled() || this.getToolMaterial().getHarvestLevel() >= block.getMiningLevel());
}
public float getStrVsBlock(ItemStack stack, Block block) { public float getStrVsBlock(ItemStack stack, Block block) {
return !this.canUseOn(stack, block) ? 1.0F : (float)this.material.getEfficiency(); return block.getMiningTool() == this.type ? (float)this.material.getEfficiency() : 1.0f;
} }
@Clientside @Clientside
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip) public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
{ {
if(this.type.isLevelled())
tooltip.add(Color.VIOLET + "Level " + (this.getToolMaterial().getHarvestLevel() + 1));
tooltip.add(Color.DARK_GREEN + "+ " + (this.material.getEfficiency() - 1) + " Abbaueffizienz"); tooltip.add(Color.DARK_GREEN + "+ " + (this.material.getEfficiency() - 1) + " Abbaueffizienz");
} }
public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker) { public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker) {
stack.damage(2, attacker); stack.damage(this.type.isMelee() ? 1 : 2, attacker);
return true; return true;
} }
@ -55,19 +61,37 @@ public abstract class ItemTool extends Item {
return this.material; return this.material;
} }
public HarvestTool getToolType() {
return this.type;
}
public int getItemEnchantability() { public int getItemEnchantability() {
return this.material.getEnchantability(); return this.material.getEnchantability();
} }
public boolean getIsRepairable(ItemStack stack, ItemStack repair) { public boolean getIsRepairable(ItemStack stack, ItemStack repair) {
return this.material.isRepairItem(repair.getItem()) ? true : super.getIsRepairable(stack, repair); return this.material.isRepairItem(repair.getItem());
} }
public int getAttackDamageBonus() { public int getAttackDamageBonus() {
return this.damage; return this.type.getDamage() >= 0 ? this.material.getDamage() + this.type.getDamage() : 0;
} }
public WieldType getWieldType() { public WieldType getWieldType() {
return WieldType.TOOL; return WieldType.TOOL;
} }
public ItemAction getItemUseAction() {
return this.type.isMelee() ? ItemAction.BLOCK : super.getItemUseAction();
}
public int getMaxItemUseDuration(ItemStack stack) {
return this.type.isMelee() ? 72000 : super.getMaxItemUseDuration(stack);
}
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) {
if(this.type.isMelee())
playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
return itemStackIn;
}
} }

View file

@ -1,154 +1,11 @@
package common.item.weapon; package common.item.weapon;
import java.util.List;
import common.block.Block;
import common.entity.npc.EntityNPC;
import common.entity.types.EntityLiving;
import common.init.ToolMaterial; import common.init.ToolMaterial;
import common.item.CheatTab; import common.item.tool.ItemTool;
import common.item.Item; import common.util.HarvestTool;
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 public class ItemSword extends ItemTool {
{ public ItemSword(ToolMaterial material) {
private int attackDamage; super(material, HarvestTool.SWORD);
private final ToolMaterial material; }
public ItemSword(ToolMaterial material)
{
this.material = material;
this.setMaxDamage(material.getDurability());
this.setTab(CheatTab.WEAPONS);
this.attackDamage = 4 + material.getDamage();
if(this.material.isMagnetic())
this.setMagnetic();
}
/**
* Returns the amount of damage this item will deal. One heart of damage is equal to 2 damage points.
*/
public int getDamageVsEntity()
{
return this.material.getDamage();
}
public ToolMaterial getToolMaterial()
{
return this.material;
}
public float getStrVsBlock(ItemStack stack, Block state)
{
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");
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker)
{
stack.damage(1, attacker);
return true;
}
/**
* Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic.
*/
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLiving playerIn)
{
if ((double)blockIn.getHardness(worldIn, pos) != 0.0D)
{
stack.damage(2, playerIn);
}
return true;
}
// /**
// * Returns True is the item is renderer in full 3D when hold.
// */
// public boolean isFull3D()
// {
// return true;
// }
/**
* returns the action that specifies what animation to play when the items is being used
*/
public ItemAction getItemUseAction()
{
return ItemAction.BLOCK;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack stack)
{
return 72000;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
{
playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
return itemStackIn;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return this.material.getEnchantability();
}
// /**
// * Return the name for this tool's material.
// */
// public String getToolMaterialName()
// {
// return this.material.toString();
// }
/**
* Return whether this item is repairable in an anvil.
*/
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
{
return this.material.isRepairItem(repair.getItem()) ? true : super.getIsRepairable(toRepair, repair);
}
public int getAttackDamageBonus() {
return this.attackDamage;
}
// public boolean canBreakBlocks() {
// return false;
// }
public WieldType getWieldType() {
return WieldType.TOOL;
}
} }

View file

@ -20,9 +20,7 @@ import common.inventory.SlotFurnaceFuel;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.material.ItemBucket; import common.item.material.ItemBucket;
import common.item.tool.ItemHoe;
import common.item.tool.ItemTool; import common.item.tool.ItemTool;
import common.item.weapon.ItemSword;
import common.tags.TagObject; import common.tags.TagObject;
import java.util.List; import java.util.List;
import common.util.ExtMath; import common.util.ExtMath;
@ -362,14 +360,13 @@ public class TileEntityFurnace extends TileEntityInventory implements ITickable,
} }
return item instanceof ItemTool && ((ItemTool)item).getToolMaterial() == ToolType.WOOD.material ? 200 : return item instanceof ItemTool && ((ItemTool)item).getToolMaterial() == ToolType.WOOD.material ? 200 :
(item instanceof ItemSword && ((ItemSword)item).getToolMaterial() == ToolType.WOOD.material ? 200 : (item == Items.hoe ? 200 :
(item instanceof ItemHoe && ((ItemHoe)item).getToolMaterial() == ToolType.WOOD.material ? 200 :
(item == Items.stick ? 100 : (item == Items.stick ? 100 :
(item == Items.coal ? 1600 : (item == Items.coal ? 1600 :
(item == Items.charcoal ? 1200 : (item == Items.charcoal ? 1200 :
(item instanceof ItemBucket && ((ItemBucket)item).getLiquid() != null && (item instanceof ItemBucket && ((ItemBucket)item).getLiquid() != null &&
((ItemBucket)item).getLiquid().getMaterial() == Material.LAVA ? 20000 : ((ItemBucket)item).getLiquid().getMaterial() == Material.LAVA ? 20000 :
(item == Items.demon_rod ? 2400 : 0))))))); (item == Items.demon_rod ? 2400 : 0))))));
} }
} }

View file

@ -0,0 +1,53 @@
package common.util;
public enum HarvestTool implements Displayable {
PICKAXE("Spitzhacke", true, 2),
AXE("Axt", 3),
SHOVEL("Schaufel", 1),
SHEARS("Schere"),
SWORD("Schwert", 4, true);
private final String display;
private final boolean levelled;
private final boolean melee;
private final int damage;
private HarvestTool(String display, boolean levelled, int damage, boolean melee) {
this.display = display;
this.levelled = levelled;
this.damage = damage;
this.melee = melee;
}
private HarvestTool(String display, boolean levelled, int damage) {
this(display, levelled, damage, false);
}
private HarvestTool(String display, int damage, boolean melee) {
this(display, false, damage, melee);
}
private HarvestTool(String display, int damage) {
this(display, false, damage, false);
}
private HarvestTool(String display) {
this(display, false, -1, false);
}
public String getDisplay() {
return this.display;
}
public boolean isLevelled() {
return this.levelled;
}
public boolean isMelee() {
return this.melee;
}
public int getDamage() {
return this.damage;
}
}