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.
- Using `@Group` to consolidate v1.7.0 and v2.0.0 into one mixin
- Loading branch information
Showing
5 changed files
with
24 additions
and
65 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
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
11 changes: 0 additions & 11 deletions
11
src/main/resources/mixins.jeid.advancedrocketry.v2_0_0.json
This file was deleted.
Oops, something went wrong.