Skip to content

Commit

Permalink
Make superflat check more accurate
Browse files Browse the repository at this point in the history
Will allow fix superflat to run in SkyGrid.

BentoBoxWorld/SkyGrid#22
  • Loading branch information
tastybento committed Jul 27, 2019
1 parent 2403cd2 commit 10b8c51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,11 @@ private boolean noClean(World world, ChunkLoadEvent e) {
if (!ready) {
return true;
}
// Clean super flat does not work if the world handles its own generator explicitly
if (getIWM().inWorld(world) && Flags.CLEAN_SUPER_FLAT.isSetForWorld(world) && getIWM().isUseOwnGenerator(world)) {
Flags.CLEAN_SUPER_FLAT.setSetting(world, false);
getPlugin().logWarning("Clean super flat is not available for " + world.getName());
return true;
}

if (!getIWM().inWorld(world) || !Flags.CLEAN_SUPER_FLAT.isSetForWorld(world) ||
(!e.getChunk().getBlock(0, 0, 0).getType().equals(Material.BEDROCK)
(!(e.getChunk().getBlock(0, 0, 0).getType().equals(Material.BEDROCK)
&& e.getChunk().getBlock(0, 1, 0).getType().equals(Material.DIRT)
&& e.getChunk().getBlock(0, 2, 0).getType().equals(Material.DIRT)
&& e.getChunk().getBlock(0, 3, 0).getType().equals(Material.GRASS_BLOCK))
|| (world.getEnvironment().equals(Environment.NETHER) && (!plugin.getIWM().isNetherGenerate(world)
|| !plugin.getIWM().isNetherIslands(world)))
|| (world.getEnvironment().equals(Environment.THE_END) && (!plugin.getIWM().isEndGenerate(world)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ public void setUp() throws Exception {
chunk = mock(Chunk.class);
when(chunk.getWorld()).thenReturn(world);
block = mock(Block.class);
when(block.getType()).thenReturn(Material.BEDROCK);
// Super flat!
when(block.getType()).thenReturn(Material.BEDROCK, Material.DIRT, Material.DIRT, Material.GRASS_BLOCK);
when(chunk.getBlock(Mockito.anyInt(), Mockito.anyInt(), Mockito.anyInt())).thenReturn(block);

// Fire the ready event
Expand Down

0 comments on commit 10b8c51

Please sign in to comment.