|
| 1 | +/* |
| 2 | + * Minecraft Forge, Patchwork Project |
| 3 | + * Copyright (c) 2016-2020, 2019-2020 |
| 4 | + * |
| 5 | + * This library is free software; you can redistribute it and/or |
| 6 | + * modify it under the terms of the GNU Lesser General Public |
| 7 | + * License as published by the Free Software Foundation version 2.1 |
| 8 | + * of the License. |
| 9 | + * |
| 10 | + * This library is distributed in the hope that it will be useful, |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | + * Lesser General Public License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU Lesser General Public |
| 16 | + * License along with this library; if not, write to the Free Software |
| 17 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | + */ |
| 19 | + |
| 20 | +package net.patchworkmc.mixin.capability; |
| 21 | + |
| 22 | +import org.spongepowered.asm.mixin.Mixin; |
| 23 | +import net.minecraftforge.common.util.INBTSerializable; |
| 24 | + |
| 25 | +import net.minecraft.nbt.CompoundTag; |
| 26 | +import net.minecraft.world.PersistentState; |
| 27 | + |
| 28 | +@Mixin(PersistentState.class) |
| 29 | +public class PersistentStateMixin implements INBTSerializable<CompoundTag> { |
| 30 | + @Override |
| 31 | + public void deserializeNBT(CompoundTag nbt) { |
| 32 | + ((PersistentState) (Object) this).fromTag(nbt); |
| 33 | + } |
| 34 | + |
| 35 | + @Override |
| 36 | + public CompoundTag serializeNBT() { |
| 37 | + return ((PersistentState) (Object) this).toTag(new CompoundTag()); |
| 38 | + } |
| 39 | +} |
0 commit comments