Pedestals serialization
This commit is contained in:
parent
068fa540be
commit
83f4f923b1
3 changed files with 38 additions and 40 deletions
|
@ -106,14 +106,30 @@ public class PedestalBlockEntity extends BlockEntity implements Inventory, Ticka
|
|||
@Override
|
||||
public void fromTag(BlockState state, CompoundTag tag) {
|
||||
super.fromTag(state, tag);
|
||||
fromClientTag(tag);
|
||||
fromTag(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag tag) {
|
||||
super.toTag(tag);
|
||||
tag.put("active_item", activeItem.toTag(new CompoundTag()));
|
||||
return tag;
|
||||
return super.toTag(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromClientTag(CompoundTag tag) {
|
||||
fromTag(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toClientTag(CompoundTag tag) {
|
||||
return toTag(tag);
|
||||
}
|
||||
|
||||
protected void fromTag(CompoundTag tag) {
|
||||
if (tag.contains("active_item")) {
|
||||
CompoundTag itemTag = tag.getCompound("active_item");
|
||||
activeItem = ItemStack.fromTag(itemTag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -125,17 +141,4 @@ public class PedestalBlockEntity extends BlockEntity implements Inventory, Ticka
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromClientTag(CompoundTag tag) {
|
||||
if (tag.contains("active_item")) {
|
||||
CompoundTag itemTag = tag.getCompound("active_item");
|
||||
activeItem = ItemStack.fromTag(itemTag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toClientTag(CompoundTag tag) {
|
||||
return toTag(tag);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue