fix block harvest tools

This commit is contained in:
Sen 2025-07-31 14:26:28 +02:00
parent 3bdc5fb4a0
commit 1272f87ea0
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
16 changed files with 173 additions and 119 deletions

View file

@ -598,6 +598,8 @@ public class Client implements IThreadListener {
private int crosshairColorBase = 0xffcfcfcf; private int crosshairColorBase = 0xffcfcfcf;
@Variable(name = "crosshair_color_target", type = IntType.COLOR, category = CVarCategory.GUI, display = "Fadenkreuz-Farbe (mit Ziel)") @Variable(name = "crosshair_color_target", type = IntType.COLOR, category = CVarCategory.GUI, display = "Fadenkreuz-Farbe (mit Ziel)")
private int crosshairColorTarget = 0xffffffff; private int crosshairColorTarget = 0xffffffff;
@Variable(name = "info_overlay", category = CVarCategory.GUI, display = "Informations-Overlay")
private boolean infoOverlay = true;
@Variable(name = "tic_target", category = CVarCategory.SYSTEM, min = 1.0f, max = 1200.0f, callback = TickFunction.class, display = "Tickrate") @Variable(name = "tic_target", category = CVarCategory.SYSTEM, min = 1.0f, max = 1200.0f, callback = TickFunction.class, display = "Tickrate")
private float tpsTarget = 20.0f; private float tpsTarget = 20.0f;
@ -1164,6 +1166,44 @@ public class Client implements IThreadListener {
this.player.getHorseJumpPower(), 0x4040ff); this.player.getHorseJumpPower(), 0x4040ff);
y = this.drawBar(x, y, String.format(Color.ACID + "EXP: " + Color.GREEN + "Level %d, %d/%d", this.player.experienceLevel, (int)((float)this.player.xpBarCap() * this.player.experience), this.player.xpBarCap()), this.player.experience, 0x40ff40); y = this.drawBar(x, y, String.format(Color.ACID + "EXP: " + Color.GREEN + "Level %d, %d/%d", this.player.experienceLevel, (int)((float)this.player.xpBarCap() * this.player.experience), this.player.xpBarCap()), this.player.experience, 0x40ff40);
} }
if(this.infoOverlay && this.world != null && this.open == null && this.player != null && this.viewEntity == this.player) {
String desc = null;
String line1 = null;
String line2 = null;
if(this.pointed != null && this.pointed.type == ObjectType.BLOCK && this.pointed.block != null) {
State state = this.world.getState(this.pointed.block);
Block block = state.getBlock();
if(block != Blocks.air) {
desc = block.getDisplay();
if(block.getMiningLevel() >= 0)
line2 = "Werkzeug: Spitzhacke 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) {
Entity entity = this.pointed.entity;
desc = entity.getName();
if(entity instanceof EntityLiving living) {
line1 = living.formatStats();
}
}
if(desc != null) {
Drawing.drawRectBorder(this.fbX / 2 - 180, 20, 360, 60, 0xff6f6f6f, 0xff000000, 0xffafafaf, 0xff4f4f4f);
Drawing.drawTextCentered(desc, this.fbX / 2, 24, 0xffffffff);
if(line1 != null)
Drawing.drawTextCentered(line1, this.fbX / 2, 80 - 4 - Font.YGLYPH * 2, 0xffffffff);
if(line2 != null)
Drawing.drawTextCentered(line2, this.fbX / 2, 80 - 4 - Font.YGLYPH, 0xffffffff);
}
}
GlState.bindTexture(0); GlState.bindTexture(0);
GlState.setActiveTexture(GL13.GL_TEXTURE0); GlState.setActiveTexture(GL13.GL_TEXTURE0);
@ -1186,18 +1226,19 @@ public class Client implements IThreadListener {
} }
} }
if(this.pointed != null && this.pointed.block != null) { if(this.infoOverlay) {
State state = this.world.getState(this.pointed.block); Item item = null;
if(state.getBlock() != Blocks.air) { if(this.pointed != null && this.pointed.type == ObjectType.BLOCK && this.pointed.block != null)
Item item = state.getBlock().getItem(); item = this.world.getState(this.pointed.block).getBlock().getItem();
if(item != null) { else if(this.pointed != null && this.pointed.type == ObjectType.ENTITY && this.pointed.entity != null)
GL11.glPopMatrix(); item = this.pointed.entity.getItem();
GL11.glPushMatrix(); if(item != null) {
GL11.glTranslatef((float)(this.fbX / 2 - 180 + 4 + 1), (float)(40 + 1), 0.0f); GL11.glPopMatrix();
GL11.glScalef(2.0f, 2.0f, 2.0f); GL11.glPushMatrix();
GlState.enableDepth(); GL11.glTranslatef((float)(this.fbX / 2 - 180 + 4 + 1), (float)(40 + 1), 0.0f);
this.renderItem.renderItemAndEffectIntoGUI(new ItemStack(item), 0, 0); GL11.glScalef(2.0f, 2.0f, 2.0f);
} GlState.enableDepth();
this.renderItem.renderItemAndEffectIntoGUI(new ItemStack(item), 0, 0);
} }
} }
@ -1546,34 +1587,12 @@ public class Client implements IThreadListener {
} }
Item item = null; Item item = null;
if (this.pointed.type == HitPosition.ObjectType.BLOCK) if (this.pointed.type == HitPosition.ObjectType.BLOCK)
{ item = this.world.getState(this.pointed.block).getBlock().getItem();
BlockPos blockpos = this.pointed.block; else if (this.pointed.type == HitPosition.ObjectType.ENTITY && this.pointed.entity != null && this.itemCheat)
Block block = this.world.getState(blockpos).getBlock();
if (block == Blocks.air)
{
return;
}
item = block.getItem();
if (item == null)
{
return;
}
}
else
{
if (this.pointed.type != HitPosition.ObjectType.ENTITY || this.pointed.entity == null || !this.itemCheat)
{
return;
}
item = this.pointed.entity.getItem(); item = this.pointed.entity.getItem();
if(item == null) if(item == null)
return; return;
}
InventoryPlayer inventoryplayer = this.player.inventory; InventoryPlayer inventoryplayer = this.player.inventory;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 4.7 KiB

Before After
Before After

View file

@ -176,11 +176,12 @@ public class Block {
private boolean sumBrightness; private boolean sumBrightness;
private boolean axeHarvest; private boolean axeHarvest;
private boolean shovelHarvest; 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;
private int miningLevel; private int miningLevel;
private int shearsEfficiency;
private int encouragement; private int encouragement;
private int flammability; private int flammability;
private float hardness; private float hardness;
@ -363,7 +364,9 @@ public class Block {
public Block(Material material) { public Block(Material material) {
this.miningLevel = (material == Material.SOLID || material == Material.HEAVY) ? 0 : -1; 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.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.sound = SoundType.STONE;
this.slipperiness = 0.6F; this.slipperiness = 0.6F;
this.material = material; this.material = material;
@ -442,8 +445,13 @@ public class Block {
return this; return this;
} }
public final Block setShearsEfficiency(int efficiency) { public final Block setShearsHarvestable() {
this.shearsEfficiency = efficiency; this.shearsHarvest = true;
return this;
}
public final Block setSwordHarvestable() {
this.swordHarvest = true;
return this; return this;
} }
@ -593,8 +601,12 @@ public class Block {
return this.shovelHarvest; return this.shovelHarvest;
} }
public final int getShearsEfficiency() { public final boolean canShearsHarvest() {
return this.shearsEfficiency; return this.shearsHarvest;
}
public final boolean canSwordHarvest() {
return this.swordHarvest;
} }
public final float getRadiation() { public final float getRadiation() {

View file

@ -2415,7 +2415,7 @@ public abstract class Entity
public final String getColoredName(Color reset) 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) { // public Text formatComponent(Text comp) {

View file

@ -351,7 +351,7 @@ public abstract class BlockRegistry {
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()).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")); 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").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").setShearsEfficiency(0)); 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")); 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()) { 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")
.setShearsEfficiency(1)); .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));
@ -672,7 +672,7 @@ public abstract class BlockRegistry {
.setDisplay("Lampe").setTab(CheatTab.TECHNOLOGY)); .setDisplay("Lampe").setTab(CheatTab.TECHNOLOGY));
register("lit_lamp", (new BlockToggleableLight(true)).setHardness(0.3F).setSound(SoundType.GLASS).setDisplay("Lampe")); register("lit_lamp", (new BlockToggleableLight(true)).setHardness(0.3F).setSound(SoundType.GLASS).setDisplay("Lampe"));
register("tripwire_hook", (new BlockTripWireHook()).setDisplay("Haken")); 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")); register("iron_door", (new BlockDoor(Material.SOLID)).setHardness(5.0F).setSound(SoundType.STONE).setDisplay("Eisentür"));
for(WoodType wood : WoodType.values()) { for(WoodType wood : WoodType.values()) {

View file

@ -3,7 +3,7 @@ package common.init;
import common.util.Color; import common.util.Color;
public enum MetalType { 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), COPPER("copper", 29, "Cu", "Kupfer", 0),
TIN("tin", 50, "Sn", "Zinn", 0), TIN("tin", 50, "Sn", "Zinn", 0),
@ -30,7 +30,7 @@ public enum MetalType {
VANADIUM("vanadium", 23, "V", "Vanadium", 4), VANADIUM("vanadium", 23, "V", "Vanadium", 4),
CHROME("chrome", 24, "Cr", "Chrom", 4), CHROME("chrome", 24, "Cr", "Chrom", 4),
PLATINUM("platinum", 78, "Pt", "Platin", 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), MANGANESE("manganese", 25, "Mn", "Mangan", 5),
COBALT("cobalt", 27, "Co", "Cobalt", 5), COBALT("cobalt", 27, "Co", "Cobalt", 5),

View file

@ -1,11 +1,11 @@
package common.init; package common.init;
public enum OreType { 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), 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.0F, 7, 12, false, 59, 12, 4, 9, 7, 4), "thi_fragment", 5, 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, 11, 12, 86, 12, 6, 12, 9, 5), "ahrd_fragment", 7, 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.0F, 11, 12, false), "ghi_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.0F, 18, 15, false, 172, 15, 12, 23, 14, 11), "nieh_fragment", 10, 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), RUBY("ruby", "Rubin", new ToolMaterial(3), "ruby", 3, 1, 0),
CINNABAR("cinnabar", "Zinnober", new ToolMaterial(2), "cinnabar", 2, 1, 1); CINNABAR("cinnabar", "Zinnober", new ToolMaterial(2), "cinnabar", 2, 1, 1);

View file

@ -13,7 +13,7 @@ public class ToolMaterial {
private final int harvestLevel; private final int harvestLevel;
private final int durability; private final int durability;
private final float efficiency; private final int efficiency;
private final int damage; private final int damage;
private final float radiationResistance; private final float radiationResistance;
private final float magicResistance; private final float magicResistance;
@ -29,7 +29,7 @@ public class ToolMaterial {
private boolean magnetic; private boolean magnetic;
private int defColor = 0xffffffff; 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) { boolean extras, int auses, int aench, int r1, int r2, int r3, int r4) {
this.harvestLevel = level; this.harvestLevel = level;
this.durability = uses; this.durability = uses;
@ -47,22 +47,22 @@ public class ToolMaterial {
} }
protected ToolMaterial(int level) { 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); 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) { 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, 0.0F, damage, ench, false, true, false, auses, aench, r1, r2, r3, 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) { 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) { 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); 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; return this.durability;
} }
public float getEfficiency() { public int getEfficiency() {
return this.efficiency; return this.efficiency;
} }

View file

@ -1,8 +1,8 @@
package common.init; package common.init;
public enum ToolType { public enum ToolType {
WOOD("wood", "Holz", new ToolMaterial(0, 59, 2.0F, 0, 15, true), WoodType.getNames("planks")), WOOD("wood", "Holz", new ToolMaterial(0, 59, 2, 0, 15, true), WoodType.getNames("planks")),
STONE("stone", "Stein", new ToolMaterial(1, 131, 4.0F, 1, 5, true), "cobblestone"), 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"), 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"), 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"); CLOTH("cloth", null, new ToolMaterial(0, 0.0f, 0.0f, 10, 0, 0, 0, 0, 0).setDyeable(0xffffff), "string");

View file

@ -12,4 +12,8 @@ public class ItemAxe extends ItemTool {
public boolean canUseOn(ItemStack stack, Block block) { public boolean canUseOn(ItemStack stack, Block block) {
return block.canAxeHarvest(); return block.canAxeHarvest();
} }
public boolean canHarvestBlock(Block block) {
return block.canAxeHarvest();
}
} }

View file

@ -1,8 +1,13 @@
package common.item.tool; package common.item.tool;
import java.util.List;
import common.block.Block; import common.block.Block;
import common.entity.npc.EntityNPC;
import common.init.ToolMaterial; import common.init.ToolMaterial;
import common.item.ItemStack; import common.item.ItemStack;
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) {
@ -16,4 +21,11 @@ public class ItemPickaxe extends ItemTool {
public boolean canUseOn(ItemStack stack, Block block) { public boolean canUseOn(ItemStack stack, Block block) {
return block.getMiningLevel() >= 0; 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,16 +1,18 @@
package common.item.tool; package common.item.tool;
import java.util.List;
import common.block.Block; import common.block.Block;
import common.block.Material; import common.entity.npc.EntityNPC;
import common.block.tech.BlockWire;
import common.entity.types.EntityLiving; import common.entity.types.EntityLiving;
import common.init.Blocks;
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.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.Color;
import common.world.World; import common.world.World;
public class ItemShears extends Item 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) 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); return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn);
} stack.damage(1, playerIn);
else return true;
{
stack.damage(1, playerIn);
return true;
}
} }
public boolean canHarvestBlock(Block blockIn) 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) public float getStrVsBlock(ItemStack stack, Block state)
{ {
return state.getShearsEfficiency() <= 0 ? 1.0F : (((float)state.getShearsEfficiency()) * (this.material.getEfficiency() - 1.0F)); return !state.canShearsHarvest() ? 1.0F : (float)this.material.getEfficiency();
// state != Blocks.web && state.getMaterial() != Material.leaves ? (state == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, state)) : 15.0F; }
@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) 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() { public WieldType getWieldType() {

View file

@ -1,7 +1,6 @@
package common.item.tool; package common.item.tool;
import common.block.Block; import common.block.Block;
import common.block.Material;
import common.init.ToolMaterial; import common.init.ToolMaterial;
import common.item.ItemStack; import common.item.ItemStack;
@ -15,6 +14,6 @@ public class ItemShovel extends ItemTool {
} }
public boolean canHarvestBlock(Block block) { public boolean canHarvestBlock(Block block) {
return block.getMaterial() == Material.POWDER || block.getMaterial() == Material.DIGGABLE; return block.canShovelHarvest();
} }
} }

View file

@ -1,6 +1,9 @@
package common.item.tool; package common.item.tool;
import java.util.List;
import common.block.Block; import common.block.Block;
import common.entity.npc.EntityNPC;
import common.entity.types.EntityLiving; import common.entity.types.EntityLiving;
import common.init.ToolMaterial; import common.init.ToolMaterial;
import common.item.CheatTab; import common.item.CheatTab;
@ -8,17 +11,17 @@ import common.item.Item;
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.Color;
import common.world.World; import common.world.World;
public abstract class ItemTool extends Item { public abstract class ItemTool extends Item {
private final float efficiency;
private final int damage; private final int damage;
private final ToolMaterial material; private final ToolMaterial material;
public ItemTool(int damage, ToolMaterial material) { public ItemTool(int damage, ToolMaterial material) {
this.material = material; this.material = material;
this.setMaxDamage(material.getDurability()); this.setMaxDamage(material.getDurability());
this.efficiency = material.getEfficiency();
this.damage = damage + material.getDamage(); this.damage = damage + material.getDamage();
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
if(this.material.isMagnetic()) if(this.material.isMagnetic())
@ -28,9 +31,15 @@ public abstract class ItemTool extends Item {
public abstract boolean canUseOn(ItemStack stack, Block block); public abstract boolean canUseOn(ItemStack stack, Block block);
public float getStrVsBlock(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) { public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker) {
stack.damage(2, attacker); stack.damage(2, attacker);
return true; return true;

View file

@ -1,10 +1,10 @@
package common.item.weapon; package common.item.weapon;
import java.util.List;
import common.block.Block; import common.block.Block;
import common.block.Material;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.entity.types.EntityLiving; import common.entity.types.EntityLiving;
import common.init.Blocks;
import common.init.ToolMaterial; import common.init.ToolMaterial;
import common.item.CheatTab; import common.item.CheatTab;
import common.item.Item; import common.item.Item;
@ -12,6 +12,8 @@ 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.Color;
import common.world.World; import common.world.World;
public class ItemSword extends Item public class ItemSword extends Item
@ -44,15 +46,18 @@ public class ItemSword extends Item
public float getStrVsBlock(ItemStack stack, Block state) public float getStrVsBlock(ItemStack stack, Block state)
{ {
if (state == Blocks.web) return state.canSwordHarvest() ? (float)this.material.getEfficiency() : 1.0f;
{ }
return 15.0F;
} public boolean canHarvestBlock(Block blockIn)
else {
{ return blockIn.canSwordHarvest();
Material material = state.getMaterial(); }
return material != Material.PLANT && material != Material.BUSH && material != Material.LEAVES && material != Material.SOFT ? 1.0F : 1.5F;
} @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; 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. * Return the enchantability factor of the item, most of the time is based on material.
*/ */

View file

@ -82,8 +82,8 @@ public class ReplacerMesa extends ReplacerBiome
int bx = x & 15; int bx = x & 15;
int by = z & 15; int by = z & 15;
State surface = Blocks.white_clay.getState(); State surface = Blocks.beige_clay.getState();
State top = Blocks.white_clay.getState(); State top = Blocks.beige_clay.getState();
int rng = (int)(noise / 3.0D + 3.0D + rand.doublev() * 0.25D); int rng = (int)(noise / 3.0D + 3.0D + rand.doublev() * 0.25D);
boolean hard = Math.cos(noise / 3.0D * Math.PI) > 0.0D; boolean hard = Math.cos(noise / 3.0D * Math.PI) > 0.0D;
int sel = -1; int sel = -1;
@ -115,8 +115,8 @@ public class ReplacerMesa extends ReplacerBiome
} }
else if (i1 >= this.seaLevel - 4 && i1 <= this.seaLevel + 1) else if (i1 >= this.seaLevel - 4 && i1 <= this.seaLevel + 1)
{ {
surface = Blocks.white_clay.getState(); surface = Blocks.beige_clay.getState();
top = Blocks.white_clay.getState(); top = Blocks.beige_clay.getState();
} }
if (i1 < this.seaLevel && (surface == null || surface.getBlock() == Blocks.air)) if (i1 < this.seaLevel && (surface == null || surface.getBlock() == Blocks.air))
@ -132,7 +132,7 @@ public class ReplacerMesa extends ReplacerBiome
if (top.getBlock() instanceof BlockColoredClay) if (top.getBlock() instanceof BlockColoredClay)
{ {
primer.set(by, i1, bx, Blocks.orange_clay.getState()); primer.set(by, i1, bx, Blocks.light_brown_clay.getState());
} }
} }
else if (soil && i1 > 86 + rng * 2) else if (soil && i1 > 86 + rng * 2)
@ -168,7 +168,7 @@ public class ReplacerMesa extends ReplacerBiome
} }
else else
{ {
iblockstate4 = Blocks.orange_clay.getState(); iblockstate4 = Blocks.light_brown_clay.getState();
} }
primer.set(by, i1, bx, iblockstate4); primer.set(by, i1, bx, iblockstate4);
@ -180,7 +180,7 @@ public class ReplacerMesa extends ReplacerBiome
if (base) if (base)
{ {
primer.set(by, i1, bx, Blocks.orange_clay.getState()); primer.set(by, i1, bx, Blocks.light_brown_clay.getState());
} }
else else
{ {
@ -200,7 +200,7 @@ public class ReplacerMesa extends ReplacerBiome
if (l1 < 64) if (l1 < 64)
{ {
this.layers[l1] = Blocks.orange_clay.getState(); this.layers[l1] = Blocks.light_brown_clay.getState();
} }
} }
@ -213,7 +213,7 @@ public class ReplacerMesa extends ReplacerBiome
for (int l = 0; k + l < 64 && l < j; ++l) for (int l = 0; k + l < 64 && l < j; ++l)
{ {
this.layers[k + l] = Blocks.yellow_clay.getState(); this.layers[k + l] = Blocks.white_clay.getState();
} }
} }
@ -226,7 +226,7 @@ public class ReplacerMesa extends ReplacerBiome
for (int i1 = 0; l3 + i1 < 64 && i1 < i3; ++i1) for (int i1 = 0; l3 + i1 < 64 && i1 < i3; ++i1)
{ {
this.layers[l3 + i1] = Blocks.brown_clay.getState(); this.layers[l3 + i1] = Blocks.dark_brown_clay.getState();
} }
} }
@ -239,7 +239,7 @@ public class ReplacerMesa extends ReplacerBiome
for (int j1 = 0; k4 + j1 < 64 && j1 < i4; ++j1) for (int j1 = 0; k4 + j1 < 64 && j1 < i4; ++j1)
{ {
this.layers[k4 + j1] = Blocks.red_clay.getState(); this.layers[k4 + j1] = Blocks.dark_red_clay.getState();
} }
} }
@ -253,7 +253,7 @@ public class ReplacerMesa extends ReplacerBiome
for (int k1 = 0; j4 + k1 < 64 && k1 < i5; ++k1) for (int k1 = 0; j4 + k1 < 64 && k1 < i5; ++k1)
{ {
this.layers[j4 + k1] = Blocks.white_clay.getState(); this.layers[j4 + k1] = Blocks.beige_clay.getState();
if (j4 + k1 > 1 && random.chance()) if (j4 + k1 > 1 && random.chance())
{ {