mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-17 08:05:25 +01:00
Fix npes
This commit is contained in:
parent
1094fd4931
commit
a7484f8644
@ -50,6 +50,7 @@ public class PlayerInit {
|
||||
//instanceContainer = MinecraftServer.getInstanceManager().createInstanceContainer(storageFolder);
|
||||
instanceContainer = MinecraftServer.getInstanceManager().createInstanceContainer(DimensionType.OVERWORLD);
|
||||
instanceContainer.enableAutoChunkLoad(true);
|
||||
//instanceContainer.setChunkDecider((x,y) -> (pos) -> pos.getY()>40?(short)0:(short)1);
|
||||
instanceContainer.setChunkGenerator(noiseTestGenerator);
|
||||
|
||||
/*netherTest = MinecraftServer.getInstanceManager().createInstanceContainer(DimensionType.NETHER);
|
||||
|
@ -342,7 +342,8 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ChunkUtils.isLoaded(instance, position.getX(), position.getZ())) {
|
||||
BlockPosition blockPosition = position.toBlockPosition();
|
||||
if (!ChunkUtils.isLoaded(instance, position.getX(), position.getZ()) || !ChunkUtils.isLoaded(instance, blockPosition.getX(), blockPosition.getZ())) {
|
||||
// No update for entities in unloaded chunk
|
||||
return;
|
||||
}
|
||||
@ -428,7 +429,6 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
||||
|
||||
float drag;
|
||||
if (onGround) {
|
||||
final BlockPosition blockPosition = position.toBlockPosition();
|
||||
final CustomBlock customBlock =
|
||||
instance.getCustomBlock(blockPosition);
|
||||
if (customBlock != null) {
|
||||
|
@ -183,6 +183,8 @@ public class InstanceContainer extends Instance {
|
||||
|
||||
private void callBlockPlace(Chunk chunk, int index, BlockPosition blockPosition) {
|
||||
final CustomBlock actualBlock = chunk.getCustomBlock(index);
|
||||
if (actualBlock == null)
|
||||
return;
|
||||
final Data previousData = chunk.getData(index);
|
||||
actualBlock.onPlace(this, blockPosition, previousData);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user