mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Merge branch 'master' into optional-pack-detection
This commit is contained in:
commit
16efe8eec5
2 changed files with 5 additions and 4 deletions
|
@ -52,6 +52,7 @@ import org.geysermc.geyser.text.ChatColor;
|
||||||
import org.geysermc.geyser.text.MinecraftLocale;
|
import org.geysermc.geyser.text.MinecraftLocale;
|
||||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||||
import org.geysermc.geyser.util.InventoryUtils;
|
import org.geysermc.geyser.util.InventoryUtils;
|
||||||
|
import org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.AttributeType;
|
||||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.ModifierOperation;
|
import org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.ModifierOperation;
|
||||||
import org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack;
|
import org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack;
|
||||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.*;
|
import org.geysermc.mcprotocollib.protocol.data.game.item.component.*;
|
||||||
|
@ -209,7 +210,7 @@ public final class ItemTranslator {
|
||||||
Map<ItemAttributeModifiers.EquipmentSlotGroup, List<String>> slotsToModifiers = new HashMap<>();
|
Map<ItemAttributeModifiers.EquipmentSlotGroup, List<String>> slotsToModifiers = new HashMap<>();
|
||||||
for (ItemAttributeModifiers.Entry entry : modifiers.getModifiers()) {
|
for (ItemAttributeModifiers.Entry entry : modifiers.getModifiers()) {
|
||||||
// convert the modifier tag to a lore entry
|
// convert the modifier tag to a lore entry
|
||||||
String loreEntry = attributeToLore(entry.getModifier(), language);
|
String loreEntry = attributeToLore(entry.getAttribute(), entry.getModifier(), language);
|
||||||
if (loreEntry == null) {
|
if (loreEntry == null) {
|
||||||
continue; // invalid or failed
|
continue; // invalid or failed
|
||||||
}
|
}
|
||||||
|
@ -254,13 +255,13 @@ public final class ItemTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private static String attributeToLore(ItemAttributeModifiers.AttributeModifier modifier, String language) {
|
private static String attributeToLore(int attribute, ItemAttributeModifiers.AttributeModifier modifier, String language) {
|
||||||
double amount = modifier.getAmount();
|
double amount = modifier.getAmount();
|
||||||
if (amount == 0) {
|
if (amount == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = modifier.getId().asMinimalString();
|
String name = AttributeType.Builtin.from(attribute).getIdentifier().asMinimalString();
|
||||||
// the namespace does not need to be present, but if it is, the java client ignores it as of pre-1.20.5
|
// the namespace does not need to be present, but if it is, the java client ignores it as of pre-1.20.5
|
||||||
|
|
||||||
ModifierOperation operation = modifier.getOperation();
|
ModifierOperation operation = modifier.getOperation();
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 23cb22f9ceeb7f24b896a69a711944d7f3e756ed
|
Subproject commit 69e302bf3a118e5274f86b23a1818c61dba84c64
|
Loading…
Add table
Add a link
Reference in a new issue