mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-13 22:43:51 +01:00
Serialize hasAttachedComputer in ComputerBehaviour
- This eliminates some edge cases were peripherals don't realize they're being controlled by a computer on a world save and load
This commit is contained in:
parent
94e3ed44ad
commit
574cd93a89
1 changed files with 13 additions and 0 deletions
|
@ -7,6 +7,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
|||
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
||||
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.common.capabilities.CapabilityToken;
|
||||
|
@ -46,6 +47,18 @@ public class ComputerBehaviour extends TileEntityBehaviour {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(CompoundTag nbt, boolean clientPacket) {
|
||||
hasAttachedComputer = nbt.getBoolean("HasAttachedComputer");
|
||||
super.read(nbt, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(CompoundTag nbt, boolean clientPacket) {
|
||||
nbt.putBoolean("HasAttachedComputer", hasAttachedComputer);
|
||||
super.write(nbt, clientPacket);
|
||||
}
|
||||
|
||||
public void setHasAttachedComputer(boolean hasAttachedComputer) {
|
||||
this.hasAttachedComputer = hasAttachedComputer;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue