From 7a0e40654e1d1352ae1578840be0bcbf738a534c Mon Sep 17 00:00:00 2001 From: UselessBullets <80850784+UselessBullets@users.noreply.github.com> Date: Fri, 10 Nov 2023 11:26:44 -0600 Subject: [PATCH] Paradise Support --- .../api/ChunkDecoratorOverworldAPI.java | 2 +- .../api/ChunkGeneratorParadiseAPI.java | 15 +++++++++++++++ .../api/ChunkDecoratorOverworldWoodsAPI.java | 10 ---------- .../api/ChunkGeneratorOverworldWoodsAPI.java | 3 ++- .../worldtypes/WorldTypeParadiseMixin.java | 18 ++++++++++++++++++ src/main/resources/terrainapi.mixins.json | 3 ++- 6 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 src/main/java/useless/terrainapi/generation/paradise/api/ChunkGeneratorParadiseAPI.java delete mode 100644 src/main/java/useless/terrainapi/generation/woods/api/ChunkDecoratorOverworldWoodsAPI.java create mode 100644 src/main/java/useless/terrainapi/mixin/worldtypes/WorldTypeParadiseMixin.java diff --git a/src/main/java/useless/terrainapi/generation/overworld/api/ChunkDecoratorOverworldAPI.java b/src/main/java/useless/terrainapi/generation/overworld/api/ChunkDecoratorOverworldAPI.java index 26b02b3..d3530ed 100644 --- a/src/main/java/useless/terrainapi/generation/overworld/api/ChunkDecoratorOverworldAPI.java +++ b/src/main/java/useless/terrainapi/generation/overworld/api/ChunkDecoratorOverworldAPI.java @@ -25,7 +25,7 @@ public class ChunkDecoratorOverworldAPI extends ChunkDecoratorAPI { public static OverworldOreFeatures oreFeatures = new OverworldOreFeatures(overworldConfig); public static OverworldRandomFeatures randomFeatures = new OverworldRandomFeatures(); public static OverworldBiomeFeatures biomeFeatures = new OverworldBiomeFeatures(); - protected ChunkDecoratorOverworldAPI(World world, int treeDensityOverride) { + public ChunkDecoratorOverworldAPI(World world, int treeDensityOverride) { super(world); this.treeDensityOverride = treeDensityOverride; this.treeDensityNoise = new PerlinNoise(world.getRandomSeed(), 8, 74); diff --git a/src/main/java/useless/terrainapi/generation/paradise/api/ChunkGeneratorParadiseAPI.java b/src/main/java/useless/terrainapi/generation/paradise/api/ChunkGeneratorParadiseAPI.java new file mode 100644 index 0000000..5c704e2 --- /dev/null +++ b/src/main/java/useless/terrainapi/generation/paradise/api/ChunkGeneratorParadiseAPI.java @@ -0,0 +1,15 @@ +package useless.terrainapi.generation.paradise.api; + +import net.minecraft.core.world.World; +import net.minecraft.core.world.generate.MapGenCaves; +import net.minecraft.core.world.generate.chunk.perlin.ChunkGeneratorPerlin; +import net.minecraft.core.world.generate.chunk.perlin.overworld.SurfaceGeneratorOverworld; +import net.minecraft.core.world.generate.chunk.perlin.paradise.TerrainGeneratorParadise; +import useless.terrainapi.generation.overworld.api.ChunkDecoratorOverworldAPI; + +public class ChunkGeneratorParadiseAPI + extends ChunkGeneratorPerlin { + public ChunkGeneratorParadiseAPI(World world) { + super(world, new ChunkDecoratorOverworldAPI(world), new TerrainGeneratorParadise(world), new SurfaceGeneratorOverworld(world), new MapGenCaves(false)); + } +} diff --git a/src/main/java/useless/terrainapi/generation/woods/api/ChunkDecoratorOverworldWoodsAPI.java b/src/main/java/useless/terrainapi/generation/woods/api/ChunkDecoratorOverworldWoodsAPI.java deleted file mode 100644 index b334c13..0000000 --- a/src/main/java/useless/terrainapi/generation/woods/api/ChunkDecoratorOverworldWoodsAPI.java +++ /dev/null @@ -1,10 +0,0 @@ -package useless.terrainapi.generation.woods.api; - -import net.minecraft.core.world.World; -import useless.terrainapi.generation.overworld.api.ChunkDecoratorOverworldAPI; - -public class ChunkDecoratorOverworldWoodsAPI extends ChunkDecoratorOverworldAPI { - protected ChunkDecoratorOverworldWoodsAPI(World world) { - super(world, 50); - } -} diff --git a/src/main/java/useless/terrainapi/generation/woods/api/ChunkGeneratorOverworldWoodsAPI.java b/src/main/java/useless/terrainapi/generation/woods/api/ChunkGeneratorOverworldWoodsAPI.java index 358143f..bf7ec06 100644 --- a/src/main/java/useless/terrainapi/generation/woods/api/ChunkGeneratorOverworldWoodsAPI.java +++ b/src/main/java/useless/terrainapi/generation/woods/api/ChunkGeneratorOverworldWoodsAPI.java @@ -5,9 +5,10 @@ import net.minecraft.core.world.generate.chunk.perlin.ChunkGeneratorPerlin; import net.minecraft.core.world.generate.chunk.perlin.overworld.SurfaceGeneratorOverworld; import net.minecraft.core.world.generate.chunk.perlin.overworld.TerrainGeneratorOverworld; +import useless.terrainapi.generation.overworld.api.ChunkDecoratorOverworldAPI; public class ChunkGeneratorOverworldWoodsAPI extends ChunkGeneratorPerlin { public ChunkGeneratorOverworldWoodsAPI(World world) { - super(world, new ChunkDecoratorOverworldWoodsAPI(world), new TerrainGeneratorOverworld(world), new SurfaceGeneratorOverworld(world), new MapGenCaves(false)); + super(world, new ChunkDecoratorOverworldAPI(world, 50), new TerrainGeneratorOverworld(world), new SurfaceGeneratorOverworld(world), new MapGenCaves(false)); } } diff --git a/src/main/java/useless/terrainapi/mixin/worldtypes/WorldTypeParadiseMixin.java b/src/main/java/useless/terrainapi/mixin/worldtypes/WorldTypeParadiseMixin.java new file mode 100644 index 0000000..d75e8a3 --- /dev/null +++ b/src/main/java/useless/terrainapi/mixin/worldtypes/WorldTypeParadiseMixin.java @@ -0,0 +1,18 @@ +package useless.terrainapi.mixin.worldtypes; + +import net.minecraft.core.world.World; +import net.minecraft.core.world.generate.chunk.ChunkGenerator; +import net.minecraft.core.world.type.WorldTypeParadise; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import useless.terrainapi.generation.paradise.api.ChunkGeneratorParadiseAPI; + +@Mixin(value = WorldTypeParadise.class, remap = false) +public class WorldTypeParadiseMixin { + @Inject(method = "createChunkGenerator(Lnet/minecraft/core/world/World;)Lnet/minecraft/core/world/generate/chunk/ChunkGenerator;", at = @At("HEAD"), cancellable = true) + private void customChunkGenerator(World world, CallbackInfoReturnable cir){ + cir.setReturnValue(new ChunkGeneratorParadiseAPI(world)); + } +} diff --git a/src/main/resources/terrainapi.mixins.json b/src/main/resources/terrainapi.mixins.json index ffbd857..a27a2a3 100644 --- a/src/main/resources/terrainapi.mixins.json +++ b/src/main/resources/terrainapi.mixins.json @@ -9,7 +9,8 @@ "worldtypes.WorldTypeNetherMixin", "worldtypes.WorldTypeOverworldMixin", "worldtypes.WorldTypeOverworldRetroMixin", - "worldtypes.WorldTypeOverworldWoodsMixin" + "worldtypes.WorldTypeOverworldWoodsMixin", + "worldtypes.WorldTypeParadiseMixin" ], "client": [ ],