@Inject(method = "trySpawnGolem", at = @At("HEAD"), cancellable = true) private void checkChunkBeforeTrySpawnGolem(World world, BlockPos pos, CallbackInfo callbackInfo) { final Chunk chunk = world.getChunkFromBlockCoords(pos); if (chunk == null || chunk.isEmpty() || !chunk.isTerrainPopulated()) { callbackInfo.cancel(); } }
@Override public void populate(IChunkProvider ichunkprovider, int i, int j) { Chunk chunk = this.provideChunk(i, j); if (!chunk.isTerrainPopulated) { chunk.isTerrainPopulated = true; if (ichunkprovider != null) { ichunkprovider.populate(ichunkprovider, i, j); for (Object decorator : decorators) { ((ILandDecorator) decorator).generate(landWorld, random, i, j, this); } chunk.setChunkModified(); } } }