mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +01:00
Implement toString
for registry objects
This commit is contained in:
parent
1775de52e4
commit
3ff5a7f414
@ -254,4 +254,9 @@ final class EntityTypeImpl implements EntityType {
|
||||
public @NotNull Registry.EntityEntry registry() {
|
||||
return registry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
@ -35,4 +35,9 @@ final class EnchantmentImpl implements Enchantment {
|
||||
public @NotNull Registry.EnchantmentEntry registry() {
|
||||
return registry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
@ -144,6 +144,13 @@ public class ItemMeta implements TagReadable, Writeable {
|
||||
return nbt.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + "{" +
|
||||
"nbt=" + nbt +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Contract(value = "-> new", pure = true)
|
||||
protected @NotNull ItemMetaBuilder builder() {
|
||||
return ItemMetaBuilder.fromNBT(metaBuilder, nbt);
|
||||
|
@ -195,6 +195,16 @@ public final class ItemStack implements TagReadable, HoverEventSource<HoverEvent
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ItemStack{" +
|
||||
"stackingRule=" + stackingRule +
|
||||
", material=" + material +
|
||||
", amount=" + amount +
|
||||
", meta=" + meta +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Contract(value = "_, _ -> new", pure = true)
|
||||
public <T> @NotNull ItemStack withTag(@NotNull Tag<T> tag, @Nullable T value) {
|
||||
return builder().meta(metaBuilder -> metaBuilder.set(tag, value)).build();
|
||||
|
@ -35,4 +35,9 @@ final class MaterialImpl implements Material {
|
||||
public @NotNull Registry.MaterialEntry registry() {
|
||||
return registry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
@ -46,4 +46,9 @@ final class ParticleImpl implements Particle {
|
||||
public int id() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
@ -35,4 +35,9 @@ final class PotionEffectImpl implements PotionEffect {
|
||||
public @NotNull Registry.PotionEffectEntry registry() {
|
||||
return registry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
@ -46,4 +46,9 @@ final class PotionTypeImpl implements PotionType {
|
||||
public int id() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
@ -46,4 +46,9 @@ final class SoundEventImpl implements SoundEvent {
|
||||
public int id() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
@ -46,4 +46,9 @@ final class StatisticTypeImpl implements StatisticType {
|
||||
public int id() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user