3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-19 14:30:17 +01:00

Merge branch 'master' of https://github.com/GeyserMC/Geyser into feature/1.16.2

Dieser Commit ist enthalten in:
DoctorMacc 2020-07-24 15:45:28 -04:00
Commit 127bc39c53
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6D6E7E059F186DB4
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);
CreativeContentPacket creativePacket = new CreativeContentPacket();
for (int i = 0; i < ItemRegistry.CREATIVE_ITEMS.length; i++) {
creativePacket.getEntries().put(i + 1, ItemRegistry.CREATIVE_ITEMS[i]);
}
creativePacket.setContents(ItemRegistry.CREATIVE_ITEMS);
upstream.sendPacket(creativePacket);
PlayStatusPacket playStatusPacket = new PlayStatusPacket();

Datei anzeigen

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