Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-20 06:50:09 +01:00
Should fix custom items and durability
Dieser Commit ist enthalten in:
Ursprung
f3f30625d4
Commit
6e9b272f50
@ -98,10 +98,10 @@ public class CustomItemRegistryPopulator {
|
||||
}
|
||||
}
|
||||
|
||||
public static GeyserCustomMappingData registerCustomItem(String customItemName, GeyserMappingItem javaItem, CustomItemData customItemData, int bedrockId) {
|
||||
public static GeyserCustomMappingData registerCustomItem(String customItemName, Item javaItem, GeyserMappingItem mapping, CustomItemData customItemData, int bedrockId) {
|
||||
ItemDefinition itemDefinition = new SimpleItemDefinition(customItemName, bedrockId, true);
|
||||
|
||||
NbtMapBuilder builder = createComponentNbt(customItemData, javaItem, customItemName, bedrockId);
|
||||
NbtMapBuilder builder = createComponentNbt(customItemData, javaItem, mapping, customItemName, bedrockId);
|
||||
ComponentItemData componentItemData = new ComponentItemData(customItemName, builder.build());
|
||||
|
||||
return new GeyserCustomMappingData(componentItemData, itemDefinition, customItemName, bedrockId);
|
||||
@ -159,7 +159,7 @@ public class CustomItemRegistryPopulator {
|
||||
return new NonVanillaItemRegistration(componentItemData, item, customItemMapping);
|
||||
}
|
||||
|
||||
private static NbtMapBuilder createComponentNbt(CustomItemData customItemData, GeyserMappingItem mapping,
|
||||
private static NbtMapBuilder createComponentNbt(CustomItemData customItemData, Item javaItem, GeyserMappingItem mapping,
|
||||
String customItemName, int customItemId) {
|
||||
NbtMapBuilder builder = NbtMap.builder();
|
||||
builder.putString("name", customItemName)
|
||||
@ -168,7 +168,7 @@ public class CustomItemRegistryPopulator {
|
||||
NbtMapBuilder itemProperties = NbtMap.builder();
|
||||
NbtMapBuilder componentBuilder = NbtMap.builder();
|
||||
|
||||
setupBasicItemInfo(mapping.getMaxDamage(), mapping.getStackSize(), mapping.getToolType() != null || customItemData.displayHandheld(), customItemData, itemProperties, componentBuilder);
|
||||
setupBasicItemInfo(javaItem.maxDamage(), javaItem.maxStackSize(), mapping.getToolType() != null || customItemData.displayHandheld(), customItemData, itemProperties, componentBuilder);
|
||||
|
||||
boolean canDestroyInCreative = true;
|
||||
if (mapping.getToolType() != null) { // This is not using the isTool boolean because it is not just a render type here.
|
||||
|
@ -398,7 +398,7 @@ public class ItemRegistryPopulator {
|
||||
}
|
||||
|
||||
GeyserCustomMappingData customMapping = CustomItemRegistryPopulator.registerCustomItem(
|
||||
customItemName, mappingItem, customItem, customProtocolId
|
||||
customItemName, javaItem, mappingItem, customItem, customProtocolId
|
||||
);
|
||||
// ComponentItemData - used to register some custom properties
|
||||
componentItemData.add(customMapping.componentItemData());
|
||||
|
@ -37,12 +37,10 @@ public class GeyserMappingItem {
|
||||
@JsonProperty("bedrock_data") int bedrockData;
|
||||
Integer firstBlockRuntimeId;
|
||||
Integer lastBlockRuntimeId;
|
||||
@JsonProperty("stack_size") int stackSize = 64;
|
||||
@JsonProperty("tool_type") String toolType;
|
||||
@JsonProperty("tool_tier") String toolTier;
|
||||
@JsonProperty("armor_type") String armorType;
|
||||
@JsonProperty("protection_value") int protectionValue;
|
||||
@JsonProperty("max_damage") int maxDamage = 0;
|
||||
@JsonProperty("is_edible") boolean edible = false;
|
||||
@JsonProperty("is_entity_placer") boolean entityPlacer = false;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren