3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00
Dieser Commit ist enthalten in:
Camotoy 2024-04-27 15:49:19 -04:00
Ursprung 9217414c8c
Commit f47754be03
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
2 geänderte Dateien mit 5 neuen und 28 gelöschten Zeilen

Datei anzeigen

@ -35,20 +35,7 @@ import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponen
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents; import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents;
import org.geysermc.mcprotocollib.protocol.data.game.item.component.Instrument; import org.geysermc.mcprotocollib.protocol.data.game.item.component.Instrument;
import java.util.List;
public class GoatHornItem extends Item { public class GoatHornItem extends Item {
private static final List<String> INSTRUMENTS = List.of(
"ponder_goat_horn",
"sing_goat_horn",
"seek_goat_horn",
"feel_goat_horn",
"admire_goat_horn",
"call_goat_horn",
"yearn_goat_horn",
"dream_goat_horn" // Called "Resist" on Bedrock 1.19.0 due to https://bugs.mojang.com/browse/MCPE-155059
);
public GoatHornItem(String javaIdentifier, Builder builder) { public GoatHornItem(String javaIdentifier, Builder builder) {
super(javaIdentifier, builder); super(javaIdentifier, builder);
} }
@ -60,19 +47,8 @@ public class GoatHornItem extends Item {
return builder; return builder;
} }
Holder<Instrument> instrument = components.get(DataComponentType.INSTRUMENT); Holder<Instrument> instrument = components.get(DataComponentType.INSTRUMENT);
// TODO registry if (instrument != null && instrument.isId()) {
if (instrument != null) { builder.damage(instrument.id());
// Drop the Minecraft namespace if applicable
// if (instrument.startsWith("minecraft:")) {
// instrument = instrument.substring("minecraft:".length());
// }
//
// int damage = INSTRUMENTS.indexOf(instrument);
// if (damage == -1) {
// damage = 0;
// GeyserImpl.getInstance().getLogger().debug("Unknown goat horn instrument: " + instrumentTag.getValue());
// }
// builder.damage(damage);
} }
return builder; return builder;
} }

Datei anzeigen

@ -93,7 +93,8 @@ public final class ItemTranslator {
NbtMap nbt = data.getTag(); NbtMap nbt = data.getTag();
if (nbt != null && !nbt.isEmpty()) { if (nbt != null && !nbt.isEmpty()) {
DataComponents components = new DataComponents(new HashMap<>()); // translateToJava may have added components
DataComponents components = itemStack.getComponents() == null ? new DataComponents(new HashMap<>()) : itemStack.getComponents();
javaItem.translateNbtToJava(nbt, components, bedrockItem); javaItem.translateNbtToJava(nbt, components, bedrockItem);
if (!components.getDataComponents().isEmpty()) { if (!components.getDataComponents().isEmpty()) {
itemStack.setComponents(components); itemStack.setComponents(components);
@ -394,7 +395,7 @@ public final class ItemTranslator {
customName = components.get(DataComponentType.ITEM_NAME); customName = components.get(DataComponentType.ITEM_NAME);
} }
if (customName != null) { if (customName != null) {
// Get the translated name and prefix it with a reset char TODO test // Get the translated name and prefix it with a reset char
return MessageTranslator.convertMessage(customName, session.locale()); return MessageTranslator.convertMessage(customName, session.locale());
} }
} }