use of mekanism.common.lib.security.SecurityMode in project Mekanism by mekanism.
the class TileComponentSecurity method read.
@Override
public void read(CompoundNBT nbtTags) {
if (nbtTags.contains(NBTConstants.COMPONENT_SECURITY, NBT.TAG_COMPOUND)) {
CompoundNBT securityNBT = nbtTags.getCompound(NBTConstants.COMPONENT_SECURITY);
NBTUtils.setEnumIfPresent(securityNBT, NBTConstants.SECURITY_MODE, SecurityMode::byIndexStatic, mode -> securityMode = mode);
NBTUtils.setUUIDIfPresent(securityNBT, NBTConstants.OWNER_UUID, uuid -> ownerUUID = uuid);
}
}
use of mekanism.common.lib.security.SecurityMode in project Mekanism by mekanism.
the class GuiSecurityTab method getOverlay.
@Override
protected ResourceLocation getOverlay() {
SecurityMode mode = getSecurity();
UUID ownerUUID = dataSource.getOwnerUUID();
SecurityData data = ownerUUID == null ? null : MekanismClient.clientSecurityMap.get(ownerUUID);
if (data != null && data.override) {
mode = data.mode;
}
if (mode == SecurityMode.PRIVATE) {
return PRIVATE;
} else if (mode == SecurityMode.TRUSTED) {
return PROTECTED;
}
return super.getOverlay();
}
use of mekanism.common.lib.security.SecurityMode in project Mekanism by mekanism.
the class EntityRobit method setSecurityMode.
@Override
public void setSecurityMode(SecurityMode mode) {
if (securityMode != mode) {
SecurityMode old = securityMode;
securityMode = mode;
onSecurityChanged(old, securityMode);
}
}
use of mekanism.common.lib.security.SecurityMode in project Mekanism by mekanism.
the class TileComponentSecurity method setMode.
public void setMode(SecurityMode mode) {
if (securityMode != mode) {
SecurityMode old = securityMode;
securityMode = mode;
tile.markDirty(false);
tile.onSecurityChanged(old, securityMode);
}
}
use of mekanism.common.lib.security.SecurityMode in project Mekanism by mekanism.
the class TileEntitySecurityDesk method setSecurityDeskMode.
public void setSecurityDeskMode(SecurityMode mode) {
SecurityFrequency frequency = getFreq();
if (frequency != null) {
SecurityMode old = frequency.getSecurityMode();
if (old != mode) {
frequency.setSecurityMode(mode);
markDirty(false);
// send the security update to other players; this change will be visible on machine security tabs
Mekanism.packetHandler.sendToAll(new PacketSecurityUpdate(frequency.getOwner(), new SecurityData(frequency)));
if (old == SecurityMode.PUBLIC || (old == SecurityMode.TRUSTED && mode == SecurityMode.PRIVATE)) {
validateAccess();
}
}
}
}
Aggregations