Skip to content

Commit

Permalink
Move tool type and tool tier back to non vanilla items
Browse files Browse the repository at this point in the history
  • Loading branch information
eclipseisoffline committed Jul 21, 2024
1 parent 52b9921 commit e5f037e
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -237,10 +223,6 @@ interface Builder {

Builder attackDamage(int attackDamage);

Builder toolType(@Nullable String toolType);

Builder toolTier(@Nullable String toolTier);

Builder armorType(@Nullable String armorType);

Builder protectionValue(int protectionValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -136,12 +150,6 @@ interface Builder extends CustomItemData.Builder {
@Override
Builder attackDamage(int attackDamage);

@Override
Builder toolType(@Nullable String toolType);

@Override
Builder toolTier(@Nullable String toolTier);

@Override
Builder armorType(@Nullable String armorType);

Expand Down Expand Up @@ -172,6 +180,10 @@ default Builder tool(boolean isTool) {

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -79,8 +77,6 @@ public GeyserCustomItemData(Builder builder) {
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;
Expand Down Expand Up @@ -159,16 +155,6 @@ public int attackDamage() {
return attackDamage;
}

@Override
public String toolType() {
return toolType;
}

@Override
public String toolTier() {
return toolTier;
}

@Override
public @Nullable String armorType() {
return armorType;
Expand Down Expand Up @@ -214,8 +200,6 @@ public static class Builder implements CustomItemData.Builder {
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;
Expand Down Expand Up @@ -307,18 +291,6 @@ public Builder attackDamage(int attackDamage) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
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;
Expand All @@ -50,6 +52,8 @@ public GeyserNonVanillaCustomItemData(Builder builder) {

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;
Expand All @@ -66,6 +70,16 @@ public int javaId() {
return javaId;
}

@Override
public String toolType() {
return toolType;
}

@Override
public String toolTier() {
return toolTier;
}

@Override
public String translationString() {
return translationString;
Expand All @@ -89,6 +103,8 @@ public String block() {
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;
Expand Down Expand Up @@ -165,16 +181,6 @@ public Builder attackDamage(int attackDamage) {
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);
Expand Down Expand Up @@ -217,6 +223,18 @@ public Builder javaId(int javaId) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,6 @@ public CustomItemData readItemMappingEntry(JsonNode node) throws InvalidCustomMa
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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ private static NbtMapBuilder createComponentNbt(CustomItemData customItemData, I
String toolType = null;
if (mapping.getToolType() != null) {
toolType = mapping.getToolType();
} else if (customItemData.toolType() != null) {
toolType = customItemData.toolType();
}

if (toolType != null) {
Expand Down

0 comments on commit e5f037e

Please sign in to comment.