3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-28 00:50:20 +01:00
Dieser Commit ist enthalten in:
AJ Ferguson 2020-07-24 11:42:15 -08:00 committet von GitHub
Ursprung b103d86ff9
Commit 5b1116b15a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 15 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -234,9 +234,7 @@ public class GeyserSession implements CommandSender {
upstream.sendPacket(entityPacket); upstream.sendPacket(entityPacket);
CreativeContentPacket creativePacket = new CreativeContentPacket(); CreativeContentPacket creativePacket = new CreativeContentPacket();
for (int i = 0; i < ItemRegistry.CREATIVE_ITEMS.length; i++) { creativePacket.setContents(ItemRegistry.CREATIVE_ITEMS);
creativePacket.getEntries().put(i + 1, ItemRegistry.CREATIVE_ITEMS[i]);
}
upstream.sendPacket(creativePacket); upstream.sendPacket(creativePacket);
PlayStatusPacket playStatusPacket = new PlayStatusPacket(); PlayStatusPacket playStatusPacket = new PlayStatusPacket();

Datei anzeigen

@ -163,24 +163,24 @@ public class ItemRegistry {
throw new AssertionError(LanguageUtils.getLocaleStringLog("geyser.toolbox.fail.creative"), e); throw new AssertionError(LanguageUtils.getLocaleStringLog("geyser.toolbox.fail.creative"), e);
} }
int netId = 1;
List<ItemData> creativeItems = new ArrayList<>(); List<ItemData> creativeItems = new ArrayList<>();
for (JsonNode itemNode : creativeItemEntries) { for (JsonNode itemNode : creativeItemEntries) {
try {
short damage = 0; short damage = 0;
NbtMap tag = null;
if (itemNode.has("damage")) { if (itemNode.has("damage")) {
damage = itemNode.get("damage").numberValue().shortValue(); damage = itemNode.get("damage").numberValue().shortValue();
} }
if (itemNode.has("nbt_b64")) { if (itemNode.has("nbt_b64")) {
byte[] bytes = Base64.getDecoder().decode(itemNode.get("nbt_b64").asText()); byte[] bytes = Base64.getDecoder().decode(itemNode.get("nbt_b64").asText());
ByteArrayInputStream bais = new ByteArrayInputStream(bytes); ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
try { tag = (NbtMap) NbtUtils.createReaderLE(bais).readTag();
NbtMap tag = (NbtMap) NbtUtils.createReaderLE(bais).readTag(); }
creativeItems.add(ItemData.of(itemNode.get("id").asInt(), damage, 1, tag)); creativeItems.add(ItemData.fromNet(netId++, itemNode.get("id").asInt(), damage, 1, tag));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} else {
creativeItems.add(ItemData.of(itemNode.get("id").asInt(), damage, 1));
}
} }
CREATIVE_ITEMS = creativeItems.toArray(new ItemData[0]); CREATIVE_ITEMS = creativeItems.toArray(new ItemData[0]);
} }