mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-06-10 22:58:56 +02:00
58 lines
1.5 KiB
Java
58 lines
1.5 KiB
Java
package com.simibubi.create.compat.computercraft;
|
|
|
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
|
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
|
|
|
import net.minecraft.nbt.CompoundTag;
|
|
import net.minecraftforge.common.capabilities.Capability;
|
|
import net.minecraftforge.common.util.LazyOptional;
|
|
|
|
public class AbstractComputerBehaviour extends TileEntityBehaviour {
|
|
|
|
public static final BehaviourType<AbstractComputerBehaviour> TYPE = new BehaviourType<>();
|
|
|
|
boolean hasAttachedComputer;
|
|
|
|
public AbstractComputerBehaviour(SmartTileEntity te) {
|
|
super(te);
|
|
this.hasAttachedComputer = false;
|
|
}
|
|
|
|
@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 <T> boolean isPeripheralCap(Capability<T> cap) {
|
|
return false;
|
|
}
|
|
|
|
public <T> LazyOptional<T> getPeripheralCapability() {
|
|
return LazyOptional.empty();
|
|
}
|
|
|
|
public void removePeripheral() {}
|
|
|
|
public void setHasAttachedComputer(boolean hasAttachedComputer) {
|
|
this.hasAttachedComputer = hasAttachedComputer;
|
|
}
|
|
|
|
public boolean hasAttachedComputer() {
|
|
return hasAttachedComputer;
|
|
}
|
|
|
|
@Override
|
|
public BehaviourType<?> getType() {
|
|
return TYPE;
|
|
}
|
|
|
|
}
|