Fixed items not saving their state correctly

This commit is contained in:
Sollace 2021-02-22 15:53:59 +02:00
parent 709e8892e8
commit 5821e13728

View file

@ -47,14 +47,14 @@ abstract class MixinItemEntity extends Entity implements IItemEntity {
@Inject(method = "writeCustomDataToTag(Lnet/minecraft/nbt/CompoundTag;)V", at = @At("HEAD"))
private void onWriteCustomDataToTag(CompoundTag tag, CallbackInfo info) {
if (tag.contains("unicopia_caster")) {
get().fromNBT(tag.getCompound("unicopia_caster"));
}
tag.put("unicopia_caster", get().toNBT());
}
@Inject(method = "readCustomDataFromTag(Lnet/minecraft/nbt/CompoundTag;)V", at = @At("HEAD"))
private void onReadCustomDataFromTag(CompoundTag tag, CallbackInfo info) {
tag.put("unicopia_caster", get().toNBT());
if (tag.contains("unicopia_caster")) {
get().fromNBT(tag.getCompound("unicopia_caster"));
}
}
@Accessor("age")