|
12 | 12 | import com.gtnewhorizons.neid.Constants;
|
13 | 13 | import com.gtnewhorizons.neid.NEIDConfig;
|
14 | 14 | import com.gtnewhorizons.neid.mixins.interfaces.IExtendedBlockStorageMixin;
|
| 15 | +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; |
| 16 | +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; |
15 | 17 | import com.llamalad7.mixinextras.sugar.Local;
|
16 | 18 |
|
17 | 19 | @Mixin(AnvilChunkLoader.class)
|
18 | 20 | public class MixinAnvilChunkLoader {
|
19 | 21 |
|
| 22 | + private static byte[] fakeByteArray = new byte[0]; |
| 23 | + private static NibbleArray fakeNibbleArray = new NibbleArray(0, 0); |
| 24 | + |
20 | 25 | @Redirect(
|
21 | 26 | method = "writeChunkToNBT",
|
22 | 27 | at = @At(
|
@@ -133,13 +138,33 @@ public class MixinAnvilChunkLoader {
|
133 | 138 | return false;
|
134 | 139 | }
|
135 | 140 |
|
| 141 | + @Redirect( |
| 142 | + method = "readChunkFromNBT", |
| 143 | + at = @At( |
| 144 | + value = "INVOKE", |
| 145 | + target = "Lnet/minecraft/nbt/NBTTagCompound;getByteArray(Ljava/lang/String;)[B", |
| 146 | + ordinal = 2), |
| 147 | + require = 1) |
| 148 | + private byte[] neid$cancelByteArrayCreationForMetadata(NBTTagCompound nbttagcompound1, String s) { |
| 149 | + return fakeByteArray; |
| 150 | + } |
| 151 | + |
| 152 | + @WrapOperation( |
| 153 | + method = "readChunkFromNBT", |
| 154 | + at = @At(value = "NEW", target = "Lnet/minecraft/world/chunk/NibbleArray;", ordinal = 1), |
| 155 | + require = 1) |
| 156 | + private NibbleArray neid$cancelNibbleArrayCreationForMetadata(byte[] bytes, int i, |
| 157 | + Operation<NibbleArray> original) { |
| 158 | + return fakeNibbleArray; |
| 159 | + } |
| 160 | + |
136 | 161 | @Redirect(
|
137 | 162 | method = "readChunkFromNBT",
|
138 | 163 | at = @At(
|
139 | 164 | value = "INVOKE",
|
140 | 165 | target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;setBlockMetadataArray(Lnet/minecraft/world/chunk/NibbleArray;)V"),
|
141 | 166 | require = 1)
|
142 |
| - private void neid$overrideReadMetadataArray(ExtendedBlockStorage ebs, NibbleArray oldBrokenNibbleArray, |
| 167 | + private void neid$overrideReadMetadataArray(ExtendedBlockStorage ebs, NibbleArray oldNibble, |
143 | 168 | @Local(ordinal = 1) NBTTagCompound nbt) {
|
144 | 169 | IExtendedBlockStorageMixin ebsMixin = (IExtendedBlockStorageMixin) ebs;
|
145 | 170 | if (nbt.hasKey("Data16")) {
|
|
0 commit comments