add item descriptions

This commit is contained in:
Sen 2025-08-04 00:29:41 +02:00
parent 1d19cddcef
commit 1c33159e64
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
3 changed files with 25 additions and 1 deletions

View file

@ -126,6 +126,8 @@ public abstract class GuiContainer extends Gui
s = Color.YELLOW + "" + stack.getSize() + " " + Color.RESET + s; s = Color.YELLOW + "" + stack.getSize() + " " + Color.RESET + s;
s = s + Color.RESET; s = s + Color.RESET;
list.add(s); list.add(s);
if(stack.getItem().getDescription() != null)
list.add(stack.getItem().getDescription());
stack.getItem().addInformation(stack, this.gm.player, list); stack.getItem().addInformation(stack, this.gm.player, list);
if(stack.getItem().isAdminItem()) if(stack.getItem().isAdminItem())
list.add(Color.RED + "Admin-Gegenstand"); list.add(Color.RED + "Admin-Gegenstand");

View file

@ -192,6 +192,7 @@ public class Block {
protected double maxZ; protected double maxZ;
private State defaultState; private State defaultState;
private String display; private String display;
private String description;
private CheatTab tab; private CheatTab tab;
private SoundType sound; private SoundType sound;
private Equipment miningTool; private Equipment miningTool;
@ -419,6 +420,12 @@ public class Block {
return this; return this;
} }
public final Block setDisplay(String name, String desc) {
this.display = name;
this.description = desc;
return this;
}
public final Block setTab(CheatTab tab) { public final Block setTab(CheatTab tab) {
this.tab = tab; this.tab = tab;
return this; return this;
@ -609,6 +616,10 @@ public class Block {
public final String getDisplay() { public final String getDisplay() {
return this.display; return this.display;
} }
public final String getDescription() {
return this.description;
}
protected Property[] getProperties() { protected Property[] getProperties() {

View file

@ -32,6 +32,7 @@ public class Item {
private int maxDamage = 0; private int maxDamage = 0;
private Item containerItem; private Item containerItem;
private String display; private String display;
private String description;
private CheatTab tab; private CheatTab tab;
private Color color = null; private Color color = null;
private int defColor = 0xffffffff; private int defColor = 0xffffffff;
@ -47,7 +48,7 @@ public class Item {
public Item(Block block) { public Item(Block block) {
this.block = block; this.block = block;
this.setDisplay(this.block.getDisplay()); this.setDisplay(this.block.getDisplay(), this.block.getDescription());
this.setTab(this.block.getTab()); this.setTab(this.block.getTab());
if(this.block.isMagnetic()) if(this.block.isMagnetic())
this.setMagnetic(); this.setMagnetic();
@ -84,6 +85,12 @@ public class Item {
return this; return this;
} }
public final Item setDisplay(String name, String desc) {
this.display = name;
this.description = desc;
return this;
}
public final Item setContainerItem(Item containerItem) { public final Item setContainerItem(Item containerItem) {
this.containerItem = containerItem; this.containerItem = containerItem;
return this; return this;
@ -153,6 +160,10 @@ public class Item {
return this.display; return this.display;
} }
public final String getDescription() {
return this.description;
}
public final Item getContainerItem() { public final Item getContainerItem() {
return this.containerItem; return this.containerItem;
} }