Skip to content

Commit

Permalink
Merge pull request #50 from jchung01/master
Browse files Browse the repository at this point in the history
Fix potion packet being read incorrectly
  • Loading branch information
ACGaming authored Apr 13, 2024
2 parents 84bb815 + 43b79ec commit 02ccfaa
Show file tree
Hide file tree
Showing 30 changed files with 64 additions and 161 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/dimdev/jeid/core/JEIDTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.function.Predicate;

/**
* Since 2.0.9: Cleaned up obfuscated code; converted most transforms to mixins.
* Since 2.1.0: Cleaned up obfuscated code; converted most transforms to mixins.
* <p>
* This class was borrowed from Zabi94's MaxPotionIDExtender
* under MIT License and with full help of Zabi. All credit in this class goes to Zabi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
*/
@Mixin(value = SPacketRemoveEntityEffect.class)
public class MixinSPacketRemoveEntityEffect {
/**
* @reason Disable default id read logic to prevent advancing readerIndex.
*/
@Final
@Redirect(method = "readPacketData", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/PacketBuffer;readUnsignedByte()S", ordinal = 0, remap = false))
private short reid$defaultReadId(PacketBuffer instance)
{
return 0;
}

@Final
@ModifyArg(method = "readPacketData", at = @At(value = "INVOKE", target = "Lnet/minecraft/potion/Potion;getPotionById(I)Lnet/minecraft/potion/Potion;"), index = 0)
private int reid$readIntPotionId(int original, @Local(argsOnly = true) PacketBuffer buf) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class MixinAnvilChunkLoader {
/**
* @reason Read palette from NBT for JustEnoughIDs BlockStateContainers.
*/
@Inject(method = "readChunkFromNBT", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;<init>(IZ)V", shift = At.Shift.BY, by = 2))
@Inject(method = "readChunkFromNBT", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/NBTTagCompound;getByteArray(Ljava/lang/String;)[B", ordinal = 0))
private void reid$readPaletteNBT(CallbackInfoReturnable<Chunk> cir, @Local(ordinal = 1) NBTTagCompound storageNBT, @Local ExtendedBlockStorage extendedBlockStorage) {
int[] palette = storageNBT.hasKey("Palette", 11) ? storageNBT.getIntArray("Palette") : null;
((INewBlockStateContainer) extendedBlockStorage.getData()).setTemporaryPalette(palette);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class MixinWorldHelpers {
/**
* @reason Sync clients and don't call unnecessary methods - {@link IChunkProvider#provideChunk} and {@link World#markBlockRangeForRenderUpdate}
*/
@Inject(method = "setBiome", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/Chunk;markDirty()V", shift = At.Shift.AFTER, remap = true), cancellable = true)
@Inject(method = "setBiome", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getChunkProvider()Lnet/minecraft/world/chunk/IChunkProvider;", remap = true), cancellable = true)
private static void reid$sendBiomeMessage(World world, BlockPos pos, Biome biome, CallbackInfo ci) {
if (!world.isRemote) {
MessageManager.sendClientsBiomeChange(world, pos, Biome.getIdForBiome(biome));
Expand Down
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.abyssalcraft.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
"package": "org.dimdev.jeid.mixin.modsupport.abyssalcraft",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["MixinBiomeUtil"],
"injectors": {
"maxShiftBy": 10
}
"mixins": ["MixinBiomeUtil"]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.advancedrocketry.client.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
"package": "org.dimdev.jeid.mixin.modsupport.advancedrocketry.client",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"client": ["MixinPacketBiomeIDChange"],
"injectors": {
"maxShiftBy": 10
}
"client": ["MixinPacketBiomeIDChange"]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.advancedrocketry.v1_7_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
"package": "org.dimdev.jeid.mixin.modsupport.advancedrocketry",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"v1_7_0.MixinBiomeHandler",
"MixinPacketBiomeIDChange"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.advancedrocketry.v2_0_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
"package": "org.dimdev.jeid.mixin.modsupport.advancedrocketry",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"v2_0_0.MixinBiomeHandler",
"MixinPacketBiomeIDChange"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.atum.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
"package": "org.dimdev.jeid.mixin.modsupport.atum",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinGenLayerAtumRiverMix"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.biomesoplenty.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
"package": "org.dimdev.jeid.mixin.modsupport.biomesoplenty",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinBOPCommand",
"MixinModBiomes"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.biometweaker.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@
"package": "org.dimdev.jeid.mixin.modsupport.biometweaker",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinBiomeColorMappings",
"MixinBiomeHelper",
"MixinCommandSetBiome"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.bookshelf.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
"package": "org.dimdev.jeid.mixin.modsupport.bookshelf",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinWorldUtils"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.compactmachines.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
"package": "org.dimdev.jeid.mixin.modsupport.compactmachines",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinChunkUtils"
],
"injectors": {
"maxShiftBy": 10
}
]
}
7 changes: 1 addition & 6 deletions src/main/resources/mixins.jeid.core.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"package": "org.dimdev.jeid.mixin.core",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
Expand Down Expand Up @@ -30,9 +29,5 @@
"potion.client.MixinNetHandlerPlayClient",
"world.client.MixinChunk",
"world.client.MixinWorldSummary"
],
"injectors": {
"maxShiftBy": 10,
"require": 1
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.creepingnether.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
"package": "org.dimdev.jeid.mixin.modsupport.creepingnether",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinCorruptorAbstract"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.cubicchunks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"package": "org.dimdev.jeid.mixin.modsupport.cubicchunks",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinCube",
Expand All @@ -12,8 +11,5 @@
"MixinIONbtWriter",
"MixinVanillaCompatibilityGenerator",
"MixinWorldEncoder"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.cyclopscore.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
"package": "org.dimdev.jeid.mixin.modsupport.cyclopscore",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinWorldHelpers"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.extrautils2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
"package": "org.dimdev.jeid.mixin.modsupport.extrautils2",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinBiomeManip",
"MixinWorldProviderSpecialDim"
],
"injectors": {
"maxShiftBy": 10
}
]
}
10 changes: 2 additions & 8 deletions src/main/resources/mixins.jeid.gaiadimension.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
{
"package": "org.dimdev.jeid.mixin.modsupport.gaiadimension",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinGenLayerGDRiverMix"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.geographicraft.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
"package": "org.dimdev.jeid.mixin.modsupport.geographicraft",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinDimensionManager"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.hammercore.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
"package": "org.dimdev.jeid.mixin.modsupport.hammercore",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinWorldLocation"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.journeymap.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
"package": "org.dimdev.jeid.mixin.modsupport.journeymap",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinChunkMD"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.moreplanets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
"package": "org.dimdev.jeid.mixin.modsupport.moreplanets",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinGenLayerRiversMix"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.mystcraft.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
"package": "org.dimdev.jeid.mixin.modsupport.mystcraft",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinBiomeReplacer"
],
"injectors": {
"maxShiftBy": 10
}
]
}
8 changes: 2 additions & 6 deletions src/main/resources/mixins.jeid.thaumcraft.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
"package": "org.dimdev.jeid.mixin.modsupport.thaumcraft",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.6",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinUtils"
],
"injectors": {
"maxShiftBy": 10
}
]
}
Loading

0 comments on commit 02ccfaa

Please sign in to comment.