From b6cba19314f136942877b91e50f7cbf4dd7a8fed Mon Sep 17 00:00:00 2001 From: Shyanne Date: Sat, 23 Sep 2023 14:00:40 -0400 Subject: [PATCH 01/19] implementing the ocean generator --- .../iridiumskyblock/IridiumSkyblock.java | 16 +- .../configs/Configuration.java | 1 + .../iridiumskyblock/configs/Generators.java | 95 ++++++++ .../generators/OceanGenerator.java | 229 ++++++++++++++++++ .../generators/VoidGenerator.java | 18 +- 5 files changed, 357 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/iridium/iridiumskyblock/configs/Generators.java create mode 100644 src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java diff --git a/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java b/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java index f4e5d683f..2fc2cec40 100644 --- a/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java +++ b/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java @@ -3,6 +3,7 @@ import com.iridium.iridiumskyblock.configs.*; import com.iridium.iridiumskyblock.database.Island; import com.iridium.iridiumskyblock.database.User; +import com.iridium.iridiumskyblock.generators.OceanGenerator; import com.iridium.iridiumskyblock.generators.VoidGenerator; import com.iridium.iridiumskyblock.listeners.*; import com.iridium.iridiumskyblock.managers.*; @@ -49,6 +50,7 @@ public class IridiumSkyblock extends IridiumTeams { private Schematics schematics; private Shop shop; private Settings settings; + private Generators generators; private IslandPlaceholderBuilder teamsPlaceholderBuilder; private UserPlaceholderBuilder userPlaceholderBuilder; @@ -78,7 +80,17 @@ public IridiumSkyblock() { @Override public void onLoad() { super.onLoad(); - this.chunkGenerator = new VoidGenerator(); + + switch(IridiumSkyblock.getInstance().getConfiguration().generatorType) { + case "ocean": { + this.chunkGenerator = new OceanGenerator(); + break; + } + default: { + this.chunkGenerator = new VoidGenerator(); + break; + } + } } @Override @@ -157,6 +169,7 @@ public void loadConfigs() { this.schematics = getPersist().load(Schematics.class); this.shop = getPersist().load(Shop.class); this.settings = getPersist().load(Settings.class); + this.generators = getPersist().load(Generators.class); super.loadConfigs(); int maxSize = enhancements.sizeEnhancement.levels.values().stream() @@ -190,6 +203,7 @@ public void saveConfigs() { getPersist().save(schematics); getPersist().save(shop); getPersist().save(settings); + getPersist().save(generators); saveSchematics(); } diff --git a/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java b/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java index 5b873a8ce..47adb5e67 100644 --- a/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java +++ b/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java @@ -42,6 +42,7 @@ public Configuration() { public String defaultDescription = "Default island description :c"; public String worldName = "IridiumSkyblock"; public String spawnWorldName = "world"; + public String generatorType = "skyblock"; public String islandTitleTop = "&9%island_name%"; public String islandTitleBottom = "&7%island_description%"; public String paster = "worldedit"; diff --git a/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java b/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java new file mode 100644 index 000000000..1779de645 --- /dev/null +++ b/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java @@ -0,0 +1,95 @@ +package com.iridium.iridiumskyblock.configs; + +import com.google.common.collect.ImmutableMap; +import com.iridium.iridiumcore.dependencies.fasterxml.annotation.JsonIgnoreProperties; +import com.iridium.iridiumcore.dependencies.xseries.XMaterial; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import java.util.Map; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class Generators { + + public Map generators = ImmutableMap.builder() + + .put("skyblock", new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorConfig( + new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld(true), + new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld(true), + new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld(true))) + + .put("ocean", new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorConfig( + new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorWorld( + XMaterial.SAND, + XMaterial.STONE, + XMaterial.WATER, + 63, 48, 53, true + ), + new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorWorld( + XMaterial.SOUL_SAND, + XMaterial.NETHERRACK, + XMaterial.LAVA, + 63, 48, 53, true + ), + new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorWorld( + XMaterial.END_STONE, + XMaterial.END_STONE, + XMaterial.VOID_AIR, + 63, 48, 53, true + ))) + .build(); + + @NoArgsConstructor + @AllArgsConstructor + public static class GeneratorConfig { + public Generators.SkyblockGeneratorConfig skyblock; + public Generators.OceanGeneratorConfig ocean; + } + + @NoArgsConstructor + @AllArgsConstructor + public static class SkyblockGeneratorConfig extends GeneratorConfig{ + public SkyblockGeneratorWorld overworld; + public SkyblockGeneratorWorld nether; + public SkyblockGeneratorWorld end; + } + + @NoArgsConstructor + @AllArgsConstructor + public static class OceanGeneratorConfig extends GeneratorConfig{ + public OceanGeneratorWorld overworld; + public OceanGeneratorWorld nether; + public OceanGeneratorWorld end; + } + + @NoArgsConstructor + public static class SkyblockGeneratorWorld { + public boolean canSpawnEntities; + + public SkyblockGeneratorWorld(boolean canSpawnEntities) { + this.canSpawnEntities = canSpawnEntities; + } + } + + @NoArgsConstructor + public static class OceanGeneratorWorld { + + public XMaterial floor; + public XMaterial underFloor; + public XMaterial liquidType; + public int liquidHeight; + public int minFloorHeight; + public int maxFloorHeight; + public boolean canSpawnEntities; + + public OceanGeneratorWorld( XMaterial floor, XMaterial underFloor, XMaterial liquidType, int liquidHeight, int minFloorHeight, int maxFloorHeight, boolean canSpawnEntities) { + this.floor = floor; + this.underFloor = underFloor; + this.liquidType = liquidType; + this.liquidHeight = liquidHeight; + this.minFloorHeight = minFloorHeight; + this. maxFloorHeight = maxFloorHeight; + this.canSpawnEntities = canSpawnEntities; + + } + } +} diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java new file mode 100644 index 000000000..6d0708097 --- /dev/null +++ b/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java @@ -0,0 +1,229 @@ +package com.iridium.iridiumskyblock.generators; + +import com.iridium.iridiumcore.dependencies.xseries.XMaterial; +import com.iridium.iridiumskyblock.IridiumSkyblock; +import com.iridium.iridiumskyblock.configs.Generators; +import com.iridium.iridiumskyblock.utils.LocationUtils; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.World.Environment; +import org.bukkit.block.Block; +import org.bukkit.generator.ChunkGenerator; +import org.bukkit.inventory.InventoryHolder; +import org.bukkit.util.noise.SimplexOctaveGenerator; +import org.jetbrains.annotations.NotNull; +import org.bukkit.generator.BiomeProvider; +import org.bukkit.generator.WorldInfo; + +import java.util.Map; +import java.util.Objects; +import java.util.Random; + +public class OceanGenerator extends ChunkGenerator { + + @Override + public @NotNull ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int chunkX, int chunkZ, @NotNull BiomeGrid biomeGrid) { + SimplexOctaveGenerator generator = new SimplexOctaveGenerator(new Random(world.getSeed()), 8); + final ChunkData chunkData = createChunkData(world); + generator.setScale(0.005D); + + for (int x = 0; x < 16; x++) { + for (int z = 0; z < 16; z++) { + int currentFloorHeight = (int) ((generator.noise(chunkX * 16 + x, chunkZ * 16 + z, 1.5D, 0.5D, true) + 1) * (getMaxFloorHeight(world.getEnvironment()) - getMinFloorHeight(world.getEnvironment())) + getMinFloorHeight(world.getEnvironment())); + + // Generate layer of bedrock + chunkData.setBlock(x, LocationUtils.getMinHeight(world), z, + Objects.requireNonNull(XMaterial.BEDROCK.parseMaterial()) + ); + + // Generate gravel layer + for (int y = LocationUtils.getMinHeight(world) + 1; y < currentFloorHeight; y++) { + chunkData.setBlock(x, y, z, + Objects.requireNonNull(getUnderFloor(world.getEnvironment()).parseMaterial()) + ); + } + + // Generate sand on top of gravel + chunkData.setBlock(x, currentFloorHeight, z, + Objects.requireNonNull(getFloor(world.getEnvironment()).parseMaterial()) + ); + + // Generate water or lava on top of the floor + for (int y = currentFloorHeight + 1; y <= getliquidHeight(world.getEnvironment()); y++) { + chunkData.setBlock(x, y, z, Objects.requireNonNull(getLiquidType(world.getEnvironment()).parseMaterial())); + } + } + } + + return chunkData; + } + + public void generateWater(World world, int x, int z) { + SimplexOctaveGenerator generator = new SimplexOctaveGenerator(new Random(world.getSeed()), 8); + generator.setScale(0.005D); + + int currentFloorHeight = (int) ((generator.noise(x, z, 1.5D, 0.5D, true) + 1) * (getMaxFloorHeight(world.getEnvironment()) - getMinFloorHeight(world.getEnvironment())) + getMinFloorHeight(world.getEnvironment())); + int minHeightWorld = LocationUtils.getMinHeight(world); + + // Generate layer of bedrock + if (world.getBlockAt(x, minHeightWorld, z).getType() != XMaterial.BEDROCK.parseMaterial()) { + if (world.getBlockAt(x, minHeightWorld, z).getState() instanceof InventoryHolder) { + ((InventoryHolder) world.getBlockAt(x, minHeightWorld, z).getState()).getInventory().clear(); + } + world.getBlockAt(x, minHeightWorld, z).setType(Material.BEDROCK, false); + } + + // Generate gravel layer + for (int y = minHeightWorld + 1; y < currentFloorHeight; y++) { + Block block = world.getBlockAt(x, y, z); + if (block.getType() != getUnderFloor(world.getEnvironment()).parseMaterial() && getUnderFloor(world.getEnvironment()).parseMaterial() != null) { + if (block.getState() instanceof InventoryHolder) { + ((InventoryHolder) block.getState()).getInventory().clear(); + } + block.setType(getUnderFloor(world.getEnvironment()).parseMaterial(), false); + } + } + + // Generate sand on top of gravel + if (world.getBlockAt(x, currentFloorHeight, z).getType() != getFloor(world.getEnvironment()).parseMaterial() && getFloor(world.getEnvironment()).parseMaterial() != null) { + if (world.getBlockAt(x, currentFloorHeight, z).getState() instanceof InventoryHolder) { + ((InventoryHolder) world.getBlockAt(x, currentFloorHeight, z).getState()).getInventory().clear(); + } + world.getBlockAt(x, currentFloorHeight, z).setType(getFloor(world.getEnvironment()).parseMaterial(), false); + } + + // Generate water or lava on top of the floor + XMaterial oceanMaterial = world.getEnvironment() == Environment.NETHER ? XMaterial.LAVA : XMaterial.WATER; + for (int y = currentFloorHeight + 1; y <= getliquidHeight(world.getEnvironment()); y++) { + Block block = world.getBlockAt(x, y, z); + if (block.getType() != oceanMaterial.parseMaterial() && oceanMaterial.parseMaterial() != null) { + if (block.getState() instanceof InventoryHolder) { + ((InventoryHolder) block.getState()).getInventory().clear(); + } + block.setType(oceanMaterial.parseMaterial(), false); + } + } + + // Replace everything else with air + for (int y = getliquidHeight(world.getEnvironment()) + 1; y < world.getMaxHeight(); y++) { + Block block = world.getBlockAt(x, y, z); + if (block.getType() != Material.AIR) { + if (block.getState() instanceof InventoryHolder) { + ((InventoryHolder) block.getState()).getInventory().clear(); + } + block.setType(Material.AIR, false); + } + } + } + + @Override + public boolean canSpawn(@NotNull World world, int x, int z) { + return true; + } + + @Override + public BiomeProvider getDefaultBiomeProvider(WorldInfo worldInfo) { + return null; + } + + Map generatorConfig = IridiumSkyblock.getInstance().getGenerators().generators; + + public XMaterial getFloor(Environment environment) { + switch(environment) { + case NETHER: { + return generatorConfig.get("floor").nether.floor; + } + case THE_END: { + return generatorConfig.get("floor").ocean.end.floor; + } + default: { + return generatorConfig.get("floor").ocean.overworld.floor; + } + } + } + + public XMaterial getUnderFloor(Environment environment) { + switch(environment) { + case NETHER: { + return generatorConfig.get("underFloor").ocean.nether.underFloor; + } + case THE_END: { + return generatorConfig.get("underFloor").ocean.end.underFloor; + } + default: { + return generatorConfig.get("underFloor").ocean.overworld.underFloor; + } + } + } + + public XMaterial getLiquidType(Environment environment) { + switch(environment) { + case NETHER: { + return generatorConfig.get("liquidType").ocean.nether.liquidType; + } + case THE_END: { + return generatorConfig.get("liquidType").ocean.end.liquidType; + } + default: { + return generatorConfig.get("liquidType").ocean.overworld.liquidType; + } + } + } + + public int getliquidHeight (Environment environment) { + switch(environment) { + case NETHER: { + return generatorConfig.get("liquidHeight").ocean.nether.liquidHeight; + } + case THE_END: { + return generatorConfig.get("liquidHeight").ocean.end.liquidHeight; + } + default: { + return generatorConfig.get("liquidHeight").ocean.overworld.liquidHeight; + } + } + } + + public int getMinFloorHeight(Environment environment) { + switch(environment) { + case NETHER: { + return generatorConfig.get("minFloorHeight").ocean.nether.minFloorHeight; + } + case THE_END: { + return generatorConfig.get("minFloorHeight").ocean.end.minFloorHeight; + } + default: { + return generatorConfig.get("minFloorHeight").ocean.overworld.minFloorHeight; + } + } + } + + public int getMaxFloorHeight(Environment environment) { + switch(environment) { + case NETHER: { + return generatorConfig.get("maxFloorHeight").ocean.nether.maxFloorHeight; + } + case THE_END: { + return generatorConfig.get("maxFloorHeight").ocean.end.maxFloorHeight; + } + default: { + return generatorConfig.get("maxFloorHeight").ocean.overworld.maxFloorHeight; + } + } + } + + public boolean getCanSpawnEntities(Environment environment) { + switch(environment) { + case NETHER: { + return generatorConfig.get("canSpawnEntities").ocean.nether.canSpawnEntities; + } + case THE_END: { + return generatorConfig.get("canSpawnEntities").ocean.end.canSpawnEntities; + } + default: { + return generatorConfig.get("canSpawnEntities").ocean.overworld.canSpawnEntities; + } + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java index beeb9af49..b5878bb1c 100644 --- a/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java +++ b/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java @@ -1,5 +1,7 @@ package com.iridium.iridiumskyblock.generators; +import com.iridium.iridiumskyblock.IridiumSkyblock; +import com.iridium.iridiumskyblock.configs.Generators; import org.bukkit.World; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.ChunkGenerator; @@ -7,6 +9,7 @@ import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.Random; public class VoidGenerator extends ChunkGenerator { @@ -27,7 +30,20 @@ public byte[][] generateBlockSections(World world, Random random, int x, int z, @Override public boolean canSpawn(@NotNull World world, int x, int z) { - return true; + + Map generatorConfig = IridiumSkyblock.getInstance().getGenerators().generators; + + switch(world.getEnvironment()) { + case NETHER: { + return generatorConfig.get("canSpawnEntities").skyblock.nether.canSpawnEntities; + } + case THE_END: { + return generatorConfig.get("canSpawnEntities").skyblock.end.canSpawnEntities; + } + default: { + return generatorConfig.get("canSpawnEntities").skyblock.overworld.canSpawnEntities; + } + } } @Override From 1923acbb723103a052037195cce9132a2000031b Mon Sep 17 00:00:00 2001 From: Peaches_MLG Date: Sat, 23 Sep 2023 19:09:04 +0100 Subject: [PATCH 02/19] Cleanup --- .../iridiumskyblock/configs/Generators.java | 67 ++++++++----------- .../generators/OceanGenerator.java | 44 ++++++------ .../generators/VoidGenerator.java | 13 ++-- 3 files changed, 54 insertions(+), 70 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java b/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java index 1779de645..23223b847 100644 --- a/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java +++ b/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java @@ -5,49 +5,41 @@ import com.iridium.iridiumcore.dependencies.xseries.XMaterial; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; + import java.util.Map; @JsonIgnoreProperties(ignoreUnknown = true) public class Generators { - public Map generators = ImmutableMap.builder() - - .put("skyblock", new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorConfig( - new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld(true), - new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld(true), - new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld(true))) - .put("ocean", new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorConfig( - new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorWorld( - XMaterial.SAND, - XMaterial.STONE, - XMaterial.WATER, - 63, 48, 53, true - ), - new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorWorld( - XMaterial.SOUL_SAND, - XMaterial.NETHERRACK, - XMaterial.LAVA, - 63, 48, 53, true - ), - new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorWorld( - XMaterial.END_STONE, - XMaterial.END_STONE, - XMaterial.VOID_AIR, - 63, 48, 53, true - ))) - .build(); + public Generators.SkyblockGeneratorConfig skyblockGenerator = new SkyblockGeneratorConfig( + new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld(true), + new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld(true), + new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld(true) + ); + public Generators.OceanGeneratorConfig oceanGenerator = new OceanGeneratorConfig( + new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorWorld( + XMaterial.SAND, + XMaterial.STONE, + XMaterial.WATER, + 63, 48, 53, true + ), + new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorWorld( + XMaterial.SOUL_SAND, + XMaterial.NETHERRACK, + XMaterial.LAVA, + 63, 48, 53, true + ), + new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorWorld( + XMaterial.END_STONE, + XMaterial.END_STONE, + XMaterial.VOID_AIR, + 63, 48, 53, true + )); @NoArgsConstructor @AllArgsConstructor - public static class GeneratorConfig { - public Generators.SkyblockGeneratorConfig skyblock; - public Generators.OceanGeneratorConfig ocean; - } - - @NoArgsConstructor - @AllArgsConstructor - public static class SkyblockGeneratorConfig extends GeneratorConfig{ + public static class SkyblockGeneratorConfig { public SkyblockGeneratorWorld overworld; public SkyblockGeneratorWorld nether; public SkyblockGeneratorWorld end; @@ -55,7 +47,7 @@ public static class SkyblockGeneratorConfig extends GeneratorConfig{ @NoArgsConstructor @AllArgsConstructor - public static class OceanGeneratorConfig extends GeneratorConfig{ + public static class OceanGeneratorConfig { public OceanGeneratorWorld overworld; public OceanGeneratorWorld nether; public OceanGeneratorWorld end; @@ -72,7 +64,6 @@ public SkyblockGeneratorWorld(boolean canSpawnEntities) { @NoArgsConstructor public static class OceanGeneratorWorld { - public XMaterial floor; public XMaterial underFloor; public XMaterial liquidType; @@ -81,13 +72,13 @@ public static class OceanGeneratorWorld { public int maxFloorHeight; public boolean canSpawnEntities; - public OceanGeneratorWorld( XMaterial floor, XMaterial underFloor, XMaterial liquidType, int liquidHeight, int minFloorHeight, int maxFloorHeight, boolean canSpawnEntities) { + public OceanGeneratorWorld(XMaterial floor, XMaterial underFloor, XMaterial liquidType, int liquidHeight, int minFloorHeight, int maxFloorHeight, boolean canSpawnEntities) { this.floor = floor; this.underFloor = underFloor; this.liquidType = liquidType; this.liquidHeight = liquidHeight; this.minFloorHeight = minFloorHeight; - this. maxFloorHeight = maxFloorHeight; + this.maxFloorHeight = maxFloorHeight; this.canSpawnEntities = canSpawnEntities; } diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java index 6d0708097..f8ca46603 100644 --- a/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java +++ b/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java @@ -126,18 +126,16 @@ public BiomeProvider getDefaultBiomeProvider(WorldInfo worldInfo) { return null; } - Map generatorConfig = IridiumSkyblock.getInstance().getGenerators().generators; - public XMaterial getFloor(Environment environment) { switch(environment) { case NETHER: { - return generatorConfig.get("floor").nether.floor; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether.floor; } case THE_END: { - return generatorConfig.get("floor").ocean.end.floor; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end.floor; } default: { - return generatorConfig.get("floor").ocean.overworld.floor; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld.floor; } } } @@ -145,13 +143,13 @@ public XMaterial getFloor(Environment environment) { public XMaterial getUnderFloor(Environment environment) { switch(environment) { case NETHER: { - return generatorConfig.get("underFloor").ocean.nether.underFloor; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether.underFloor; } case THE_END: { - return generatorConfig.get("underFloor").ocean.end.underFloor; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end.underFloor; } default: { - return generatorConfig.get("underFloor").ocean.overworld.underFloor; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld.underFloor; } } } @@ -159,13 +157,13 @@ public XMaterial getUnderFloor(Environment environment) { public XMaterial getLiquidType(Environment environment) { switch(environment) { case NETHER: { - return generatorConfig.get("liquidType").ocean.nether.liquidType; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether.liquidType; } case THE_END: { - return generatorConfig.get("liquidType").ocean.end.liquidType; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end.liquidType; } default: { - return generatorConfig.get("liquidType").ocean.overworld.liquidType; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld.liquidType; } } } @@ -173,13 +171,13 @@ public XMaterial getLiquidType(Environment environment) { public int getliquidHeight (Environment environment) { switch(environment) { case NETHER: { - return generatorConfig.get("liquidHeight").ocean.nether.liquidHeight; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether.liquidHeight; } case THE_END: { - return generatorConfig.get("liquidHeight").ocean.end.liquidHeight; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end.liquidHeight; } default: { - return generatorConfig.get("liquidHeight").ocean.overworld.liquidHeight; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld.liquidHeight; } } } @@ -187,13 +185,13 @@ public int getliquidHeight (Environment environment) { public int getMinFloorHeight(Environment environment) { switch(environment) { case NETHER: { - return generatorConfig.get("minFloorHeight").ocean.nether.minFloorHeight; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether.minFloorHeight; } case THE_END: { - return generatorConfig.get("minFloorHeight").ocean.end.minFloorHeight; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end.minFloorHeight; } default: { - return generatorConfig.get("minFloorHeight").ocean.overworld.minFloorHeight; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld.minFloorHeight; } } } @@ -201,13 +199,13 @@ public int getMinFloorHeight(Environment environment) { public int getMaxFloorHeight(Environment environment) { switch(environment) { case NETHER: { - return generatorConfig.get("maxFloorHeight").ocean.nether.maxFloorHeight; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether.maxFloorHeight; } case THE_END: { - return generatorConfig.get("maxFloorHeight").ocean.end.maxFloorHeight; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end.maxFloorHeight; } default: { - return generatorConfig.get("maxFloorHeight").ocean.overworld.maxFloorHeight; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld.maxFloorHeight; } } } @@ -215,13 +213,13 @@ public int getMaxFloorHeight(Environment environment) { public boolean getCanSpawnEntities(Environment environment) { switch(environment) { case NETHER: { - return generatorConfig.get("canSpawnEntities").ocean.nether.canSpawnEntities; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether.canSpawnEntities; } case THE_END: { - return generatorConfig.get("canSpawnEntities").ocean.end.canSpawnEntities; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end.canSpawnEntities; } default: { - return generatorConfig.get("canSpawnEntities").ocean.overworld.canSpawnEntities; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld.canSpawnEntities; } } } diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java index b5878bb1c..78d294f50 100644 --- a/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java +++ b/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java @@ -1,7 +1,6 @@ package com.iridium.iridiumskyblock.generators; import com.iridium.iridiumskyblock.IridiumSkyblock; -import com.iridium.iridiumskyblock.configs.Generators; import org.bukkit.World; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.ChunkGenerator; @@ -9,7 +8,6 @@ import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Random; public class VoidGenerator extends ChunkGenerator { @@ -30,18 +28,15 @@ public byte[][] generateBlockSections(World world, Random random, int x, int z, @Override public boolean canSpawn(@NotNull World world, int x, int z) { - - Map generatorConfig = IridiumSkyblock.getInstance().getGenerators().generators; - - switch(world.getEnvironment()) { + switch (world.getEnvironment()) { case NETHER: { - return generatorConfig.get("canSpawnEntities").skyblock.nether.canSpawnEntities; + return IridiumSkyblock.getInstance().getGenerators().skyblockGenerator.nether.canSpawnEntities; } case THE_END: { - return generatorConfig.get("canSpawnEntities").skyblock.end.canSpawnEntities; + return IridiumSkyblock.getInstance().getGenerators().skyblockGenerator.end.canSpawnEntities; } default: { - return generatorConfig.get("canSpawnEntities").skyblock.overworld.canSpawnEntities; + return IridiumSkyblock.getInstance().getGenerators().skyblockGenerator.overworld.canSpawnEntities; } } } From 7d972d1b95f92ee58e70d16c30e676b929949a39 Mon Sep 17 00:00:00 2001 From: Shyanne Date: Sat, 23 Sep 2023 17:04:26 -0400 Subject: [PATCH 03/19] Updated Generators updated generators to allow server owners to set the default biome and whether they'd like their oceans to be decorated or not (includes ores, deposits, and geodes, no caves) --- .../iridiumskyblock/configs/Generators.java | 42 +++-- .../generators/OceanGenerator.java | 151 +++++------------- .../generators/VoidGenerator.java | 33 ++-- 3 files changed, 95 insertions(+), 131 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java b/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java index 23223b847..e8de31863 100644 --- a/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java +++ b/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java @@ -2,6 +2,7 @@ import com.google.common.collect.ImmutableMap; import com.iridium.iridiumcore.dependencies.fasterxml.annotation.JsonIgnoreProperties; +import com.iridium.iridiumcore.dependencies.xseries.XBiome; import com.iridium.iridiumcore.dependencies.xseries.XMaterial; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; @@ -11,30 +12,47 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class Generators { - public Generators.SkyblockGeneratorConfig skyblockGenerator = new SkyblockGeneratorConfig( - new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld(true), - new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld(true), - new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld(true) + new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld( + XBiome.PLAINS, + true + ), + new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld( + XBiome.NETHER_WASTES, + true + ), + new com.iridium.iridiumskyblock.configs.Generators.SkyblockGeneratorWorld( + XBiome.THE_END, + true + ) ); public Generators.OceanGeneratorConfig oceanGenerator = new OceanGeneratorConfig( new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorWorld( + XBiome.OCEAN, XMaterial.SAND, XMaterial.STONE, XMaterial.WATER, - 63, 48, 53, true + 63, 48, 53, + true, + true ), new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorWorld( + XBiome.NETHER_WASTES, XMaterial.SOUL_SAND, XMaterial.NETHERRACK, XMaterial.LAVA, - 63, 48, 53, true + 63, 48, 53, + true, + true ), new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorWorld( + XBiome.END_BARRENS, XMaterial.END_STONE, XMaterial.END_STONE, XMaterial.VOID_AIR, - 63, 48, 53, true + 63, 48, 53, + true, + true )); @NoArgsConstructor @@ -55,30 +73,36 @@ public static class OceanGeneratorConfig { @NoArgsConstructor public static class SkyblockGeneratorWorld { + public XBiome biome; public boolean canSpawnEntities; - public SkyblockGeneratorWorld(boolean canSpawnEntities) { + public SkyblockGeneratorWorld(XBiome biome, boolean canSpawnEntities) { + this.biome = biome; this.canSpawnEntities = canSpawnEntities; } } @NoArgsConstructor public static class OceanGeneratorWorld { + public XBiome biome; public XMaterial floor; public XMaterial underFloor; public XMaterial liquidType; public int liquidHeight; public int minFloorHeight; public int maxFloorHeight; + public boolean decorate; public boolean canSpawnEntities; - public OceanGeneratorWorld(XMaterial floor, XMaterial underFloor, XMaterial liquidType, int liquidHeight, int minFloorHeight, int maxFloorHeight, boolean canSpawnEntities) { + public OceanGeneratorWorld(XBiome biome, XMaterial floor, XMaterial underFloor, XMaterial liquidType, int liquidHeight, int minFloorHeight, int maxFloorHeight, boolean decorate, boolean canSpawnEntities) { + this.biome = biome; this.floor = floor; this.underFloor = underFloor; this.liquidType = liquidType; this.liquidHeight = liquidHeight; this.minFloorHeight = minFloorHeight; this.maxFloorHeight = maxFloorHeight; + this.decorate = decorate; this.canSpawnEntities = canSpawnEntities; } diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java index f8ca46603..eb6257b4b 100644 --- a/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java +++ b/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java @@ -12,24 +12,26 @@ import org.bukkit.inventory.InventoryHolder; import org.bukkit.util.noise.SimplexOctaveGenerator; import org.jetbrains.annotations.NotNull; -import org.bukkit.generator.BiomeProvider; import org.bukkit.generator.WorldInfo; -import java.util.Map; -import java.util.Objects; -import java.util.Random; +import java.util.*; public class OceanGenerator extends ChunkGenerator { @Override - public @NotNull ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int chunkX, int chunkZ, @NotNull BiomeGrid biomeGrid) { + public @NotNull ChunkData generateChunkData( + @NotNull World world, @NotNull Random random, int chunkX, int chunkZ, @NotNull BiomeGrid biomeGrid) { + SimplexOctaveGenerator generator = new SimplexOctaveGenerator(new Random(world.getSeed()), 8); final ChunkData chunkData = createChunkData(world); generator.setScale(0.005D); for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { - int currentFloorHeight = (int) ((generator.noise(chunkX * 16 + x, chunkZ * 16 + z, 1.5D, 0.5D, true) + 1) * (getMaxFloorHeight(world.getEnvironment()) - getMinFloorHeight(world.getEnvironment())) + getMinFloorHeight(world.getEnvironment())); + int currentFloorHeight = (int) ((generator.noise( + chunkX * 16 + x, chunkZ * 16 + z, 1.5D, 0.5D, true) + 1) + * (getOceanGenerator(world.getEnvironment()).maxFloorHeight - getOceanGenerator(world.getEnvironment()).minFloorHeight) + + getOceanGenerator(world.getEnvironment()).minFloorHeight); // Generate layer of bedrock chunkData.setBlock(x, LocationUtils.getMinHeight(world), z, @@ -39,19 +41,22 @@ public class OceanGenerator extends ChunkGenerator { // Generate gravel layer for (int y = LocationUtils.getMinHeight(world) + 1; y < currentFloorHeight; y++) { chunkData.setBlock(x, y, z, - Objects.requireNonNull(getUnderFloor(world.getEnvironment()).parseMaterial()) + Objects.requireNonNull(getOceanGenerator(world.getEnvironment()).underFloor.parseMaterial()) ); } // Generate sand on top of gravel chunkData.setBlock(x, currentFloorHeight, z, - Objects.requireNonNull(getFloor(world.getEnvironment()).parseMaterial()) + Objects.requireNonNull(getOceanGenerator(world.getEnvironment()).floor.parseMaterial()) ); // Generate water or lava on top of the floor - for (int y = currentFloorHeight + 1; y <= getliquidHeight(world.getEnvironment()); y++) { - chunkData.setBlock(x, y, z, Objects.requireNonNull(getLiquidType(world.getEnvironment()).parseMaterial())); + for (int y = currentFloorHeight + 1; y <= getOceanGenerator(world.getEnvironment()).liquidHeight; y++) { + chunkData.setBlock(x, y, z, Objects.requireNonNull( + getOceanGenerator(world.getEnvironment()).liquidType.parseMaterial())); } + + biomeGrid.setBiome(x, z, Objects.requireNonNull(getOceanGenerator(world.getEnvironment()).biome.getBiome())); } } @@ -62,7 +67,11 @@ public void generateWater(World world, int x, int z) { SimplexOctaveGenerator generator = new SimplexOctaveGenerator(new Random(world.getSeed()), 8); generator.setScale(0.005D); - int currentFloorHeight = (int) ((generator.noise(x, z, 1.5D, 0.5D, true) + 1) * (getMaxFloorHeight(world.getEnvironment()) - getMinFloorHeight(world.getEnvironment())) + getMinFloorHeight(world.getEnvironment())); + int currentFloorHeight = (int) ((generator.noise( + x, z, 1.5D, 0.5D, true) + 1) + * (getOceanGenerator(world.getEnvironment()).maxFloorHeight - getOceanGenerator(world.getEnvironment()).minFloorHeight) + + getOceanGenerator(world.getEnvironment()).minFloorHeight); + int minHeightWorld = LocationUtils.getMinHeight(world); // Generate layer of bedrock @@ -76,25 +85,30 @@ public void generateWater(World world, int x, int z) { // Generate gravel layer for (int y = minHeightWorld + 1; y < currentFloorHeight; y++) { Block block = world.getBlockAt(x, y, z); - if (block.getType() != getUnderFloor(world.getEnvironment()).parseMaterial() && getUnderFloor(world.getEnvironment()).parseMaterial() != null) { + if (block.getType() != getOceanGenerator(world.getEnvironment()).underFloor.parseMaterial() + && getOceanGenerator(world.getEnvironment()).underFloor.parseMaterial() != null) { + if (block.getState() instanceof InventoryHolder) { ((InventoryHolder) block.getState()).getInventory().clear(); } - block.setType(getUnderFloor(world.getEnvironment()).parseMaterial(), false); + block.setType(Objects.requireNonNull(getOceanGenerator(world.getEnvironment()).underFloor.parseMaterial()), false); } } // Generate sand on top of gravel - if (world.getBlockAt(x, currentFloorHeight, z).getType() != getFloor(world.getEnvironment()).parseMaterial() && getFloor(world.getEnvironment()).parseMaterial() != null) { + if (world.getBlockAt(x, currentFloorHeight, z).getType() != getOceanGenerator(world.getEnvironment()).floor.parseMaterial() + && getOceanGenerator(world.getEnvironment()).floor.parseMaterial() != null) { + if (world.getBlockAt(x, currentFloorHeight, z).getState() instanceof InventoryHolder) { ((InventoryHolder) world.getBlockAt(x, currentFloorHeight, z).getState()).getInventory().clear(); } - world.getBlockAt(x, currentFloorHeight, z).setType(getFloor(world.getEnvironment()).parseMaterial(), false); + world.getBlockAt(x, currentFloorHeight, z) + .setType(Objects.requireNonNull(getOceanGenerator(world.getEnvironment()).floor.parseMaterial()), false); } // Generate water or lava on top of the floor XMaterial oceanMaterial = world.getEnvironment() == Environment.NETHER ? XMaterial.LAVA : XMaterial.WATER; - for (int y = currentFloorHeight + 1; y <= getliquidHeight(world.getEnvironment()); y++) { + for (int y = currentFloorHeight + 1; y <= getOceanGenerator(world.getEnvironment()).liquidHeight; y++) { Block block = world.getBlockAt(x, y, z); if (block.getType() != oceanMaterial.parseMaterial() && oceanMaterial.parseMaterial() != null) { if (block.getState() instanceof InventoryHolder) { @@ -105,7 +119,7 @@ public void generateWater(World world, int x, int z) { } // Replace everything else with air - for (int y = getliquidHeight(world.getEnvironment()) + 1; y < world.getMaxHeight(); y++) { + for (int y = getOceanGenerator(world.getEnvironment()).liquidHeight + 1; y < world.getMaxHeight(); y++) { Block block = world.getBlockAt(x, y, z); if (block.getType() != Material.AIR) { if (block.getState() instanceof InventoryHolder) { @@ -117,111 +131,26 @@ public void generateWater(World world, int x, int z) { } @Override - public boolean canSpawn(@NotNull World world, int x, int z) { - return true; + public boolean shouldGenerateDecorations(@NotNull WorldInfo worldInfo, @NotNull Random random, int x, int z) { + return getOceanGenerator(worldInfo.getEnvironment()).decorate; } @Override - public BiomeProvider getDefaultBiomeProvider(WorldInfo worldInfo) { - return null; - } - - public XMaterial getFloor(Environment environment) { - switch(environment) { - case NETHER: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether.floor; - } - case THE_END: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end.floor; - } - default: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld.floor; - } - } - } - - public XMaterial getUnderFloor(Environment environment) { - switch(environment) { - case NETHER: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether.underFloor; - } - case THE_END: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end.underFloor; - } - default: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld.underFloor; - } - } - } - - public XMaterial getLiquidType(Environment environment) { - switch(environment) { - case NETHER: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether.liquidType; - } - case THE_END: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end.liquidType; - } - default: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld.liquidType; - } - } - } - - public int getliquidHeight (Environment environment) { - switch(environment) { - case NETHER: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether.liquidHeight; - } - case THE_END: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end.liquidHeight; - } - default: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld.liquidHeight; - } - } - } - - public int getMinFloorHeight(Environment environment) { - switch(environment) { - case NETHER: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether.minFloorHeight; - } - case THE_END: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end.minFloorHeight; - } - default: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld.minFloorHeight; - } - } - } - - public int getMaxFloorHeight(Environment environment) { - switch(environment) { - case NETHER: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether.maxFloorHeight; - } - case THE_END: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end.maxFloorHeight; - } - default: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld.maxFloorHeight; - } - } + public boolean canSpawn(@NotNull World world, int x, int z) { + return getOceanGenerator(world.getEnvironment()).canSpawnEntities; } - public boolean getCanSpawnEntities(Environment environment) { - switch(environment) { + private Generators.OceanGeneratorWorld getOceanGenerator(Environment environment) { + switch (environment) { case NETHER: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether.canSpawnEntities; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.nether; } case THE_END: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end.canSpawnEntities; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.end; } default: { - return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld.canSpawnEntities; + return IridiumSkyblock.getInstance().getGenerators().oceanGenerator.overworld; } } } - } \ No newline at end of file diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java index 78d294f50..554032dea 100644 --- a/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java +++ b/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java @@ -1,6 +1,7 @@ package com.iridium.iridiumskyblock.generators; import com.iridium.iridiumskyblock.IridiumSkyblock; +import com.iridium.iridiumskyblock.configs.Generators; import org.bukkit.World; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.ChunkGenerator; @@ -8,6 +9,7 @@ import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.Random; public class VoidGenerator extends ChunkGenerator { @@ -16,7 +18,13 @@ public class VoidGenerator extends ChunkGenerator { @Override public @NotNull ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int chunkX, int chunkZ, @NotNull BiomeGrid biomeGrid) { - return createChunkData(world); + final ChunkData chunkData = createChunkData(world); + for (int x = 0; x < 16; x++) { + for (int z = 0; z < 16; z++) { + biomeGrid.setBiome(x, z, Objects.requireNonNull(getSkyblockGenerator(world.getEnvironment()).biome.getBiome())); + } + } + return chunkData; } public byte[][] generateBlockSections(World world, Random random, int x, int z, BiomeGrid biomeGrid) { @@ -28,22 +36,25 @@ public byte[][] generateBlockSections(World world, Random random, int x, int z, @Override public boolean canSpawn(@NotNull World world, int x, int z) { - switch (world.getEnvironment()) { + return getSkyblockGenerator(world.getEnvironment()).canSpawnEntities; + } + + @Override + public @NotNull List getDefaultPopulators(@NotNull World world) { + return Collections.emptyList(); + } + + private Generators.SkyblockGeneratorWorld getSkyblockGenerator(World.Environment environment) { + switch (environment) { case NETHER: { - return IridiumSkyblock.getInstance().getGenerators().skyblockGenerator.nether.canSpawnEntities; + return IridiumSkyblock.getInstance().getGenerators().skyblockGenerator.nether; } case THE_END: { - return IridiumSkyblock.getInstance().getGenerators().skyblockGenerator.end.canSpawnEntities; + return IridiumSkyblock.getInstance().getGenerators().skyblockGenerator.end; } default: { - return IridiumSkyblock.getInstance().getGenerators().skyblockGenerator.overworld.canSpawnEntities; + return IridiumSkyblock.getInstance().getGenerators().skyblockGenerator.overworld; } } } - - @Override - public @NotNull List getDefaultPopulators(@NotNull World world) { - return Collections.emptyList(); - } - } From aca79915df0b89f4ac47ad14cc8bd09ab9632ffd Mon Sep 17 00:00:00 2001 From: Shyanne Date: Sat, 23 Sep 2023 20:55:39 -0400 Subject: [PATCH 04/19] Update OceanGenerator.java cleaned up some residual das code --- .../iridiumskyblock/generators/OceanGenerator.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java index eb6257b4b..915e57497 100644 --- a/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java +++ b/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java @@ -63,7 +63,7 @@ public class OceanGenerator extends ChunkGenerator { return chunkData; } - public void generateWater(World world, int x, int z) { + public void generateOcean(World world, int x, int z) { SimplexOctaveGenerator generator = new SimplexOctaveGenerator(new Random(world.getSeed()), 8); generator.setScale(0.005D); @@ -107,14 +107,13 @@ && getOceanGenerator(world.getEnvironment()).floor.parseMaterial() != null) { } // Generate water or lava on top of the floor - XMaterial oceanMaterial = world.getEnvironment() == Environment.NETHER ? XMaterial.LAVA : XMaterial.WATER; for (int y = currentFloorHeight + 1; y <= getOceanGenerator(world.getEnvironment()).liquidHeight; y++) { Block block = world.getBlockAt(x, y, z); - if (block.getType() != oceanMaterial.parseMaterial() && oceanMaterial.parseMaterial() != null) { + if (block.getType() != getOceanGenerator(world.getEnvironment()).liquidType.parseMaterial() && getOceanGenerator(world.getEnvironment()).liquidType.parseMaterial() != null) { if (block.getState() instanceof InventoryHolder) { ((InventoryHolder) block.getState()).getInventory().clear(); } - block.setType(oceanMaterial.parseMaterial(), false); + block.setType(getOceanGenerator(world.getEnvironment()).liquidType.parseMaterial(), false); } } @@ -128,6 +127,9 @@ && getOceanGenerator(world.getEnvironment()).floor.parseMaterial() != null) { block.setType(Material.AIR, false); } } + + Random random = new Random((world.getSeed())); + shouldGenerateDecorations(world, random , x, z); } @Override From 3e646d2d1cee79e7bcff4cbdcbf7684939149bcb Mon Sep 17 00:00:00 2001 From: Shyanne Date: Fri, 2 Feb 2024 16:04:11 -0500 Subject: [PATCH 05/19] fixed the generator! uh so we basically create a duplicate of the world on first generation of an island that will then be used to copy and paste the terrain under the islands the first generation is slow because it has to create the worlds, but once this is done its exactly like the deleting blocks method except in reverse --- .../generators/OceanGenerator.java | 16 +++-- .../managers/IslandManager.java | 67 ++++++++++++++++++- 2 files changed, 78 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java index 915e57497..5a08457e8 100644 --- a/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java +++ b/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java @@ -64,7 +64,10 @@ public class OceanGenerator extends ChunkGenerator { } public void generateOcean(World world, int x, int z) { - SimplexOctaveGenerator generator = new SimplexOctaveGenerator(new Random(world.getSeed()), 8); + + Random random = new Random((world.getSeed())); + + SimplexOctaveGenerator generator = new SimplexOctaveGenerator(random, 8); generator.setScale(0.005D); int currentFloorHeight = (int) ((generator.noise( @@ -102,8 +105,13 @@ && getOceanGenerator(world.getEnvironment()).floor.parseMaterial() != null) { if (world.getBlockAt(x, currentFloorHeight, z).getState() instanceof InventoryHolder) { ((InventoryHolder) world.getBlockAt(x, currentFloorHeight, z).getState()).getInventory().clear(); } - world.getBlockAt(x, currentFloorHeight, z) - .setType(Objects.requireNonNull(getOceanGenerator(world.getEnvironment()).floor.parseMaterial()), false); + + for(int y = currentFloorHeight; y < currentFloorHeight + 5; y++) { + world.getBlockAt(x, currentFloorHeight, z) + .setType(Objects.requireNonNull(getOceanGenerator(world.getEnvironment()).floor.parseMaterial()), false); + currentFloorHeight++; + } + } // Generate water or lava on top of the floor @@ -128,7 +136,7 @@ && getOceanGenerator(world.getEnvironment()).floor.parseMaterial() != null) { } } - Random random = new Random((world.getSeed())); + // Generate kelp, ores, and mineral deposits shouldGenerateDecorations(world, random , x, z); } diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java index 61d9ad557..5a47fa773 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java @@ -15,6 +15,7 @@ import com.iridium.iridiumskyblock.configs.Schematics; import com.iridium.iridiumskyblock.database.Island; import com.iridium.iridiumskyblock.database.User; +import com.iridium.iridiumskyblock.generators.VoidGenerator; import com.iridium.iridiumskyblock.gui.CreateGUI; import com.iridium.iridiumskyblock.utils.LocationUtils; import com.iridium.iridiumskyblock.utils.PlayerUtils; @@ -39,7 +40,6 @@ import org.jetbrains.annotations.Nullable; import java.io.File; -import java.io.IOException; import java.time.LocalDateTime; import java.util.*; import java.util.concurrent.CompletableFuture; @@ -221,6 +221,7 @@ public CompletableFuture generateIsland(Island island, Schematics.Schemati return CompletableFuture.runAsync(() -> { setHome(island, schematicConfig); deleteIslandBlocks(island).join(); + regenerateTerrain(island).join(); IridiumSkyblock.getInstance().getSchematicManager().pasteSchematic(island, schematicConfig).join(); setIslandBiome(island, XBiome.matchXBiome(schematicConfig.overworld.biome)); setIslandBiome(island, XBiome.matchXBiome(schematicConfig.nether.biome)); @@ -283,6 +284,69 @@ private void deleteIslandBlocks(Island island, World world, int y, CompletableFu } } + public CompletableFuture regenerateTerrain(Island island) { + return CompletableFuture.runAsync(() -> { + List> completableFutures = Arrays.asList( + regenerateTerrain(island, getWorld(World.Environment.NORMAL)), + regenerateTerrain(island, getWorld(World.Environment.NETHER)), + regenerateTerrain(island, getWorld(World.Environment.THE_END)) + ); + completableFutures.forEach(CompletableFuture::join); + }); + } + + private CompletableFuture regenerateTerrain(Island island, World world) { + CompletableFuture completableFuture = new CompletableFuture<>(); + if (world == null) { + completableFuture.complete(null); + } else { + Bukkit.getScheduler().runTask(IridiumSkyblock.getInstance(), () -> regenerateTerrain(island, world, world.getMaxHeight(), completableFuture, 0)); + } + return completableFuture; + } + + public void regenerateTerrain (Island island, World world, int y, CompletableFuture completableFuture, int delay) { + + if (world == null) return; + Location pos1 = island.getPosition1(world); + Location pos2 = island.getPosition2(world); + + if(!(IridiumSkyblock.getInstance().getDefaultWorldGenerator(world.getName(), null) instanceof VoidGenerator)) { + + String worldName = "plugins/iridiumskyblock" + "/" + "regenWorlds" + "/" + world.getName() + "_regen"; + if (Bukkit.getWorld(worldName) == null) { + + WorldCreator worldCreator = new WorldCreator(worldName) + .generator(IridiumSkyblock.getInstance().getDefaultWorldGenerator(world.getName(), null)) + .environment(world.getEnvironment()) + .seed(world.getSeed()); + + worldCreator.createWorld(); + } + + World regenWorld = Bukkit.getWorld(worldName); + + for (int x = pos1.getBlockX(); x <= pos2.getBlockX(); x++) { + for (int z = pos1.getBlockZ(); z <= pos2.getBlockZ(); z++) { + Block blockA = regenWorld.getBlockAt(x, y, z); + Block blockB = world.getBlockAt(x, y, z); + + blockB.setType(blockA.getType(), false); + } + } + + if (y <= LocationUtils.getMinHeight(world)) { + completableFuture.complete(null); + } else { + if (delay < 1) { + regenerateTerrain(island, world, y - 1, completableFuture, delay); + } else { + Bukkit.getScheduler().runTaskLater(IridiumSkyblock.getInstance(), () -> regenerateTerrain(island, world, y - 1, completableFuture, delay), delay); + } + } + } + } + @Override public boolean deleteTeam(Island island, User user) { IslandDeleteEvent islandDeleteEvent = new IslandDeleteEvent(island, user); @@ -291,6 +355,7 @@ public boolean deleteTeam(Island island, User user) { if (IridiumSkyblock.getInstance().getConfiguration().removeIslandBlocksOnDelete) { deleteIslandBlocks(island); + regenerateTerrain(island); } IridiumSkyblock.getInstance().getDatabaseManager().getIslandTableManager().delete(island); From 9cc68b0caa24041edcf4db16cc35eabc88b6741c Mon Sep 17 00:00:00 2001 From: Shyanne Date: Mon, 19 Feb 2024 17:55:49 -0500 Subject: [PATCH 06/19] refactored world generation to createWorld() - moved the cache world creation to the create world method so that the plugin does not lag on island creation - changed setting to GeneratorType enum - added vanilla generation option (takes advantage of null chunk generator) - deletes and regenerates cache world on bad seed comparison so that the cache world matches even on generator change --- .../iridiumskyblock/IridiumSkyblock.java | 7 +- .../configs/Configuration.java | 3 +- .../managers/GeneratorType.java | 11 ++ .../managers/IslandManager.java | 106 ++++++++++++------ 4 files changed, 92 insertions(+), 35 deletions(-) create mode 100644 src/main/java/com/iridium/iridiumskyblock/managers/GeneratorType.java diff --git a/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java b/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java index 2101e8875..b6b6cdcac 100644 --- a/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java +++ b/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java @@ -82,11 +82,16 @@ public IridiumSkyblock() { public void onLoad() { super.onLoad(); + // This switch statement is here so that if we end up adding another generator type, we can throw it in this. switch(IridiumSkyblock.getInstance().getConfiguration().generatorType) { - case "ocean": { + case OCEAN: { this.chunkGenerator = new OceanGenerator(); break; } + case VANILLA: { + this.chunkGenerator = null; + break; + } default: { this.chunkGenerator = new VoidGenerator(); break; diff --git a/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java b/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java index e0dab96f5..6b361ba49 100644 --- a/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java +++ b/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java @@ -5,6 +5,7 @@ import com.iridium.iridiumcore.Item; import com.iridium.iridiumcore.dependencies.xseries.XMaterial; import com.iridium.iridiumcore.dependencies.xseries.XSound; +import com.iridium.iridiumskyblock.managers.GeneratorType; import com.iridium.iridiumteams.Reward; import org.bukkit.World; @@ -43,7 +44,7 @@ public Configuration() { public String defaultDescription = "Default island description :c"; public String worldName = "IridiumSkyblock"; public String spawnWorldName = "world"; - public String generatorType = "skyblock"; + public GeneratorType generatorType = GeneratorType.VOID; public String islandTitleTop = "&9%island_name%"; public String islandTitleBottom = "&7%island_description%"; public String paster = "worldedit"; diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/GeneratorType.java b/src/main/java/com/iridium/iridiumskyblock/managers/GeneratorType.java new file mode 100644 index 000000000..c26afbe68 --- /dev/null +++ b/src/main/java/com/iridium/iridiumskyblock/managers/GeneratorType.java @@ -0,0 +1,11 @@ +package com.iridium.iridiumskyblock.managers; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum GeneratorType { + VOID(false), OCEAN(true), VANILLA(true); + private final boolean terrainGenerator; +} \ No newline at end of file diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java index 35cd2285f..081975c0d 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java @@ -15,7 +15,6 @@ import com.iridium.iridiumskyblock.configs.Schematics; import com.iridium.iridiumskyblock.database.Island; import com.iridium.iridiumskyblock.database.User; -import com.iridium.iridiumskyblock.generators.VoidGenerator; import com.iridium.iridiumskyblock.gui.CreateGUI; import com.iridium.iridiumskyblock.utils.LocationUtils; import com.iridium.iridiumskyblock.utils.PlayerUtils; @@ -53,13 +52,37 @@ public IslandManager() { super(IridiumSkyblock.getInstance()); } + public boolean deleteWorld(File path) { + if(path.exists()) { + File files[] = path.listFiles(); + for(int i=0; i getIslandCreateEvent(@NotNull User public CompletableFuture generateIsland(Island island, Schematics.SchematicConfig schematicConfig) { return CompletableFuture.runAsync(() -> { setHome(island, schematicConfig); + clearEntities(island); deleteIslandBlocks(island).join(); regenerateTerrain(island).join(); - clearEntities(island); IridiumSkyblock.getInstance().getSchematicManager().pasteSchematic(island, schematicConfig).join(); - setIslandBiome(island, XBiome.matchXBiome(schematicConfig.overworld.biome)); - setIslandBiome(island, XBiome.matchXBiome(schematicConfig.nether.biome)); - setIslandBiome(island, XBiome.matchXBiome(schematicConfig.end.biome)); + setIslandBiome(island, schematicConfig); }); } @@ -237,6 +282,12 @@ private void setHome(Island island, Schematics.SchematicConfig schematicConfig) island.setHome(location); } + public void setIslandBiome(Island island, Schematics.SchematicConfig schematicConfig) { + setIslandBiome(island, XBiome.matchXBiome(schematicConfig.overworld.biome)); + setIslandBiome(island, XBiome.matchXBiome(schematicConfig.nether.biome)); + setIslandBiome(island, XBiome.matchXBiome(schematicConfig.end.biome)); + } + public CompletableFuture clearEntities(Island island) { return CompletableFuture.runAsync(() -> { List> completableFutures = Arrays.asList( @@ -341,42 +392,31 @@ private CompletableFuture regenerateTerrain(Island island, World world) { public void regenerateTerrain (Island island, World world, int y, CompletableFuture completableFuture, int delay) { - if (world == null) return; - Location pos1 = island.getPosition1(world); - Location pos2 = island.getPosition2(world); - - if(!(IridiumSkyblock.getInstance().getDefaultWorldGenerator(world.getName(), null) instanceof VoidGenerator)) { - - String worldName = "plugins/iridiumskyblock" + "/" + "regenWorlds" + "/" + world.getName() + "_regen"; - if (Bukkit.getWorld(worldName) == null) { + if(world == null) return; - WorldCreator worldCreator = new WorldCreator(worldName) - .generator(IridiumSkyblock.getInstance().getDefaultWorldGenerator(world.getName(), null)) - .environment(world.getEnvironment()) - .seed(world.getSeed()); + if(!IridiumSkyblock.getInstance().getConfiguration().generatorType.isTerrainGenerator()) completableFuture.complete(null); - worldCreator.createWorld(); - } + Location pos1 = island.getPosition1(world); + Location pos2 = island.getPosition2(world); - World regenWorld = Bukkit.getWorld(worldName); + World regenWorld = Bukkit.getWorld(getCacheWorldName(world)); - for (int x = pos1.getBlockX(); x <= pos2.getBlockX(); x++) { - for (int z = pos1.getBlockZ(); z <= pos2.getBlockZ(); z++) { - Block blockA = regenWorld.getBlockAt(x, y, z); - Block blockB = world.getBlockAt(x, y, z); + for (int x = pos1.getBlockX(); x <= pos2.getBlockX(); x++) { + for (int z = pos1.getBlockZ(); z <= pos2.getBlockZ(); z++) { + Block blockA = regenWorld.getBlockAt(x, y, z); + Block blockB = world.getBlockAt(x, y, z); - blockB.setType(blockA.getType(), false); - } + blockB.setType(blockA.getType(), false); } + } - if (y <= LocationUtils.getMinHeight(world)) { - completableFuture.complete(null); + if (y <= LocationUtils.getMinHeight(world)) { + completableFuture.complete(null); + } else { + if (delay < 1) { + regenerateTerrain(island, world, y - 1, completableFuture, delay); } else { - if (delay < 1) { - regenerateTerrain(island, world, y - 1, completableFuture, delay); - } else { - Bukkit.getScheduler().runTaskLater(IridiumSkyblock.getInstance(), () -> regenerateTerrain(island, world, y - 1, completableFuture, delay), delay); - } + Bukkit.getScheduler().runTaskLater(IridiumSkyblock.getInstance(), () -> regenerateTerrain(island, world, y - 1, completableFuture, delay), delay); } } } From 3d20ad2b425ed0e7fdf6ece74245700f491d09f9 Mon Sep 17 00:00:00 2001 From: Shyanne Date: Wed, 6 Mar 2024 02:18:34 -0500 Subject: [PATCH 07/19] added generator type logging --- src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java b/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java index b6b6cdcac..741a07c77 100644 --- a/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java +++ b/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java @@ -82,6 +82,7 @@ public IridiumSkyblock() { public void onLoad() { super.onLoad(); + getLogger().info("Loading world generator..."); // This switch statement is here so that if we end up adding another generator type, we can throw it in this. switch(IridiumSkyblock.getInstance().getConfiguration().generatorType) { case OCEAN: { @@ -179,6 +180,7 @@ public void loadConfigs() { this.biomes = getPersist().load(Biomes.class); this.settings = getPersist().load(Settings.class); this.generators = getPersist().load(Generators.class); + getLogger().info("GENERATOR TYPE: " + IridiumSkyblock.getInstance().getConfiguration().generatorType); super.loadConfigs(); int maxSize = enhancements.sizeEnhancement.levels.values().stream() From 9b82606ffeef5bd7b3cd44da24aef49510484f6e Mon Sep 17 00:00:00 2001 From: Shyanne Date: Sat, 16 Mar 2024 10:13:36 -0400 Subject: [PATCH 08/19] Updated calls to regenerateTerrain to use .join() - moved the check for if the generator is a terrain generator to the methods that call regenerateTerrain --- .../iridium/iridiumskyblock/managers/IslandManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java index 081975c0d..c58bbef5f 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java @@ -270,7 +270,8 @@ public CompletableFuture generateIsland(Island island, Schematics.Schemati setHome(island, schematicConfig); clearEntities(island); deleteIslandBlocks(island).join(); - regenerateTerrain(island).join(); + if(IridiumSkyblock.getInstance().getConfiguration().generatorType.isTerrainGenerator()) + regenerateTerrain(island).join(); IridiumSkyblock.getInstance().getSchematicManager().pasteSchematic(island, schematicConfig).join(); setIslandBiome(island, schematicConfig); }); @@ -394,8 +395,6 @@ public void regenerateTerrain (Island island, World world, int y, CompletableFut if(world == null) return; - if(!IridiumSkyblock.getInstance().getConfiguration().generatorType.isTerrainGenerator()) completableFuture.complete(null); - Location pos1 = island.getPosition1(world); Location pos2 = island.getPosition2(world); @@ -429,7 +428,8 @@ public boolean deleteTeam(Island island, User user) { if (IridiumSkyblock.getInstance().getConfiguration().removeIslandBlocksOnDelete) { deleteIslandBlocks(island); - regenerateTerrain(island); + if(IridiumSkyblock.getInstance().getConfiguration().generatorType.isTerrainGenerator()) + regenerateTerrain(island).join(); } IridiumSkyblock.getInstance().getDatabaseManager().getIslandTableManager().delete(island); From 545e4148b9b0addf9eee9d4c8ee9a3c9255f5358 Mon Sep 17 00:00:00 2001 From: Shyanne Date: Sat, 16 Mar 2024 10:31:21 -0400 Subject: [PATCH 09/19] das suggested we format the enum differently so we did Co-authored-by: Daniel Scherf <35780068+dlsf@users.noreply.github.com> --- .../com/iridium/iridiumskyblock/managers/GeneratorType.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/GeneratorType.java b/src/main/java/com/iridium/iridiumskyblock/managers/GeneratorType.java index c26afbe68..81fa94a8f 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/GeneratorType.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/GeneratorType.java @@ -6,6 +6,9 @@ @Getter @AllArgsConstructor public enum GeneratorType { - VOID(false), OCEAN(true), VANILLA(true); + VOID(false), + OCEAN(true), + VANILLA(true); + private final boolean terrainGenerator; } \ No newline at end of file From 0801168b8cb7c803115643acf042fa297770cdb9 Mon Sep 17 00:00:00 2001 From: Shyanne Date: Fri, 10 May 2024 15:14:38 -0400 Subject: [PATCH 10/19] Added flatlands generator (#845) * Added flatlands generator - also added some logging about the generator type to ensure that server admins know what the correct enum values are * forgot to import arrays, silly me --- .../iridiumskyblock/IridiumSkyblock.java | 12 +- .../iridiumskyblock/configs/Generators.java | 53 +++++++ .../generators/FlatGenerator.java | 134 ++++++++++++++++++ .../managers/GeneratorType.java | 1 + 4 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/iridium/iridiumskyblock/generators/FlatGenerator.java diff --git a/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java b/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java index 741a07c77..5ba477fab 100644 --- a/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java +++ b/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java @@ -4,6 +4,7 @@ import com.iridium.iridiumskyblock.configs.*; import com.iridium.iridiumskyblock.database.Island; import com.iridium.iridiumskyblock.database.User; +import com.iridium.iridiumskyblock.generators.FlatGenerator; import com.iridium.iridiumskyblock.generators.OceanGenerator; import com.iridium.iridiumskyblock.generators.VoidGenerator; import com.iridium.iridiumskyblock.listeners.*; @@ -28,6 +29,7 @@ import java.nio.file.Path; import java.nio.file.StandardCopyOption; import java.sql.SQLException; +import java.util.Arrays; import java.util.Comparator; import java.util.Objects; @@ -83,17 +85,25 @@ public void onLoad() { super.onLoad(); getLogger().info("Loading world generator..."); + getLogger().info("Generator Type = " + IridiumSkyblock.getInstance().getConfiguration().generatorType); + // This switch statement is here so that if we end up adding another generator type, we can throw it in this. - switch(IridiumSkyblock.getInstance().getConfiguration().generatorType) { + switch (IridiumSkyblock.getInstance().getConfiguration().generatorType) { case OCEAN: { this.chunkGenerator = new OceanGenerator(); break; } + case FLAT: { + this.chunkGenerator = new FlatGenerator(); + break; + } case VANILLA: { this.chunkGenerator = null; break; } default: { + getLogger().warning("Invalid generator type [" + IridiumSkyblock.getInstance().getConfiguration().generatorType + "], valid types are " + Arrays.toString(GeneratorType.values())); + getLogger().info("Generator Type = " + GeneratorType.VOID); this.chunkGenerator = new VoidGenerator(); break; } diff --git a/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java b/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java index e8de31863..30c9c48e2 100644 --- a/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java +++ b/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java @@ -26,6 +26,7 @@ public class Generators { true ) ); + public Generators.OceanGeneratorConfig oceanGenerator = new OceanGeneratorConfig( new com.iridium.iridiumskyblock.configs.Generators.OceanGeneratorWorld( XBiome.OCEAN, @@ -55,6 +56,32 @@ public class Generators { true )); + public Generators.FlatGeneratorConfig flatGenerator = new FlatGeneratorConfig( + new com.iridium.iridiumskyblock.configs.Generators.FlatGeneratorWorld( + XBiome.PLAINS, + XMaterial.GRASS_BLOCK, + XMaterial.DIRT, + -59, + true, + true + ), + new com.iridium.iridiumskyblock.configs.Generators.FlatGeneratorWorld( + XBiome.NETHER_WASTES, + XMaterial.NETHERRACK, + XMaterial.NETHERRACK, + 5, + true, + true + ), + new com.iridium.iridiumskyblock.configs.Generators.FlatGeneratorWorld( + XBiome.END_BARRENS, + XMaterial.END_STONE, + XMaterial.END_STONE, + 5, + true, + true + )); + @NoArgsConstructor @AllArgsConstructor public static class SkyblockGeneratorConfig { @@ -71,6 +98,14 @@ public static class OceanGeneratorConfig { public OceanGeneratorWorld end; } + @NoArgsConstructor + @AllArgsConstructor + public static class FlatGeneratorConfig { + public FlatGeneratorWorld overworld; + public FlatGeneratorWorld nether; + public FlatGeneratorWorld end; + } + @NoArgsConstructor public static class SkyblockGeneratorWorld { public XBiome biome; @@ -104,7 +139,25 @@ public OceanGeneratorWorld(XBiome biome, XMaterial floor, XMaterial underFloor, this.maxFloorHeight = maxFloorHeight; this.decorate = decorate; this.canSpawnEntities = canSpawnEntities; + } + } + + @NoArgsConstructor + public static class FlatGeneratorWorld { + public XBiome biome; + public XMaterial floor; + public XMaterial underFloor; + public int floorHeight; + public boolean decorate; + public boolean canSpawnEntities; + public FlatGeneratorWorld(XBiome biome, XMaterial floor, XMaterial underFloor, int floorHeight, boolean decorate, boolean canSpawnEntities) { + this.biome = biome; + this.floor = floor; + this.underFloor = underFloor; + this.floorHeight = floorHeight; + this.decorate = decorate; + this.canSpawnEntities = canSpawnEntities; } } } diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/FlatGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/FlatGenerator.java new file mode 100644 index 000000000..1b74840de --- /dev/null +++ b/src/main/java/com/iridium/iridiumskyblock/generators/FlatGenerator.java @@ -0,0 +1,134 @@ +package com.iridium.iridiumskyblock.generators; + +import com.iridium.iridiumcore.dependencies.xseries.XMaterial; +import com.iridium.iridiumskyblock.IridiumSkyblock; +import com.iridium.iridiumskyblock.configs.Generators; +import com.iridium.iridiumskyblock.utils.LocationUtils; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.World.Environment; +import org.bukkit.block.Block; +import org.bukkit.generator.ChunkGenerator; +import org.bukkit.inventory.InventoryHolder; +import org.bukkit.util.noise.SimplexOctaveGenerator; +import org.jetbrains.annotations.NotNull; +import org.bukkit.generator.WorldInfo; + +import java.util.*; + +public class FlatGenerator extends ChunkGenerator { + + @Override + public @NotNull ChunkData generateChunkData( + @NotNull World world, @NotNull Random random, int chunkX, int chunkZ, @NotNull BiomeGrid biomeGrid) { + + final ChunkData chunkData = createChunkData(world); + int floorHeight = getFlatGenerator(world.getEnvironment()).floorHeight; + + for (int x = 0; x < 16; x++) { + for (int z = 0; z < 16; z++) { + + // Generate layer of bedrock + chunkData.setBlock(x, LocationUtils.getMinHeight(world), z, + Objects.requireNonNull(XMaterial.BEDROCK.parseMaterial()) + ); + + // Generate dirt layer + for (int y = LocationUtils.getMinHeight(world) + 1; y < floorHeight; y++) { + chunkData.setBlock(x, y, z, + Objects.requireNonNull(getFlatGenerator(world.getEnvironment()).underFloor.parseMaterial()) + ); + } + + // Generate grass on top of dirt + chunkData.setBlock(x, floorHeight, z, + Objects.requireNonNull(getFlatGenerator(world.getEnvironment()).floor.parseMaterial()) + ); + + biomeGrid.setBiome(x, z, Objects.requireNonNull(getFlatGenerator(world.getEnvironment()).biome.getBiome())); + } + } + + return chunkData; + } + + public void generateFlatland(World world, int x, int z) { + + Random random = new Random((world.getSeed())); + + int floorHeight = getFlatGenerator(world.getEnvironment()).floorHeight; + int minFloorHeight = world.getMinHeight(); + + // Generate layer of bedrock + if (world.getBlockAt(x, minFloorHeight, z).getType() != XMaterial.BEDROCK.parseMaterial()) { + if (world.getBlockAt(x, minFloorHeight, z).getState() instanceof InventoryHolder) { + ((InventoryHolder) world.getBlockAt(x, minFloorHeight, z).getState()).getInventory().clear(); + } + world.getBlockAt(x, minFloorHeight, z).setType(Material.BEDROCK, false); + } + + // Generate dirt layer + for (int y = minFloorHeight + 1; y < floorHeight; y++) { + Block block = world.getBlockAt(x, y, z); + if (block.getType() != getFlatGenerator(world.getEnvironment()).underFloor.parseMaterial() + && getFlatGenerator(world.getEnvironment()).underFloor.parseMaterial() != null) { + + if (block.getState() instanceof InventoryHolder) { + ((InventoryHolder) block.getState()).getInventory().clear(); + } + block.setType(Objects.requireNonNull(getFlatGenerator(world.getEnvironment()).underFloor.parseMaterial()), false); + } + } + + // Generate grass on top of dirt + if (world.getBlockAt(x, floorHeight, z).getType() != getFlatGenerator(world.getEnvironment()).floor.parseMaterial() + && getFlatGenerator(world.getEnvironment()).floor.parseMaterial() != null) { + + if (world.getBlockAt(x, floorHeight, z).getState() instanceof InventoryHolder) { + ((InventoryHolder) world.getBlockAt(x, floorHeight, z).getState()).getInventory().clear(); + } + + world.getBlockAt(x, floorHeight, z) + .setType(Objects.requireNonNull(getFlatGenerator(world.getEnvironment()).floor.parseMaterial()), false); + + } + + // Replace everything else with air + for (int y = floorHeight + 1; y < world.getMaxHeight(); y++) { + Block block = world.getBlockAt(x, y, z); + if (block.getType() != Material.AIR) { + if (block.getState() instanceof InventoryHolder) { + ((InventoryHolder) block.getState()).getInventory().clear(); + } + block.setType(Material.AIR, false); + } + } + + // Generate kelp, ores, and mineral deposits + shouldGenerateDecorations(world, random , x, z); + } + + @Override + public boolean shouldGenerateDecorations(@NotNull WorldInfo worldInfo, @NotNull Random random, int x, int z) { + return getFlatGenerator(worldInfo.getEnvironment()).decorate; + } + + @Override + public boolean canSpawn(@NotNull World world, int x, int z) { + return getFlatGenerator(world.getEnvironment()).canSpawnEntities; + } + + private Generators.FlatGeneratorWorld getFlatGenerator(Environment environment) { + switch (environment) { + case NETHER: { + return IridiumSkyblock.getInstance().getGenerators().flatGenerator.nether; + } + case THE_END: { + return IridiumSkyblock.getInstance().getGenerators().flatGenerator.end; + } + default: { + return IridiumSkyblock.getInstance().getGenerators().flatGenerator.overworld; + } + } + } +} \ No newline at end of file diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/GeneratorType.java b/src/main/java/com/iridium/iridiumskyblock/managers/GeneratorType.java index 81fa94a8f..311aff57f 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/GeneratorType.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/GeneratorType.java @@ -8,6 +8,7 @@ public enum GeneratorType { VOID(false), OCEAN(true), + FLAT(true), VANILLA(true); private final boolean terrainGenerator; From d0fe9f82acb7d9adf9a9b048bfaf2311d7481ab2 Mon Sep 17 00:00:00 2001 From: Shyanne Date: Fri, 10 May 2024 16:10:02 -0400 Subject: [PATCH 11/19] added a more explicit comment --- .../com/iridium/iridiumskyblock/managers/IslandManager.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java index 8739f6709..dac819325 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java @@ -66,9 +66,8 @@ public boolean deleteWorld(File path) { return(path.delete()); } - // When creating the cached world, we specify its name with a path to place it in the data folder. - // For some silly reason, using getDataFolder() results in an illegal character error. - // Same with using File.separator. + // Bukkit's createWorld method requires "/" no matter which platform we're on. + // Which is why we need to code it like this, File.separator and co. aren't enough. public String getCacheWorldName(World world) { return "plugins/iridiumskyblock" + "/" + "regenWorlds" + "/" + world.getName() + "_regen"; } From 00b4258551fd68e515c1b84c892e2479c6f656e6 Mon Sep 17 00:00:00 2001 From: Shyanne Date: Fri, 10 May 2024 16:12:42 -0400 Subject: [PATCH 12/19] made the delete world method a lil nicer (ty das) Co-authored-by: Daniel Scherf <35780068+dlsf@users.noreply.github.com> --- .../iridiumskyblock/managers/IslandManager.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java index dac819325..0f20871be 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java @@ -53,17 +53,10 @@ public IslandManager() { } public boolean deleteWorld(File path) { - if(path.exists()) { - File files[] = path.listFiles(); - for(int i=0; i Date: Fri, 10 May 2024 16:15:01 -0400 Subject: [PATCH 13/19] removed generateChunkData --- .../iridiumskyblock/generators/VoidGenerator.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java index 554032dea..e9e9a84a1 100644 --- a/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java +++ b/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java @@ -16,17 +16,6 @@ public class VoidGenerator extends ChunkGenerator { public byte[][] blockSections; - @Override - public @NotNull ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int chunkX, int chunkZ, @NotNull BiomeGrid biomeGrid) { - final ChunkData chunkData = createChunkData(world); - for (int x = 0; x < 16; x++) { - for (int z = 0; z < 16; z++) { - biomeGrid.setBiome(x, z, Objects.requireNonNull(getSkyblockGenerator(world.getEnvironment()).biome.getBiome())); - } - } - return chunkData; - } - public byte[][] generateBlockSections(World world, Random random, int x, int z, BiomeGrid biomeGrid) { if (blockSections == null) { blockSections = new byte[world.getMaxHeight() / 16][]; From d262577c59c6b4346243abd8b7fff1eca50b585a Mon Sep 17 00:00:00 2001 From: Shyanne Date: Fri, 10 May 2024 16:18:58 -0400 Subject: [PATCH 14/19] reverted deleteWorld method overhaul --- .../iridiumskyblock/managers/IslandManager.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java index 0f20871be..b7dddd4b8 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java @@ -40,6 +40,8 @@ import org.jetbrains.annotations.Nullable; import java.io.File; +import java.io.IOException; +import java.nio.file.Files; import java.time.LocalDateTime; import java.util.*; import java.util.concurrent.CompletableFuture; @@ -53,10 +55,17 @@ public IslandManager() { } public boolean deleteWorld(File path) { - Files.walk(pathToBeDeleted) - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); + if(path.exists()) { + File files[] = path.listFiles(); + for(int i=0; i Date: Fri, 10 May 2024 16:19:52 -0400 Subject: [PATCH 15/19] remove imports --- .../com/iridium/iridiumskyblock/managers/IslandManager.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java index b7dddd4b8..dac819325 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java @@ -40,8 +40,6 @@ import org.jetbrains.annotations.Nullable; import java.io.File; -import java.io.IOException; -import java.nio.file.Files; import java.time.LocalDateTime; import java.util.*; import java.util.concurrent.CompletableFuture; From 0bfba52ba04827428b93a8301cbab596b6fb0af3 Mon Sep 17 00:00:00 2001 From: Shyanne Date: Sun, 12 May 2024 22:59:15 -0400 Subject: [PATCH 16/19] Re-implemented ChunkData method, cleaned up cache world creation --- .../iridiumskyblock/generators/VoidGenerator.java | 11 +++++++++++ .../iridiumskyblock/managers/IslandManager.java | 12 +++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java index e9e9a84a1..554032dea 100644 --- a/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java +++ b/src/main/java/com/iridium/iridiumskyblock/generators/VoidGenerator.java @@ -16,6 +16,17 @@ public class VoidGenerator extends ChunkGenerator { public byte[][] blockSections; + @Override + public @NotNull ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int chunkX, int chunkZ, @NotNull BiomeGrid biomeGrid) { + final ChunkData chunkData = createChunkData(world); + for (int x = 0; x < 16; x++) { + for (int z = 0; z < 16; z++) { + biomeGrid.setBiome(x, z, Objects.requireNonNull(getSkyblockGenerator(world.getEnvironment()).biome.getBiome())); + } + } + return chunkData; + } + public byte[][] generateBlockSections(World world, Random random, int x, int z, BiomeGrid biomeGrid) { if (blockSections == null) { blockSections = new byte[world.getMaxHeight() / 16][]; diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java index dac819325..5a44dde2b 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java @@ -78,6 +78,7 @@ public void createWorld(World.Environment environment, String name) { WorldCreator worldCreator = new WorldCreator(name) .generator(IridiumSkyblock.getInstance().getDefaultWorldGenerator(name, null)) .environment(environment); + World world = Bukkit.createWorld(worldCreator); createCacheWorld(world); @@ -111,14 +112,8 @@ public void createCacheWorld(World world) { if(!IridiumSkyblock.getInstance().getConfiguration().generatorType.isTerrainGenerator()) return; - if (Bukkit.getWorld(getCacheWorldName(world)) == null) { - - WorldCreator worldCreator = new WorldCreator(getCacheWorldName(world)) - .generator(IridiumSkyblock.getInstance().getDefaultWorldGenerator(world.getName(), null)) - .environment(world.getEnvironment()) - .seed(world.getSeed()); - + WorldCreator worldCreator = new WorldCreator(getCacheWorldName(world)).copy(world); worldCreator.createWorld(); } @@ -403,8 +398,7 @@ public void regenerateTerrain (Island island, World world, int y, CompletableFut for (int z = pos1.getBlockZ(); z <= pos2.getBlockZ(); z++) { Block blockA = regenWorld.getBlockAt(x, y, z); Block blockB = world.getBlockAt(x, y, z); - - blockB.setType(blockA.getType(), false); + blockB.setBlockData(blockA.getBlockData(), false); } } From ee13fe23156a194ab10a96066c10b3a58c14142b Mon Sep 17 00:00:00 2001 From: Shyanne Date: Sun, 12 May 2024 23:00:39 -0400 Subject: [PATCH 17/19] Removed shouldGenerateDecorations methods (temporarily) --- .../com/iridium/iridiumskyblock/generators/FlatGenerator.java | 3 ++- .../com/iridium/iridiumskyblock/generators/OceanGenerator.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/FlatGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/FlatGenerator.java index 1b74840de..a3df3f080 100644 --- a/src/main/java/com/iridium/iridiumskyblock/generators/FlatGenerator.java +++ b/src/main/java/com/iridium/iridiumskyblock/generators/FlatGenerator.java @@ -105,7 +105,8 @@ && getFlatGenerator(world.getEnvironment()).floor.parseMaterial() != null) { } // Generate kelp, ores, and mineral deposits - shouldGenerateDecorations(world, random , x, z); + // BREAKS BELOW 1.18 + //shouldGenerateDecorations(world, random , x, z); } @Override diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java index 5a08457e8..290400513 100644 --- a/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java +++ b/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java @@ -137,7 +137,8 @@ && getOceanGenerator(world.getEnvironment()).floor.parseMaterial() != null) { } // Generate kelp, ores, and mineral deposits - shouldGenerateDecorations(world, random , x, z); + // BREAKS BELOW 1.18 + //shouldGenerateDecorations(world, random , x, z); } @Override From 099bf9aa01a7c3dad54039f20197f9e28ddc4200 Mon Sep 17 00:00:00 2001 From: Shyanne Date: Sun, 21 Jul 2024 13:37:30 -0400 Subject: [PATCH 18/19] Update IridiumSkyblock.java plugin would incorrectly report invalid generator type for VOID because i didnt add the case for void, so it would default --- .../java/com/iridium/iridiumskyblock/IridiumSkyblock.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java b/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java index 5ba477fab..028e32287 100644 --- a/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java +++ b/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java @@ -101,6 +101,10 @@ public void onLoad() { this.chunkGenerator = null; break; } + case VOID: { + this.chunkGenerator = new VoidGenerator(); + break; + } default: { getLogger().warning("Invalid generator type [" + IridiumSkyblock.getInstance().getConfiguration().generatorType + "], valid types are " + Arrays.toString(GeneratorType.values())); getLogger().info("Generator Type = " + GeneratorType.VOID); From 208779a6475f9e977589bc391cf76ac7186e1972 Mon Sep 17 00:00:00 2001 From: Daniel Scherf Date: Wed, 4 Sep 2024 23:41:33 +0200 Subject: [PATCH 19/19] Fix imports --- .../com/iridium/iridiumskyblock/configs/Generators.java | 9 +++------ .../iridiumskyblock/generators/FlatGenerator.java | 3 +-- .../iridiumskyblock/generators/OceanGenerator.java | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java b/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java index 30c9c48e2..18875b018 100644 --- a/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java +++ b/src/main/java/com/iridium/iridiumskyblock/configs/Generators.java @@ -1,14 +1,11 @@ package com.iridium.iridiumskyblock.configs; -import com.google.common.collect.ImmutableMap; -import com.iridium.iridiumcore.dependencies.fasterxml.annotation.JsonIgnoreProperties; -import com.iridium.iridiumcore.dependencies.xseries.XBiome; -import com.iridium.iridiumcore.dependencies.xseries.XMaterial; +import com.cryptomorin.xseries.XBiome; +import com.cryptomorin.xseries.XMaterial; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; -import java.util.Map; - @JsonIgnoreProperties(ignoreUnknown = true) public class Generators { diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/FlatGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/FlatGenerator.java index a3df3f080..570ae1dc4 100644 --- a/src/main/java/com/iridium/iridiumskyblock/generators/FlatGenerator.java +++ b/src/main/java/com/iridium/iridiumskyblock/generators/FlatGenerator.java @@ -1,6 +1,6 @@ package com.iridium.iridiumskyblock.generators; -import com.iridium.iridiumcore.dependencies.xseries.XMaterial; +import com.cryptomorin.xseries.XMaterial; import com.iridium.iridiumskyblock.IridiumSkyblock; import com.iridium.iridiumskyblock.configs.Generators; import com.iridium.iridiumskyblock.utils.LocationUtils; @@ -10,7 +10,6 @@ import org.bukkit.block.Block; import org.bukkit.generator.ChunkGenerator; import org.bukkit.inventory.InventoryHolder; -import org.bukkit.util.noise.SimplexOctaveGenerator; import org.jetbrains.annotations.NotNull; import org.bukkit.generator.WorldInfo; diff --git a/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java b/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java index 290400513..482ebaa03 100644 --- a/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java +++ b/src/main/java/com/iridium/iridiumskyblock/generators/OceanGenerator.java @@ -1,6 +1,6 @@ package com.iridium.iridiumskyblock.generators; -import com.iridium.iridiumcore.dependencies.xseries.XMaterial; +import com.cryptomorin.xseries.XMaterial; import com.iridium.iridiumskyblock.IridiumSkyblock; import com.iridium.iridiumskyblock.configs.Generators; import com.iridium.iridiumskyblock.utils.LocationUtils;