3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-10-03 00:50:05 +02: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)
i.setTag(new CompoundTag(""));
// Backup data for toServer
i.getTag().put(createViaNBT(original));
// Keep original data
if (original.getTag() != null)
for (Tag ai : original.getTag())
i.getTag().put(ai);
// Handle colors
if (i.getTag().contains("display")) {
CompoundTag tag = i.getTag().get("display");
@ -76,6 +83,8 @@ public abstract class BlockItemRewriter<T extends BackwardsProtocol> extends Rew
data.getItemHandler().handle(i);
}
System.out.println(i);
return i;
}
@ -146,8 +155,10 @@ public abstract class BlockItemRewriter<T extends BackwardsProtocol> extends Rew
for (int z = 0; z < 16; z++) {
int block = section.getBlock(x, y, z);
int btype = block >> 4;
int meta = block & 15;
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());
}
// Entity Tags

Datei anzeigen

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