diff --git a/src/main/java/com/gtnewhorizons/neid/mixins/early/minecraft/MixinAnvilChunkLoader.java b/src/main/java/com/gtnewhorizons/neid/mixins/early/minecraft/MixinAnvilChunkLoader.java index 0a31fb9..e5c50e2 100644 --- a/src/main/java/com/gtnewhorizons/neid/mixins/early/minecraft/MixinAnvilChunkLoader.java +++ b/src/main/java/com/gtnewhorizons/neid/mixins/early/minecraft/MixinAnvilChunkLoader.java @@ -12,11 +12,16 @@ import com.gtnewhorizons.neid.Constants; import com.gtnewhorizons.neid.NEIDConfig; import com.gtnewhorizons.neid.mixins.interfaces.IExtendedBlockStorageMixin; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.llamalad7.mixinextras.sugar.Local; @Mixin(AnvilChunkLoader.class) public class MixinAnvilChunkLoader { + private static byte[] fakeByteArray = new byte[0]; + private static NibbleArray fakeNibbleArray = new NibbleArray(0, 0); + @Redirect( method = "writeChunkToNBT", at = @At( @@ -133,13 +138,33 @@ public class MixinAnvilChunkLoader { return false; } + @Redirect( + method = "readChunkFromNBT", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/nbt/NBTTagCompound;getByteArray(Ljava/lang/String;)[B", + ordinal = 2), + require = 1) + private byte[] neid$cancelByteArrayCreationForMetadata(NBTTagCompound nbttagcompound1, String s) { + return fakeByteArray; + } + + @WrapOperation( + method = "readChunkFromNBT", + at = @At(value = "NEW", target = "Lnet/minecraft/world/chunk/NibbleArray;", ordinal = 1), + require = 1) + private NibbleArray neid$cancelNibbleArrayCreationForMetadata(byte[] bytes, int i, + Operation original) { + return fakeNibbleArray; + } + @Redirect( method = "readChunkFromNBT", at = @At( value = "INVOKE", target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;setBlockMetadataArray(Lnet/minecraft/world/chunk/NibbleArray;)V"), require = 1) - private void neid$overrideReadMetadataArray(ExtendedBlockStorage ebs, NibbleArray oldBrokenNibbleArray, + private void neid$overrideReadMetadataArray(ExtendedBlockStorage ebs, NibbleArray oldNibble, @Local(ordinal = 1) NBTTagCompound nbt) { IExtendedBlockStorageMixin ebsMixin = (IExtendedBlockStorageMixin) ebs; if (nbt.hasKey("Data16")) {