This commit is contained in:
Eoghanmc22 2020-08-15 18:01:10 -04:00
parent 1094fd4931
commit a7484f8644
3 changed files with 5 additions and 2 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -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);
}