Move tool type and tool tier back to non vanilla items

This commit is contained in:
Eclipse 2024-07-21 14:03:27 +00:00
parent 52b9921838
commit e5f037e45f
No known key found for this signature in database
GPG key ID: 95E6998F82EC938A
6 changed files with 46 additions and 72 deletions

View file

@ -144,20 +144,6 @@ public interface CustomItemData {
*/
int attackDamage();
/**
* Gets the tool type of the item.
*
* @return the tool type of the item
*/
@Nullable String toolType();
/**
* Gets the tool tier of the item.
*
* @return the tool tier of the item
*/
@Nullable String toolTier();
/**
* Gets the armor type of the item.
*
@ -237,10 +223,6 @@ public interface CustomItemData {
Builder attackDamage(int attackDamage);
Builder toolType(@Nullable String toolType);
Builder toolTier(@Nullable String toolTier);
Builder armorType(@Nullable String armorType);
Builder protectionValue(int protectionValue);

View file

@ -43,6 +43,20 @@ public interface NonVanillaCustomItemData extends CustomItemData {
*/
@NonNull String identifier();
/**
* Gets the tool type of the item.
*
* @return the tool type of the item
*/
@Nullable String toolType();
/**
* Gets the tool tier of the item.
*
* @return the tool tier of the item
*/
@Nullable String toolTier();
/**
* Gets the java item id of the item.
*
@ -136,12 +150,6 @@ public interface NonVanillaCustomItemData extends CustomItemData {
@Override
Builder attackDamage(int attackDamage);
@Override
Builder toolType(@Nullable String toolType);
@Override
Builder toolTier(@Nullable String toolTier);
@Override
Builder armorType(@Nullable String armorType);
@ -172,6 +180,10 @@ public interface NonVanillaCustomItemData extends CustomItemData {
Builder javaId(@NonNegative int javaId);
Builder toolType(@Nullable String toolType);
Builder toolTier(@Nullable String toolTier);
Builder translationString(@Nullable String translationString);
Builder repairMaterials(@Nullable Set<String> repairMaterials);

View file

@ -55,8 +55,6 @@ public class GeyserCustomItemData implements CustomItemData {
private final int stackSize;
private final int maxDamage;
private final int attackDamage;
private final String toolType;
private final String toolTier;
private final String armorType;
private final int protectionValue;
private final boolean isHat;
@ -79,8 +77,6 @@ public class GeyserCustomItemData implements CustomItemData {
this.stackSize = builder.stackSize;
this.maxDamage = builder.maxDamage;
this.attackDamage = builder.attackDamage;
this.toolType = builder.toolType;
this.toolTier = builder.toolTier;
this.armorType = builder.armorType;
this.protectionValue = builder.protectionValue;
this.isHat = builder.hat;
@ -159,16 +155,6 @@ public class GeyserCustomItemData implements CustomItemData {
return attackDamage;
}
@Override
public String toolType() {
return toolType;
}
@Override
public String toolTier() {
return toolTier;
}
@Override
public @Nullable String armorType() {
return armorType;
@ -214,8 +200,6 @@ public class GeyserCustomItemData implements CustomItemData {
private int stackSize = 0;
private int maxDamage = -1;
private int attackDamage = 0;
private String toolType = null;
private String toolTier = null;
private String armorType = null;
private int protectionValue = 0;
private boolean hat = false;
@ -307,18 +291,6 @@ public class GeyserCustomItemData implements CustomItemData {
return this;
}
@Override
public Builder toolType(@Nullable String toolType) {
this.toolType = toolType;
return this;
}
@Override
public Builder toolTier(@Nullable String toolTier) {
this.toolTier = toolTier;
return this;
}
@Override
public Builder armorType(@Nullable String armorType) {
this.armorType = armorType;

View file

@ -40,6 +40,8 @@ import java.util.Set;
public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData implements NonVanillaCustomItemData {
private final String identifier;
private final int javaId;
private final String toolType;
private final String toolTier;
private final String translationString;
private final Set<String> repairMaterials;
private final boolean isChargeable;
@ -50,6 +52,8 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
this.identifier = builder.identifier;
this.javaId = builder.javaId;
this.toolType = builder.toolType;
this.toolTier = builder.toolTier;
this.translationString = builder.translationString;
this.repairMaterials = builder.repairMaterials;
this.isChargeable = builder.chargeable;
@ -66,6 +70,16 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
return javaId;
}
@Override
public String toolType() {
return toolType;
}
@Override
public String toolTier() {
return toolTier;
}
@Override
public String translationString() {
return translationString;
@ -89,6 +103,8 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
public static class Builder extends GeyserCustomItemData.Builder implements NonVanillaCustomItemData.Builder {
private String identifier = null;
private int javaId = -1;
private String toolType = null;
private String toolTier = null;
private String translationString;
private Set<String> repairMaterials;
private boolean chargeable = false;
@ -165,16 +181,6 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
return (Builder) super.attackDamage(attackDamage);
}
@Override
public Builder toolType(@Nullable String toolType) {
return (Builder) super.toolType(toolType);
}
@Override
public Builder toolTier(@Nullable String toolTier) {
return (Builder) super.toolTier(toolTier);
}
@Override
public Builder armorType(@Nullable String armorType) {
return (Builder) super.armorType(armorType);
@ -217,6 +223,18 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
return this;
}
@Override
public Builder toolType(@Nullable String toolType) {
this.toolType = toolType;
return this;
}
@Override
public Builder toolTier(@Nullable String toolTier) {
this.toolTier = toolTier;
return this;
}
@Override
public Builder translationString(@Nullable String translationString) {
this.translationString = translationString;

View file

@ -225,14 +225,6 @@ public class MappingsReader_v1 extends MappingsReader {
customItemData.maxDamage(node.get("attack_damage").asInt());
}
if (node.has("tool_type")) {
customItemData.toolType(node.get("tool_type").asText());
}
if (node.has("tool_tier")) {
customItemData.toolTier(node.get("tool_tier").asText());
}
if (node.has("armor_type")) {
customItemData.armorType(node.get("armor_type").asText());
}

View file

@ -176,8 +176,6 @@ public class CustomItemRegistryPopulator {
String toolType = null;
if (mapping.getToolType() != null) {
toolType = mapping.getToolType();
} else if (customItemData.toolType() != null) {
toolType = customItemData.toolType();
}
if (toolType != null) {