Added default biomes for nether end. 1.16.1 only from now on.

This commit is contained in:
tastybento 2020-06-29 18:48:10 -07:00
parent f7a9342c4d
commit 50d234b9b2
5 changed files with 59 additions and 24 deletions

View File

@ -229,6 +229,12 @@ public class AISettings implements WorldSettings {
@ConfigComment("The default biome for the overworld")
@ConfigEntry(path = "world.default-biome")
private Biome defaultBiome = Biome.WARM_OCEAN;
@ConfigComment("The default biome for the nether world (this may affect what mobs can spawn)")
@ConfigEntry(path = "world.default-nether-biome")
private Biome defaultNetherBiome = Biome.NETHER_WASTES;
@ConfigComment("The default biome for the end world (this may affect what mobs can spawn)")
@ConfigEntry(path = "world.default-end-biome")
private Biome defaultEndBiome = Biome.THE_END;
@ConfigComment("The maximum number of players a player can ban at any one time in this game mode.")
@ConfigComment("The permission acidisland.ban.maxlimit.X where X is a number can also be used per player")
@ -1791,4 +1797,28 @@ public class AISettings implements WorldSettings {
public void setDefaultPlayerAction(String defaultPlayerAction) {
this.defaultPlayerAction = defaultPlayerAction;
}
/**
* @return the defaultNetherBiome
*/
public Biome getDefaultNetherBiome() {
return defaultNetherBiome;
}
/**
* @param defaultNetherBiome the defaultNetherBiome to set
*/
public void setDefaultNetherBiome(Biome defaultNetherBiome) {
this.defaultNetherBiome = defaultNetherBiome;
}
/**
* @return the defaultEndBiome
*/
public Biome getDefaultEndBiome() {
return defaultEndBiome;
}
/**
* @param defaultEndBiome the defaultEndBiome to set
*/
public void setDefaultEndBiome(Biome defaultEndBiome) {
this.defaultEndBiome = defaultEndBiome;
}
}

View File

@ -56,19 +56,20 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
@Override
public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biomeGrid) {
if (world.getEnvironment().equals(Environment.NORMAL)) setBiome(biomeGrid);
setBiome(world, biomeGrid);
return generateChunks(world);
}
@SuppressWarnings("deprecation")
private void setBiome(BiomeGrid biomeGrid) {
Biome biome = addon.getSettings().getDefaultBiome();
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
biomeGrid.setBiome(x, z, biome);
private void setBiome(World world, BiomeGrid biomeGrid) {
Biome biome = world.getEnvironment() == Environment.NORMAL ? addon.getSettings().getDefaultBiome() :
world.getEnvironment() == Environment.NETHER ? addon.getSettings().getDefaultNetherBiome() : addon.getSettings().getDefaultEndBiome();
for (int x = 0; x < 16; x+=4) {
for (int z = 0; z < 16; z+=4) {
for (int y = 0; y < world.getMaxHeight(); y+=4) {
biomeGrid.setBiome(x, y, z, biome);
}
}
}
}
// This needs to be set to return true to override minecraft's default

View File

@ -1,7 +1,7 @@
name: AcidIsland
main: world.bentobox.acidisland.AcidIsland
version: ${version}${build.number}
api-version: 1.13.0
api-version: 1.14
metrics: true
repository: "BentoBoxWorld/AcidIsland"
icon: "OAK_BOAT"

View File

@ -141,6 +141,10 @@ world:
default-game-mode: SURVIVAL
# The default biome for the overworld
default-biome: WARM_OCEAN
# The default biome for the nether world (this may affect what mobs can spawn)
default-nether-biome: NETHER_WASTES
# The default biome for the end world (this may affect what mobs can spawn)
default-end-biome: THE_END
# The maximum number of players a player can ban at any one time in this game mode.
# The permission acidisland.ban.maxlimit.X where X is a number can also be used per player
# -1 = unlimited
@ -186,7 +190,7 @@ world:
# This setting is toggled in world flags and set by the settings GUI.
# Mob white list - these mobs will NOT be removed when logging in or doing /island
remove-mobs-whitelist:
- PIG_ZOMBIE
- ZOMBIFIED_PIGLIN
- ZOMBIE_VILLAGER
- WITHER
- ENDERMAN

View File

@ -65,6 +65,7 @@ public class ChunkGeneratorWorldTest {
when(Bukkit.getServer()).thenReturn(server);
// World
when(world.getEnvironment()).thenReturn(World.Environment.NORMAL);
when(world.getMaxHeight()).thenReturn(256);
// Settings
when(addon.getSettings()).thenReturn(settings);
when(settings.getSeaHeight()).thenReturn(0);
@ -84,7 +85,6 @@ public class ChunkGeneratorWorldTest {
/**
* Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
*/
@SuppressWarnings("deprecation")
@Test
public void testGenerateChunkDataWorldRandomIntIntBiomeGridOverworldVoid() {
ChunkData cd = cg.generateChunkData(world, random, 0 , 0 , biomeGrid);
@ -92,7 +92,7 @@ public class ChunkGeneratorWorldTest {
// Verifications
// Default biome
verify(settings).getDefaultBiome();
verify(biomeGrid, times(16 * 16)).setBiome(anyInt(), anyInt(), any());
verify(biomeGrid, times(1024)).setBiome(anyInt(), anyInt(), anyInt(), any());
// Sea height
verify(settings).getSeaHeight();
// Void
@ -102,7 +102,6 @@ public class ChunkGeneratorWorldTest {
/**
* Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
*/
@SuppressWarnings("deprecation")
@Test
public void testGenerateChunkDataWorldRandomIntIntBiomeGridOverworldSea() {
// Set sea height
@ -114,7 +113,7 @@ public class ChunkGeneratorWorldTest {
// Verifications
// Default biome
verify(settings).getDefaultBiome();
verify(biomeGrid, times(16 * 16)).setBiome(anyInt(), anyInt(), any());
verify(biomeGrid, times(1024)).setBiome(anyInt(), anyInt(), anyInt(), any());
// Sea height
verify(settings, times(2)).getSeaHeight();
// Water. Blocks = 16 x 16 x 11 because block 0
@ -124,7 +123,6 @@ public class ChunkGeneratorWorldTest {
/**
* Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
*/
@SuppressWarnings("deprecation")
@Test
public void testGenerateChunkDataWorldRandomIntIntBiomeGridEnd() {
when(world.getEnvironment()).thenReturn(World.Environment.THE_END);
@ -132,9 +130,9 @@ public class ChunkGeneratorWorldTest {
assertEquals(data, cd);
// Verifications
// Default biome
verify(settings, never()).getDefaultBiome();
// Never set biome in end
verify(biomeGrid, never()).setBiome(anyInt(), anyInt(), any());
verify(settings).getDefaultEndBiome();
// Set biome in end
verify(biomeGrid, times(1024)).setBiome(anyInt(), anyInt(), anyInt(), any());
// Sea height
verify(settings).getSeaHeight();
// Void
@ -144,17 +142,18 @@ public class ChunkGeneratorWorldTest {
/**
* Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
*/
@SuppressWarnings("deprecation")
@Test
public void testGenerateChunkDataWorldRandomIntIntBiomeGridNetherWithRoof() {
when(world.getEnvironment()).thenReturn(World.Environment.NETHER);
ChunkData cd = cg.generateChunkData(world, random, 0 , 0 , biomeGrid);
assertEquals(data, cd);
// Verifications
// Default biome
verify(settings).getDefaultNetherBiome();
// Nether roof check
verify(settings).isNetherRoof();
// Never set biome in nether
verify(biomeGrid, never()).setBiome(anyInt(), anyInt(), any());
verify(biomeGrid, times(1024)).setBiome(anyInt(), anyInt(), anyInt(), any());
// Nether roof - at least bedrock layer
verify(cd, atLeast(16 * 16)).setBlock(anyInt(), anyInt(), anyInt(), eq(Material.BEDROCK));
}
@ -162,7 +161,6 @@ public class ChunkGeneratorWorldTest {
/**
* Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
*/
@SuppressWarnings("deprecation")
@Test
public void testGenerateChunkDataWorldRandomIntIntBiomeGridNetherNoRoof() {
when(settings.isNetherRoof()).thenReturn(false);
@ -172,8 +170,10 @@ public class ChunkGeneratorWorldTest {
// Verifications
// Nether roof check
verify(settings).isNetherRoof();
// Nether roof check
verify(settings).isNetherRoof();
// Never set biome in nether
verify(biomeGrid, never()).setBiome(anyInt(), anyInt(), any());
verify(biomeGrid, times(1024)).setBiome(anyInt(), anyInt(), anyInt(), any());
// Nether roof - at least bedrock layer
verify(cd, never()).setBlock(anyInt(), anyInt(), anyInt(), any(Material.class));
}