net.silkmc.silk.persistence.mixin.chunk.ChunkSerializerMixin Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of silk-persistence Show documentation
Show all versions of silk-persistence Show documentation
Silk is a Minecraft API for Kotlin
package net.silkmc.silk.persistence.mixin.chunk;
import net.minecraft.class_1923;
import net.minecraft.class_2487;
import net.minecraft.class_2791;
import net.minecraft.class_2839;
import net.minecraft.class_2852;
import net.minecraft.class_3218;
import net.minecraft.class_4153;
import net.silkmc.silk.persistence.CompoundProvider;
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.CallbackInfoReturnable;
@Mixin(class_2852.class)
public class ChunkSerializerMixin {
@Inject(method = "write", at = @At("RETURN"))
private static void onSerialize(class_3218 world,
class_2791 chunk,
CallbackInfoReturnable cir) {
((CompoundProvider) chunk).getCompound()
.putInCompound(cir.getReturnValue().method_10562("Level"));
}
@Inject(method = "read", at = @At("RETURN"))
private static void onDeserialize(class_3218 world,
class_4153 poiStorage,
class_1923 pos,
class_2487 nbt,
CallbackInfoReturnable cir) {
((CompoundProvider) cir.getReturnValue()).getCompound()
.loadFromCompound(nbt.method_10562("Level"));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy