Add config option to disable block protections

This commit is contained in:
Clienthax 2016-08-15 02:58:15 +01:00
parent 833d7372fb
commit 03191f198b
9 changed files with 19 additions and 6 deletions

View file

@ -66,6 +66,7 @@ public class MekanismConfig
public static double superheatingHeatTransfer = 10000;
public static double heatPerFuelTick = 4;
public static boolean allowTransmitterAlloyUpgrade;
public static boolean allowProtection = true;
}
public static class client

View file

@ -2,6 +2,7 @@ package mekanism.client.gui.element;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.MekanismConfig.general;
import mekanism.api.util.ListUtils;
import mekanism.client.MekanismClient;
import mekanism.client.gui.IGuiWrapper;
@ -129,6 +130,9 @@ public class GuiSecurityTab extends GuiElement
private SecurityMode getSecurity()
{
if(!general.allowProtection) {
return SecurityMode.PUBLIC;
}
if(isItem)
{
if(getItem() == null || !(getItem().getItem() instanceof ISecurityItem))
@ -172,7 +176,7 @@ public class GuiSecurityTab extends GuiElement
@Override
public void mouseClicked(int xAxis, int yAxis, int button)
{
if(button == 0)
if(button == 0 && general.allowProtection)
{
if(getOwner() != null && mc.thePlayer.getCommandSenderName().equals(getOwner()))
{

View file

@ -298,6 +298,7 @@ public class CommonProxy implements IGuiProvider
general.superheatingHeatTransfer = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SuperheatingHeatTransfer", 10000D).getDouble();
general.heatPerFuelTick = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "HeatPerFuelTick", 4D).getDouble();
general.allowTransmitterAlloyUpgrade = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowTransmitterAlloyUpgrade", true).getBoolean();
general.allowProtection = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowProtection", true).getBoolean();
general.blacklistIC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistIC2Power", false).getBoolean();
general.blacklistRF = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistRFPower", false).getBoolean();

View file

@ -393,7 +393,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IE
@Override
public SecurityMode getSecurity(ItemStack stack)
{
if(stack.stackTagCompound == null)
if(stack.stackTagCompound == null || !general.allowProtection)
{
return SecurityMode.PUBLIC;
}

View file

@ -373,7 +373,7 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
@Override
public SecurityMode getSecurity(ItemStack stack)
{
if(stack.stackTagCompound == null)
if(stack.stackTagCompound == null || !general.allowProtection)
{
return SecurityMode.PUBLIC;
}

View file

@ -944,7 +944,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
@Override
public SecurityMode getSecurity(ItemStack stack)
{
if(stack.stackTagCompound == null)
if(stack.stackTagCompound == null || !general.allowProtection)
{
return SecurityMode.PUBLIC;
}

View file

@ -72,6 +72,7 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
dataStream.writeDouble(general.superheatingHeatTransfer);
dataStream.writeDouble(general.heatPerFuelTick);
dataStream.writeBoolean(general.allowTransmitterAlloyUpgrade);
dataStream.writeBoolean(general.allowProtection);
for(MachineType type : MachineType.getValidMachines())
{
@ -160,6 +161,7 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
general.superheatingHeatTransfer = dataStream.readDouble();
general.heatPerFuelTick = dataStream.readDouble();
general.allowTransmitterAlloyUpgrade = dataStream.readBoolean();
general.allowProtection = dataStream.readBoolean();
for(MachineType type : MachineType.getValidMachines())
{

View file

@ -5,6 +5,7 @@ import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import mekanism.api.Coord4D;
import mekanism.api.MekanismConfig.general;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.base.ITileComponent;
@ -58,7 +59,11 @@ public class TileComponentSecurity implements ITileComponent
public SecurityMode getMode()
{
return securityMode;
if(general.allowProtection) {
return securityMode;
} else {
return SecurityMode.PUBLIC;
}
}
public void setMode(SecurityMode mode)

View file

@ -520,7 +520,7 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, ISp
@Override
public SecurityMode getSecurity(ItemStack stack)
{
if(stack.stackTagCompound == null)
if(stack.stackTagCompound == null || !general.allowProtection)
{
return SecurityMode.PUBLIC;
}