1
0
Fork 0

add basic inventory mode switch (tab)

This commit is contained in:
Sen 2025-09-05 18:50:20 +02:00
parent 9f452b410e
commit 83dca68f11
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
46 changed files with 198 additions and 22 deletions

View file

@ -468,6 +468,7 @@ public class Client implements IThreadListener {
private boolean saving; private boolean saving;
private boolean drawFps; private boolean drawFps;
private boolean drawDebug; private boolean drawDebug;
private boolean placeMode;
public boolean jump; public boolean jump;
public boolean sneak; public boolean sneak;
public boolean debugCamEnable; public boolean debugCamEnable;
@ -961,6 +962,11 @@ public class Client implements IThreadListener {
this.renderer.setDisplayListEntitiesDirty(); this.renderer.setDisplayListEntitiesDirty();
} }
if (Bind.ITEMMODE.isPressed() && this.viewEntity == this.player)
{
this.placeMode ^= true;
}
boolean hadZoom = this.zooming; boolean hadZoom = this.zooming;
this.zooming = Bind.ZOOM.isDown() || this.viewEntity != this.player; this.zooming = Bind.ZOOM.isDown() || this.viewEntity != this.player;
@ -1096,7 +1102,7 @@ public class Client implements IThreadListener {
this.displayTick(ExtMath.floord(this.player.posX), ExtMath.floord(this.player.posY), ExtMath.floord(this.player.posZ)); this.displayTick(ExtMath.floord(this.player.posX), ExtMath.floord(this.player.posY), ExtMath.floord(this.player.posZ));
} }
this.effectRenderer.update(); this.effectRenderer.update();
if(this.player != null && this.player.getHeldItem() == null) if(this.player != null && (this.player.getHeldItem() == null || !this.player.getHeldItem().getItem().canBeHeld() || (this.player.getHeldItem().getItem().getBlock() != null) != this.placeMode))
this.select(1); this.select(1);
} }
else if (this.connection != null) else if (this.connection != null)
@ -1166,7 +1172,7 @@ public class Client implements IThreadListener {
if(this.world != null && this.player != null && this.viewEntity == this.player) { if(this.world != null && this.player != null && this.viewEntity == this.player) {
total = 0; total = 0;
for(int z = 0; z < this.player.getHotbarSize(); z++) { for(int z = 0; z < this.player.getHotbarSize(); z++) {
if(this.player.getStackInSlot(z) != null) if(this.player.getStackInSlot(z) != null && this.player.getStackInSlot(z).getItem().canBeHeld() && (this.player.getStackInSlot(z).getItem().getBlock() != null) == this.placeMode)
++total; ++total;
} }
if(total == 0) if(total == 0)
@ -1198,7 +1204,7 @@ public class Client implements IThreadListener {
int x = xoff * scale; int x = xoff * scale;
for(int n = 0; n < size; n++) { for(int n = 0; n < size; n++) {
if(this.player.getStackInSlot(n) == null) if(this.player.getStackInSlot(n) == null || !this.player.getStackInSlot(n).getItem().canBeHeld() || (this.player.getStackInSlot(n).getItem().getBlock() != null) != this.placeMode)
continue; continue;
if(selected == n) if(selected == n)
Drawing.drawRect(x - scale * 2, by - scale * 2, 20 * scale, 20 * scale, 0xffffffff); Drawing.drawRect(x - scale * 2, by - scale * 2, 20 * scale, 20 * scale, 0xffffffff);
@ -1364,7 +1370,7 @@ public class Client implements IThreadListener {
int cnt = 0; int cnt = 0;
for(int index = 0; index < size; ++index) { for(int index = 0; index < size; ++index) {
ItemStack itemstack = this.player.getStackInSlot(index); ItemStack itemstack = this.player.getStackInSlot(index);
if(itemstack != null) { if(itemstack != null && itemstack.getItem().canBeHeld() && (itemstack.getItem().getBlock() != null) == this.placeMode) {
if(width < 20 && selected != index && selected != index + 1 && cnt != total - 1) { if(width < 20 && selected != index && selected != index + 1 && cnt != total - 1) {
this.scissor(xPos * scale, this.fbY - (by + 16 * scale), (width - 1) * scale, 16 * scale); this.scissor(xPos * scale, this.fbY - (by + 16 * scale), (width - 1) * scale, 16 * scale);
GL15.glEnable(GL15.GL_SCISSOR_TEST); GL15.glEnable(GL15.GL_SCISSOR_TEST);
@ -1408,12 +1414,13 @@ public class Client implements IThreadListener {
int xPos = xoff * scale; int xPos = xoff * scale;
for(int index = 0; index < size; ++index) { for(int index = 0; index < size; ++index) {
ItemStack itemstack = this.player.getStackInSlot(index); ItemStack itemstack = this.player.getStackInSlot(index);
if(itemstack != null && (width >= 17 || index == selected)) { if(itemstack != null && itemstack.getItem().canBeHeld() && (itemstack.getItem().getBlock() != null) == this.placeMode) {
GuiContainer.renderItemOverlay(itemstack, if(width >= 17 || index == selected) {
xPos, by, null, index == this.player.getSelectedIndex() ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax(), scale); GuiContainer.renderItemOverlay(itemstack,
} xPos, by, null, index == this.player.getSelectedIndex() ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax(), scale);
if(itemstack != null) }
xPos += (width >= 20 || selected == index || selected == index + 1 ? 20 : width) * scale; xPos += (width >= 20 || selected == index || selected == index + 1 ? 20 : width) * scale;
}
} }
} }
if(this.open != null) if(this.open != null)
@ -1543,7 +1550,7 @@ public class Client implements IThreadListener {
this.player.setSelectedIndex(0); this.player.setSelectedIndex(0);
++n; ++n;
} }
while(this.player.getHeldItem() == null && n < this.player.getHotbarSize()); while((this.player.getHeldItem() == null || !this.player.getHeldItem().getItem().canBeHeld() || (this.player.getHeldItem().getItem().getBlock() != null) != this.placeMode) && n < this.player.getHotbarSize());
this.controller.resetUseCooldown(); this.controller.resetUseCooldown();
} }

View file

@ -179,10 +179,12 @@ public abstract class GuiContainer extends Gui
if(stack.getRepairCost() > 0) if(stack.getRepairCost() > 0)
list.add("Reparaturkosten: " + stack.getRepairCost() + " Mana"); list.add("Reparaturkosten: " + stack.getRepairCost() + " Mana");
if(stack.getItem().getMaxAmount() == 1) list.add(stack.getItem().getMaxAmount() == 1 ? "Nicht stapelbar" : "Stapelbar");
list.add("Nicht stapelbar");
else list.add("Gewicht: " + (stack.getSize() != 1 ? stack.getSize() * stack.getItem().getWeight() + "(" + stack.getSize() + "x " + stack.getItem().getWeight() + ")" : stack.getItem().getWeight()));
list.add("Stapelbar bis " + stack.getItem().getMaxAmount());
if(stack.getItem().canBeHeld())
list.add("Kann gehalten werden");
list.add(Color.GRAY + ItemRegistry.getName(stack.getItem())); list.add(Color.GRAY + ItemRegistry.getName(stack.getItem()));

View file

@ -17,6 +17,7 @@ public enum Bind implements Identifyable, CVar {
DOWN(BindCategory.MOVEMENT, "down", "Abwärts, Langsam", Keysym.LEFT_CONTROL), DOWN(BindCategory.MOVEMENT, "down", "Abwärts, Langsam", Keysym.LEFT_CONTROL),
FAST(BindCategory.MOVEMENT, "fast", "Schneller", Keysym.LEFT_SHIFT), FAST(BindCategory.MOVEMENT, "fast", "Schneller", Keysym.LEFT_SHIFT),
INVENTORY(BindCategory.INTERACTION, "inventory", "Inventar", Keysym.E), INVENTORY(BindCategory.INTERACTION, "inventory", "Inventar", Keysym.E),
ITEMMODE(BindCategory.INTERACTION, "itemmode", "Platziermodus", Keysym.TAB),
PRIMARY(BindCategory.INTERACTION, "primary", "Primäre Aktion", Button.MOUSE_LEFT), PRIMARY(BindCategory.INTERACTION, "primary", "Primäre Aktion", Button.MOUSE_LEFT),
SECONDARY(BindCategory.INTERACTION, "secondary", "Sekundäre Aktion", Button.MOUSE_RIGHT), SECONDARY(BindCategory.INTERACTION, "secondary", "Sekundäre Aktion", Button.MOUSE_RIGHT),
TERTIARY(BindCategory.INTERACTION, "tertiary", "Tertiäre Aktion", Button.MOUSE_MIDDLE), TERTIARY(BindCategory.INTERACTION, "tertiary", "Tertiäre Aktion", Button.MOUSE_MIDDLE),
@ -42,7 +43,7 @@ public enum Bind implements Identifyable, CVar {
RENAME(BindCategory.INTERACTION, "rename", "Umbenennen", Keysym.N), RENAME(BindCategory.INTERACTION, "rename", "Umbenennen", Keysym.N),
CONSOLE(BindCategory.GENERAL, "console", "Konsole", Keysym.F1), CONSOLE(BindCategory.GENERAL, "console", "Konsole", Keysym.F1),
COMMAND(BindCategory.GENERAL, "command", "Befehl / Chat", Keysym.C), COMMAND(BindCategory.GENERAL, "command", "Befehl / Chat", Keysym.C),
INFO(BindCategory.GENERAL, "info", "Infos einblenden", Keysym.TAB), INFO(BindCategory.GENERAL, "info", "Infos einblenden", Keysym.CIRCUMFLEX),
PERSPECTIVE(BindCategory.GENERAL, "perspective", "Perspektive", Keysym.F4), PERSPECTIVE(BindCategory.GENERAL, "perspective", "Perspektive", Keysym.F4),
ZOOM(BindCategory.GENERAL, "zoom", "Kamera zoomen", Keysym.Y), ZOOM(BindCategory.GENERAL, "zoom", "Kamera zoomen", Keysym.Y),
MENU(BindCategory.GENERAL, "menu", "Menü", Keysym.ESCAPE), MENU(BindCategory.GENERAL, "menu", "Menü", Keysym.ESCAPE),

View file

@ -47,7 +47,7 @@ public class BlockNuke extends Block
public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) {
if(playerIn.getHeldItem() != null) { if(playerIn.getHeldItem() != null) {
Item item = playerIn.getHeldItem().getItem(); Item item = playerIn.getHeldItem().getItem();
if(item == Items.charged_powder) { if(item == Items.fireball) {
this.explode(worldIn, pos, playerIn); this.explode(worldIn, pos, playerIn);
worldIn.setBlockToAir(pos); worldIn.setBlockToAir(pos);
playerIn.getHeldItem().decrSize(); playerIn.getHeldItem().decrSize();

View file

@ -28,7 +28,7 @@ public class EntityMouse extends EntityAnimal {
this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(1, new EntityAIPanic(this, 1.4D)); this.tasks.addTask(1, new EntityAIPanic(this, 1.4D));
this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.sugar, false)); this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.cheese, false));
this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D)); this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D));
this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
this.tasks.addTask(6, new EntityAIWatchClosest(this, null, 6.0F)); this.tasks.addTask(6, new EntityAIWatchClosest(this, null, 6.0F));
@ -85,7 +85,7 @@ public class EntityMouse extends EntityAnimal {
} }
public boolean isBreedingItem(ItemStack stack) { public boolean isBreedingItem(ItemStack stack) {
return stack != null && stack.getItem() == Items.sugar; return stack != null && stack.getItem() == Items.cheese;
} }
protected int getExperiencePoints(EntityNPC player) { protected int getExperiencePoints(EntityNPC player) {

View file

@ -36,6 +36,7 @@ import common.item.material.ItemBucket;
import common.item.material.ItemDye; import common.item.material.ItemDye;
import common.item.material.ItemEnchantedBook; import common.item.material.ItemEnchantedBook;
import common.item.material.ItemGrindedBones; import common.item.material.ItemGrindedBones;
import common.item.material.ItemLure;
import common.item.material.ItemAnimalArmor; import common.item.material.ItemAnimalArmor;
import common.item.material.ItemMetal; import common.item.material.ItemMetal;
import common.item.material.ItemRecord; import common.item.material.ItemRecord;
@ -212,7 +213,7 @@ public abstract class ItemRegistry {
register("stick", (new Item()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setWeight(ItemWeight.XS).setFuelAmount(100)); register("stick", (new Item()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setWeight(ItemWeight.XS).setFuelAmount(100));
register("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.MATERIALS).setWeight(ItemWeight.XXS)); register("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.MATERIALS).setWeight(ItemWeight.XXS));
register("gunpowder", (new Item()).setDisplay("Schwarzpulver").setTab(CheatTab.MATERIALS).setWeight(ItemWeight.XS).setExplosive(1)); register("gunpowder", (new Item()).setDisplay("Schwarzpulver").setTab(CheatTab.MATERIALS).setWeight(ItemWeight.XS).setExplosive(1));
register("wheat", (new Item()).setDisplay("Weizen").setTab(CheatTab.MATERIALS).setWeight(ItemWeight.S)); register("wheat", (new ItemLure()).setDisplay("Weizen").setTab(CheatTab.MATERIALS).setWeight(ItemWeight.S));
register("bread", (new ItemFood(5, false)).setDisplay("Brot")); register("bread", (new ItemFood(5, false)).setDisplay("Brot"));
register("flint", (new Item()).setDisplay("Feuerstein").setTab(CheatTab.MATERIALS).setWeight(ItemWeight.S)); register("flint", (new Item()).setDisplay("Feuerstein").setTab(CheatTab.MATERIALS).setWeight(ItemWeight.S));
register("porkchop", (new ItemFood(3, true)).setDisplay("Rohes Schweinefleisch")); register("porkchop", (new ItemFood(3, true)).setDisplay("Rohes Schweinefleisch"));
@ -242,7 +243,7 @@ public abstract class ItemRegistry {
for(Color color : Color.values()) { for(Color color : Color.values()) {
register(color.getName() + "_dye", new ItemDye(color)); register(color.getName() + "_dye", new ItemDye(color));
} }
register("bone", (new Item()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setWeight(ItemWeight.S)); register("bone", (new ItemLure()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setWeight(ItemWeight.S));
register("sugar", (new Item()).setDisplay("Zucker").setTab(CheatTab.MATERIALS).setWeight(ItemWeight.XXS)); register("sugar", (new Item()).setDisplay("Zucker").setTab(CheatTab.MATERIALS).setWeight(ItemWeight.XXS));
register("cookie", (new ItemFood(2, false)).setDisplay("Keks").setWeight(ItemWeight.S)); register("cookie", (new ItemFood(2, false)).setDisplay("Keks").setWeight(ItemWeight.S));
register("melon", (new ItemFood(2, false)).setDisplay("Melone")); register("melon", (new ItemFood(2, false)).setDisplay("Melone"));

View file

@ -24,6 +24,7 @@ import common.item.material.ItemBucket;
import common.item.material.ItemDye; import common.item.material.ItemDye;
import common.item.material.ItemEnchantedBook; import common.item.material.ItemEnchantedBook;
import common.item.material.ItemGrindedBones; import common.item.material.ItemGrindedBones;
import common.item.material.ItemLure;
import common.item.material.ItemAnimalArmor; import common.item.material.ItemAnimalArmor;
import common.item.material.ItemMetal; import common.item.material.ItemMetal;
import common.item.material.ItemRecord; import common.item.material.ItemRecord;
@ -183,7 +184,7 @@ public abstract class Items {
public static final ItemBoat boat = get("boat"); public static final ItemBoat boat = get("boat");
public static final ItemAmmo bolt = get("bolt"); public static final ItemAmmo bolt = get("bolt");
public static final ItemBoltgun boltgun = get("boltgun"); public static final ItemBoltgun boltgun = get("boltgun");
public static final Item bone = get("bone"); public static final ItemLure bone = get("bone");
public static final ItemBook book = get("book"); public static final ItemBook book = get("book");
public static final Item bookshelf = get("bookshelf"); public static final Item bookshelf = get("bookshelf");
public static final ItemBow bow = get("bow"); public static final ItemBow bow = get("bow");
@ -770,7 +771,7 @@ public abstract class Items {
public static final ItemWeatherToken weather_token_thunder = get("weather_token_thunder"); public static final ItemWeatherToken weather_token_thunder = get("weather_token_thunder");
public static final Item web = get("web"); public static final Item web = get("web");
public static final ItemSeeds wheat_seed = get("wheat_seed"); public static final ItemSeeds wheat_seed = get("wheat_seed");
public static final Item wheat = get("wheat"); public static final ItemLure wheat = get("wheat");
public static final Item white_bed = get("white_bed"); public static final Item white_bed = get("white_bed");
public static final Item white_carpet = get("white_carpet"); public static final Item white_carpet = get("white_carpet");
public static final Item white_clay = get("white_clay"); public static final Item white_clay = get("white_clay");

View file

@ -131,6 +131,10 @@ public class Item {
return this.block; return this.block;
} }
public final int getWeight() {
return this.weight;
}
public final int getMaxAmount() { public final int getMaxAmount() {
return this.stackable ? 67108864 : 1; return this.stackable ? 67108864 : 1;
} }
@ -281,6 +285,10 @@ public class Item {
return this.block != null ? this.block.getRadiation() * (float)stack.getSize() : 0.0f; return this.block != null ? this.block.getRadiation() * (float)stack.getSize() : 0.0f;
} }
public boolean canBeHeld() {
return this.block != null;
}
public WieldType getWieldType() { public WieldType getWieldType() {
return null; return null;
} }

View file

@ -28,6 +28,10 @@ public class ItemFood extends Item
this.setTab(CheatTab.FOOD); this.setTab(CheatTab.FOOD);
} }
public boolean canBeHeld() {
return true;
}
/** /**
* Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using
* the Item before the action is complete. * the Item before the action is complete.

View file

@ -18,6 +18,10 @@ public class ItemMilkBottle extends Item {
this.setMagnetic(); this.setMagnetic();
} }
public boolean canBeHeld() {
return true;
}
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn) { public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn) {
stack.decrSize(); stack.decrSize();
if(!worldIn.client) if(!worldIn.client)

View file

@ -80,6 +80,10 @@ public class ItemPotion extends Item
POTIONS.add(this); POTIONS.add(this);
} }
public boolean canBeHeld() {
return true;
}
public StatusEffect getEffect() public StatusEffect getEffect()
{ {
return this.effect; return this.effect;

View file

@ -71,6 +71,7 @@ public class ItemArmor extends Item {
return this.material.isRepairItem(repair.getItem()) ? true : super.getIsRepairable(toRepair, repair); return this.material.isRepairItem(repair.getItem()) ? true : super.getIsRepairable(toRepair, repair);
} }
/*
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) { public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) {
for(Equipment slot : this.type.getPossibleSlots(playerIn)) { for(Equipment slot : this.type.getPossibleSlots(playerIn)) {
if(playerIn.getArmor(slot) == null) { if(playerIn.getArmor(slot) == null) {
@ -82,6 +83,7 @@ public class ItemArmor extends Item {
return itemStackIn; return itemStackIn;
} }
*/
public void getArmorModifiers(Map<Attribute, Float> map) { public void getArmorModifiers(Map<Attribute, Float> map) {
if(this.material.getRadiationReduction(this.type) > 0.0f) if(this.material.getRadiationReduction(this.type) > 0.0f)

View file

@ -15,8 +15,13 @@ public class ItemBottle extends Item
public ItemBottle() public ItemBottle()
{ {
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
this.setFragile();
} }
public boolean canBeHeld() {
return true;
}
/** /**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/ */

View file

@ -132,6 +132,10 @@ public class ItemBucket extends Item
MAPPING.put(liquid.getStaticBlock(), this); MAPPING.put(liquid.getStaticBlock(), this);
} }
} }
public boolean canBeHeld() {
return true;
}
public BlockDynamicLiquid getLiquid() { public BlockDynamicLiquid getLiquid() {
return this.liquid; return this.liquid;

View file

@ -34,6 +34,10 @@ public class ItemDye extends Item {
this.setWeight(ItemWeight.XXS); this.setWeight(ItemWeight.XXS);
DIES[this.color.ordinal()] = this; DIES[this.color.ordinal()] = this;
} }
public boolean canBeHeld() {
return true;
}
public Color getColor() { public Color getColor() {
return this.color; return this.color;

View file

@ -40,6 +40,10 @@ public class ItemGrindedBones extends Item {
} }
} }
public boolean canBeHeld() {
return true;
}
public static boolean applyBonemeal(ItemStack stack, World worldIn, LocalPos target) public static boolean applyBonemeal(ItemStack stack, World worldIn, LocalPos target)
{ {
State iblockstate = worldIn.getState(target); State iblockstate = worldIn.getState(target);

View file

@ -0,0 +1,9 @@
package common.item.material;
import common.item.Item;
public class ItemLure extends Item {
public boolean canBeHeld() {
return true;
}
}

View file

@ -22,6 +22,10 @@ public class ItemSeeds extends Item
this.setTab(CheatTab.MATERIALS); this.setTab(CheatTab.MATERIALS);
} }
public boolean canBeHeld() {
return true;
}
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ)
{ {
if (side != Facing.UP) if (side != Facing.UP)

View file

@ -25,6 +25,10 @@ public class ItemChargedOrb extends Item
this.setColor(Color.DARK_MAGENTA); this.setColor(Color.DARK_MAGENTA);
this.setFragile(); this.setFragile();
} }
public boolean canBeHeld() {
return true;
}
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
{ {

View file

@ -52,6 +52,10 @@ public class ItemDie extends Item
this.setDisplay("Würfel W" + this.sides); this.setDisplay("Würfel W" + this.sides);
DICE.put(sides, this); DICE.put(sides, this);
} }
public boolean canBeHeld() {
return true;
}
public int getSides() { public int getSides() {
return this.sides; return this.sides;

View file

@ -31,6 +31,10 @@ public class ItemDynamite extends Item {
DYNAMITE[power] = this; DYNAMITE[power] = this;
} }
public boolean canBeHeld() {
return true;
}
public int getExplosionPower() { public int getExplosionPower() {
return this.power; return this.power;
} }

View file

@ -21,6 +21,10 @@ public class ItemEgg extends Item
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
} }
public boolean canBeHeld() {
return true;
}
/** /**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/ */

View file

@ -22,6 +22,10 @@ public class ItemFireball extends Item
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
} }
public boolean canBeHeld() {
return true;
}
/** /**
* Called when a Block is right-clicked with this Item * Called when a Block is right-clicked with this Item
*/ */

View file

@ -21,6 +21,10 @@ public class ItemSnowball extends Item
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
} }
public boolean canBeHeld() {
return true;
}
/** /**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/ */

View file

@ -29,6 +29,10 @@ public class ItemBoat extends Item
this.setTab(CheatTab.VEHICLES); this.setTab(CheatTab.VEHICLES);
} }
public boolean canBeHeld() {
return true;
}
/** /**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/ */

View file

@ -40,6 +40,10 @@ public class ItemCharTemplate extends Item
this.setDisplay("delegate"); this.setDisplay("delegate");
TEMPLATES.add(this); TEMPLATES.add(this);
} }
public boolean canBeHeld() {
return true;
}
public void delegateSetDisplay() { public void delegateSetDisplay() {
this.setDisplay("DNA-Probe von " + this.getCharName()); this.setDisplay("DNA-Probe von " + this.getCharName());

View file

@ -26,6 +26,10 @@ public class ItemMinecart extends Item
this.setMagnetic(); this.setMagnetic();
} }
public boolean canBeHeld() {
return true;
}
/** /**
* Called when a Block is right-clicked with this Item * Called when a Block is right-clicked with this Item
*/ */

View file

@ -38,6 +38,10 @@ public class ItemMobTemplate extends Item
this.setDisplay("delegate"); this.setDisplay("delegate");
TEMPLATES.add(this); TEMPLATES.add(this);
} }
public boolean canBeHeld() {
return true;
}
public void delegateSetDisplay() { public void delegateSetDisplay() {
this.setDisplay("DNA-Probe von " + EntityRegistry.getEntityName(this.entityId)); this.setDisplay("DNA-Probe von " + EntityRegistry.getEntityName(this.entityId));

View file

@ -13,6 +13,10 @@ public class ItemCamera extends Item {
this.setUnstackable(); this.setUnstackable();
this.setMagnetic(); this.setMagnetic();
} }
public boolean canBeHeld() {
return true;
}
public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) { public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) {
if(control == ItemControl.SECONDARY) { if(control == ItemControl.SECONDARY) {

View file

@ -13,6 +13,10 @@ public class ItemEditor extends Item {
this.setUnstackable(); this.setUnstackable();
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
} }
public boolean canBeHeld() {
return true;
}
public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) { public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) {
if(!world.client && control == ItemControl.TERTIARY && player.connection.isAdmin()) if(!world.client && control == ItemControl.TERTIARY && player.connection.isAdmin())

View file

@ -30,6 +30,10 @@ public class ItemFire extends Item
this.setMagnetic(); this.setMagnetic();
} }
public boolean canBeHeld() {
return true;
}
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip) { public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip) {
this.fireBlock.getTooltips(stack, playerIn, tooltip); this.fireBlock.getTooltips(stack, playerIn, tooltip);
} }

View file

@ -18,6 +18,10 @@ public class ItemFishingRod extends Item
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
} }
public boolean canBeHeld() {
return true;
}
// /** // /**
// * Returns True is the item is renderer in full 3D when hold. // * Returns True is the item is renderer in full 3D when hold.
// */ // */

View file

@ -20,6 +20,10 @@ public class ItemHoe extends Item
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
} }
public boolean canBeHeld() {
return true;
}
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos 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))

View file

@ -6,4 +6,8 @@ public class ItemKey extends Item {
public ItemKey() { public ItemKey() {
this.setMagnetic(); this.setMagnetic();
} }
public boolean canBeHeld() {
return true;
}
} }

View file

@ -20,6 +20,10 @@ public class ItemLead extends Item
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
} }
public boolean canBeHeld() {
return true;
}
/** /**
* Called when a Block is right-clicked with this Item * Called when a Block is right-clicked with this Item
*/ */

View file

@ -24,6 +24,10 @@ public class ItemMagnet extends Item {
this.chicken = chicken; this.chicken = chicken;
} }
public boolean canBeHeld() {
return true;
}
// public boolean isFull3D() { // public boolean isFull3D() {
// return true; // return true;
// } // }

View file

@ -13,6 +13,10 @@ public class ItemNameTag extends Item
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
} }
public boolean canBeHeld() {
return true;
}
/** /**
* Returns true if the item can be used on the given entity, e.g. shears on sheep. * Returns true if the item can be used on the given entity, e.g. shears on sheep.
*/ */

View file

@ -15,6 +15,10 @@ public class ItemSaddle extends Item
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
} }
public boolean canBeHeld() {
return true;
}
/** /**
* Returns true if the item can be used on the given entity, e.g. shears on sheep. * Returns true if the item can be used on the given entity, e.g. shears on sheep.
*/ */

View file

@ -22,6 +22,10 @@ public class ItemSpaceNavigator extends Item {
this.setColor(Color.DARK_GREEN); this.setColor(Color.DARK_GREEN);
this.setMagnetic(); this.setMagnetic();
} }
public boolean canBeHeld() {
return true;
}
public void setLocalTime(String local) { public void setLocalTime(String local) {
this.localTime = local; this.localTime = local;

View file

@ -34,6 +34,10 @@ public class ItemTool extends Item {
this.setFuelAmount(200); this.setFuelAmount(200);
} }
public boolean canBeHeld() {
return true;
}
@Clientside @Clientside
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip) public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
{ {

View file

@ -23,6 +23,10 @@ public abstract class ItemWand extends Item {
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
} }
public boolean canBeHeld() {
return true;
}
public final boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) { public final boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) {
if(control == ItemControl.SECONDARY && !world.client && block == null) { if(control == ItemControl.SECONDARY && !world.client && block == null) {
LocalPos vec = world.getBlockTrace(player, this.getRange(stack, player)); LocalPos vec = world.getBlockTrace(player, this.getRange(stack, player));

View file

@ -19,6 +19,10 @@ public class ItemWeatherToken extends Item {
this.setDisplay("Wetterkristall (" + this.weather.getDisplay() + ")"); this.setDisplay("Wetterkristall (" + this.weather.getDisplay() + ")");
this.setMagnetic(); this.setMagnetic();
} }
public boolean canBeHeld() {
return true;
}
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
{ {

View file

@ -16,6 +16,10 @@ public class ItemWhip extends Item
this.setMaxDamage(35); this.setMaxDamage(35);
} }
public boolean canBeHeld() {
return true;
}
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
{ {
if (playerIn.isRiding() && playerIn.vehicle instanceof EntityPig) if (playerIn.isRiding() && playerIn.vehicle instanceof EntityPig)

View file

@ -22,6 +22,10 @@ public class ItemBow extends Item
this.setTab(CheatTab.WEAPONS); this.setTab(CheatTab.WEAPONS);
} }
public boolean canBeHeld() {
return true;
}
/** /**
* Called when the player stops using an Item (stops holding the right mouse button). * Called when the player stops using an Item (stops holding the right mouse button).
*/ */

View file

@ -18,6 +18,10 @@ public class ItemExterminator extends Item {
this.setMagnetic(); this.setMagnetic();
} }
public boolean canBeHeld() {
return true;
}
public ItemStack onItemRightClick(ItemStack stack, World world, EntityNPC player) { public ItemStack onItemRightClick(ItemStack stack, World world, EntityNPC player) {
if(!world.client && player.connection.isAdmin()) { if(!world.client && player.connection.isAdmin()) {
world.playSoundAtEntity(player, SoundEvent.CLICK, 1.0F); world.playSoundAtEntity(player, SoundEvent.CLICK, 1.0F);

View file

@ -26,6 +26,10 @@ public abstract class ItemGunBase extends Item
this.setTab(CheatTab.WEAPONS); this.setTab(CheatTab.WEAPONS);
} }
public boolean canBeHeld() {
return true;
}
@Clientside @Clientside
public ItemAction getItemPosition() public ItemAction getItemPosition()
{ {