GT6 styled pipe and wire connection

This commit is contained in:
Antifluxfield 2017-10-30 09:18:40 +08:00
parent 2d8df8d145
commit 22c2f16509
13 changed files with 340 additions and 144 deletions

View file

@ -280,6 +280,7 @@ public class GT_Mod implements IGT_Mod {
gregtechproxy.enableBasaltOres = GregTech_API.sWorldgenFile.get("general", "enableBasaltOres", gregtechproxy.enableBasaltOres); gregtechproxy.enableBasaltOres = GregTech_API.sWorldgenFile.get("general", "enableBasaltOres", gregtechproxy.enableBasaltOres);
gregtechproxy.enableGCOres = GregTech_API.sWorldgenFile.get("general", "enableGCOres", gregtechproxy.enableGCOres); gregtechproxy.enableGCOres = GregTech_API.sWorldgenFile.get("general", "enableGCOres", gregtechproxy.enableGCOres);
gregtechproxy.enableUBOres = GregTech_API.sWorldgenFile.get("general", "enableUBOres", gregtechproxy.enableUBOres); gregtechproxy.enableUBOres = GregTech_API.sWorldgenFile.get("general", "enableUBOres", gregtechproxy.enableUBOres);
gregtechproxy.gt6Pipe = tMainConfig.get("general", "GT6StyledPipesAndWiresConnection", true).getBoolean(true);
Materials[] tDisableOres = new Materials[]{Materials.Chrome, Materials.Naquadria, Materials.Silicon, Materials.Cobalt, Materials.Cadmium, Materials.Indium, Materials.Tungsten, 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}; Materials.Adamantium, Materials.Mithril, Materials.DarkIron, Materials.Rutile, Materials.Alduorite, Materials.Magnesium, Materials.Nikolite};

View file

@ -127,7 +127,7 @@ public class GregTech_API {
/** /**
* The List of Tools, which can be used. Accepts regular damageable Items and Electric Items * The List of Tools, which can be used. Accepts regular damageable Items and Electric Items
*/ */
public static final GT_HashSet<GT_ItemStack> sToolList = new GT_HashSet<GT_ItemStack>(), sCrowbarList = new GT_HashSet<GT_ItemStack>(), sScrewdriverList = new GT_HashSet<GT_ItemStack>(), sWrenchList = new GT_HashSet<GT_ItemStack>(), sSoftHammerList = new GT_HashSet<GT_ItemStack>(), sHardHammerList = new GT_HashSet<GT_ItemStack>(), sSolderingToolList = new GT_HashSet<GT_ItemStack>(), sSolderingMetalList = new GT_HashSet<GT_ItemStack>(); public static final GT_HashSet<GT_ItemStack> sToolList = new GT_HashSet<GT_ItemStack>(), sCrowbarList = new GT_HashSet<GT_ItemStack>(), sScrewdriverList = new GT_HashSet<GT_ItemStack>(), sWrenchList = new GT_HashSet<GT_ItemStack>(), sSoftHammerList = new GT_HashSet<GT_ItemStack>(), sHardHammerList = new GT_HashSet<GT_ItemStack>(), sWireCutterList = new GT_HashSet<GT_ItemStack>(), sSolderingToolList = new GT_HashSet<GT_ItemStack>(), sSolderingMetalList = new GT_HashSet<GT_ItemStack>();
/** /**
* The List of Hazmat Armors * The List of Hazmat Armors
*/ */
@ -575,6 +575,15 @@ public class GregTech_API {
return registerTool(aTool, sHardHammerList); return registerTool(aTool, sHardHammerList);
} }
/**
* Register a Wire Cutter to interact with Machines
* <p/>
* You need to register Tools in the Load Phase, because otherwise the Autodetection will assign a Tool Type in certain Cases during postload (When IToolWrench or similar Interfaces are implemented).
*/
public static boolean registerWireCutter(ItemStack aTool) {
return registerTool(aTool, sWireCutterList);
}
/** /**
* Register a Soldering Tool to interact with Machines * Register a Soldering Tool to interact with Machines
* <p/> * <p/>

View file

@ -0,0 +1,16 @@
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.
*/
public interface IConnectable {
/**
* Try to connect to the Block at the specified side
* returns the connection state. Non-positive values for failed, others for succeeded.
*/
public int connect(byte aSide);
/**
* Try to disconnect to the Block at the specified side
*/
public void disconnect(byte aSide);
}

View file

@ -816,6 +816,14 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
return true; return true;
} }
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)) {
if (mMetaTileEntity.onWireCutterRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) {
GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer);
GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
}
return true;
}
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) { if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) {
if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) { if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) {
mStrongRedstone ^= (1 << tSide); mStrongRedstone ^= (1 << tSide);

View file

@ -2,7 +2,9 @@ package gregtech.api.metatileentity;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API; import gregtech.api.GregTech_API;
import gregtech.api.interfaces.metatileentity.IConnectable;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_ItemStack;
@ -45,7 +47,7 @@ import static gregtech.api.enums.GT_Values.V;
* Call the Constructor like the following example inside the Load Phase, to register it. * Call the Constructor like the following example inside the Load Phase, to register it.
* "new GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");" * "new GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");"
*/ */
public abstract class MetaPipeEntity implements IMetaTileEntity { public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
/** /**
* The Inventory of the MetaTileEntity. Amount of Slots can be larger than 256. HAYO! * The Inventory of the MetaTileEntity. Amount of Slots can be larger than 256. HAYO!
*/ */
@ -203,6 +205,10 @@ public abstract class MetaPipeEntity implements IMetaTileEntity {
return false; return false;
} }
public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
return false;
}
@Override @Override
public void onExplosion() {/*Do nothing*/} public void onExplosion() {/*Do nothing*/}
@ -689,4 +695,35 @@ public abstract class MetaPipeEntity implements IMetaTileEntity {
public String getAlternativeModeText() { public String getAlternativeModeText() {
return ""; return "";
} }
public String trans(String aKey, String aEnglish){
return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_"+aKey, aEnglish, false);
}
@Override
public int connect(byte aSide) {
if (aSide >= 6) return 0;
mConnections |= (1 << aSide);
if (GT_Mod.gregtechproxy.gt6Pipe) {
byte tSide = GT_Utility.getOppositeSide(aSide);
IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide);
IMetaTileEntity tPipe = tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() : null;
if (this.getClass().isInstance(tPipe) && (((MetaPipeEntity) tPipe).mConnections & (1 << tSide)) == 0)
((MetaPipeEntity) tPipe).connect(tSide);
}
return 1;
}
@Override
public void disconnect(byte aSide) {
if (aSide >= 6) return;
mConnections &= ~(1 << aSide);
if (GT_Mod.gregtechproxy.gt6Pipe) {
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);
}
}
} }

View file

@ -21,6 +21,7 @@ import gregtech.common.GT_Client;
import ic2.api.energy.tile.IEnergySink; import ic2.api.energy.tile.IEnergySink;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -34,7 +35,7 @@ import java.util.Arrays;
import static gregtech.api.enums.GT_Values.VN; import static gregtech.api.enums.GT_Values.VN;
public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTileEntityCable { public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTileEntityCable{
public final float mThickNess; public final float mThickNess;
public final Materials mMaterial; public final Materials mMaterial;
public final long mCableLossPerMeter, mAmperage, mVoltage; public final long mCableLossPerMeter, mAmperage, mVoltage;
@ -42,6 +43,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
public long mTransferredAmperage = 0, mTransferredAmperageLast20 = 0, mTransferredVoltageLast20 = 0; public long mTransferredAmperage = 0, mTransferredAmperageLast20 = 0, mTransferredVoltageLast20 = 0;
public long mRestRF; public long mRestRF;
public short mOverheat; public short mOverheat;
private boolean mCheckConnections = !GT_Mod.gregtechproxy.gt6Pipe;
public GT_MetaPipeEntity_Cable(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { 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); super(aID, aName, aNameRegional, 0);
@ -241,46 +243,56 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
if (aTick % 20 == 0) { if (aTick % 20 == 0) {
mTransferredVoltageLast20 = 0; mTransferredVoltageLast20 = 0;
mTransferredAmperageLast20 = 0; mTransferredAmperageLast20 = 0;
mConnections = 0; for (byte i = 0; i < 6; i++) {
for (byte i = 0, j = 0; i < 6; i++) { if ((mCheckConnections || (mConnections & (1 << i)) != 0) && connect(i) <= 0) disconnect(i);
j = GT_Utility.getOppositeSide(i);
if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity) || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyIn(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity) || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyOut(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity)) {
TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i);
if (tTileEntity instanceof IColoredTileEntity) {
if (aBaseMetaTileEntity.getColorization() >= 0) {
byte tColor = ((IColoredTileEntity) tTileEntity).getColorization();
if (tColor >= 0 && tColor != aBaseMetaTileEntity.getColorization()) continue;
}
}
if (tTileEntity instanceof IEnergyConnected && (((IEnergyConnected) tTileEntity).inputEnergyFrom(j) || ((IEnergyConnected) tTileEntity).outputsEnergyTo(j))) {
mConnections |= (1 << i);
continue;
}
if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable) {
if (((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).letsEnergyIn(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).letsEnergyOut(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity))) {
mConnections |= (1 << i);
continue;
}
}
if (tTileEntity instanceof IEnergySink && ((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) {
mConnections |= (1 << i);
continue;
}
if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver && ((IEnergyReceiver) tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(j))) {
mConnections |= (1 << i);
continue;
}
/*
if (tTileEntity instanceof IEnergyEmitter && ((IEnergyEmitter)tTileEntity).emitsEnergyTo((TileEntity)aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) {
mConnections |= (1<<i);
continue;
}*/
}
} }
if (GT_Mod.gregtechproxy.gt6Pipe) mCheckConnections = false;
} }
}else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate(); }else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate();
} }
@Override
public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (GT_Mod.gregtechproxy.gt6Pipe) {
byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ);
if ((mConnections & (1 << tSide)) == 0)
connect(tSide);
else
disconnect(tSide);
return true;
}
return false;
}
@Override
public int connect(byte aSide) {
int rConnect = 0;
if (aSide >= 6) return rConnect;
byte tSide = GT_Utility.getOppositeSide(aSide);
TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(aSide);
if (getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).alwaysLookConnected(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity()) || getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity()) || getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyOut(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity())) {
if (tTileEntity instanceof IColoredTileEntity) {
if (getBaseMetaTileEntity().getColorization() >= 0) {
byte tColor = ((IColoredTileEntity) tTileEntity).getColorization();
if (tColor >= 0 && tColor != getBaseMetaTileEntity().getColorization())
return rConnect;
}
}
if ((tTileEntity instanceof IEnergyConnected && (((IEnergyConnected) tTileEntity).inputEnergyFrom(tSide) || ((IEnergyConnected) tTileEntity).outputsEnergyTo(tSide)))
|| (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable
&& (((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(tSide).alwaysLookConnected(tSide, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(tSide), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(tSide), ((IGregTechTileEntity) tTileEntity)) || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(tSide).letsEnergyIn(tSide, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(tSide), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(tSide), ((IGregTechTileEntity) tTileEntity)) || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(tSide).letsEnergyOut(tSide, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(tSide), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(tSide), ((IGregTechTileEntity) tTileEntity))))
|| (tTileEntity instanceof IEnergySink && ((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) getBaseMetaTileEntity(), ForgeDirection.getOrientation(tSide)))
|| (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver && ((IEnergyReceiver) tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(tSide)))
/*|| (tTileEntity instanceof IEnergyEmitter && ((IEnergyEmitter)tTileEntity).emitsEnergyTo((TileEntity)getBaseMetaTileEntity(), ForgeDirection.getOrientation(tSide)))*/) {
rConnect = 1;
}
}
if (rConnect > 0) {
super.connect(aSide);
}
return rConnect;
}
@Override @Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false; return false;
@ -302,17 +314,22 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
@Override @Override
public float getThickNess() { public float getThickNess() {
if(GT_Mod.instance.isClientSide() && GT_Client.hideValue==1) return 0.0625F; if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) return 0.0625F;
return mThickNess; return mThickNess;
} }
@Override @Override
public void saveNBTData(NBTTagCompound aNBT) { public void saveNBTData(NBTTagCompound aNBT) {
// if (GT_Mod.gregtechproxy.gt6Pipe)
aNBT.setByte("mConnections", mConnections);
} }
@Override @Override
public void loadNBTData(NBTTagCompound aNBT) { public void loadNBTData(NBTTagCompound aNBT) {
// if (GT_Mod.gregtechproxy.gt6Pipe) {
if (!aNBT.hasKey("mConnections"))
mCheckConnections = true;
mConnections = aNBT.getByte("mConnections");
}
} }
} }

View file

@ -16,6 +16,7 @@ import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Client; import gregtech.common.GT_Client;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
@ -32,13 +33,18 @@ import java.util.concurrent.ConcurrentHashMap;
import static gregtech.api.enums.GT_Values.D1; import static gregtech.api.enums.GT_Values.D1;
public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity{
public final float mThickNess; public final float mThickNess;
public final Materials mMaterial; public final Materials mMaterial;
public final int mCapacity, mHeatResistance; public final int mCapacity, mHeatResistance;
public final boolean mGasProof; public final boolean mGasProof;
public FluidStack mFluid; public FluidStack mFluid;
public byte mLastReceivedFrom = 0, oLastReceivedFrom = 0; public byte mLastReceivedFrom = 0, oLastReceivedFrom = 0;
private boolean mCheckConnections = !GT_Mod.gregtechproxy.gt6Pipe;
/**
* Bitmask for whether disable fluid input form each side.
*/
public byte mDisableInput = 0;
public GT_MetaPipeEntity_Fluid(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof) { public GT_MetaPipeEntity_Fluid(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof) {
super(aID, aName, aNameRegional, 0); super(aID, aName, aNameRegional, 0);
@ -121,12 +127,22 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
public void saveNBTData(NBTTagCompound aNBT) { public void saveNBTData(NBTTagCompound aNBT) {
if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound()));
aNBT.setByte("mLastReceivedFrom", mLastReceivedFrom); aNBT.setByte("mLastReceivedFrom", mLastReceivedFrom);
if (GT_Mod.gregtechproxy.gt6Pipe) {
aNBT.setByte("mConnections", mConnections);
aNBT.setByte("mDisableInput", mDisableInput);
}
} }
@Override @Override
public void loadNBTData(NBTTagCompound aNBT) { public void loadNBTData(NBTTagCompound aNBT) {
mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
mLastReceivedFrom = aNBT.getByte("mLastReceivedFrom"); mLastReceivedFrom = aNBT.getByte("mLastReceivedFrom");
if (GT_Mod.gregtechproxy.gt6Pipe) {
if (!aNBT.hasKey("mConnections"))
mCheckConnections = false;
mConnections = aNBT.getByte("mConnections");
mDisableInput = aNBT.getByte("mDisableInput");
}
} }
@Override @Override
@ -212,55 +228,19 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
if (mLastReceivedFrom == oLastReceivedFrom) { if (mLastReceivedFrom == oLastReceivedFrom) {
ConcurrentHashMap<IFluidHandler, ForgeDirection> tTanks = new ConcurrentHashMap<IFluidHandler, ForgeDirection>(); ConcurrentHashMap<IFluidHandler, ForgeDirection> tTanks = new ConcurrentHashMap<IFluidHandler, ForgeDirection>();
mConnections = 0;
for (byte tSide = 0, i = 0, j = (byte) aBaseMetaTileEntity.getRandomNumber(6); i < 6; i++) { for (byte tSide = 0, i = 0, j = (byte) aBaseMetaTileEntity.getRandomNumber(6); i < 6; i++) {
tSide = (byte) ((j + i) % 6); tSide = (byte) ((i + j) % 6);
if (mCheckConnections || (mConnections & (1 << tSide)) != 0)
IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(tSide); switch (connect(tSide)) {
if (tTileEntity != null) { case 0:
if (tTileEntity instanceof IGregTechTileEntity) { disconnect(tSide); break;
if (aBaseMetaTileEntity.getColorization() >= 0) { case 2:
byte tColor = ((IGregTechTileEntity) tTileEntity).getColorization(); tTanks.put(aBaseMetaTileEntity.getITankContainerAtSide(tSide), ForgeDirection.getOrientation(tSide).getOpposite()); break;
if (tColor >= 0 && (tColor & 15) != (aBaseMetaTileEntity.getColorization() & 15)) { }
continue;
}
}
}
FluidTankInfo[] tInfo = tTileEntity.getTankInfo(ForgeDirection.getOrientation(tSide).getOpposite());
if (tInfo != null && tInfo.length > 0) {
if (tTileEntity instanceof ICoverable && ((ICoverable) tTileEntity).getCoverBehaviorAtSide(GT_Utility.getOppositeSide(tSide)).alwaysLookConnected(GT_Utility.getOppositeSide(tSide), ((ICoverable) tTileEntity).getCoverIDAtSide(GT_Utility.getOppositeSide(tSide)), ((ICoverable) tTileEntity).getCoverDataAtSide(GT_Utility.getOppositeSide(tSide)), ((ICoverable) tTileEntity))) {
mConnections |= (1 << tSide);
}
if (aBaseMetaTileEntity.getCoverBehaviorAtSide(tSide).letsFluidIn(tSide, aBaseMetaTileEntity.getCoverIDAtSide(tSide), aBaseMetaTileEntity.getCoverDataAtSide(tSide), null, aBaseMetaTileEntity)) {
mConnections |= (1 << tSide);
}
if (aBaseMetaTileEntity.getCoverBehaviorAtSide(tSide).letsFluidOut(tSide, aBaseMetaTileEntity.getCoverIDAtSide(tSide), aBaseMetaTileEntity.getCoverDataAtSide(tSide), null, aBaseMetaTileEntity)) {
mConnections |= (1 << tSide);
if (((1 << tSide) & mLastReceivedFrom) == 0)
tTanks.put(tTileEntity, ForgeDirection.getOrientation(tSide).getOpposite());
}
if (aBaseMetaTileEntity.getCoverBehaviorAtSide(tSide).alwaysLookConnected(tSide, aBaseMetaTileEntity.getCoverIDAtSide(tSide), aBaseMetaTileEntity.getCoverDataAtSide(tSide), aBaseMetaTileEntity)) {
mConnections |= (1 << tSide);
}
}else if(tInfo != null && tInfo.length == 0){
IGregTechTileEntity tSideTile = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(tSide);
if(tSideTile!=null){
ItemStack tCover = tSideTile.getCoverItemAtSide(GT_Utility.getOppositeSide(tSide));
if (tCover!=null &&(GT_Utility.areStacksEqual(tCover, ItemList.FluidRegulator_LV.get(1, new Object[]{},true)) ||
GT_Utility.areStacksEqual(tCover, ItemList.FluidRegulator_MV.get(1, new Object[]{},true)) ||
GT_Utility.areStacksEqual(tCover, ItemList.FluidRegulator_HV.get(1, new Object[]{},true)) ||
GT_Utility.areStacksEqual(tCover, ItemList.FluidRegulator_EV.get(1, new Object[]{},true)) ||
GT_Utility.areStacksEqual(tCover, ItemList.FluidRegulator_IV.get(1, new Object[]{},true)))) {
mConnections |= (1 << tSide);
}
}
}
}
} }
if (GT_Mod.gregtechproxy.gt6Pipe) mCheckConnections = false;
if (mFluid != null && mFluid.amount > 0) { if (mFluid != null && mFluid.amount > 0) {
int tAmount = Math.max(1, Math.min(mCapacity * 10, mFluid.amount / 2)), tSuccessfulTankAmount = 0; int tAmount = Math.max(1, Math.min(mCapacity * 10, mFluid.amount / 2)), tSuccessfulTankAmount = 0;
@ -295,6 +275,88 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
}else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate(); }else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate();
} }
@Override
public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (GT_Mod.gregtechproxy.gt6Pipe) {
byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ);
byte tMask = (byte) (1 << tSide);
if (aPlayer.isSneaking()) {
if ((mDisableInput & tMask) != 0) {
mDisableInput &= ~tMask;
GT_Utility.sendChatToPlayer(aPlayer, trans("212", "Input enabled"));
} else {
mDisableInput |= tMask;
GT_Utility.sendChatToPlayer(aPlayer, trans("213", "Input disabled"));
}
} else {
if ((mConnections & tMask) == 0)
connect(tSide);
else
disconnect(tSide);
}
return true;
}
return false;
}
@Override
public int connect(byte aSide) {
int rConnect = 0;
if (aSide >= 6) return rConnect;
IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(aSide);
GT_MetaPipeEntity_Fluid tFluidPipe = null;
byte tSide = GT_Utility.getOppositeSide(aSide);
if (tTileEntity != null) {
if (tTileEntity instanceof IGregTechTileEntity) {
if (getBaseMetaTileEntity().getColorization() >= 0) {
byte tColor = ((IGregTechTileEntity) tTileEntity).getColorization();
if (tColor >= 0 && (tColor & 15) != (getBaseMetaTileEntity().getColorization() & 15)) {
return rConnect;
}
}
if (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Fluid) {
tFluidPipe = (GT_MetaPipeEntity_Fluid) ((IGregTechTileEntity) tTileEntity).getMetaTileEntity();
}
}
FluidTankInfo[] tInfo = tTileEntity.getTankInfo(ForgeDirection.getOrientation(aSide).getOpposite());
if (tInfo != null) {
if (tInfo.length > 0) {
if ((tTileEntity instanceof ICoverable && ((ICoverable) tTileEntity).getCoverBehaviorAtSide(tSide).alwaysLookConnected(tSide, ((ICoverable) tTileEntity).getCoverIDAtSide(tSide), ((ICoverable) tTileEntity).getCoverDataAtSide(tSide), ((ICoverable) tTileEntity)))
|| getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsFluidIn(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), null, getBaseMetaTileEntity())
|| getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).alwaysLookConnected(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity())) {
rConnect = 1;
}
if (getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsFluidOut(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), null, getBaseMetaTileEntity())) {
rConnect = 2;
}
} else if (tInfo.length == 0) {
IGregTechTileEntity tSideTile = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide);
if (tSideTile != null){
ItemStack tCover = tSideTile.getCoverItemAtSide(tSide);
if (tCover!=null &&(GT_Utility.areStacksEqual(tCover, ItemList.FluidRegulator_LV.get(1, new Object[]{},true)) ||
GT_Utility.areStacksEqual(tCover, ItemList.FluidRegulator_MV.get(1, new Object[]{},true)) ||
GT_Utility.areStacksEqual(tCover, ItemList.FluidRegulator_HV.get(1, new Object[]{},true)) ||
GT_Utility.areStacksEqual(tCover, ItemList.FluidRegulator_EV.get(1, new Object[]{},true)) ||
GT_Utility.areStacksEqual(tCover, ItemList.FluidRegulator_IV.get(1, new Object[]{},true)))) {
rConnect = 1;
}
}
}
}
}
if (rConnect > 0) {
if (GT_Mod.gregtechproxy.gt6Pipe && tFluidPipe != null) {
if ((mDisableInput == 0 || (tFluidPipe.mDisableInput & (1 << tSide)) == 0)) {
mConnections |= (1 << aSide);
if ((tFluidPipe.mConnections & (1 << tSide)) == 0) tFluidPipe.connect(tSide);
}
} else {
mConnections |= (1 << aSide);
}
}
return rConnect;
}
@Override @Override
public void doSound(byte aIndex, double aX, double aY, double aZ) { public void doSound(byte aIndex, double aX, double aY, double aZ) {
super.doSound(aIndex, aX, aY, aZ); super.doSound(aIndex, aX, aY, aZ);
@ -409,7 +471,17 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
@Override @Override
public float getThickNess() { public float getThickNess() {
if(GT_Mod.instance.isClientSide() && GT_Client.hideValue==1) return 0.0625F; if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) return 0.0625F;
return mThickNess; return mThickNess;
} }
@Override
public boolean isLiquidInput(byte aSide) {
return (mDisableInput & (1 << aSide)) == 0;
}
@Override
public boolean isLiquidOutput(byte aSide) {
return true;
}
} }

View file

@ -91,4 +91,10 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity {
public final boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { public final boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false; return false;
} }
@Override
public int connect(byte aSide) {return 0;}
@Override
public void disconnect(byte aSide) {/*Do nothing*/}
} }

View file

@ -12,6 +12,7 @@ import gregtech.api.metatileentity.MetaPipeEntity;
import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility; import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Client; import gregtech.common.GT_Client;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -26,7 +27,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileEntityItemPipe { public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileEntityItemPipe{
public final float mThickNess; public final float mThickNess;
public final Materials mMaterial; public final Materials mMaterial;
public final int mStepSize; public final int mStepSize;
@ -34,6 +35,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
public int mTransferredItems = 0; public int mTransferredItems = 0;
public byte mLastReceivedFrom = 0, oLastReceivedFrom = 0; public byte mLastReceivedFrom = 0, oLastReceivedFrom = 0;
public boolean mIsRestrictive = false; public boolean mIsRestrictive = false;
private boolean mCheckConnections = !GT_Mod.gregtechproxy.gt6Pipe;
public GT_MetaPipeEntity_Item(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, int aInvSlotCount, int aStepSize, boolean aIsRestrictive, int aTickTime) { public GT_MetaPipeEntity_Item(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, int aInvSlotCount, int aStepSize, boolean aIsRestrictive, int aTickTime) {
super(aID, aName, aNameRegional, aInvSlotCount); super(aID, aName, aNameRegional, aInvSlotCount);
@ -141,70 +143,29 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
@Override @Override
public void saveNBTData(NBTTagCompound aNBT) { public void saveNBTData(NBTTagCompound aNBT) {
aNBT.setByte("mLastReceivedFrom", mLastReceivedFrom); aNBT.setByte("mLastReceivedFrom", mLastReceivedFrom);
if (GT_Mod.gregtechproxy.gt6Pipe)
aNBT.setByte("mConnections", mConnections);
} }
@Override @Override
public void loadNBTData(NBTTagCompound aNBT) { public void loadNBTData(NBTTagCompound aNBT) {
mLastReceivedFrom = aNBT.getByte("mLastReceivedFrom"); mLastReceivedFrom = aNBT.getByte("mLastReceivedFrom");
if (GT_Mod.gregtechproxy.gt6Pipe) {
if (!aNBT.hasKey("mConnections"))
mCheckConnections = true;
mConnections = aNBT.getByte("mConnections");
}
} }
@Override @Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (aBaseMetaTileEntity.isServerSide() && aTick % 10 == 0) { if (aBaseMetaTileEntity.isServerSide() && aTick % 10 == 0) {
mConnections = 0;
if (aTick % mTickTime == 0) mTransferredItems = 0; if (aTick % mTickTime == 0) mTransferredItems = 0;
for (byte i = 0; i < 6; i++) { for (byte i = 0; i < 6; i++) {
TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); if ((mCheckConnections || (mConnections & (1 << i)) != 0) && connect(i) <= 0) disconnect(i);
if (tTileEntity != null) {
boolean temp = GT_Utility.isConnectableNonInventoryPipe(tTileEntity, GT_Utility.getOppositeSide(i));
if (tTileEntity instanceof IGregTechTileEntity) {
temp = true;
if (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() == null) continue;
if (aBaseMetaTileEntity.getColorization() >= 0) {
byte tColor = ((IGregTechTileEntity) tTileEntity).getColorization();
if (tColor >= 0 && tColor != aBaseMetaTileEntity.getColorization()) {
continue;
}
}
if (((IGregTechTileEntity) tTileEntity).getMetaTileEntity().connectsToItemPipe(GT_Utility.getOppositeSide(i))) {
mConnections |= (1 << i);
continue;
}
}
if (tTileEntity instanceof IInventory) {
temp = true;
if (((IInventory) tTileEntity).getSizeInventory() <= 0) {
continue;
}
}
if (tTileEntity instanceof ISidedInventory) {
temp = true;
int[] tSlots = ((ISidedInventory) tTileEntity).getAccessibleSlotsFromSide(GT_Utility.getOppositeSide(i));
if (tSlots == null || tSlots.length <= 0) {
continue;
}
}
if (temp) {
if (tTileEntity instanceof ICoverable && ((ICoverable) tTileEntity).getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i)).alwaysLookConnected(GT_Utility.getOppositeSide(i), ((ICoverable) tTileEntity).getCoverIDAtSide(GT_Utility.getOppositeSide(i)), ((ICoverable) tTileEntity).getCoverDataAtSide(GT_Utility.getOppositeSide(i)), ((ICoverable) tTileEntity))) {
mConnections |= (1 << i);
continue;
}
if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity)) {
mConnections |= (1 << i);
continue;
}
if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsItemsIn(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), -1, aBaseMetaTileEntity)) {
mConnections |= (1 << i);
continue;
}
if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsItemsOut(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), -1, aBaseMetaTileEntity)) {
mConnections |= (1 << i);
continue;
}
}
}
} }
if (GT_Mod.gregtechproxy.gt6Pipe) mCheckConnections = false;
if (oLastReceivedFrom == mLastReceivedFrom) { if (oLastReceivedFrom == mLastReceivedFrom) {
doTickProfilingInThisTick = false; doTickProfilingInThisTick = false;
@ -229,6 +190,70 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
}else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate(); }else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate();
} }
@Override
public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (GT_Mod.gregtechproxy.gt6Pipe) {
byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ);
if ((mConnections & (1 << tSide)) == 0)
connect(tSide);
else
disconnect(tSide);
return true;
}
return false;
}
@Override
public int connect(byte aSide) {
int rConnect = 0;
if (aSide >= 6) return rConnect;
TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(aSide);
byte tSide = GT_Utility.getOppositeSide(aSide);
if (tTileEntity != null) {
boolean temp = GT_Utility.isConnectableNonInventoryPipe(tTileEntity, tSide);
if (tTileEntity instanceof IGregTechTileEntity) {
temp = true;
if (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() == null) return rConnect;
if (getBaseMetaTileEntity().getColorization() >= 0) {
byte tColor = ((IGregTechTileEntity) tTileEntity).getColorization();
if (tColor >= 0 && tColor != getBaseMetaTileEntity().getColorization()) {
return rConnect;
}
}
if (((IGregTechTileEntity) tTileEntity).getMetaTileEntity().connectsToItemPipe(tSide)) {
rConnect = 1;
}
}
if (rConnect == 0) {
if (tTileEntity instanceof IInventory) {
temp = true;
if (((IInventory) tTileEntity).getSizeInventory() <= 0) {
return rConnect;
}
}
if (tTileEntity instanceof ISidedInventory) {
temp = true;
int[] tSlots = ((ISidedInventory) tTileEntity).getAccessibleSlotsFromSide(tSide);
if (tSlots == null || tSlots.length <= 0) {
return rConnect;
}
}
if (temp) {
if ((tTileEntity instanceof ICoverable && ((ICoverable) tTileEntity).getCoverBehaviorAtSide(tSide).alwaysLookConnected(tSide, ((ICoverable) tTileEntity).getCoverIDAtSide(tSide), ((ICoverable) tTileEntity).getCoverDataAtSide(tSide), ((ICoverable) tTileEntity)))
|| getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).alwaysLookConnected(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity())
|| getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsItemsIn(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), -1, getBaseMetaTileEntity())
|| getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsItemsOut(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), -1, getBaseMetaTileEntity())) {
rConnect = 1;
}
}
}
}
if (rConnect > 0) {
super.connect(aSide);
}
return rConnect;
}
@Override @Override
public boolean incrementTransferCounter(int aIncrement) { public boolean incrementTransferCounter(int aIncrement) {
mTransferredItems += aIncrement; mTransferredItems += aIncrement;
@ -315,7 +340,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
@Override @Override
public float getThickNess() { public float getThickNess() {
if(GT_Mod.instance.isClientSide() && GT_Client.hideValue==1) return 0.0625F; if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) return 0.0625F;
return mThickNess; return mThickNess;
} }

View file

@ -354,7 +354,7 @@ public class GT_Client extends GT_Proxy
TileEntity aTileEntity = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ); TileEntity aTileEntity = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
try { try {
Class.forName("codechicken.lib.vec.Rotation"); Class.forName("codechicken.lib.vec.Rotation");
if (((aTileEntity instanceof BaseMetaPipeEntity)) && (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0) && ((GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCovers.keySet())) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCrowbarList)) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sScrewdriverList)))) { if (((aTileEntity instanceof BaseMetaPipeEntity)) && (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0) && ((GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCovers.keySet())) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCrowbarList)) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sScrewdriverList)) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWireCutterList)))) {
drawGrid(aEvent); drawGrid(aEvent);
return; return;
} }

View file

@ -201,6 +201,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public boolean enableBasaltOres = true; public boolean enableBasaltOres = true;
public boolean enableGCOres = true; public boolean enableGCOres = true;
public boolean enableUBOres = true; public boolean enableUBOres = true;
public boolean gt6Pipe = true;
public GT_Proxy() { public GT_Proxy() {
GameRegistry.registerFuelHandler(this); GameRegistry.registerFuelHandler(this);

View file

@ -2,6 +2,7 @@ package gregtech.common.blocks;
import gregtech.api.GregTech_API; import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values; import gregtech.api.enums.GT_Values;
import gregtech.api.interfaces.metatileentity.IConnectable;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_ItsNotMyFaultException; import gregtech.api.util.GT_ItsNotMyFaultException;
import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_LanguageManager;
@ -131,6 +132,9 @@ public class GT_Item_Machines
tTileEntity.setOwnerName(aPlayer.getDisplayName()); tTileEntity.setOwnerName(aPlayer.getDisplayName());
} }
tTileEntity.getMetaTileEntity().initDefaultModes(aStack.getTagCompound()); tTileEntity.getMetaTileEntity().initDefaultModes(aStack.getTagCompound());
if (tTileEntity.getMetaTileEntity() instanceof IConnectable) {
((IConnectable) tTileEntity.getMetaTileEntity()).connect(GT_Utility.getOppositeSide(side));
}
} }
} else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tDamage, 3)) { } else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tDamage, 3)) {
return false; return false;

View file

@ -71,7 +71,7 @@ public class GT_MetaGenerated_Tool_01 extends GT_MetaGenerated_Tool {
GregTech_API.registerTool(addTool(20, "Crowbar", "Dismounts Covers and Rotates Rails", new GT_Tool_Crowbar(), ToolDictNames.craftingToolCrowbar, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.TELUM, 2L)), GregTech_API.sCrowbarList); GregTech_API.registerTool(addTool(20, "Crowbar", "Dismounts Covers and Rotates Rails", new GT_Tool_Crowbar(), ToolDictNames.craftingToolCrowbar, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.TELUM, 2L)), GregTech_API.sCrowbarList);
GregTech_API.registerTool(addTool(22, "Screwdriver", "Adjusts Covers and Machines", new GT_Tool_Screwdriver(), ToolDictNames.craftingToolScrewdriver, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)), GregTech_API.sScrewdriverList); GregTech_API.registerTool(addTool(22, "Screwdriver", "Adjusts Covers and Machines", new GT_Tool_Screwdriver(), ToolDictNames.craftingToolScrewdriver, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)), GregTech_API.sScrewdriverList);
addTool(24, "Mortar", "", new GT_Tool_Mortar(), ToolDictNames.craftingToolMortar, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.PERDITIO, 2L)); addTool(24, "Mortar", "", new GT_Tool_Mortar(), ToolDictNames.craftingToolMortar, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.PERDITIO, 2L));
addTool(26, "Wire Cutter", "", new GT_Tool_WireCutter(), ToolDictNames.craftingToolWireCutter, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)); GregTech_API.registerTool(addTool(26, "Wire Cutter", "", new GT_Tool_WireCutter(), ToolDictNames.craftingToolWireCutter, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)), GregTech_API.sWireCutterList);
addTool(28, "Scoop", "", new GT_Tool_Scoop(), ToolDictNames.craftingToolScoop, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.BESTIA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.PANNUS, 2L)); addTool(28, "Scoop", "", new GT_Tool_Scoop(), ToolDictNames.craftingToolScoop, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.BESTIA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.PANNUS, 2L));
addTool(30, "Branch Cutter", "", new GT_Tool_BranchCutter(), ToolDictNames.craftingToolBranchCutter, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.METO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.HERBA, 2L)); addTool(30, "Branch Cutter", "", new GT_Tool_BranchCutter(), ToolDictNames.craftingToolBranchCutter, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.METO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.HERBA, 2L));
GregTech_API.registerTool(addTool(32, "Universal Spade", "", new GT_Tool_UniversalSpade(), ToolDictNames.craftingToolBlade, ToolDictNames.craftingToolShovel, ToolDictNames.craftingToolCrowbar, ToolDictNames.craftingToolSaw, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.TELUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.METO, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 1L)), GregTech_API.sCrowbarList); GregTech_API.registerTool(addTool(32, "Universal Spade", "", new GT_Tool_UniversalSpade(), ToolDictNames.craftingToolBlade, ToolDictNames.craftingToolShovel, ToolDictNames.craftingToolCrowbar, ToolDictNames.craftingToolSaw, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.TELUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.METO, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 1L)), GregTech_API.sCrowbarList);