aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAntifluxfield <lyj_299792458@163.com>2017-10-30 19:17:00 +0800
committerAntifluxfield <lyj_299792458@163.com>2017-10-30 19:17:00 +0800
commit78aa11bd38ae3229c89f348034d165fb9a5c631c (patch)
treec2e038dd17865f07d41a93df8d285e2031a7027a /src
parent1e8189e5f9a984f962d64fe92883a564d0d92569 (diff)
downloadGT5-Unofficial-78aa11bd38ae3229c89f348034d165fb9a5c631c.tar.gz
GT5-Unofficial-78aa11bd38ae3229c89f348034d165fb9a5c631c.tar.bz2
GT5-Unofficial-78aa11bd38ae3229c89f348034d165fb9a5c631c.zip
Another config to control wire connections, and disable them by default.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gregtech/GT_Mod.java5
-rw-r--r--src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java2
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java23
-rw-r--r--src/main/java/gregtech/common/GT_Proxy.java3
4 files changed, 24 insertions, 9 deletions
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java
index 9c07457ae4..cfcc38a615 100644
--- a/src/main/java/gregtech/GT_Mod.java
+++ b/src/main/java/gregtech/GT_Mod.java
@@ -280,8 +280,9 @@ public class GT_Mod implements IGT_Mod {
gregtechproxy.enableBasaltOres = GregTech_API.sWorldgenFile.get("general", "enableBasaltOres", gregtechproxy.enableBasaltOres);
gregtechproxy.enableGCOres = GregTech_API.sWorldgenFile.get("general", "enableGCOres", gregtechproxy.enableGCOres);
gregtechproxy.enableUBOres = GregTech_API.sWorldgenFile.get("general", "enableUBOres", gregtechproxy.enableUBOres);
- gregtechproxy.gt6Pipe = tMainConfig.get("general", "GT6StyledPipesAndWiresConnection", true).getBoolean(true);
- gregtechproxy.costlyCableConnection = tMainConfig.get("general", "CableConnectionRequiresSolderingMaterial", true).getBoolean(true);
+ gregtechproxy.gt6Pipe = tMainConfig.get("general", "GT6StyledPipesConnection", true).getBoolean(true);
+ gregtechproxy.gt6Cable = tMainConfig.get("general", "GT6StyledWiresConnection", false).getBoolean(false);
+ gregtechproxy.costlyCableConnection = tMainConfig.get("general", "CableConnectionRequiresSolderingMaterial", false).getBoolean(false);
Materials[] tDisableOres = new Materials[]{Materials.Chrome, Materials.Naquadria, Materials.Silicon, Materials.Cobalt, Materials.Cadmium, Materials.Indium, Materials.Tungsten,
Materials.Adamantium, Materials.Mithril, Materials.DarkIron, Materials.Rutile, Materials.Alduorite, Materials.Magnesium, Materials.Nikolite};
diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java b/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java
index db8e812cf8..c1391371b9 100644
--- a/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java
+++ b/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java
@@ -1,7 +1,7 @@
package gregtech.api.interfaces.metatileentity;
/**
- * For pipes, wires, and other MetaTiles which should be decided whether they should connect to the block at each side.
+ * For pipes, wires, and other MetaTiles which need to be decided whether they should connect to the block at each side.
*/
public interface IConnectable {
/**
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
index 1885b2f861..d8b03ccfc9 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
@@ -44,7 +44,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
public long mTransferredAmperage = 0, mTransferredAmperageLast20 = 0, mTransferredVoltageLast20 = 0;
public long mRestRF;
public short mOverheat;
- private boolean mCheckConnections = !GT_Mod.gregtechproxy.gt6Pipe;
+ private boolean mCheckConnections = !GT_Mod.gregtechproxy.gt6Cable;
public GT_MetaPipeEntity_Cable(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) {
super(aID, aName, aNameRegional, 0);
@@ -247,7 +247,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
for (byte i = 0; i < 6; i++) {
if ((mCheckConnections || (mConnections & (1 << i)) != 0) && connect(i) <= 0) disconnect(i);
}
- if (GT_Mod.gregtechproxy.gt6Pipe) mCheckConnections = false;
+ if (GT_Mod.gregtechproxy.gt6Cable) mCheckConnections = false;
}
}else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate();
}
@@ -263,7 +263,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
}
private boolean onConnectionToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (GT_Mod.gregtechproxy.gt6Pipe) {
+ if (GT_Mod.gregtechproxy.gt6Cable) {
byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ);
if ((mConnections & (1 << tSide)) == 0) {
if (GT_Mod.gregtechproxy.costlyCableConnection && !GT_ModHandler.consumeSolderingMaterial(aPlayer)) return false;
@@ -308,6 +308,19 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
return rConnect;
}
+ @Override
+ public void disconnect(byte aSide) {
+ if (aSide >= 6) return;
+ mConnections &= ~(1 << aSide);
+ if (GT_Mod.gregtechproxy.gt6Cable) {
+ byte tSide = GT_Utility.getOppositeSide(aSide);
+ IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide);
+ IMetaTileEntity tPipe = tTileEntity == null ? null : tTileEntity.getMetaTileEntity();
+ if (this.getClass().isInstance(tPipe) && (((MetaPipeEntity) tPipe).mConnections & (1 << tSide)) != 0)
+ ((MetaPipeEntity) tPipe).disconnect(tSide);
+ }
+ }
+
@Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false;
@@ -335,13 +348,13 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
@Override
public void saveNBTData(NBTTagCompound aNBT) {
- if (GT_Mod.gregtechproxy.gt6Pipe)
+ if (GT_Mod.gregtechproxy.gt6Cable)
aNBT.setByte("mConnections", mConnections);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
- if (GT_Mod.gregtechproxy.gt6Pipe) {
+ if (GT_Mod.gregtechproxy.gt6Cable) {
if (!aNBT.hasKey("mConnections"))
mCheckConnections = true;
mConnections = aNBT.getByte("mConnections");
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java
index 2541ec4e1d..83e5396810 100644
--- a/src/main/java/gregtech/common/GT_Proxy.java
+++ b/src/main/java/gregtech/common/GT_Proxy.java
@@ -202,7 +202,8 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public boolean enableGCOres = true;
public boolean enableUBOres = true;
public boolean gt6Pipe = true;
- public boolean costlyCableConnection = true;
+ public boolean gt6Cable = false;
+ public boolean costlyCableConnection = false;
public GT_Proxy() {
GameRegistry.registerFuelHandler(this);