From b66270829ec8eda79e5d6750be2cf495c7896e23 Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Wed, 31 Jul 2024 14:12:12 +0200 Subject: [PATCH] Add Terrablender compat for Meneglin biome --- build.gradle | 5 +++ gradle.properties | 1 + .../IntegratedDynamicsCompat.java | 2 ++ .../integrateddynamicscompat/Reference.java | 1 + .../terrablender/TerrablenderCompat.java | 34 +++++++++++++++++++ .../TerrablenderCompatInitializer.java | 19 +++++++++++ .../modcompat/terrablender/TestRegion.java | 30 ++++++++++++++++ 7 files changed, 92 insertions(+) create mode 100644 src/main/java/org/cyclops/integrateddynamicscompat/modcompat/terrablender/TerrablenderCompat.java create mode 100644 src/main/java/org/cyclops/integrateddynamicscompat/modcompat/terrablender/TerrablenderCompatInitializer.java create mode 100644 src/main/java/org/cyclops/integrateddynamicscompat/modcompat/terrablender/TestRegion.java diff --git a/build.gradle b/build.gradle index 51c919a4..6a566fa5 100644 --- a/build.gradle +++ b/build.gradle @@ -140,6 +140,8 @@ dependencies { /*runtimeOnly(fg.deobf("com.refinedmods:refinedstorage:${project.refinedstorage_version}")) { // https://repo.refinedmods.com/com/refinedmods/refinedstorage/ transitive = false }*/ + + implementation fg.deobf("com.github.glitchfiend:TerraBlender-forge:${project.terrablender_version}") } minecraft { @@ -152,6 +154,9 @@ minecraft { workingDirectory project.file('run') //property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP' property 'forge.logging.console.level', 'debug' + property 'mixin.env.remapRefMap', 'true' + property 'mixin.env.refMapRemappingFile',"${buildDir}/createSrgToMcp/output.srg" + mods { integrateddynamics { source sourceSets.main diff --git a/gradle.properties b/gradle.properties index 88f37fc6..2cf0977d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,6 +22,7 @@ ie_version=0.12-90-521 crafttweakerapi_version=4.1.6.457 crafttweakermain_version=1.12-4.1.6.457 signals_version=1.12.2:1.1.0-2 +terrablender_version=1.19.2-2.0.1.166 # Workaround for Spotless bug # https://github.com/diffplug/spotless/issues/834 diff --git a/src/main/java/org/cyclops/integrateddynamicscompat/IntegratedDynamicsCompat.java b/src/main/java/org/cyclops/integrateddynamicscompat/IntegratedDynamicsCompat.java index c0ad799b..cc9ea72d 100644 --- a/src/main/java/org/cyclops/integrateddynamicscompat/IntegratedDynamicsCompat.java +++ b/src/main/java/org/cyclops/integrateddynamicscompat/IntegratedDynamicsCompat.java @@ -18,6 +18,7 @@ import org.cyclops.integrateddynamicscompat.modcompat.capabilities.WorkerDryingBasinBlockEntityCompat; import org.cyclops.integrateddynamicscompat.modcompat.capabilities.WorkerMechanicalMachineBlockEntityCompat; import org.cyclops.integrateddynamicscompat.modcompat.capabilities.WorkerSqueezerBlockEntityCompat; +import org.cyclops.integrateddynamicscompat.modcompat.terrablender.TerrablenderCompat; import org.cyclops.integrateddynamicscompat.modcompat.top.TopModCompat; import org.cyclops.integrateddynamicscompat.proxy.ClientProxy; import org.cyclops.integrateddynamicscompat.proxy.CommonProxy; @@ -40,6 +41,7 @@ public IntegratedDynamicsCompat() { protected void loadModCompats(ModCompatLoader modCompatLoader) { super.loadModCompats(modCompatLoader); modCompatLoader.addModCompat(new TopModCompat()); + modCompatLoader.addModCompat(new TerrablenderCompat()); // TODO: temporarily disable some mod compats // Mod compats // modCompatLoader.addModCompat(new RefinedStorageModCompat()); diff --git a/src/main/java/org/cyclops/integrateddynamicscompat/Reference.java b/src/main/java/org/cyclops/integrateddynamicscompat/Reference.java index fefdbabd..fe7baebe 100644 --- a/src/main/java/org/cyclops/integrateddynamicscompat/Reference.java +++ b/src/main/java/org/cyclops/integrateddynamicscompat/Reference.java @@ -17,4 +17,5 @@ public class Reference { public static final String MOD_TOP = "theoneprobe"; public static final String MOD_WAILA = "waila"; public static final String MOD_REFINEDSTORAGE = "refinedstorage"; + public static final String MOD_TERRABLENDER = "terrablender"; } diff --git a/src/main/java/org/cyclops/integrateddynamicscompat/modcompat/terrablender/TerrablenderCompat.java b/src/main/java/org/cyclops/integrateddynamicscompat/modcompat/terrablender/TerrablenderCompat.java new file mode 100644 index 00000000..0955b2ed --- /dev/null +++ b/src/main/java/org/cyclops/integrateddynamicscompat/modcompat/terrablender/TerrablenderCompat.java @@ -0,0 +1,34 @@ +package org.cyclops.integrateddynamicscompat.modcompat.terrablender; + +import org.cyclops.cyclopscore.modcompat.ICompatInitializer; +import org.cyclops.cyclopscore.modcompat.IModCompat; +import org.cyclops.integrateddynamicscompat.Reference; + +/** + * Compatibility plugin for Terrablender. + * @author rubensworks + * + */ +public class TerrablenderCompat implements IModCompat { + + @Override + public String getId() { + return Reference.MOD_TERRABLENDER; + } + + @Override + public boolean isEnabledDefault() { + return true; + } + + @Override + public String getComment() { + return "Injection of biomes."; + } + + @Override + public ICompatInitializer createInitializer() { + return new TerrablenderCompatInitializer(); + } + +} diff --git a/src/main/java/org/cyclops/integrateddynamicscompat/modcompat/terrablender/TerrablenderCompatInitializer.java b/src/main/java/org/cyclops/integrateddynamicscompat/modcompat/terrablender/TerrablenderCompatInitializer.java new file mode 100644 index 00000000..78338afe --- /dev/null +++ b/src/main/java/org/cyclops/integrateddynamicscompat/modcompat/terrablender/TerrablenderCompatInitializer.java @@ -0,0 +1,19 @@ +package org.cyclops.integrateddynamicscompat.modcompat.terrablender; + +import net.minecraft.resources.ResourceLocation; +import org.cyclops.cyclopscore.modcompat.ICompatInitializer; +import org.cyclops.integrateddynamics.Reference; +import org.cyclops.integrateddynamics.world.biome.BiomeMeneglinConfig; +import terrablender.api.Regions; + +/** + * @author rubensworks + */ +public class TerrablenderCompatInitializer implements ICompatInitializer { + @Override + public void initialize() { + if (BiomeMeneglinConfig.spawnWeight > 0) { + Regions.register(new TestRegion(new ResourceLocation(Reference.MOD_ID, "overworld"), BiomeMeneglinConfig.spawnWeight)); + } + } +} diff --git a/src/main/java/org/cyclops/integrateddynamicscompat/modcompat/terrablender/TestRegion.java b/src/main/java/org/cyclops/integrateddynamicscompat/modcompat/terrablender/TestRegion.java new file mode 100644 index 00000000..a206323c --- /dev/null +++ b/src/main/java/org/cyclops/integrateddynamicscompat/modcompat/terrablender/TestRegion.java @@ -0,0 +1,30 @@ +package org.cyclops.integrateddynamicscompat.modcompat.terrablender; + +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.Biomes; +import net.minecraft.world.level.biome.Climate; +import org.cyclops.integrateddynamics.Reference; +import terrablender.api.Region; +import terrablender.api.RegionType; + +import java.util.function.Consumer; + +/** + * @author rubensworks + */ +public class TestRegion extends Region +{ + public TestRegion(ResourceLocation name, int weight) { + super(name, RegionType.OVERWORLD, weight); + } + + @Override + public void addBiomes(Registry registry, Consumer>> mapper) { + this.addModifiedVanillaOverworldBiomes(mapper, builder -> { + builder.replaceBiome(Biomes.FOREST, ResourceKey.create(Registry.BIOME_REGISTRY, new ResourceLocation(Reference.MOD_ID, "meneglin"))); + }); + } +}