Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-28 00:50:20 +01:00
ShulkerBoxItemTranslator: Ensure Items ListTag is present (#1221)
* ShulkerBoxItemTranslator: Ensure Items ListTag is present * Compile
Dieser Commit ist enthalten in:
Ursprung
37c4192c12
Commit
2f9ff0c622
@ -35,7 +35,7 @@ import com.nukkitx.nbt.NbtType;
|
|||||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
@ -358,7 +358,7 @@ public abstract class ItemTranslator {
|
|||||||
|
|
||||||
// If its not a message convert it
|
// If its not a message convert it
|
||||||
if (!MessageUtils.isMessage(name)) {
|
if (!MessageUtils.isMessage(name)) {
|
||||||
TextComponent component = LegacyComponentSerializer.legacySection().deserialize(name);
|
Component component = LegacyComponentSerializer.legacySection().deserialize(name);
|
||||||
name = GsonComponentSerializer.gson().serialize(component);
|
name = GsonComponentSerializer.gson().serialize(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ public class ShulkerBoxItemTranslator extends NbtItemStackTranslator {
|
|||||||
if (!itemTag.contains("BlockEntityTag")) return; // Empty shulker box
|
if (!itemTag.contains("BlockEntityTag")) return; // Empty shulker box
|
||||||
|
|
||||||
CompoundTag blockEntityTag = itemTag.get("BlockEntityTag");
|
CompoundTag blockEntityTag = itemTag.get("BlockEntityTag");
|
||||||
|
if (blockEntityTag.get("Items") == null) return;
|
||||||
ListTag itemsList = new ListTag("Items");
|
ListTag itemsList = new ListTag("Items");
|
||||||
for (Tag item : (ListTag) blockEntityTag.get("Items")) {
|
for (Tag item : (ListTag) blockEntityTag.get("Items")) {
|
||||||
CompoundTag itemData = (CompoundTag) item; // Information about the item
|
CompoundTag itemData = (CompoundTag) item; // Information about the item
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren