mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-24 05:54:31 +00:00
Fix Chunk API Compatibility (#22)
Co-authored-by: Alexdoru <[email protected]>
This commit is contained in:
1 parent
2067bd1ab0
commit
b0df1a2444
5 files changed
+61
-3
No files matched your search
@@ -0,0 +1,26 @@
|
||||
package com.gtnewhorizons.postea.mixins;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.gtnewhorizon.gtnhmixins.ILateMixinLoader;
|
||||
import com.gtnewhorizon.gtnhmixins.LateMixin;
|
||||
|
||||
@LateMixin
|
||||
public final class PosteaLateLoadingPlugin implements ILateMixinLoader {
|
||||
|
||||
@Override
|
||||
public String getMixinConfig() {
|
||||
return "mixins.postea.late.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMixins(Set<String> loadedMods) {
|
||||
final List<String> mixins = new ArrayList<>();
|
||||
if (loadedMods.contains("chunkapi")) {
|
||||
mixins.add("MixinDataRegistryImpl");
|
||||
}
|
||||
return mixins;
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public abstract class MixinAnvilChunkLoader {
|
||||
ChunkFixerUtility.onChunkLoaded(cir.getReturnValue());
|
||||
}
|
||||
|
||||
@Inject(method = "writeChunkToNBT", at = @At("HEAD"))
|
||||
@Inject(method = "writeChunkToNBT", at = @At("HEAD"), order = 900)
|
||||
private void postea$writePosteaChunkCode(Chunk chunk, World world, NBTTagCompound nbtTagCompound, CallbackInfo ci) {
|
||||
ChunkFixerUtility.onChunkWrite(chunk, nbtTagCompound);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.gtnewhorizons.postea.mixins.late;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import com.falsepattern.chunk.internal.DataRegistryImpl;
|
||||
import com.gtnewhorizons.postea.utility.ChunkFixerUtility;
|
||||
|
||||
@Mixin(value = DataRegistryImpl.class, remap = false)
|
||||
public abstract class MixinDataRegistryImpl {
|
||||
|
||||
@Inject(
|
||||
method = "readChunkFromNBT(Lnet/minecraft/world/chunk/Chunk;Lnet/minecraft/nbt/NBTTagCompound;)V",
|
||||
at = @At("RETURN"),
|
||||
require = 1)
|
||||
private static void Postea$chunkReadHook(Chunk chunk, NBTTagCompound chunkNBT, CallbackInfo ci) {
|
||||
ChunkFixerUtility.onChunkRead(chunk, chunk.worldObj, chunkNBT);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user