Actually, we should prevent all updates caused by SchematicWorld

This commit is contained in:
reidbhuntley 2021-05-30 14:36:06 -04:00
parent b890204f44
commit a633bc47be
2 changed files with 5 additions and 6 deletions

View file

@ -202,6 +202,9 @@ public class SchematicWorld extends WrappedWorld implements IServerWorld {
return true; return true;
} }
@Override
public void notifyBlockUpdate(BlockPos pos, BlockState oldState, BlockState newState, int flags) { }
@Override @Override
public ITickList<Block> getPendingBlockTicks() { public ITickList<Block> getPendingBlockTicks() {
return EmptyTickList.get(); return EmptyTickList.get();
@ -233,4 +236,5 @@ public class SchematicWorld extends WrappedWorld implements IServerWorld {
} }
throw new IllegalStateException("Cannot use IServerWorld#getWorld in a client environment"); throw new IllegalStateException("Cannot use IServerWorld#getWorld in a client environment");
} }
} }

View file

@ -87,13 +87,8 @@ public class WrappedWorld extends World {
@Override @Override
public void notifyBlockUpdate(BlockPos pos, BlockState oldState, BlockState newState, int flags) { public void notifyBlockUpdate(BlockPos pos, BlockState oldState, BlockState newState, int flags) {
Chunk chunk = world.getChunkProvider().getWorldChunk(pos.getX() >> 4, pos.getZ() >> 4);
if (chunk != null) {
ChunkSection chunksection = chunk.getSections()[SectionPos.toChunk(pos.getY())];
if (chunksection != null)
world.notifyBlockUpdate(pos, oldState, newState, flags); world.notifyBlockUpdate(pos, oldState, newState, flags);
} }
}
@Override @Override
public ITickList<Block> getPendingBlockTicks() { public ITickList<Block> getPendingBlockTicks() {