-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TwilightForest fixes and uses proper fixes depending on version
- Also added a few logging points for aesthetics - Will log which TwilightForest mixins the mod is using, should there be an issue
- Loading branch information
1 parent
58ec790
commit 0d3bb68
Showing
8 changed files
with
133 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...java/org/dimdev/jeid/mixin/modsupport/twilightforest/MixinBlockTFMagicLogSpecial_Old.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.dimdev.jeid.mixin.modsupport.twilightforest; | ||
|
||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.biome.Biome; | ||
import net.minecraft.world.chunk.Chunk; | ||
import net.minecraftforge.fml.common.network.NetworkRegistry; | ||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | ||
import org.dimdev.jeid.INewChunk; | ||
import org.dimdev.jeid.network.BiomeChangeMessage; | ||
import org.dimdev.jeid.network.MessageManager; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Pseudo; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||
import twilightforest.biomes.TFBiomes; | ||
import twilightforest.block.BlockTFMagicLogSpecial; | ||
|
||
import java.util.Random; | ||
|
||
@Pseudo | ||
@Mixin(BlockTFMagicLogSpecial.class) | ||
public class MixinBlockTFMagicLogSpecial_Old { | ||
/** | ||
* For versions upto and including 3.8 | ||
*/ | ||
@Overwrite(remap = false) | ||
private void sendChangedBiome(World world, BlockPos pos) { | ||
IMessage message = new BiomeChangeMessage(pos.getX(), pos.getZ(), Biome.getIdForBiome(TFBiomes.enchantedForest)); | ||
MessageManager.CHANNEL.sendToAllAround(message, new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), 128.0D, pos.getZ(), 128.0D)); | ||
} | ||
|
||
@Inject(method = "doTreeOfTransformationEffect", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"), locals = LocalCapture.CAPTURE_FAILSOFT) | ||
private void onChangeBiome(World world, BlockPos pos, Random rand, CallbackInfo ci, int i, BlockPos dPos, Biome biomeAt, Chunk chunkAt) { | ||
((INewChunk) chunkAt).getIntBiomeArray()[(dPos.getZ() & 15) << 4 | (dPos.getX() & 15)] = Biome.getIdForBiome(TFBiomes.enchantedForest); | ||
} | ||
|
||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/org/dimdev/jeid/mixin/modsupport/twilightforest/TwilightMixinPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package org.dimdev.jeid.mixin.modsupport.twilightforest; | ||
|
||
import net.minecraftforge.fml.common.Loader; | ||
import net.minecraftforge.fml.common.ModContainer; | ||
import org.dimdev.jeid.JEID; | ||
import org.spongepowered.asm.lib.tree.ClassNode; | ||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; | ||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public class TwilightMixinPlugin implements IMixinConfigPlugin { | ||
@Override | ||
public void onLoad(String s) {} | ||
|
||
@Override | ||
public String getRefMapperConfig() { return null; } | ||
|
||
@Override | ||
public boolean shouldApplyMixin(String s, String s1) { | ||
for (ModContainer mod : Loader.instance().getModList()) { | ||
if (mod.getModId().equals("twilightforest")) { | ||
if (s1.equals("org.dimdev.jeid.mixin.modsupport.twilightforest.MixinBlockTFMagicLogSpecial_Old")) { | ||
if (Integer.parseInt(mod.getVersion().split("[.]")[2]) < 689) { | ||
JEID.LOGGER.info("Older TwilightForest version (<689). Using mixin: " + s1); | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} else if (s1.equals("org.dimdev.jeid.mixin.modsupport.twilightforest.MixinBlockTFMagicLogSpecial")) { | ||
if (Integer.parseInt(mod.getVersion().split("[.]")[2]) > 689) { | ||
JEID.LOGGER.info("Newer TwilightForest version (>689). Using mixin: " + s1); | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} else { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public void acceptTargets(Set<String> set, Set<String> set1) { | ||
|
||
} | ||
|
||
@Override | ||
public List<String> getMixins() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void preApply(String s, ClassNode classNode, String s1, IMixinInfo iMixinInfo) { | ||
|
||
} | ||
|
||
@Override | ||
public void postApply(String s, ClassNode classNode, String s1, IMixinInfo iMixinInfo) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"package": "org.dimdev.jeid.mixin.modsupport.twilightforest", | ||
"plugin": "org.dimdev.jeid.mixin.modsupport.twilightforest.TwilightMixinPlugin", | ||
"required": true, | ||
"refmap": "mixins.jeid.refmap.json", | ||
"target": "@env(DEFAULT)", | ||
"minVersion": "0.6", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
"MixinBlockTFMagicLogSpecial", | ||
"MixinBlockTFMagicLogSpecial_Old", | ||
"MixinGenLayerTFRiverMix" | ||
], | ||
"client": [], | ||
"injectors": { | ||
"maxShiftBy": 10 | ||
} | ||
} |