Reworked nether and end ocean bottomss and added configs. #149

This commit is contained in:
tastybento 2024-03-04 18:22:56 -08:00
parent ac5dedf156
commit abbc9ab319
3 changed files with 96 additions and 7 deletions

View File

@ -220,6 +220,21 @@ public class AISettings implements WorldSettings {
@ConfigEntry(path = "world.ocean-floor", needsReset = true) @ConfigEntry(path = "world.ocean-floor", needsReset = true)
private boolean oceanFloor = false; private boolean oceanFloor = false;
@ConfigComment("Structures")
@ConfigComment("This creates an vanilla structures in the worlds.")
@ConfigEntry(path = "world.make-structures", needsReset = true)
private boolean makeStructures = false;
@ConfigComment("Caves")
@ConfigComment("This creates an vanilla caves in the worlds.")
@ConfigEntry(path = "world.make-caves", needsReset = true)
private boolean makeCaves = false;
@ConfigComment("Decorations")
@ConfigComment("This creates an vanilla decorations in the worlds.")
@ConfigEntry(path = "world.make-decorations", needsReset = true)
private boolean makeDecorations = true;
@ConfigComment("Maximum number of islands in the world. Set to -1 or 0 for unlimited. ") @ConfigComment("Maximum number of islands in the world. Set to -1 or 0 for unlimited. ")
@ConfigComment("If the number of islands is greater than this number, no new island will be created.") @ConfigComment("If the number of islands is greater than this number, no new island will be created.")
@ConfigEntry(path = "world.max-islands") @ConfigEntry(path = "world.max-islands")
@ -2024,4 +2039,46 @@ public class AISettings implements WorldSettings {
public void setOceanFloor(boolean oceanFloor) { public void setOceanFloor(boolean oceanFloor) {
this.oceanFloor = oceanFloor; this.oceanFloor = oceanFloor;
} }
/**
* @return the makeStructures
*/
public boolean isMakeStructures() {
return makeStructures;
}
/**
* @param makeStructures the makeStructures to set
*/
public void setMakeStructures(boolean makeStructures) {
this.makeStructures = makeStructures;
}
/**
* @return the makeCaves
*/
public boolean isMakeCaves() {
return makeCaves;
}
/**
* @param makeCaves the makeCaves to set
*/
public void setMakeCaves(boolean makeCaves) {
this.makeCaves = makeCaves;
}
/**
* @return the makeDecorations
*/
public boolean isMakeDecorations() {
return makeDecorations;
}
/**
* @param makeDecorations the makeDecorations to set
*/
public void setMakeDecorations(boolean makeDecorations) {
this.makeDecorations = makeDecorations;
}
} }

View File

@ -27,10 +27,17 @@ import world.bentobox.acidisland.AcidIsland;
*/ */
public class ChunkGeneratorWorld extends ChunkGenerator { public class ChunkGeneratorWorld extends ChunkGenerator {
private record FloorMats(Material base, Material top) {
}
private final AcidIsland addon; private final AcidIsland addon;
private final Random rand = new Random(); private final Random rand = new Random();
private final Map<Environment, WorldConfig> seaHeight = new EnumMap<>(Environment.class); private final Map<Environment, WorldConfig> seaHeight = new EnumMap<>(Environment.class);
private final Map<Vector, Material> roofChunk = new HashMap<>(); private final Map<Vector, Material> roofChunk = new HashMap<>();
private static final Map<Environment, FloorMats> floorMats = Map.of(Environment.NETHER,
new FloorMats(Material.NETHERRACK, Material.SOUL_SAND), Environment.NORMAL,
new FloorMats(Material.SANDSTONE, Material.SAND), Environment.THE_END,
new FloorMats(Material.END_STONE, Material.END_STONE));
private PerlinOctaveGenerator gen; private PerlinOctaveGenerator gen;
private record WorldConfig(int seaHeight, Material waterBlock) {} private record WorldConfig(int seaHeight, Material waterBlock) {}
@ -72,7 +79,8 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
for (int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
int n = (int)(25 * gen.noise((chunkX << 4) + (double)x, (chunkZ << 4) + (double)z, 0.5, 0.5, true)); int n = (int)(25 * gen.noise((chunkX << 4) + (double)x, (chunkZ << 4) + (double)z, 0.5, 0.5, true));
for (int y = worldInfo.getMinHeight(); y < 25 + n; y++) { for (int y = worldInfo.getMinHeight(); y < 25 + n; y++) {
chunkData.setBlock(x, y, z, rand.nextBoolean() ? Material.SAND : Material.SANDSTONE); chunkData.setBlock(x, y, z, rand.nextBoolean() ? floorMats.get(worldInfo.getEnvironment()).top()
: floorMats.get(worldInfo.getEnvironment()).base());
} }
} }
} }
@ -90,11 +98,11 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
} }
@Override @Override
public boolean shouldGenerateCaves() { public boolean shouldGenerateCaves() {
return addon.getSettings().isOceanFloor(); return addon.getSettings().isMakeCaves();
} }
@Override @Override
public boolean shouldGenerateDecorations() { public boolean shouldGenerateDecorations() {
return addon.getSettings().isOceanFloor(); return addon.getSettings().isMakeDecorations();
} }
@Override @Override
public boolean shouldGenerateMobs() { public boolean shouldGenerateMobs() {
@ -102,7 +110,7 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
} }
@Override @Override
public boolean shouldGenerateStructures() { public boolean shouldGenerateStructures() {
return addon.getSettings().isOceanFloor(); return addon.getSettings().isMakeStructures();
} }
@Override @Override

View File

@ -139,6 +139,18 @@ world:
# This creates an ocean floor environment, with vanilla elements. # This creates an ocean floor environment, with vanilla elements.
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds. # /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
ocean-floor: true ocean-floor: true
# Structures
# This creates an vanilla structures in the worlds.
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
make-structures: false
# Caves
# This creates an vanilla caves in the worlds.
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
make-caves: false
# Decorations
# This creates an vanilla decorations in the worlds.
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
make-decorations: true
# Maximum number of islands in the world. Set to -1 or 0 for unlimited. # Maximum number of islands in the world. Set to -1 or 0 for unlimited.
# If the number of islands is greater than this number, no new island will be created. # If the number of islands is greater than this number, no new island will be created.
max-islands: 0 max-islands: 0
@ -212,9 +224,9 @@ world:
# Mob white list - these mobs will NOT be removed when logging in or doing /island # Mob white list - these mobs will NOT be removed when logging in or doing /island
remove-mobs-whitelist: remove-mobs-whitelist:
- ZOMBIE_VILLAGER - ZOMBIE_VILLAGER
- ENDERMAN
- ZOMBIFIED_PIGLIN
- WITHER - WITHER
- ZOMBIFIED_PIGLIN
- ENDERMAN
# 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:
CREEPER_DAMAGE: true CREEPER_DAMAGE: true
@ -229,18 +241,21 @@ world:
NATURAL_SPAWNING_OUTSIDE_RANGE: true NATURAL_SPAWNING_OUTSIDE_RANGE: true
ENTER_EXIT_MESSAGES: true ENTER_EXIT_MESSAGES: true
ENDERMAN_DEATH_DROP: true ENDERMAN_DEATH_DROP: true
LIQUIDS_FLOWING_OUT: false
OFFLINE_REDSTONE: true OFFLINE_REDSTONE: true
REMOVE_END_EXIT_ISLAND: true REMOVE_END_EXIT_ISLAND: true
OFFLINE_GROWTH: true OFFLINE_GROWTH: true
REMOVE_MOBS: true REMOVE_MOBS: true
ENDER_CHEST: false ENDER_CHEST: false
ITEM_FRAME_DAMAGE: false ITEM_FRAME_DAMAGE: false
TREES_GROWING_OUTSIDE_RANGE: false
BOAT: true BOAT: true
# These are the default protection settings for new islands. # These are the default protection settings for new islands.
# The value is the minimum island rank required allowed to do the action # The value is the minimum island rank required allowed to do the action
# Ranks are: Visitor = 0, Member = 900, Owner = 1000 # Ranks are: Visitor = 0, Member = 900, Owner = 1000
default-island-flags: default-island-flags:
HURT_ANIMALS: 500 HURT_ANIMALS: 500
LOOM: 500
DRAGON_EGG: 500 DRAGON_EGG: 500
REDSTONE: 500 REDSTONE: 500
BUCKET: 500 BUCKET: 500
@ -256,6 +271,8 @@ world:
END_PORTAL: 500 END_PORTAL: 500
BREEDING: 500 BREEDING: 500
HURT_VILLAGERS: 500 HURT_VILLAGERS: 500
BOOKSHELF: 500
HARVEST: 500
TURTLE_EGGS: 500 TURTLE_EGGS: 500
FROST_WALKER: 500 FROST_WALKER: 500
COLLECT_LAVA: 500 COLLECT_LAVA: 500
@ -268,6 +285,7 @@ world:
NAME_TAG: 500 NAME_TAG: 500
ARMOR_STAND: 500 ARMOR_STAND: 500
CHANGE_SETTINGS: 1000 CHANGE_SETTINGS: 1000
SIGN_EDITING: 500
TRADING: 0 TRADING: 0
EGGS: 500 EGGS: 500
ITEM_DROP: 0 ITEM_DROP: 0
@ -278,6 +296,7 @@ world:
SCULK_SENSOR: 500 SCULK_SENSOR: 500
LECTERN: 500 LECTERN: 500
SHULKER_BOX: 500 SHULKER_BOX: 500
GRINDSTONE: 500
ITEM_PICKUP: 0 ITEM_PICKUP: 0
CROP_TRAMPLE: 500 CROP_TRAMPLE: 500
DROPPER: 500 DROPPER: 500
@ -287,6 +306,7 @@ world:
AXOLOTL_SCOOPING: 500 AXOLOTL_SCOOPING: 500
BUTTON: 500 BUTTON: 500
COMPOSTER: 500 COMPOSTER: 500
STONECUTTING: 500
FIRE_EXTINGUISH: 500 FIRE_EXTINGUISH: 500
COMMAND_RANKS: 500 COMMAND_RANKS: 500
BEACON: 500 BEACON: 500
@ -298,6 +318,7 @@ world:
HIVE: 500 HIVE: 500
ITEM_FRAME: 500 ITEM_FRAME: 500
PLACE_BLOCKS: 500 PLACE_BLOCKS: 500
CROP_PLANTING: 500
CRAFTING: 0 CRAFTING: 0
SHEARING: 500 SHEARING: 500
ENCHANTING: 0 ENCHANTING: 0
@ -309,6 +330,7 @@ world:
DISPENSER: 500 DISPENSER: 500
SCULK_SHRIEKER: 500 SCULK_SHRIEKER: 500
GATE: 0 GATE: 0
SMITHING: 500
EXPERIENCE_PICKUP: 500 EXPERIENCE_PICKUP: 500
HOPPER: 500 HOPPER: 500
LEASH: 500 LEASH: 500
@ -320,13 +342,16 @@ world:
POTION_THROWING: 500 POTION_THROWING: 500
BARREL: 500 BARREL: 500
COLLECT_POWDERED_SNOW: 500 COLLECT_POWDERED_SNOW: 500
CARTOGRAPHY: 500
# These are the default settings for new islands # These are the default settings for new islands
default-island-settings: default-island-settings:
PVP_END: false PVP_END: false
PVP_NETHER: false PVP_NETHER: false
LEAF_DECAY: true LEAF_DECAY: true
ENDERMAN_TELEPORT: true
ANIMAL_NATURAL_SPAWN: true ANIMAL_NATURAL_SPAWN: true
MONSTER_NATURAL_SPAWN: true MONSTER_NATURAL_SPAWN: true
SHULKER_TELEPORT: true
FIRE_SPREAD: true FIRE_SPREAD: true
FIRE_BURNING: true FIRE_BURNING: true
PVP_OVERWORLD: false PVP_OVERWORLD: false
@ -551,4 +576,3 @@ protection:
do-not-edit-these-settings: do-not-edit-these-settings:
# These settings should not be edited # These settings should not be edited
reset-epoch: 0 reset-epoch: 0