Skip to content

Commit d54aedc

Browse files
committed
Worldborder on player login
1 parent 24530a4 commit d54aedc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/dev/compactmods/machines/core/ServerEventHandler.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ public static void onWorldLoaded(final WorldEvent.Load evt) {
5555
}
5656
}
5757

58+
@SubscribeEvent
59+
public static void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent evt) {
60+
final var player = evt.getPlayer();
61+
if(player.level.dimension().equals(Registration.COMPACT_DIMENSION) && player instanceof ServerPlayer sp) {
62+
// Send a fake world border to the player instead of the "real" one in overworld
63+
sp.connection.send(new ClientboundInitializeBorderPacket(new WorldBorder()));
64+
}
65+
}
66+
5867
@SubscribeEvent
5968
public static void onPlayerDimChange(final PlayerEvent.PlayerChangedDimensionEvent evt) {
6069
if(evt.getTo().equals(Registration.COMPACT_DIMENSION)) {

0 commit comments

Comments
 (0)