Support default biomes in nether and end

This commit is contained in:
tastybento 2020-06-27 14:54:59 -07:00
parent 1016d73545
commit 3a5a866ea5
4 changed files with 51 additions and 11 deletions

View File

@ -146,6 +146,12 @@ public class Settings implements WorldSettings {
@ConfigComment("The default biome for the overworld") @ConfigComment("The default biome for the overworld")
@ConfigEntry(path = "world.default-biome") @ConfigEntry(path = "world.default-biome")
private Biome defaultBiome = Biome.PLAINS; private Biome defaultBiome = Biome.PLAINS;
@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 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") @ConfigComment("The permission acidisland.ban.maxlimit.X where X is a number can also be used per player")
@ -453,7 +459,7 @@ public class Settings implements WorldSettings {
@ConfigComment("List of mobs that should not spawn in BSkyBlock.") @ConfigComment("List of mobs that should not spawn in BSkyBlock.")
@ConfigEntry(path = "protection.block-mobs", since = "1.13.1") @ConfigEntry(path = "protection.block-mobs", since = "1.13.1")
private List<String> mobLimitSettings = new ArrayList<>(); private List<String> mobLimitSettings = new ArrayList<>();
// Invincible visitor settings // Invincible visitor settings
@ConfigComment("Invincible visitors. List of damages that will not affect visitors.") @ConfigComment("Invincible visitors. List of damages that will not affect visitors.")
@ConfigComment("Make list blank if visitors should receive all damages") @ConfigComment("Make list blank if visitors should receive all damages")
@ -1613,7 +1619,7 @@ public class Settings implements WorldSettings {
public void setMaxTrustSize(int maxTrustSize) { public void setMaxTrustSize(int maxTrustSize) {
this.maxTrustSize = maxTrustSize; this.maxTrustSize = maxTrustSize;
} }
/** /**
* @return the defaultNewPlayerAction * @return the defaultNewPlayerAction
*/ */
@ -1658,4 +1664,32 @@ public class Settings implements WorldSettings {
public void setMobLimitSettings(List<String> mobLimitSettings) { public void setMobLimitSettings(List<String> mobLimitSettings) {
this.mobLimitSettings = mobLimitSettings; this.mobLimitSettings = mobLimitSettings;
} }
/**
* @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

@ -49,18 +49,20 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
@Override @Override
public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biomeGrid) { 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); return generateChunks(world);
} }
@SuppressWarnings("deprecation") private void setBiome(World world, BiomeGrid biomeGrid) {
private void setBiome(BiomeGrid biomeGrid) { Biome biome = world.getEnvironment() == Environment.NORMAL ? addon.getSettings().getDefaultBiome() :
Biome biome = addon.getSettings().getDefaultBiome(); world.getEnvironment() == Environment.NETHER ? addon.getSettings().getDefaultNetherBiome() : addon.getSettings().getDefaultEndBiome();
for (int x = 0; x < 16; x++) { for (int x = 0; x < 16; x+=4) {
for (int z = 0; z < 16; z++) { for (int z = 0; z < 16; z+=4) {
biomeGrid.setBiome(x, z, biome); for (int y = 0; y < world.getMaxHeight(); y+=4) {
biomeGrid.setBiome(x, y, z, biome);
}
}
} }
}
} }

View File

@ -90,6 +90,10 @@ world:
default-game-mode: SURVIVAL default-game-mode: SURVIVAL
# The default biome for the overworld # The default biome for the overworld
default-biome: PLAINS default-biome: PLAINS
# 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 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 # The permission acidisland.ban.maxlimit.X where X is a number can also be used per player
# -1 = unlimited # -1 = unlimited
@ -123,7 +127,7 @@ world:
remove-mobs-whitelist: remove-mobs-whitelist:
- ZOMBIE_VILLAGER - ZOMBIE_VILLAGER
- ENDERMAN - ENDERMAN
- PIG_ZOMBIE - ZOMBIFIED_PIGLIN
- WITHER - WITHER
# World flags. These are boolean settings for various flags for this world # World flags. These are boolean settings for various flags for this world
flags: flags: