3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-20 06:50:10 +01:00

Fix NPE for unknown beds & keep original NBT data

Dieser Commit ist enthalten in:
Matsv 2017-07-29 13:19:59 +02:00
Ursprung ea2f603cf7
Commit dbc92572fd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 97CEC2A2EA31350F
2 geänderte Dateien mit 13 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -52,8 +52,15 @@ public abstract class BlockItemRewriter<T extends BackwardsProtocol> extends Rew
if (i.getTag() == null) if (i.getTag() == null)
i.setTag(new CompoundTag("")); i.setTag(new CompoundTag(""));
// Backup data for toServer
i.getTag().put(createViaNBT(original)); i.getTag().put(createViaNBT(original));
// Keep original data
if (original.getTag() != null)
for (Tag ai : original.getTag())
i.getTag().put(ai);
// Handle colors // Handle colors
if (i.getTag().contains("display")) { if (i.getTag().contains("display")) {
CompoundTag tag = i.getTag().get("display"); CompoundTag tag = i.getTag().get("display");
@ -76,6 +83,8 @@ public abstract class BlockItemRewriter<T extends BackwardsProtocol> extends Rew
data.getItemHandler().handle(i); data.getItemHandler().handle(i);
} }
System.out.println(i);
return i; return i;
} }
@ -146,8 +155,10 @@ public abstract class BlockItemRewriter<T extends BackwardsProtocol> extends Rew
for (int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
int block = section.getBlock(x, y, z); int block = section.getBlock(x, y, z);
int btype = block >> 4; int btype = block >> 4;
int meta = block & 15;
if (containsBlock(btype)) { if (containsBlock(btype)) {
Block b = handleBlock(btype, block & 15); // Type / data Block b = handleBlock(btype, meta); // Type / data
section.setBlock(x, y, z, b.getId(), b.getData()); section.setBlock(x, y, z, b.getId(), b.getData());
} }
// Entity Tags // Entity Tags

Datei anzeigen

@ -45,6 +45,6 @@ public class BlockColors {
} }
public static String get(Integer key) { public static String get(Integer key) {
return colors.get(key); return colors.getOrDefault(key, "Unknown color");
} }
} }