forked from DimensionalDevelopment/JustEnoughIDs
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from jchung01/mod-support
Improve support for SRP, WoN, Advanced Rocketry
- Loading branch information
Showing
11 changed files
with
162 additions
and
150 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
32 changes: 19 additions & 13 deletions
32
...cedrocketry/v1_7_0/MixinBiomeHandler.java → ...t/advancedrocketry/MixinBiomeHandler.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 |
---|---|---|
@@ -1,41 +1,47 @@ | ||
package org.dimdev.jeid.mixin.modsupport.advancedrocketry.v1_7_0; | ||
package org.dimdev.jeid.mixin.modsupport.advancedrocketry; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.biome.Biome; | ||
import net.minecraft.world.chunk.Chunk; | ||
import org.dimdev.jeid.ducks.INewChunk; | ||
import org.spongepowered.asm.mixin.Dynamic; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Group; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||
import zmaster587.advancedRocketry.util.BiomeHandler; | ||
|
||
/** | ||
* Mixin for Advanced Rocketry 1.7.0 | ||
*/ | ||
@SuppressWarnings("target") | ||
@Mixin(value = BiomeHandler.class, remap = false) | ||
public class MixinBiomeHandler { | ||
@Dynamic("Only present with AR 1.7.0") | ||
@Shadow | ||
public static void changeBiome(World world, int biomeId, BlockPos pos) { | ||
} | ||
// Do not use @Local sugar for these injectors, it doesn't handle invalid targets well! | ||
|
||
@Dynamic("Use int biome array for AR 1.7.0") | ||
@Inject(method = "changeBiome(Lnet/minecraft/world/World;ILnet/minecraft/util/math/BlockPos;)V", at = @At(value = "INVOKE", target = "Lzmaster587/libVulpes/network/PacketHandler;sendToNearby(Lzmaster587/libVulpes/network/BasePacket;ILnet/minecraft/util/math/BlockPos;D)V"), require = 0) | ||
private static void reid$toIntBiomeArray1_7_0(World world, int biomeId, BlockPos pos, CallbackInfo ci, @Local Chunk chunk) { | ||
@Group(name = "versionAgnosticAR", min = 1, max = 2) | ||
@Inject(method = "changeBiome(Lnet/minecraft/world/World;ILnet/minecraft/util/math/BlockPos;)V", at = @At(value = "INVOKE", target = "Lzmaster587/libVulpes/network/PacketHandler;sendToNearby(Lzmaster587/libVulpes/network/BasePacket;ILnet/minecraft/util/math/BlockPos;D)V"), locals = LocalCapture.CAPTURE_FAILHARD, require = 0) | ||
private static void reid$toIntBiomeArray1_7_0(World world, int biomeId, BlockPos pos, CallbackInfo ci, Chunk chunk) { | ||
((INewChunk) chunk).getIntBiomeArray()[(pos.getZ() & 0xF) << 4 | pos.getX() & 0xF] = biomeId; | ||
chunk.markDirty(); | ||
// Method sends packet | ||
} | ||
|
||
@Dynamic("Overload for AR 1.7.0") | ||
@Group(name = "versionAgnosticAR", min = 1, max = 2) | ||
@Inject(method = "changeBiome(Lnet/minecraft/world/World;ILnet/minecraft/world/chunk/Chunk;Lnet/minecraft/util/math/BlockPos;)V", at = @At(value = "HEAD"), cancellable = true, require = 0) | ||
private static void reid$toIntBiomeArray1_7_0Chunk(World world, int biomeId, Chunk chunk, BlockPos pos, CallbackInfo ci) { | ||
changeBiome(world, biomeId, pos); | ||
BiomeHandler.changeBiome(world, biomeId, pos); | ||
ci.cancel(); | ||
} | ||
|
||
@Dynamic("Use int biome array for AR 2.0.0") | ||
@Group(name = "versionAgnosticAR", min = 1, max = 2) | ||
@Inject(method = "changeBiome(Lnet/minecraft/world/World;Lnet/minecraft/world/biome/Biome;Lnet/minecraft/util/math/BlockPos;)V", at = @At(value = "INVOKE", target = "Lzmaster587/libVulpes/network/PacketHandler;sendToNearby(Lzmaster587/libVulpes/network/BasePacket;ILnet/minecraft/util/math/BlockPos;D)V"), locals = LocalCapture.CAPTURE_FAILHARD, require = 0) | ||
private static void reid$toIntBiomeArray2_0_0(World world, Biome biomeId, BlockPos pos, CallbackInfo ci, Chunk chunk) { | ||
((INewChunk) chunk).getIntBiomeArray()[(pos.getZ() & 0xF) << 4 | pos.getX() & 0xF] = Biome.getIdForBiome(biomeId); | ||
chunk.markDirty(); | ||
// Method sends packet | ||
} | ||
} |
30 changes: 0 additions & 30 deletions
30
...main/java/org/dimdev/jeid/mixin/modsupport/advancedrocketry/v2_0_0/MixinBiomeHandler.java
This file was deleted.
Oops, something went wrong.
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
50 changes: 0 additions & 50 deletions
50
src/main/java/org/dimdev/jeid/mixin/modsupport/wyrmsofnyrus/MixinBiomeSpread.java
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
src/main/java/org/dimdev/jeid/mixin/modsupport/wyrmsofnyrus/MixinHiveCreepSpreadFurther.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,27 @@ | ||
package org.dimdev.jeid.mixin.modsupport.wyrmsofnyrus; | ||
|
||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.biome.Biome; | ||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | ||
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import com.vetpetmon.wyrmsofnyrus.invasion.HiveCreepSpreadFurther; | ||
import com.vetpetmon.wyrmsofnyrus.world.biome.BiomeRegistry; | ||
import org.dimdev.jeid.network.MessageManager; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(value = HiveCreepSpreadFurther.class, remap = false) | ||
public class MixinHiveCreepSpreadFurther { | ||
/** | ||
* @reason Use REID message to immediately re-render changes on client | ||
*/ | ||
@Redirect(method = "decay", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper;sendToDimension(Lnet/minecraftforge/fml/common/network/simpleimpl/IMessage;I)V")) | ||
private static void reid$sendSpreadBiomeChange(SimpleNetworkWrapper instance, IMessage message, int dimensionId, BlockPos pos, World world, | ||
@Local(ordinal = 2) BlockPos spreadPos) { | ||
MessageManager.sendClientsBiomePosChange(world, spreadPos, Biome.getIdForBiome(BiomeRegistry.CREEPLANDS)); | ||
} | ||
} |
Oops, something went wrong.