dont sync please

This commit is contained in:
Ellpeck 2018-10-16 18:08:32 +02:00
parent 9645d09063
commit 0b7b43fd7f

View file

@ -149,20 +149,22 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable {
super.writeNBT(compound, syncing); super.writeNBT(compound, syncing);
compound.setTag("item", this.stack.writeToNBT(new NBTTagCompound())); compound.setTag("item", this.stack.writeToNBT(new NBTTagCompound()));
if (this.ritualPos != null && this.involvedStands != null && this.output != null && this.totalTime > 0) { if (!syncing) {
compound.setLong("ritual_pos", this.ritualPos.toLong()); if (this.ritualPos != null && this.involvedStands != null && this.output != null && this.totalTime > 0) {
compound.setInteger("timer", this.timer); compound.setLong("ritual_pos", this.ritualPos.toLong());
compound.setInteger("total_time", this.totalTime); compound.setInteger("timer", this.timer);
compound.setTag("output", this.output.writeToNBT(new NBTTagCompound())); compound.setInteger("total_time", this.totalTime);
compound.setTag("output", this.output.writeToNBT(new NBTTagCompound()));
NBTTagList list = new NBTTagList(); NBTTagList list = new NBTTagList();
for (Map.Entry<BlockPos, ItemStack> entry : this.involvedStands.entrySet()) { for (Map.Entry<BlockPos, ItemStack> entry : this.involvedStands.entrySet()) {
NBTTagCompound tag = new NBTTagCompound(); NBTTagCompound tag = new NBTTagCompound();
tag.setLong("pos", entry.getKey().toLong()); tag.setLong("pos", entry.getKey().toLong());
tag.setTag("item", entry.getValue().writeToNBT(new NBTTagCompound())); tag.setTag("item", entry.getValue().writeToNBT(new NBTTagCompound()));
list.appendTag(tag); list.appendTag(tag);
}
compound.setTag("stands", list);
} }
compound.setTag("stands", list);
} }
} }
@ -171,20 +173,22 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable {
super.readNBT(compound, syncing); super.readNBT(compound, syncing);
this.stack = new ItemStack(compound.getCompoundTag("item")); this.stack = new ItemStack(compound.getCompoundTag("item"));
if (compound.hasKey("ritual_pos") && compound.hasKey("stands") && compound.hasKey("output") && compound.hasKey("total_time")) { if (!syncing) {
this.ritualPos = BlockPos.fromLong(compound.getLong("ritual_pos")); if (compound.hasKey("ritual_pos") && compound.hasKey("stands") && compound.hasKey("output") && compound.hasKey("total_time")) {
this.timer = compound.getInteger("timer"); this.ritualPos = BlockPos.fromLong(compound.getLong("ritual_pos"));
this.totalTime = compound.getInteger("total_time"); this.timer = compound.getInteger("timer");
this.output = new ItemStack(compound.getCompoundTag("output")); this.totalTime = compound.getInteger("total_time");
this.output = new ItemStack(compound.getCompoundTag("output"));
this.involvedStands = new HashMap<>(); this.involvedStands = new HashMap<>();
NBTTagList list = compound.getTagList("stands", 10); NBTTagList list = compound.getTagList("stands", 10);
for (NBTBase base : list) { for (NBTBase base : list) {
NBTTagCompound tag = (NBTTagCompound) base; NBTTagCompound tag = (NBTTagCompound) base;
this.involvedStands.put( this.involvedStands.put(
BlockPos.fromLong(tag.getLong("pos")), BlockPos.fromLong(tag.getLong("pos")),
new ItemStack(tag.getCompoundTag("item")) new ItemStack(tag.getCompoundTag("item"))
); );
}
} }
} }
} }