3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-09-08 20:43:04 +02:00

Move translation string back to non vanilla and move hat to vanilla

Dieser Commit ist enthalten in:
Eclipse 2024-05-11 10:08:21 +00:00
Ursprung 965d11c7a1
Commit 72da5a576b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 441A0B7FDD01D03A
5 geänderte Dateien mit 42 neuen und 42 gelöschten Zeilen

Datei anzeigen

@ -158,13 +158,6 @@ public interface CustomItemData {
*/
@Nullable String toolTier();
/**
* Gets the item's translation string.
*
* @return the item's translation string
*/
@Nullable String translationString();
/**
* Gets the armor type of the item.
*
@ -179,6 +172,14 @@ public interface CustomItemData {
*/
int protectionValue();
/**
* Gets if the item is a hat. This is used to determine if the item should be rendered on the player's head, and
* normally allow the player to equip it. This is not meant for armor.
*
* @return if the item is a hat
*/
boolean isHat();
/**
* Gets if the item is a foil. This is used to determine if the item should be rendered with an enchantment glint effect.
*
@ -255,7 +256,7 @@ public interface CustomItemData {
Builder protectionValue(int protectionValue);
Builder translationString(@Nullable String translationString);
Builder hat(boolean isHat);
Builder foil(boolean isFoil);

Datei anzeigen

@ -50,6 +50,13 @@ public interface NonVanillaCustomItemData extends CustomItemData {
*/
@NonNegative int javaId();
/**
* Gets the item's translation string.
*
* @return the item's translation string
*/
@Nullable String translationString();
/**
* Gets the repair materials of the item.
*
@ -57,14 +64,6 @@ public interface NonVanillaCustomItemData extends CustomItemData {
*/
@Nullable Set<String> repairMaterials();
/**
* Gets if the item is a hat. This is used to determine if the item should be rendered on the player's head, and
* normally allow the player to equip it. This is not meant for armor.
*
* @return if the item is a hat
*/
boolean isHat();
/**
* Gets if the item is chargable, like a bow.
*
@ -91,9 +90,9 @@ public interface NonVanillaCustomItemData extends CustomItemData {
Builder javaId(@NonNegative int javaId);
Builder repairMaterials(@Nullable Set<String> repairMaterials);
Builder translationString(@Nullable String translationString);
Builder hat(boolean isHat);
Builder repairMaterials(@Nullable Set<String> repairMaterials);
Builder chargeable(boolean isChargeable);

Datei anzeigen

@ -57,9 +57,9 @@ public class GeyserCustomItemData implements CustomItemData {
private final int attackDamage;
private final String toolType;
private final String toolTier;
private final String translationString;
private final String armorType;
private final int protectionValue;
private final boolean isHat;
private final boolean isFoil;
private final boolean isEdible;
private final boolean canAlwaysEat;
@ -81,9 +81,9 @@ public class GeyserCustomItemData implements CustomItemData {
this.attackDamage = builder.attackDamage;
this.toolType = builder.toolType;
this.toolTier = builder.toolTier;
this.translationString = builder.translationString;
this.armorType = builder.armorType;
this.protectionValue = builder.protectionValue;
this.isHat = builder.hat;
this.isFoil = builder.foil;
this.isEdible = builder.edible;
this.canAlwaysEat = builder.canAlwaysEat;
@ -180,8 +180,8 @@ public class GeyserCustomItemData implements CustomItemData {
}
@Override
public String translationString() {
return translationString;
public boolean isHat() {
return isHat;
}
@Override
@ -218,7 +218,7 @@ public class GeyserCustomItemData implements CustomItemData {
private String toolTier = null;
private String armorType = null;
private int protectionValue = 0;
private String translationString;
private boolean hat = false;
private boolean foil = false;
private boolean edible = false;
private boolean canAlwaysEat = false;
@ -332,8 +332,8 @@ public class GeyserCustomItemData implements CustomItemData {
}
@Override
public Builder translationString(@Nullable String translationString) {
this.translationString = translationString;
public Builder hat(boolean isHat) {
this.hat = isHat;
return this;
}

Datei anzeigen

@ -40,8 +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 translationString;
private final Set<String> repairMaterials;
private final boolean isHat;
private final boolean isChargeable;
private final String block;
@ -50,8 +50,8 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
this.identifier = builder.identifier;
this.javaId = builder.javaId;
this.translationString = builder.translationString;
this.repairMaterials = builder.repairMaterials;
this.isHat = builder.hat;
this.isChargeable = builder.chargeable;
this.block = builder.block;
}
@ -67,13 +67,13 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
}
@Override
public Set<String> repairMaterials() {
return repairMaterials;
public String translationString() {
return translationString;
}
@Override
public boolean isHat() {
return isHat;
public Set<String> repairMaterials() {
return repairMaterials;
}
@Override
@ -89,8 +89,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 translationString;
private Set<String> repairMaterials;
private boolean hat = false;
private boolean chargeable = false;
private String block = null;
@ -152,6 +152,12 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
return this;
}
@Override
public Builder translationString(@Nullable String translationString) {
this.translationString = translationString;
return this;
}
@Override
public Builder repairMaterials(@Nullable Set<String> repairMaterials) {
this.repairMaterials = repairMaterials;
@ -168,12 +174,6 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
return (Builder) super.creativeGroup(creativeGroup);
}
@Override
public Builder hat(boolean isHat) {
this.hat = isHat;
return this;
}
@Override
public Builder chargeable(boolean isChargeable) {
this.chargeable = isChargeable;

Datei anzeigen

@ -153,7 +153,7 @@ public class CustomItemRegistryPopulator {
.build();
NbtMapBuilder builder = createComponentNbt(customItemData, customItemData.identifier(), customItemId,
customItemData.isHat(), customItemData.displayHandheld(), protocolVersion);
customItemData.displayHandheld(), protocolVersion);
ComponentItemData componentItemData = new ComponentItemData(customIdentifier, builder.build());
return new NonVanillaItemRegistration(componentItemData, item, customItemMapping);
@ -226,7 +226,7 @@ public class CustomItemRegistryPopulator {
computeThrowableProperties(componentBuilder);
}
computeRenderOffsets(false, customItemData, componentBuilder);
computeRenderOffsets(customItemData.isHat(), customItemData, componentBuilder);
componentBuilder.putCompound("item_properties", itemProperties.build());
builder.putCompound("components", componentBuilder.build());
@ -235,7 +235,7 @@ public class CustomItemRegistryPopulator {
}
private static NbtMapBuilder createComponentNbt(NonVanillaCustomItemData customItemData, String customItemName,
int customItemId, boolean isHat, boolean displayHandheld, int protocolVersion) {
int customItemId, boolean displayHandheld, int protocolVersion) {
NbtMapBuilder builder = NbtMap.builder();
builder.putString("name", customItemName)
.putInt("id", customItemId);
@ -269,7 +269,7 @@ public class CustomItemRegistryPopulator {
computeChargeableProperties(itemProperties, componentBuilder, "minecraft:" + tooltype, protocolVersion);
}
computeRenderOffsets(isHat, customItemData, componentBuilder);
computeRenderOffsets(customItemData.isHat(), customItemData, componentBuilder);
if (customItemData.isFoil()) {
itemProperties.putBoolean("foil", true);