mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-21 15:41:38 +01:00
fix: send LEVEL_CHUNKS_LOAD_START state on all instance changes, not just first join
This commit is contained in:
parent
0d21e487d2
commit
1813cdb1a8
@ -28,6 +28,7 @@ import net.minestom.server.item.metadata.BundleMeta;
|
||||
import net.minestom.server.monitoring.BenchmarkManager;
|
||||
import net.minestom.server.monitoring.TickMonitor;
|
||||
import net.minestom.server.utils.MathUtils;
|
||||
import net.minestom.server.utils.NamespaceID;
|
||||
import net.minestom.server.utils.time.TimeUnit;
|
||||
import net.minestom.server.world.DimensionType;
|
||||
|
||||
@ -151,6 +152,11 @@ public class PlayerInit {
|
||||
instanceContainer.setGenerator(unit -> unit.modifier().fillHeight(0, 40, Block.STONE));
|
||||
instanceContainer.setChunkSupplier(LightingChunk::new);
|
||||
|
||||
var i2 = new InstanceContainer(UUID.randomUUID(), DimensionType.OVERWORLD, null, NamespaceID.from("minestom:demo"));
|
||||
instanceManager.registerInstance(i2);
|
||||
i2.setGenerator(unit -> unit.modifier().fillHeight(0, 40, Block.GRASS_BLOCK));
|
||||
i2.setChunkSupplier(LightingChunk::new);
|
||||
|
||||
// System.out.println("start");
|
||||
// var chunks = new ArrayList<CompletableFuture<Chunk>>();
|
||||
// ChunkUtils.forChunksInRange(0, 0, 32, (x, z) -> chunks.add(instanceContainer.loadChunk(x, z)));
|
||||
|
@ -349,9 +349,6 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
refreshHealth(); // Heal and send health packet
|
||||
refreshAbilities(); // Send abilities packet
|
||||
|
||||
// Start chunk load
|
||||
sendPacket(new ChangeGameStatePacket(ChangeGameStatePacket.Reason.LEVEL_CHUNKS_LOAD_START, 0));
|
||||
|
||||
return setInstance(spawnInstance);
|
||||
}
|
||||
|
||||
@ -756,6 +753,9 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
if (dimensionChange || firstSpawn) {
|
||||
this.inventory.update();
|
||||
sendPacket(new HeldItemChangePacket(heldSlot));
|
||||
|
||||
// Tell the client to leave the loading terrain screen
|
||||
sendPacket(new ChangeGameStatePacket(ChangeGameStatePacket.Reason.LEVEL_CHUNKS_LOAD_START, 0));
|
||||
}
|
||||
|
||||
EventDispatcher.call(new PlayerSpawnEvent(this, instance, firstSpawn));
|
||||
|
Loading…
Reference in New Issue
Block a user