crash with 1.13.1 client
fensoft opened this issue ยท 2 comments
Hello everyone,
I'm using paperclip 1.13.1 (r192)
I want to open a sign to accept user input. This code was working with previous version but in 1.13.1 it's crashing the client:
List<PacketContainer> packets = new ArrayList<PacketContainer>();
int x = player.getLocation().getBlockX(), y = 1, z = player.getLocation().getBlockZ();
BlockPosition p = new BlockPosition(x, y, z);
WrappedBlockData post = WrappedBlockData.createData(Material.SIGN, 0);
WrappedBlockData air = WrappedBlockData.createData(Material.AIR, 0);
if (defaultText != null) {
PacketContainer packet53 = new PacketContainer(PacketType.Play.Server.BLOCK_CHANGE);
packet53.getBlockPositionModifier().write(0, p);
packet53.getBlockData().write(0, post);
packets.add(packet53);
PacketContainer packet130 = new PacketContainer(PacketType.Play.Server.TILE_ENTITY_DATA);
packet130.getBlockPositionModifier().write(0, p);
packet130.getIntegers().write(0, 9);
if (defaultText.length != 4)
throw new IllegalArgumentException("value must have 4 elements! (have " + defaultText.length + ")");
WrappedChatComponent[] components = new WrappedChatComponent[4];
for (int i = 0; i < 4; i++)
components[i] = WrappedChatComponent.fromText(defaultText[i]);
packet130.getChatComponentArrays().write(0, components);
packets.add(packet130);
}
PacketContainer packet133 = new PacketContainer(PacketType.Play.Server.OPEN_SIGN_EDITOR);
packet133.getBlockPositionModifier().write(0, p);
packets.add(packet133);
if (defaultText != null) {
PacketContainer packet53 = new PacketContainer(PacketType.Play.Server.BLOCK_CHANGE);
packet53.getBlockPositionModifier().write(0, p);
packet53.getBlockData().write(0, air);
packets.add(packet53);
}
try {
for (PacketContainer packet : packets) {
protocolManager.sendServerPacket(player, packet);
}
} catch (InvocationTargetException e) {
e.printStackTrace();
}
Here's the client error:
The game crashed whilst rendering screen
The game crashed whilst rendering screen
Error: java.lang.IllegalArgumentException: Cannot get property bmd{name=facing, clazz=class eq, values=[north, south, west, east]} as it does not exist in Block{minecraft:void_air}
Do you have any idea why it's crashing the client ?
well, the error message is pretty clear, you can open a non existing sign.
seems like you need to always send the block change, not just if you have default text, or your block change code is wrong (could easily just use bukkit api for that)