Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-09-19 01:30:08 +02:00
Move armor type to super class and implement protection value and armor type in vanilla custom registry
Dieser Commit ist enthalten in:
Ursprung
97e1bebcbd
Commit
965d11c7a1
@ -165,6 +165,13 @@ public interface CustomItemData {
|
|||||||
*/
|
*/
|
||||||
@Nullable String translationString();
|
@Nullable String translationString();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the armor type of the item.
|
||||||
|
*
|
||||||
|
* @return the armor type of the item
|
||||||
|
*/
|
||||||
|
@Nullable String armorType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the armor protection value of the item.
|
* Gets the armor protection value of the item.
|
||||||
*
|
*
|
||||||
@ -244,6 +251,8 @@ public interface CustomItemData {
|
|||||||
|
|
||||||
Builder toolTier(@Nullable String toolTier);
|
Builder toolTier(@Nullable String toolTier);
|
||||||
|
|
||||||
|
Builder armorType(@Nullable String armorType);
|
||||||
|
|
||||||
Builder protectionValue(int protectionValue);
|
Builder protectionValue(int protectionValue);
|
||||||
|
|
||||||
Builder translationString(@Nullable String translationString);
|
Builder translationString(@Nullable String translationString);
|
||||||
|
@ -50,13 +50,6 @@ public interface NonVanillaCustomItemData extends CustomItemData {
|
|||||||
*/
|
*/
|
||||||
@NonNegative int javaId();
|
@NonNegative int javaId();
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the armor type of the item.
|
|
||||||
*
|
|
||||||
* @return the armor type of the item
|
|
||||||
*/
|
|
||||||
@Nullable String armorType();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the repair materials of the item.
|
* Gets the repair materials of the item.
|
||||||
*
|
*
|
||||||
@ -98,8 +91,6 @@ public interface NonVanillaCustomItemData extends CustomItemData {
|
|||||||
|
|
||||||
Builder javaId(@NonNegative int javaId);
|
Builder javaId(@NonNegative int javaId);
|
||||||
|
|
||||||
Builder armorType(@Nullable String armorType);
|
|
||||||
|
|
||||||
Builder repairMaterials(@Nullable Set<String> repairMaterials);
|
Builder repairMaterials(@Nullable Set<String> repairMaterials);
|
||||||
|
|
||||||
Builder hat(boolean isHat);
|
Builder hat(boolean isHat);
|
||||||
|
@ -37,7 +37,6 @@ import java.util.HashSet;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.geysermc.geyser.api.item.custom.NonVanillaCustomItemData;
|
|
||||||
|
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
@ToString
|
@ToString
|
||||||
@ -59,6 +58,7 @@ public class GeyserCustomItemData implements CustomItemData {
|
|||||||
private final String toolType;
|
private final String toolType;
|
||||||
private final String toolTier;
|
private final String toolTier;
|
||||||
private final String translationString;
|
private final String translationString;
|
||||||
|
private final String armorType;
|
||||||
private final int protectionValue;
|
private final int protectionValue;
|
||||||
private final boolean isFoil;
|
private final boolean isFoil;
|
||||||
private final boolean isEdible;
|
private final boolean isEdible;
|
||||||
@ -82,6 +82,7 @@ public class GeyserCustomItemData implements CustomItemData {
|
|||||||
this.toolType = builder.toolType;
|
this.toolType = builder.toolType;
|
||||||
this.toolTier = builder.toolTier;
|
this.toolTier = builder.toolTier;
|
||||||
this.translationString = builder.translationString;
|
this.translationString = builder.translationString;
|
||||||
|
this.armorType = builder.armorType;
|
||||||
this.protectionValue = builder.protectionValue;
|
this.protectionValue = builder.protectionValue;
|
||||||
this.isFoil = builder.foil;
|
this.isFoil = builder.foil;
|
||||||
this.isEdible = builder.edible;
|
this.isEdible = builder.edible;
|
||||||
@ -168,6 +169,11 @@ public class GeyserCustomItemData implements CustomItemData {
|
|||||||
return toolTier;
|
return toolTier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String armorType() {
|
||||||
|
return armorType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int protectionValue() {
|
public int protectionValue() {
|
||||||
return protectionValue;
|
return protectionValue;
|
||||||
@ -210,10 +216,10 @@ public class GeyserCustomItemData implements CustomItemData {
|
|||||||
private int attackDamage = 0;
|
private int attackDamage = 0;
|
||||||
private String toolType = null;
|
private String toolType = null;
|
||||||
private String toolTier = null;
|
private String toolTier = null;
|
||||||
|
private String armorType = null;
|
||||||
private int protectionValue = 0;
|
private int protectionValue = 0;
|
||||||
private String translationString;
|
private String translationString;
|
||||||
private boolean foil = false;
|
private boolean foil = false;
|
||||||
private boolean tool = false;
|
|
||||||
private boolean edible = false;
|
private boolean edible = false;
|
||||||
private boolean canAlwaysEat = false;
|
private boolean canAlwaysEat = false;
|
||||||
|
|
||||||
@ -313,6 +319,12 @@ public class GeyserCustomItemData implements CustomItemData {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Builder armorType(@Nullable String armorType) {
|
||||||
|
this.armorType = armorType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Builder protectionValue(int protectionValue) {
|
public Builder protectionValue(int protectionValue) {
|
||||||
this.protectionValue = protectionValue;
|
this.protectionValue = protectionValue;
|
||||||
|
@ -40,7 +40,6 @@ 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 armorType;
|
|
||||||
private final Set<String> repairMaterials;
|
private final Set<String> repairMaterials;
|
||||||
private final boolean isHat;
|
private final boolean isHat;
|
||||||
private final boolean isChargeable;
|
private final boolean isChargeable;
|
||||||
@ -51,7 +50,6 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
|
|||||||
|
|
||||||
this.identifier = builder.identifier;
|
this.identifier = builder.identifier;
|
||||||
this.javaId = builder.javaId;
|
this.javaId = builder.javaId;
|
||||||
this.armorType = builder.armorType;
|
|
||||||
this.repairMaterials = builder.repairMaterials;
|
this.repairMaterials = builder.repairMaterials;
|
||||||
this.isHat = builder.hat;
|
this.isHat = builder.hat;
|
||||||
this.isChargeable = builder.chargeable;
|
this.isChargeable = builder.chargeable;
|
||||||
@ -68,11 +66,6 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
|
|||||||
return javaId;
|
return javaId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public @Nullable String armorType() {
|
|
||||||
return armorType;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> repairMaterials() {
|
public Set<String> repairMaterials() {
|
||||||
return repairMaterials;
|
return repairMaterials;
|
||||||
@ -96,7 +89,6 @@ 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 armorType = null;
|
|
||||||
private Set<String> repairMaterials;
|
private Set<String> repairMaterials;
|
||||||
private boolean hat = false;
|
private boolean hat = false;
|
||||||
private boolean chargeable = false;
|
private boolean chargeable = false;
|
||||||
@ -160,12 +152,6 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Builder armorType(@Nullable String armorType) {
|
|
||||||
this.armorType = armorType;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Builder repairMaterials(@Nullable Set<String> repairMaterials) {
|
public Builder repairMaterials(@Nullable Set<String> repairMaterials) {
|
||||||
this.repairMaterials = repairMaterials;
|
this.repairMaterials = repairMaterials;
|
||||||
|
@ -188,8 +188,18 @@ public class CustomItemRegistryPopulator {
|
|||||||
|
|
||||||
itemProperties.putBoolean("can_destroy_in_creative", canDestroyInCreative);
|
itemProperties.putBoolean("can_destroy_in_creative", canDestroyInCreative);
|
||||||
|
|
||||||
|
String armorType = null;
|
||||||
|
int protectionValue = 0;
|
||||||
if (mapping.getArmorType() != null) {
|
if (mapping.getArmorType() != null) {
|
||||||
computeArmorProperties(mapping.getArmorType(), mapping.getProtectionValue(), itemProperties, componentBuilder);
|
armorType = mapping.getArmorType();
|
||||||
|
protectionValue = mapping.getProtectionValue();
|
||||||
|
} else if (customItemData.armorType() != null) {
|
||||||
|
armorType = customItemData.armorType();
|
||||||
|
protectionValue = customItemData.protectionValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (armorType != null) {
|
||||||
|
computeArmorProperties(armorType, protectionValue, itemProperties, componentBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapping.getFirstBlockRuntimeId() != null) {
|
if (mapping.getFirstBlockRuntimeId() != null) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren