Skip to content

Commit

Permalink
Add chunk loading check
Browse files Browse the repository at this point in the history
  • Loading branch information
zbx1425 committed Jan 3, 2025
1 parent 53d0306 commit 1700779
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/cn/zbx1425/projectme/sync/Synchronizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.lettuce.core.pubsub.StatefulRedisPubSubConnection;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.MinecraftServer;
Expand Down Expand Up @@ -78,6 +79,7 @@ protected void handlePlayerPresence(UUID player, String playerName, ResourceKey<
}
ServerLevel targetLevel = server.getLevel(level);
if (targetLevel == null) return;
if (!targetLevel.isLoaded(new BlockPos((int) position.x, (int) position.y, (int) position.z))) return;
CompoundTag entityInitData = new CompoundTag();
entityInitData.putString("id", ProjectMe.id("projection").toString());
entityInitData.putUUID("projectingPlayer", player);
Expand Down

0 comments on commit 1700779

Please sign in to comment.