Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-26 08:10:10 +01:00
Fix NPE for unknown beds & keep original NBT data
Dieser Commit ist enthalten in:
Ursprung
ea2f603cf7
Commit
dbc92572fd
@ -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
|
||||
|
@ -45,6 +45,6 @@ public class BlockColors {
|
||||
}
|
||||
|
||||
public static String get(Integer key) {
|
||||
return colors.get(key);
|
||||
return colors.getOrDefault(key, "Unknown color");
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren