Skip to content

Commit

Permalink
Merge pull request #55 from Vetpetmon-Labs/master
Browse files Browse the repository at this point in the history
WoN Spreading Biome support
  • Loading branch information
ACGaming authored May 29, 2024
2 parents 432094c + 28de93d commit 6c06a14
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ dependencies {
}
}
compileOnly rfg.deobf("maven.modrinth:scapeandrunparasites:1.9.20")
compileOnly rfg.deobf("maven.modrinth:wyrms:0.5.124")
compileOnly rfg.deobf("curse.maven:biomes-o-plenty-220318:2842510")
compileOnly rfg.deobf("curse.maven:twilightforest-227639:3051450")
compileOnly rfg.deobf("curse.maven:thaumcraft-223628:2629023")
Expand Down Expand Up @@ -257,4 +258,4 @@ idea {

tasks.named("processIdeaSettings").configure {
dependsOn("injectTags")
}
}
1 change: 1 addition & 0 deletions src/main/java/org/dimdev/jeid/JEID.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class JEID {
+ "after:tofucraft;"
+ "after:tropicraft;"
+ "after:twilightforest;"
+ "after:wyrmsofnyrus;"
+ "after:worldedit";
public static final Logger LOGGER = LogManager.getLogger(JEID.NAME);

Expand Down
9 changes: 9 additions & 0 deletions src/main/java/org/dimdev/jeid/core/JEIDMixinLoader.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.dimdev.jeid.core;

import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
import zone.rong.mixinbooter.ILateMixinLoader;

import java.util.ArrayList;
Expand Down Expand Up @@ -106,6 +107,14 @@ public List<String> getMixinConfigs() {
configs.add("mixins.jeid.worldedit.json");
}

// Checks if the mod is within the version that has the legacy Biome Spread code
if (Loader.isModLoaded("wyrmsofnyrus"))
//TODO: Doesn't work since this code runs before anything is actually loaded, so we'll need to find another way before v0.6 comes out.
// Loader.instance().getCustomModProperties("wyrmsofnyrus").get("version").matches("0.5.[1-9][0-9]{1,3}") )
// this checks any version between v0.5.10 (introduced the system) and v0.5.9999 (Impossible number of versions for a LTS version, but let's futureproof it to be safe.)
configs.add("mixins.jeid.wyrmsofnyrus.json");


return configs;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package org.dimdev.jeid.mixin.modsupport.wyrmsofnyrus;

import com.vetpetmon.wyrmsofnyrus.world.biome.BiomeRegistry;
import com.vetpetmon.wyrmsofnyrus.world.biome.SpreadingBiome;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import org.dimdev.jeid.INewChunk;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Pseudo;

@Pseudo
@Mixin(SpreadingBiome.class)
public class MixinBiomeSpread {
// I would natively implement this considering it doesn't even need anything fancy,
// but I must agree that making a one-off patch is much more performant than making the game
// check for REID, though I am concerned if people are using JEID and don't know about REID...
//
// In 0.6 or a later 0.5.x release I'll probably figure out a way to make a native patch.
//
// WoN's biome alteration code is similar to Thaumcraft's and SRP's biome alteration,
// so these patches are based on those mods' patches.
// I keep calling Mixins patches. I see no difference.
// Can you believe this is the first Mixin I made that actually works? -Modrome, official WoN dev
/**
* @author Modrome
* @reason Patches Wyrms of Nyrus's Biome Spread compatible for WoN 0.5.x; code will need to be updated when 0.6 releases
*/
@Overwrite(remap=false)
public static void setBiome(World w, BlockPos pos, Biome biome) {
if (biome != null) {
int convX = pos.getX() & 15;
int convZ = pos.getZ() & 15;
((INewChunk)w.getChunk(pos)).getIntBiomeArray()[convZ << 4 | convX] = Biome.getIdForBiome(biome);
}

}

/**
* @author Modrome
* @reason The alternative function; code will need to be updated when 0.6 releases. This code in WoN is a default shortcut that has since been removed in 0.6
*/
@Overwrite(remap=false)
public static void setBiome(World w, BlockPos pos) {
int convX = pos.getX() & 15;
int convZ = pos.getZ() & 15;
((INewChunk)w.getChunk(pos)).getIntBiomeArray()[convZ << 4 | convX] = Biome.getIdForBiome(BiomeRegistry.CREEPLANDS);
}
}
10 changes: 10 additions & 0 deletions src/main/resources/mixins.jeid.wyrmsofnyrus.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"package": "org.dimdev.jeid.mixin.modsupport.wyrmsofnyrus",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinBiomeSpread"
]
}

0 comments on commit 6c06a14

Please sign in to comment.