Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-03 14:50:19 +01:00
Move translation string back to non vanilla and move hat to vanilla
Dieser Commit ist enthalten in:
Ursprung
965d11c7a1
Commit
72da5a576b
@ -158,13 +158,6 @@ public interface CustomItemData {
|
|||||||
*/
|
*/
|
||||||
@Nullable String toolTier();
|
@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.
|
* Gets the armor type of the item.
|
||||||
*
|
*
|
||||||
@ -179,6 +172,14 @@ public interface CustomItemData {
|
|||||||
*/
|
*/
|
||||||
int protectionValue();
|
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.
|
* 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 protectionValue(int protectionValue);
|
||||||
|
|
||||||
Builder translationString(@Nullable String translationString);
|
Builder hat(boolean isHat);
|
||||||
|
|
||||||
Builder foil(boolean isFoil);
|
Builder foil(boolean isFoil);
|
||||||
|
|
||||||
|
@ -50,6 +50,13 @@ public interface NonVanillaCustomItemData extends CustomItemData {
|
|||||||
*/
|
*/
|
||||||
@NonNegative int javaId();
|
@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.
|
* Gets the repair materials of the item.
|
||||||
*
|
*
|
||||||
@ -57,14 +64,6 @@ public interface NonVanillaCustomItemData extends CustomItemData {
|
|||||||
*/
|
*/
|
||||||
@Nullable Set<String> repairMaterials();
|
@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.
|
* Gets if the item is chargable, like a bow.
|
||||||
*
|
*
|
||||||
@ -91,9 +90,9 @@ public interface NonVanillaCustomItemData extends CustomItemData {
|
|||||||
|
|
||||||
Builder javaId(@NonNegative int javaId);
|
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);
|
Builder chargeable(boolean isChargeable);
|
||||||
|
|
||||||
|
@ -57,9 +57,9 @@ public class GeyserCustomItemData implements CustomItemData {
|
|||||||
private final int attackDamage;
|
private final int attackDamage;
|
||||||
private final String toolType;
|
private final String toolType;
|
||||||
private final String toolTier;
|
private final String toolTier;
|
||||||
private final String translationString;
|
|
||||||
private final String armorType;
|
private final String armorType;
|
||||||
private final int protectionValue;
|
private final int protectionValue;
|
||||||
|
private final boolean isHat;
|
||||||
private final boolean isFoil;
|
private final boolean isFoil;
|
||||||
private final boolean isEdible;
|
private final boolean isEdible;
|
||||||
private final boolean canAlwaysEat;
|
private final boolean canAlwaysEat;
|
||||||
@ -81,9 +81,9 @@ public class GeyserCustomItemData implements CustomItemData {
|
|||||||
this.attackDamage = builder.attackDamage;
|
this.attackDamage = builder.attackDamage;
|
||||||
this.toolType = builder.toolType;
|
this.toolType = builder.toolType;
|
||||||
this.toolTier = builder.toolTier;
|
this.toolTier = builder.toolTier;
|
||||||
this.translationString = builder.translationString;
|
|
||||||
this.armorType = builder.armorType;
|
this.armorType = builder.armorType;
|
||||||
this.protectionValue = builder.protectionValue;
|
this.protectionValue = builder.protectionValue;
|
||||||
|
this.isHat = builder.hat;
|
||||||
this.isFoil = builder.foil;
|
this.isFoil = builder.foil;
|
||||||
this.isEdible = builder.edible;
|
this.isEdible = builder.edible;
|
||||||
this.canAlwaysEat = builder.canAlwaysEat;
|
this.canAlwaysEat = builder.canAlwaysEat;
|
||||||
@ -180,8 +180,8 @@ public class GeyserCustomItemData implements CustomItemData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String translationString() {
|
public boolean isHat() {
|
||||||
return translationString;
|
return isHat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -218,7 +218,7 @@ public class GeyserCustomItemData implements CustomItemData {
|
|||||||
private String toolTier = null;
|
private String toolTier = null;
|
||||||
private String armorType = null;
|
private String armorType = null;
|
||||||
private int protectionValue = 0;
|
private int protectionValue = 0;
|
||||||
private String translationString;
|
private boolean hat = false;
|
||||||
private boolean foil = false;
|
private boolean foil = false;
|
||||||
private boolean edible = false;
|
private boolean edible = false;
|
||||||
private boolean canAlwaysEat = false;
|
private boolean canAlwaysEat = false;
|
||||||
@ -332,8 +332,8 @@ public class GeyserCustomItemData implements CustomItemData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Builder translationString(@Nullable String translationString) {
|
public Builder hat(boolean isHat) {
|
||||||
this.translationString = translationString;
|
this.hat = isHat;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ import java.util.Set;
|
|||||||
public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData implements NonVanillaCustomItemData {
|
public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData implements NonVanillaCustomItemData {
|
||||||
private final String identifier;
|
private final String identifier;
|
||||||
private final int javaId;
|
private final int javaId;
|
||||||
|
private final String translationString;
|
||||||
private final Set<String> repairMaterials;
|
private final Set<String> repairMaterials;
|
||||||
private final boolean isHat;
|
|
||||||
private final boolean isChargeable;
|
private final boolean isChargeable;
|
||||||
private final String block;
|
private final String block;
|
||||||
|
|
||||||
@ -50,8 +50,8 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
|
|||||||
|
|
||||||
this.identifier = builder.identifier;
|
this.identifier = builder.identifier;
|
||||||
this.javaId = builder.javaId;
|
this.javaId = builder.javaId;
|
||||||
|
this.translationString = builder.translationString;
|
||||||
this.repairMaterials = builder.repairMaterials;
|
this.repairMaterials = builder.repairMaterials;
|
||||||
this.isHat = builder.hat;
|
|
||||||
this.isChargeable = builder.chargeable;
|
this.isChargeable = builder.chargeable;
|
||||||
this.block = builder.block;
|
this.block = builder.block;
|
||||||
}
|
}
|
||||||
@ -67,13 +67,13 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> repairMaterials() {
|
public String translationString() {
|
||||||
return repairMaterials;
|
return translationString;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHat() {
|
public Set<String> repairMaterials() {
|
||||||
return isHat;
|
return repairMaterials;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -89,8 +89,8 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
|
|||||||
public static class Builder extends GeyserCustomItemData.Builder implements NonVanillaCustomItemData.Builder {
|
public static class Builder extends GeyserCustomItemData.Builder implements NonVanillaCustomItemData.Builder {
|
||||||
private String identifier = null;
|
private String identifier = null;
|
||||||
private int javaId = -1;
|
private int javaId = -1;
|
||||||
|
private String translationString;
|
||||||
private Set<String> repairMaterials;
|
private Set<String> repairMaterials;
|
||||||
private boolean hat = false;
|
|
||||||
private boolean chargeable = false;
|
private boolean chargeable = false;
|
||||||
private String block = null;
|
private String block = null;
|
||||||
|
|
||||||
@ -152,6 +152,12 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Builder translationString(@Nullable String translationString) {
|
||||||
|
this.translationString = translationString;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Builder repairMaterials(@Nullable Set<String> repairMaterials) {
|
public Builder repairMaterials(@Nullable Set<String> repairMaterials) {
|
||||||
this.repairMaterials = repairMaterials;
|
this.repairMaterials = repairMaterials;
|
||||||
@ -168,12 +174,6 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
|
|||||||
return (Builder) super.creativeGroup(creativeGroup);
|
return (Builder) super.creativeGroup(creativeGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Builder hat(boolean isHat) {
|
|
||||||
this.hat = isHat;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Builder chargeable(boolean isChargeable) {
|
public Builder chargeable(boolean isChargeable) {
|
||||||
this.chargeable = isChargeable;
|
this.chargeable = isChargeable;
|
||||||
|
@ -153,7 +153,7 @@ public class CustomItemRegistryPopulator {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
NbtMapBuilder builder = createComponentNbt(customItemData, customItemData.identifier(), customItemId,
|
NbtMapBuilder builder = createComponentNbt(customItemData, customItemData.identifier(), customItemId,
|
||||||
customItemData.isHat(), customItemData.displayHandheld(), protocolVersion);
|
customItemData.displayHandheld(), protocolVersion);
|
||||||
ComponentItemData componentItemData = new ComponentItemData(customIdentifier, builder.build());
|
ComponentItemData componentItemData = new ComponentItemData(customIdentifier, builder.build());
|
||||||
|
|
||||||
return new NonVanillaItemRegistration(componentItemData, item, customItemMapping);
|
return new NonVanillaItemRegistration(componentItemData, item, customItemMapping);
|
||||||
@ -226,7 +226,7 @@ public class CustomItemRegistryPopulator {
|
|||||||
computeThrowableProperties(componentBuilder);
|
computeThrowableProperties(componentBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
computeRenderOffsets(false, customItemData, componentBuilder);
|
computeRenderOffsets(customItemData.isHat(), customItemData, componentBuilder);
|
||||||
|
|
||||||
componentBuilder.putCompound("item_properties", itemProperties.build());
|
componentBuilder.putCompound("item_properties", itemProperties.build());
|
||||||
builder.putCompound("components", componentBuilder.build());
|
builder.putCompound("components", componentBuilder.build());
|
||||||
@ -235,7 +235,7 @@ public class CustomItemRegistryPopulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static NbtMapBuilder createComponentNbt(NonVanillaCustomItemData customItemData, String customItemName,
|
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();
|
NbtMapBuilder builder = NbtMap.builder();
|
||||||
builder.putString("name", customItemName)
|
builder.putString("name", customItemName)
|
||||||
.putInt("id", customItemId);
|
.putInt("id", customItemId);
|
||||||
@ -269,7 +269,7 @@ public class CustomItemRegistryPopulator {
|
|||||||
computeChargeableProperties(itemProperties, componentBuilder, "minecraft:" + tooltype, protocolVersion);
|
computeChargeableProperties(itemProperties, componentBuilder, "minecraft:" + tooltype, protocolVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
computeRenderOffsets(isHat, customItemData, componentBuilder);
|
computeRenderOffsets(customItemData.isHat(), customItemData, componentBuilder);
|
||||||
|
|
||||||
if (customItemData.isFoil()) {
|
if (customItemData.isFoil()) {
|
||||||
itemProperties.putBoolean("foil", true);
|
itemProperties.putBoolean("foil", true);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren