Skip to content

Commit d104c61

Browse files
committed
fix thread bug in 1.20.1
1 parent 88f5b8c commit d104c61

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/main/java/me/clickism/clicksigns/network/RoadSignPacket.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,19 @@ public void receive(
7575
/*ServerWorld world = player.getServerWorld();
7676
RoadSignPacket packet = fromPacketByteBuf(buf);
7777
*///?}
78-
if (world.getBlockEntity(packet.pos()) instanceof RoadSignBlockEntity entity) {
79-
if (packet.identifier().equals(ClickSigns.ERROR_TEMPLATE_ID)) return;
80-
entity.setRoadSign(packet.toRoadSign());
81-
PlayerLookup.world(world).forEach(p ->
82-
//? if >=1.20.5 {
83-
ServerPlayNetworking.send(p, packet)
84-
//?} else {
85-
/*ServerPlayNetworking.send(p, PACKET_ID, packet.toPacketByteBuf())
86-
*///?}
87-
);
88-
}
78+
world.getServer().execute(() -> {
79+
if (world.getBlockEntity(packet.pos()) instanceof RoadSignBlockEntity entity) {
80+
if (packet.identifier().equals(ClickSigns.ERROR_TEMPLATE_ID)) return;
81+
entity.setRoadSign(packet.toRoadSign());
82+
PlayerLookup.world(world).forEach(p ->
83+
//? if >=1.20.5 {
84+
ServerPlayNetworking.send(p, packet)
85+
//?} else {
86+
/*ServerPlayNetworking.send(p, PACKET_ID, packet.toPacketByteBuf())
87+
*///?}
88+
);
89+
}
90+
});
8991
}
9092
}
9193

0 commit comments

Comments
 (0)