Fixed player race not being persisted between instances

This commit is contained in:
Sollace 2020-05-03 19:45:23 +02:00
parent 2afe31c706
commit 6ccc91a2c1

View file

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