add item descriptions

This commit is contained in:
Sen 2025-08-04 00:50:14 +02:00
parent 1c33159e64
commit e115ca1707
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
5 changed files with 15 additions and 11 deletions

View file

@ -1,6 +1,7 @@
package client.gui.container; package client.gui.container;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -126,8 +127,11 @@ 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) if(stack.getItem().getDescription() != null) {
list.add(stack.getItem().getDescription()); for(String line : stack.getItem().getDescription()) {
list.add(Color.GRAY + line);
}
}
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,7 +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 String[] description;
private CheatTab tab; private CheatTab tab;
private SoundType sound; private SoundType sound;
private Equipment miningTool; private Equipment miningTool;
@ -420,7 +420,7 @@ public class Block {
return this; return this;
} }
public final Block setDisplay(String name, String desc) { public final Block setDisplay(String name, String ... desc) {
this.display = name; this.display = name;
this.description = desc; this.description = desc;
return this; return this;
@ -617,7 +617,7 @@ public class Block {
return this.display; return this.display;
} }
public final String getDescription() { public final String[] getDescription() {
return this.description; return this.description;
} }

View file

@ -159,8 +159,8 @@ public abstract class ItemRegistry {
"_bucket", new ItemBucket(liquid.second(), true)); "_bucket", new ItemBucket(liquid.second(), true));
} }
register("boat", (new ItemBoat()).setDisplay("Boot").setFuelAmount(800)); register("boat", (new ItemBoat()).setDisplay("Boot", "Keine Lust mehr auf Schwimmen oder Tauchen?", "Ist dir Wasser einfach zu Nass und Säure zu scharf?", "Damit ist jetzt Schluss, mit diesem hochwertigen Kahn!").setFuelAmount(800));
register("minecart", (new ItemMinecart()).setDisplay("Lore")); register("minecart", (new ItemMinecart()).setDisplay("Lore", "Füße zu träge? Keine Kraft mehr in den Beinen?", "Diese Lore wird dich garantiert mühelos an dein Ziel bringen!", "Hinweis: Keine Haftung bei Schäden oder spontanem Tod durch", "ungünstig platzierte Schienen oder darüber laufende Kreaturen"));
for(EntityInfo egg : EntityRegistry.DNA.values()) { for(EntityInfo egg : EntityRegistry.DNA.values()) {
register("dna_sample_" + egg.id().toLowerCase(), (new ItemMobTemplate(egg.id())) register("dna_sample_" + egg.id().toLowerCase(), (new ItemMobTemplate(egg.id()))
.setMaxAmount(StackSize.L)); .setMaxAmount(StackSize.L));

View file

@ -32,7 +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 String[] description;
private CheatTab tab; private CheatTab tab;
private Color color = null; private Color color = null;
private int defColor = 0xffffffff; private int defColor = 0xffffffff;
@ -85,7 +85,7 @@ public class Item {
return this; return this;
} }
public final Item setDisplay(String name, String desc) { public final Item setDisplay(String name, String ... desc) {
this.display = name; this.display = name;
this.description = desc; this.description = desc;
return this; return this;
@ -160,7 +160,7 @@ public class Item {
return this.display; return this.display;
} }
public final String getDescription() { public final String[] getDescription() {
return this.description; return this.description;
} }

View file

@ -116,7 +116,7 @@ public class ItemBucket extends Item
{ {
if(liquid != null) { if(liquid != null) {
this.setUnstackable(); this.setUnstackable();
this.setDisplay((recursive ? "Flutender" : "") + "Eimer mit " + liquid.getDisplay()); this.setDisplay((recursive ? "Flutender" : "") + "Eimer mit " + liquid.getDisplay(), liquid.getDescription());
} }
else { else {
this.setDisplay((recursive ? "Unendlicher" : "") + "Eimer"); this.setDisplay((recursive ? "Unendlicher" : "") + "Eimer");