Merge pull request #1264 from Antifluxfield/GT6-styled_pipes

GT6 Styled Pipes & Cables
This commit is contained in:
Blood-Asp 2017-11-25 18:45:33 +01:00 committed by GitHub
commit 7cc77f5abf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
88 changed files with 986 additions and 441 deletions

View file

@ -281,6 +281,9 @@ 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", "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[] 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

@ -188,6 +188,8 @@ public enum OrePrefixes {
pipeMedium("Medium Pipes", "Medium ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 3, 64, 80), pipeMedium("Medium Pipes", "Medium ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 3, 64, 80),
pipeLarge("Large pipes", "Large ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 6, 64, 81), pipeLarge("Large pipes", "Large ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 6, 64, 81),
pipeHuge("Huge Pipes", "Huge ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 12, 64, 82), pipeHuge("Huge Pipes", "Huge ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 12, 64, 82),
pipeQuadruple("Quadruple Pipes", "Quadruple ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M *12, 64, 84),
pipeNonuple("Nonuple Pipes", "Nonuple ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 9, 64, 85),
pipeRestrictiveTiny("Tiny Restrictive Pipes", "Tiny Restrictive ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M / 2, 64, 78), pipeRestrictiveTiny("Tiny Restrictive Pipes", "Tiny Restrictive ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M / 2, 64, 78),
pipeRestrictiveSmall("Small Restrictive Pipes", "Small Restrictive ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 1, 64, 79), pipeRestrictiveSmall("Small Restrictive Pipes", "Small Restrictive ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 1, 64, 79),
pipeRestrictiveMedium("Medium Restrictive Pipes", "Medium Restrictive ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 3, 64, 80), pipeRestrictiveMedium("Medium Restrictive Pipes", "Medium Restrictive ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 3, 64, 80),

View file

@ -103,8 +103,8 @@ public class TextureSet {
mTextures[81] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/pipeLarge"); mTextures[81] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/pipeLarge");
mTextures[82] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/pipeHuge"); mTextures[82] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/pipeHuge");
mTextures[83] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/frameGt"); mTextures[83] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/frameGt");
mTextures[84] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir); mTextures[84] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/pipeQuadruple");
mTextures[85] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir); mTextures[85] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + "/pipeNonuple");
mTextures[86] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir); mTextures[86] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
mTextures[87] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir); mTextures[87] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);
mTextures[88] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir); mTextures[88] = new Textures.BlockIcons.CustomIcon(aTextMatIconDir + mSetName + aTextVoidDir);

View file

@ -103,7 +103,9 @@ public class Textures {
OVERLAY_FRONT_PROCESSING_ARRAY, OVERLAY_FRONT_OIL_DRILL_ACTIVE, OVERLAY_FRONT_OIL_DRILL, OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE, OVERLAY_FRONT_DIESEL_ENGINE, OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE, OVERLAY_FRONT_PROCESSING_ARRAY, OVERLAY_FRONT_OIL_DRILL_ACTIVE, OVERLAY_FRONT_OIL_DRILL, OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE, OVERLAY_FRONT_DIESEL_ENGINE, OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE,
OVERLAY_FRONT_PYROLYSE_OVEN, OVERLAY_FRONT_OIL_CRACKER_ACTIVE, OVERLAY_FRONT_OIL_CRACKER, OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE, OVERLAY_FRONT_DISTILLATION_TOWER, OVERLAY_FRONT_PYROLYSE_OVEN, OVERLAY_FRONT_OIL_CRACKER_ACTIVE, OVERLAY_FRONT_OIL_CRACKER, OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE, OVERLAY_FRONT_DISTILLATION_TOWER,
OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE, OVERLAY_FRONT_ASSEMBLY_LINE, OVERLAY_FRONT_ORE_DRILL_ACTIVE, OVERLAY_FRONT_ORE_DRILL, OVERLAY_TOP_CLEANROOM_ACTIVE, OVERLAY_TOP_CLEANROOM, OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE, OVERLAY_FRONT_ASSEMBLY_LINE, OVERLAY_FRONT_ORE_DRILL_ACTIVE, OVERLAY_FRONT_ORE_DRILL, OVERLAY_TOP_CLEANROOM_ACTIVE, OVERLAY_TOP_CLEANROOM,
OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR, OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE; OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR, OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE,
PIPE_RESTRICTOR_UP, PIPE_RESTRICTOR_DOWN, PIPE_RESTRICTOR_LEFT, PIPE_RESTRICTOR_RIGHT, PIPE_RESTRICTOR_NU, PIPE_RESTRICTOR_ND, PIPE_RESTRICTOR_NL, PIPE_RESTRICTOR_NR,
PIPE_RESTRICTOR_UD, PIPE_RESTRICTOR_UL, PIPE_RESTRICTOR_UR, PIPE_RESTRICTOR_DL, PIPE_RESTRICTOR_DR, PIPE_RESTRICTOR_LR;
/** /**
* Icon for Fresh CFoam * Icon for Fresh CFoam

View file

@ -0,0 +1,16 @@
package gregtech.api.interfaces.metatileentity;
/**
* For pipes, wires, and other MetaTiles which need to 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,8 +816,19 @@ 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 (mMetaTileEntity.onSolderingToolRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) {
GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 500, aPlayer);
GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
} else if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) {
mStrongRedstone ^= (1 << tSide); mStrongRedstone ^= (1 << tSide);
GT_Utility.sendChatToPlayer(aPlayer, trans("091","Redstone Output at Side ") + tSide + trans("092"," set to: ") + ((mStrongRedstone & (1 << tSide)) != 0 ? trans("093","Strong") : trans("094","Weak"))); GT_Utility.sendChatToPlayer(aPlayer, trans("091","Redstone Output at Side ") + tSide + trans("092"," set to: ") + ((mStrongRedstone & (1 << tSide)) != 0 ? trans("093","Strong") : trans("094","Weak")));
GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 3.0F, -1, xCoord, yCoord, zCoord); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 3.0F, -1, xCoord, yCoord, zCoord);

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,14 @@ 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;
}
public boolean onSolderingToolRightClick(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 +699,31 @@ 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);
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);
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

@ -16,11 +16,13 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.metatileentity.MetaPipeEntity; import gregtech.api.metatileentity.MetaPipeEntity;
import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility; import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Client; 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;
@ -31,6 +33,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import static gregtech.api.enums.GT_Values.VN; import static gregtech.api.enums.GT_Values.VN;
@ -42,6 +45,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.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) { 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);
@ -104,34 +108,6 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
GT_Utility.applyElectricityDamage((EntityLivingBase) aEntity, mTransferredVoltageLast20, mTransferredAmperageLast20); GT_Utility.applyElectricityDamage((EntityLivingBase) aEntity, mTransferredVoltageLast20, mTransferredAmperageLast20);
} }
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
float tSpace = (1f - mThickNess)/2;
float tSide0 = tSpace;
float tSide1 = 1f - tSpace;
float tSide2 = tSpace;
float tSide3 = 1f - tSpace;
float tSide4 = tSpace;
float tSide5 = 1f - tSpace;
if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 0) != 0){tSide0=tSide2=tSide4=0;tSide3=tSide5=1;}
if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 1) != 0){tSide2=tSide4=0;tSide1=tSide3=tSide5=1;}
if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 2) != 0){tSide0=tSide2=tSide4=0;tSide1=tSide5=1;}
if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 3) != 0){tSide0=tSide4=0;tSide1=tSide3=tSide5=1;}
if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 4) != 0){tSide0=tSide2=tSide4=0;tSide1=tSide3=1;}
if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 5) != 0){tSide0=tSide2=0;tSide1=tSide3=tSide5=1;}
byte tConn = ((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections;
if((tConn & (1 << ForgeDirection.DOWN.ordinal()) ) != 0) tSide0 = 0f;
if((tConn & (1 << ForgeDirection.UP.ordinal()) ) != 0) tSide1 = 1f;
if((tConn & (1 << ForgeDirection.NORTH.ordinal())) != 0) tSide2 = 0f;
if((tConn & (1 << ForgeDirection.SOUTH.ordinal())) != 0) tSide3 = 1f;
if((tConn & (1 << ForgeDirection.WEST.ordinal()) ) != 0) tSide4 = 0f;
if((tConn & (1 << ForgeDirection.EAST.ordinal()) ) != 0) tSide5 = 1f;
return AxisAlignedBB.getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3);
}
@Override @Override
public boolean isSimpleMachine() { public boolean isSimpleMachine() {
return true; return true;
@ -241,46 +217,75 @@ 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.gt6Cable) 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) {
return onConnectionToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ);
}
@Override
public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
return onConnectionToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ);
}
private boolean onConnectionToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
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;
if (connect(tSide) > 0)
GT_Utility.sendChatToPlayer(aPlayer, trans("214", "Connected"));
}
else {
disconnect(tSide);
GT_Utility.sendChatToPlayer(aPlayer, trans("215", "Disconnected"));
}
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 (tTileEntity != null) {
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;
}
}
} else if (getBaseMetaTileEntity().getOffsetX(aSide, 1) >> 4 != getBaseMetaTileEntity().getXCoord() >> 4
|| getBaseMetaTileEntity().getOffsetZ(aSide, 1) >> 4 != getBaseMetaTileEntity().getZCoord() >> 4) { // if chunk unloaded
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 +307,66 @@ 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.gt6Cable)
aNBT.setByte("mConnections", mConnections);
} }
@Override @Override
public void loadNBTData(NBTTagCompound aNBT) { public void loadNBTData(NBTTagCompound aNBT) {
// if (GT_Mod.gregtechproxy.gt6Cable) {
if (!aNBT.hasKey("mConnections"))
mCheckConnections = true;
mConnections = aNBT.getByte("mConnections");
}
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0)
return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1);
else
return getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
}
private AxisAlignedBB getActualCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
float tSpace = (1f - mThickNess)/2;
float tSide0 = tSpace;
float tSide1 = 1f - tSpace;
float tSide2 = tSpace;
float tSide3 = 1f - tSpace;
float tSide4 = tSpace;
float tSide5 = 1f - tSpace;
if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 0) != 0){tSide0=tSide2=tSide4=0;tSide3=tSide5=1;}
if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 1) != 0){tSide2=tSide4=0;tSide1=tSide3=tSide5=1;}
if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 2) != 0){tSide0=tSide2=tSide4=0;tSide1=tSide5=1;}
if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 3) != 0){tSide0=tSide4=0;tSide1=tSide3=tSide5=1;}
if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 4) != 0){tSide0=tSide2=tSide4=0;tSide1=tSide3=1;}
if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 5) != 0){tSide0=tSide2=0;tSide1=tSide3=tSide5=1;}
byte tConn = ((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections;
if((tConn & (1 << ForgeDirection.DOWN.ordinal()) ) != 0) tSide0 = 0f;
if((tConn & (1 << ForgeDirection.UP.ordinal()) ) != 0) tSide1 = 1f;
if((tConn & (1 << ForgeDirection.NORTH.ordinal())) != 0) tSide2 = 0f;
if((tConn & (1 << ForgeDirection.SOUTH.ordinal())) != 0) tSide3 = 1f;
if((tConn & (1 << ForgeDirection.WEST.ordinal()) ) != 0) tSide4 = 0f;
if((tConn & (1 << ForgeDirection.EAST.ordinal()) ) != 0) tSide5 = 1f;
return AxisAlignedBB.getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3);
}
@Override
public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) {
super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) {
AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
if (inputAABB.intersectsWith(aabb)) outputAABB.add(aabb);
}
} }
} }

View file

@ -8,6 +8,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.metatileentity.BaseTileEntity;
import gregtech.api.metatileentity.MetaPipeEntity; import gregtech.api.metatileentity.MetaPipeEntity;
import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.XSTR; import gregtech.api.objects.XSTR;
@ -16,6 +17,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;
@ -27,6 +29,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -35,27 +38,45 @@ 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, mPipeAmount;
public final boolean mGasProof; public final boolean mGasProof;
public FluidStack mFluid; public final FluidStack[] mFluids;
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); this(aID, aName, aNameRegional, aThickNess, aMaterial, aCapacity, aHeatResistance, aGasProof, 1);
}
public GT_MetaPipeEntity_Fluid(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof, int aFluidTypes) {
super(aID, aName, aNameRegional, 0);
mThickNess = aThickNess; mThickNess = aThickNess;
mMaterial = aMaterial; mMaterial = aMaterial;
mCapacity = aCapacity; mCapacity = aCapacity;
mGasProof = aGasProof; mGasProof = aGasProof;
mHeatResistance = aHeatResistance; mHeatResistance = aHeatResistance;
mPipeAmount = aFluidTypes;
mFluids = new FluidStack[mPipeAmount];
} }
@Deprecated
public GT_MetaPipeEntity_Fluid(String aName, float aThickNess, Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof) { public GT_MetaPipeEntity_Fluid(String aName, float aThickNess, Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof) {
this(aName, aThickNess, aMaterial, aCapacity, aHeatResistance, aGasProof, 1);
}
public GT_MetaPipeEntity_Fluid(String aName, float aThickNess, Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof, int aFluidTypes) {
super(aName, 0); super(aName, 0);
mThickNess = aThickNess; mThickNess = aThickNess;
mMaterial = aMaterial; mMaterial = aMaterial;
mCapacity = aCapacity; mCapacity = aCapacity;
mGasProof = aGasProof; mGasProof = aGasProof;
mHeatResistance = aHeatResistance; mHeatResistance = aHeatResistance;
mPipeAmount = aFluidTypes;
mFluids = new FluidStack[mPipeAmount];
} }
@Override @Override
@ -65,26 +86,66 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
@Override @Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaPipeEntity_Fluid(mName, mThickNess, mMaterial, mCapacity, mHeatResistance, mGasProof); return new GT_MetaPipeEntity_Fluid(mName, mThickNess, mMaterial, mCapacity, mHeatResistance, mGasProof, mPipeAmount);
} }
@Override @Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) {
if (aConnected) { float tThickNess = getThickNess();
float tThickNess = getThickNess(); if (mDisableInput == 0) return new ITexture[]{aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) : new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
if (tThickNess < 0.124F) byte tMask = 0;
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; byte[][] sRestrictionArray = new byte[][]{
if (tThickNess < 0.374F)//0.375 {2, 3, 5, 4},
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; {2, 3, 4, 5},
if (tThickNess < 0.499F)//0.500 {1, 0, 4, 5},
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; {1, 0, 4, 5},
if (tThickNess < 0.749F)//0.750 {1, 0, 2, 3},
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; {1, 0, 2, 3}
if (tThickNess < 0.874F)//0.825 };
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; if (aSide >= 0 && aSide < 6) for (byte i = 0; i < 4; i++) if ((mDisableInput & (1 << sRestrictionArray[aSide][i])) != 0) tMask |= 1 << i;
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; return new ITexture[]{aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) : new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), getRestrictorTexture(tMask)};
} }
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
protected static final ITexture getBaseTexture(float aThickNess, int aPipeAmount, Materials aMaterial, byte aColorIndex) {
if (aPipeAmount >= 9) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
if (aPipeAmount >= 4) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
if (aThickNess < 0.124F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
if (aThickNess < 0.374F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
if (aThickNess < 0.499F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
if (aThickNess < 0.749F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
if (aThickNess < 0.874F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
}
protected static final ITexture getRestrictorTexture(byte aMask) {
switch (aMask) {
case 1: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_UP);
case 2: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_DOWN);
case 3: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_UD);
case 4: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_LEFT);
case 5: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_UL);
case 6: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_DL);
case 7: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_NR);
case 8: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_RIGHT);
case 9: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_UR);
case 10: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_DR);
case 11: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_NL);
case 12: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_LR);
case 13: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_ND);
case 14: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_NU);
case 15: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR);
default: return null;
}
}
@Override
public void onValueUpdate(byte aValue) {
mDisableInput = aValue;
}
@Override
public byte getUpdateData() {
return mDisableInput;
} }
@Override @Override
@ -119,30 +180,431 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
@Override @Override
public void saveNBTData(NBTTagCompound aNBT) { public void saveNBTData(NBTTagCompound aNBT) {
if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); for (int i = 0; i < mPipeAmount; i++)
if (mFluids[i] != null)
aNBT.setTag("mFluid"+(i==0?"":i), mFluids[i].writeToNBT(new NBTTagCompound()));
aNBT.setByte("mLastReceivedFrom", mLastReceivedFrom); aNBT.setByte("mLastReceivedFrom", mLastReceivedFrom);
} if (GT_Mod.gregtechproxy.gt6Pipe) {
aNBT.setByte("mConnections", mConnections);
@Override aNBT.setByte("mDisableInput", mDisableInput);
public void loadNBTData(NBTTagCompound aNBT) {
mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
mLastReceivedFrom = aNBT.getByte("mLastReceivedFrom");
}
@Override
public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) {
if (mFluid != null && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase) {
int tTemperature = mFluid.getFluid().getTemperature(mFluid);
if (tTemperature > 320 && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) {
GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, (tTemperature - 300) / 50.0F);
} else if (tTemperature < 260 && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) {
GT_Utility.applyFrostDamage((EntityLivingBase) aEntity, (270 - tTemperature) / 25.0F);
}
} }
} }
@Override
public void loadNBTData(NBTTagCompound aNBT) {
for (int i = 0; i < mPipeAmount; i++)
mFluids[i] = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"+(i==0?"":i)));
mLastReceivedFrom = aNBT.getByte("mLastReceivedFrom");
if (GT_Mod.gregtechproxy.gt6Pipe) {
if (!aNBT.hasKey("mConnections"))
mCheckConnections = false;
mConnections = aNBT.getByte("mConnections");
mDisableInput = aNBT.getByte("mDisableInput");
}
}
@Override
public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) {
if ((((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase) {
for (FluidStack tFluid : mFluids) {
if (tFluid != null) {
int tTemperature = tFluid.getFluid().getTemperature(tFluid);
if (tTemperature > 320 && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) {
GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, (tTemperature - 300) / 50.0F); break;
} else if (tTemperature < 260 && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) {
GT_Utility.applyFrostDamage((EntityLivingBase) aEntity, (270 - tTemperature) / 25.0F); break;
}
}
}
}
}
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (aBaseMetaTileEntity.isServerSide() && aTick % 5 == 0) {
mLastReceivedFrom &= 63;
if (mLastReceivedFrom == 63) {
mLastReceivedFrom = 0;
}
for (FluidStack tFluid : mFluids) {
if (tFluid != null && tFluid.amount > 0) {
int tTemperature = tFluid.getFluid().getTemperature(tFluid);
if (tTemperature > mHeatResistance) {
if (aBaseMetaTileEntity.getRandomNumber(100) == 0) {
aBaseMetaTileEntity.setToFire();
return;
}
aBaseMetaTileEntity.setOnFire();
}
if (!mGasProof && tFluid.getFluid().isGaseous(tFluid)) {
tFluid.amount -= 5;
sendSound((byte) 9);
if (tTemperature > 320) {
try {
for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(getBaseMetaTileEntity().getXCoord() - 2, getBaseMetaTileEntity().getYCoord() - 2, getBaseMetaTileEntity().getZCoord() - 2, getBaseMetaTileEntity().getXCoord() + 3, getBaseMetaTileEntity().getYCoord() + 3, getBaseMetaTileEntity().getZCoord() + 3))) {
GT_Utility.applyHeatDamage(tLiving, (tTemperature - 300) / 25.0F);
}
} catch (Throwable e) {
if (D1) e.printStackTrace(GT_Log.err);
}
} else if (tTemperature < 260) {
try {
for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(getBaseMetaTileEntity().getXCoord() - 2, getBaseMetaTileEntity().getYCoord() - 2, getBaseMetaTileEntity().getZCoord() - 2, getBaseMetaTileEntity().getXCoord() + 3, getBaseMetaTileEntity().getYCoord() + 3, getBaseMetaTileEntity().getZCoord() + 3))) {
GT_Utility.applyFrostDamage(tLiving, (270 - tTemperature) / 12.5F);
}
} catch (Throwable e) {
if (D1) e.printStackTrace(GT_Log.err);
}
}
if (tFluid.amount <= 0) tFluid = null;
}
}
}
if (mLastReceivedFrom == oLastReceivedFrom) {
ConcurrentHashMap<IFluidHandler, ForgeDirection> tTanks = new ConcurrentHashMap<IFluidHandler, ForgeDirection>();
for (byte tSide = 0, i = 0, j = (byte) aBaseMetaTileEntity.getRandomNumber(6); i < 6; i++) {
tSide = (byte) ((i + j) % 6);
if (mCheckConnections || (mConnections & (1 << tSide)) != 0)
switch (connect(tSide)) {
case 0:
disconnect(tSide); break;
case 2:
if ((mLastReceivedFrom & (1 << tSide)) == 0)
tTanks.put(aBaseMetaTileEntity.getITankContainerAtSide(tSide), ForgeDirection.getOrientation(tSide).getOpposite()); break;
}
}
if (GT_Mod.gregtechproxy.gt6Pipe) mCheckConnections = false;
for (int i = 0, j = aBaseMetaTileEntity.getRandomNumber(mPipeAmount); i < mPipeAmount; i++) {
int index = (i + j) % mPipeAmount;
if (mFluids[index] != null && mFluids[index].amount > 0) {
int tAmount = Math.max(1, Math.min(mCapacity * 10, mFluids[index].amount / 2)), tSuccessfulTankAmount = 0;
for (Entry<IFluidHandler, ForgeDirection> tEntry : tTanks.entrySet())
if (tEntry.getKey().fill(tEntry.getValue(), drainFromIndex(tAmount, false, index), false) > 0)
tSuccessfulTankAmount++;
if (tSuccessfulTankAmount > 0) {
if (tAmount >= tSuccessfulTankAmount) {
tAmount /= tSuccessfulTankAmount;
for (Entry<IFluidHandler, ForgeDirection> tTileEntity : tTanks.entrySet()) {
if (mFluids[index] == null || mFluids[index].amount <= 0) break;
int tFilledAmount = tTileEntity.getKey().fill(tTileEntity.getValue(), drain(tAmount, false), false);
if (tFilledAmount > 0)
tTileEntity.getKey().fill(tTileEntity.getValue(), drainFromIndex(tFilledAmount, true, index), true);
}
} else {
for (Entry<IFluidHandler, ForgeDirection> tTileEntity : tTanks.entrySet()) {
if (mFluids[index] == null || mFluids[index].amount <= 0) break;
int tFilledAmount = tTileEntity.getKey().fill(tTileEntity.getValue(), drainFromIndex(mFluids[index].amount, false, index), false);
if (tFilledAmount > 0)
tTileEntity.getKey().fill(tTileEntity.getValue(), drainFromIndex(tFilledAmount, true, index), true);
}
}
}
}
}
mLastReceivedFrom = 0;
}
oLastReceivedFrom = mLastReceivedFrom;
}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"));
if ((mConnections & tMask) == 0)
connect(tSide);
} else {
mDisableInput |= tMask;
GT_Utility.sendChatToPlayer(aPlayer, trans("213", "Input disabled"));
}
} else {
if ((mConnections & tMask) == 0) {
if (connect(tSide) > 0)
GT_Utility.sendChatToPlayer(aPlayer, trans("214", "Connected"));
}
else {
disconnect(tSide);
GT_Utility.sendChatToPlayer(aPlayer, trans("215", "Disconnected"));
}
}
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;
}
}
}
}
} else if (getBaseMetaTileEntity().getOffsetX(aSide, 1) >> 4 != getBaseMetaTileEntity().getXCoord() >> 4
|| getBaseMetaTileEntity().getOffsetZ(aSide, 1) >> 4 != getBaseMetaTileEntity().getZCoord() >> 4) { // if chunk unloaded
rConnect = -1;
}
if (rConnect > 0) {
if (GT_Mod.gregtechproxy.gt6Pipe && tFluidPipe != null) {
if ((mDisableInput & (1 << aSide)) == 0 || (tFluidPipe.mDisableInput & (1 << tSide)) == 0) {
mConnections |= (1 << aSide);
if ((tFluidPipe.mConnections & (1 << tSide)) == 0) tFluidPipe.connect(tSide);
} else rConnect = 0;
} else {
mConnections |= (1 << aSide);
}
}
return rConnect;
}
@Override
public void doSound(byte aIndex, double aX, double aY, double aZ) {
super.doSound(aIndex, aX, aY, aZ);
if (aIndex == 9) {
GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 5, 1.0F, aX, aY, aZ);
for (byte i = 0; i < 6; i++)
for (int l = 0; l < 2; ++l)
getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5 + (new XSTR()).nextFloat(), aY - 0.5 + (new XSTR()).nextFloat(), aZ - 0.5 + (new XSTR()).nextFloat(), ForgeDirection.getOrientation(i).offsetX / 5.0, ForgeDirection.getOrientation(i).offsetY / 5.0, ForgeDirection.getOrientation(i).offsetZ / 5.0);
}
}
@Override
public final int getCapacity() {
return mCapacity * 20 * mPipeAmount;
}
@Override
public FluidTankInfo getInfo() {
for (FluidStack tFluid : mFluids) {
if (tFluid != null)
return new FluidTankInfo(tFluid, mCapacity * 20);
}
return new FluidTankInfo(null, mCapacity * 20);
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection aSide) {
if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[]{};
ArrayList<FluidTankInfo> tList = new ArrayList<>();
for (FluidStack tFluid : mFluids)
tList.add(new FluidTankInfo(tFluid, mCapacity * 20));
return tList.toArray(new FluidTankInfo[mPipeAmount]);
}
@Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false;
}
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false;
}
@Override
public final FluidStack getFluid() {
for (FluidStack tFluid : mFluids) {
if (tFluid != null)
return tFluid;
}
return null;
}
@Override
public final int getFluidAmount() {
int rAmount = 0;
for (FluidStack tFluid : mFluids) {
if (tFluid != null)
rAmount += tFluid.amount;
}
return rAmount;
}
@Override
public final int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
if (aFluid == null || aFluid.getFluid().getID() <= 0) return 0;
int index = -1;
for (int i = 0; i < mPipeAmount; i++) {
if (mFluids[i] != null && mFluids[i].isFluidEqual(aFluid)) {
index = i; break;
}
else if ((mFluids[i] == null || mFluids[i].getFluid().getID() <= 0) && index < 0) {
index = i;
}
}
return fill_default_intoIndex(aSide, aFluid, doFill, index);
}
private final int fill_default_intoIndex(ForgeDirection aSide, FluidStack aFluid, boolean doFill, int index) {
if (index < 0 || index >= mPipeAmount) return 0;
if (aFluid == null || aFluid.getFluid().getID() <= 0) return 0;
if (mFluids[index] == null || mFluids[index].getFluid().getID() <= 0) {
if (aFluid.amount * mPipeAmount <= getCapacity()) {
if (doFill) {
mFluids[index] = aFluid.copy();
mLastReceivedFrom |= (1 << aSide.ordinal());
}
return aFluid.amount;
}
if (doFill) {
mFluids[index] = aFluid.copy();
mLastReceivedFrom |= (1 << aSide.ordinal());
mFluids[index].amount = getCapacity() / mPipeAmount;
}
return getCapacity() / mPipeAmount;
}
if (!mFluids[index].isFluidEqual(aFluid)) return 0;
int space = getCapacity() / mPipeAmount - mFluids[index].amount;
if (aFluid.amount <= space) {
if (doFill) {
mFluids[index].amount += aFluid.amount;
mLastReceivedFrom |= (1 << aSide.ordinal());
}
return aFluid.amount;
}
if (doFill) {
mFluids[index].amount = getCapacity() / mPipeAmount;
mLastReceivedFrom |= (1 << aSide.ordinal());
}
return space;
}
@Override
public final FluidStack drain(int maxDrain, boolean doDrain) {
FluidStack drained = null;
for (int i = 0; i < mPipeAmount; i++) {
if ((drained = drainFromIndex(maxDrain, doDrain, i)) != null)
return drained;
}
return null;
}
private final FluidStack drainFromIndex(int maxDrain, boolean doDrain, int index) {
if (index < 0 || index >= mPipeAmount) return null;
if (mFluids[index] == null) return null;
if (mFluids[index].amount <= 0) {
mFluids[index] = null;
return null;
}
int used = maxDrain;
if (mFluids[index].amount < used)
used = mFluids[index].amount;
if (doDrain) {
mFluids[index].amount -= used;
}
FluidStack drained = mFluids[index].copy();
drained.amount = used;
if (mFluids[index].amount <= 0) {
mFluids[index] = null;
}
return drained;
}
@Override
public int getTankPressure() {
return getFluidAmount() - (getCapacity() / 2);
}
@Override
public String[] getDescription() {
if (mPipeAmount == 1) {
return new String[]{
EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + (mCapacity * 20) + "%%% L/sec" + EnumChatFormatting.GRAY,
EnumChatFormatting.RED + "Heat Limit: %%%" + mHeatResistance + "%%% K" + EnumChatFormatting.GRAY
};
} else {
return new String[]{
EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + (mCapacity * 20) + "%%% L/sec" + EnumChatFormatting.GRAY,
EnumChatFormatting.RED + "Heat Limit: %%%" + mHeatResistance + "%%% K" + EnumChatFormatting.GRAY,
EnumChatFormatting.AQUA + "Pipe Amount: %%%" + mPipeAmount + EnumChatFormatting.GRAY
};
}
}
@Override
public float getThickNess() {
if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) return 0.0625F;
return mThickNess;
}
@Override
public boolean isLiquidInput(byte aSide) {
return (mDisableInput & (1 << aSide)) == 0;
}
@Override
public boolean isLiquidOutput(byte aSide) {
return true;
}
@Override @Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0)
return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1);
else
return getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
}
private AxisAlignedBB getActualCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
float tSpace = (1f - mThickNess)/2; float tSpace = (1f - mThickNess)/2;
float tSide0 = tSpace; float tSide0 = tSpace;
float tSide1 = 1f - tSpace; float tSide1 = 1f - tSpace;
@ -170,246 +632,11 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
} }
@Override @Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) {
if (aBaseMetaTileEntity.isServerSide() && aTick % 5 == 0) { super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
mLastReceivedFrom &= 63; if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) {
if (mLastReceivedFrom == 63) { AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
mLastReceivedFrom = 0; if (inputAABB.intersectsWith(aabb)) outputAABB.add(aabb);
} }
if (mFluid != null && mFluid.amount > 0) {
int tTemperature = mFluid.getFluid().getTemperature(mFluid);
if (tTemperature > mHeatResistance) {
if (aBaseMetaTileEntity.getRandomNumber(100) == 0) {
aBaseMetaTileEntity.setToFire();
return;
}
aBaseMetaTileEntity.setOnFire();
}
if (!mGasProof && mFluid.getFluid().isGaseous(mFluid)) {
mFluid.amount -= 5;
sendSound((byte) 9);
if (tTemperature > 320) {
try {
for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(getBaseMetaTileEntity().getXCoord() - 2, getBaseMetaTileEntity().getYCoord() - 2, getBaseMetaTileEntity().getZCoord() - 2, getBaseMetaTileEntity().getXCoord() + 3, getBaseMetaTileEntity().getYCoord() + 3, getBaseMetaTileEntity().getZCoord() + 3))) {
GT_Utility.applyHeatDamage(tLiving, (tTemperature - 300) / 25.0F);
}
} catch (Throwable e) {
if (D1) e.printStackTrace(GT_Log.err);
}
} else if (tTemperature < 260) {
try {
for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(getBaseMetaTileEntity().getXCoord() - 2, getBaseMetaTileEntity().getYCoord() - 2, getBaseMetaTileEntity().getZCoord() - 2, getBaseMetaTileEntity().getXCoord() + 3, getBaseMetaTileEntity().getYCoord() + 3, getBaseMetaTileEntity().getZCoord() + 3))) {
GT_Utility.applyFrostDamage(tLiving, (270 - tTemperature) / 12.5F);
}
} catch (Throwable e) {
if (D1) e.printStackTrace(GT_Log.err);
}
}
if (mFluid.amount <= 0) mFluid = null;
}
}
if (mLastReceivedFrom == oLastReceivedFrom) {
ConcurrentHashMap<IFluidHandler, ForgeDirection> tTanks = new ConcurrentHashMap<IFluidHandler, ForgeDirection>();
mConnections = 0;
for (byte tSide = 0, i = 0, j = (byte) aBaseMetaTileEntity.getRandomNumber(6); i < 6; i++) {
tSide = (byte) ((j + i) % 6);
IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(tSide);
if (tTileEntity != null) {
if (tTileEntity instanceof IGregTechTileEntity) {
if (aBaseMetaTileEntity.getColorization() >= 0) {
byte tColor = ((IGregTechTileEntity) tTileEntity).getColorization();
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 (mFluid != null && mFluid.amount > 0) {
int tAmount = Math.max(1, Math.min(mCapacity * 10, mFluid.amount / 2)), tSuccessfulTankAmount = 0;
for (Entry<IFluidHandler, ForgeDirection> tEntry : tTanks.entrySet())
if (tEntry.getKey().fill(tEntry.getValue(), drain(tAmount, false), false) > 0)
tSuccessfulTankAmount++;
if (tSuccessfulTankAmount > 0) {
if (tAmount >= tSuccessfulTankAmount) {
tAmount /= tSuccessfulTankAmount;
for (Entry<IFluidHandler, ForgeDirection> tTileEntity : tTanks.entrySet()) {
if (mFluid == null || mFluid.amount <= 0) break;
int tFilledAmount = tTileEntity.getKey().fill(tTileEntity.getValue(), drain(tAmount, false), false);
if (tFilledAmount > 0)
tTileEntity.getKey().fill(tTileEntity.getValue(), drain(tFilledAmount, true), true);
}
} else {
for (Entry<IFluidHandler, ForgeDirection> tTileEntity : tTanks.entrySet()) {
if (mFluid == null || mFluid.amount <= 0) break;
int tFilledAmount = tTileEntity.getKey().fill(tTileEntity.getValue(), drain(mFluid.amount, false), false);
if (tFilledAmount > 0)
tTileEntity.getKey().fill(tTileEntity.getValue(), drain(tFilledAmount, true), true);
}
}
}
}
mLastReceivedFrom = 0;
}
oLastReceivedFrom = mLastReceivedFrom;
}else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate();
}
@Override
public void doSound(byte aIndex, double aX, double aY, double aZ) {
super.doSound(aIndex, aX, aY, aZ);
if (aIndex == 9) {
GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 5, 1.0F, aX, aY, aZ);
for (byte i = 0; i < 6; i++)
for (int l = 0; l < 2; ++l)
getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5 + (new XSTR()).nextFloat(), aY - 0.5 + (new XSTR()).nextFloat(), aZ - 0.5 + (new XSTR()).nextFloat(), ForgeDirection.getOrientation(i).offsetX / 5.0, ForgeDirection.getOrientation(i).offsetY / 5.0, ForgeDirection.getOrientation(i).offsetZ / 5.0);
}
}
@Override
public final int getCapacity() {
return mCapacity * 20;
}
@Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false;
}
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false;
}
@Override
public final FluidStack getFluid() {
return mFluid;
}
@Override
public final int getFluidAmount() {
return mFluid != null ? mFluid.amount : 0;
}
@Override
public final int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
if (aFluid == null || aFluid.getFluid().getID() <= 0) return 0;
if (mFluid == null || mFluid.getFluid().getID() <= 0) {
if (aFluid.amount <= getCapacity()) {
if (doFill) {
mFluid = aFluid.copy();
mLastReceivedFrom |= (1 << aSide.ordinal());
}
return aFluid.amount;
}
if (doFill) {
mFluid = aFluid.copy();
mLastReceivedFrom |= (1 << aSide.ordinal());
mFluid.amount = getCapacity();
}
return getCapacity();
}
if (!mFluid.isFluidEqual(aFluid)) return 0;
int space = getCapacity() - mFluid.amount;
if (aFluid.amount <= space) {
if (doFill) {
mFluid.amount += aFluid.amount;
mLastReceivedFrom |= (1 << aSide.ordinal());
}
return aFluid.amount;
}
if (doFill) {
mFluid.amount = getCapacity();
mLastReceivedFrom |= (1 << aSide.ordinal());
}
return space;
}
@Override
public final FluidStack drain(int maxDrain, boolean doDrain) {
if (mFluid == null) return null;
if (mFluid.amount <= 0) {
mFluid = null;
return null;
}
int used = maxDrain;
if (mFluid.amount < used)
used = mFluid.amount;
if (doDrain) {
mFluid.amount -= used;
}
FluidStack drained = mFluid.copy();
drained.amount = used;
if (mFluid.amount <= 0) {
mFluid = null;
}
return drained;
}
@Override
public int getTankPressure() {
return (mFluid == null ? 0 : mFluid.amount) - (getCapacity() / 2);
}
@Override
public String[] getDescription() {
return new String[]{
EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + (mCapacity * 20) + "%%% L/sec" + EnumChatFormatting.GRAY,
EnumChatFormatting.RED + "Heat Limit: %%%" + mHeatResistance + "%%% K" + EnumChatFormatting.GRAY
};
}
@Override
public float getThickNess() {
if(GT_Mod.instance.isClientSide() && GT_Client.hideValue==1) return 0.0625F;
return mThickNess;
} }
} }

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,8 @@ 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.Entity;
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;
@ -24,6 +26,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
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 {
@ -34,6 +37,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);
@ -45,21 +49,21 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
} }
public GT_MetaPipeEntity_Item(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, int aInvSlotCount, int aStepSize, boolean aIsRestrictive) { public GT_MetaPipeEntity_Item(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, int aInvSlotCount, int aStepSize, boolean aIsRestrictive) {
super(aID, aName, aNameRegional, aInvSlotCount); this(aID, aName, aNameRegional, aThickNess, aMaterial, aInvSlotCount, aStepSize, aIsRestrictive, 20);
mIsRestrictive = aIsRestrictive;
mThickNess = aThickNess;
mMaterial = aMaterial;
mStepSize = aStepSize;
mTickTime = 20;
} }
@Deprecated
public GT_MetaPipeEntity_Item(String aName, float aThickNess, Materials aMaterial, int aInvSlotCount, int aStepSize, boolean aIsRestrictive) { public GT_MetaPipeEntity_Item(String aName, float aThickNess, Materials aMaterial, int aInvSlotCount, int aStepSize, boolean aIsRestrictive) {
super(aName, aInvSlotCount); this(aName, aThickNess, aMaterial, aInvSlotCount, aStepSize, aIsRestrictive, 20);
}
public GT_MetaPipeEntity_Item(String aName, float aThickNess, Materials aMaterial, int aInvSlotCount, int aStepSize, boolean aIsRestrictive, int aTickTime) {
super(aName, aInvSlotCount);
mIsRestrictive = aIsRestrictive; mIsRestrictive = aIsRestrictive;
mThickNess = aThickNess; mThickNess = aThickNess;
mMaterial = aMaterial; mMaterial = aMaterial;
mStepSize = aStepSize; mStepSize = aStepSize;
mTickTime = 20; mTickTime = aTickTime;
} }
@Override @Override
@ -69,7 +73,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
@Override @Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaPipeEntity_Item(mName, mThickNess, mMaterial, mInventory.length, mStepSize, mIsRestrictive); return new GT_MetaPipeEntity_Item(mName, mThickNess, mMaterial, mInventory.length, mStepSize, mIsRestrictive, mTickTime);
} }
@Override @Override
@ -141,70 +145,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;
@ -219,7 +182,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
tPipeList.add(tTileEntity); tPipeList.add(tTileEntity);
while (!temp && !isInventoryEmpty() && tTileEntity.sendItemStack(aBaseMetaTileEntity)) while (!temp && !isInventoryEmpty() && tTileEntity.sendItemStack(aBaseMetaTileEntity))
for (IMetaTileEntityItemPipe tPipe : tPipeList) for (IMetaTileEntityItemPipe tPipe : tPipeList)
if (!tPipe.incrementTransferCounter(1)) temp = false; if (!tPipe.incrementTransferCounter(1)) temp = true;
} }
} }
} }
@ -229,6 +192,77 @@ 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) {
if (connect(tSide) > 0)
GT_Utility.sendChatToPlayer(aPlayer, trans("214", "Connected"));
}
else {
disconnect(tSide);
GT_Utility.sendChatToPlayer(aPlayer, trans("215", "Disconnected"));
}
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;
}
}
}
} else if (getBaseMetaTileEntity().getOffsetX(aSide, 1) >> 4 != getBaseMetaTileEntity().getXCoord() >> 4
|| getBaseMetaTileEntity().getOffsetZ(aSide, 1) >> 4 != getBaseMetaTileEntity().getZCoord() >> 4) { // if chunk unloaded
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;
@ -305,7 +339,12 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
@Override @Override
public String[] getDescription() { public String[] getDescription() {
return new String[]{"Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/sec", "Routing Value: %%%" + mStepSize}; if (mTickTime == 20)
return new String[]{"Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/sec", "Routing Value: %%%" + mStepSize};
else if (mTickTime % 20 == 0)
return new String[]{"Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/%%%" + (mTickTime / 20) + "%%% sec", "Routing Value: %%%" + mStepSize};
else
return new String[]{"Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/%%%" + mTickTime + "%%% ticks", "Routing Value: %%%" + mStepSize};
} }
private boolean isInventoryEmpty() { private boolean isInventoryEmpty() {
@ -315,12 +354,19 @@ 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;
} }
@Override @Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0)
return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1);
else
return getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
}
private AxisAlignedBB getActualCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
float tSpace = (1f - mThickNess)/2; float tSpace = (1f - mThickNess)/2;
float tSide0 = tSpace; float tSide0 = tSpace;
float tSide1 = 1f - tSpace; float tSide1 = 1f - tSpace;
@ -345,6 +391,14 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
if((tConn & (1 << ForgeDirection.EAST.ordinal()) ) != 0) tSide5 = 1f; if((tConn & (1 << ForgeDirection.EAST.ordinal()) ) != 0) tSide5 = 1f;
return AxisAlignedBB.getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); return AxisAlignedBB.getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3);
}
@Override
public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) {
super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) {
AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
if (inputAABB.intersectsWith(aabb)) outputAABB.add(aabb);
}
} }
} }

View file

@ -317,7 +317,10 @@ public class GT_LanguageManager {
// addStringLocalization("Interaction_DESCRIPTION_Index_209", "Grab"); // addStringLocalization("Interaction_DESCRIPTION_Index_209", "Grab");
// addStringLocalization("Interaction_DESCRIPTION_Index_210", "Grab"); // addStringLocalization("Interaction_DESCRIPTION_Index_210", "Grab");
addStringLocalization("Interaction_DESCRIPTION_Index_211", "Items per side: "); addStringLocalization("Interaction_DESCRIPTION_Index_211", "Items per side: ");
addStringLocalization("Interaction_DESCRIPTION_Index_212", "Input enabled");
addStringLocalization("Interaction_DESCRIPTION_Index_213", "Input disabled");
addStringLocalization("Interaction_DESCRIPTION_Index_214", "Connected");
addStringLocalization("Interaction_DESCRIPTION_Index_215", "Disconnected");
addStringLocalization("Item_DESCRIPTION_Index_000", "Stored Heat: %s"); addStringLocalization("Item_DESCRIPTION_Index_000", "Stored Heat: %s");
addStringLocalization("Item_DESCRIPTION_Index_001", "Durability: %s/%s"); addStringLocalization("Item_DESCRIPTION_Index_001", "Durability: %s/%s");
addStringLocalization("Item_DESCRIPTION_Index_002", "%s lvl %s"); addStringLocalization("Item_DESCRIPTION_Index_002", "%s lvl %s");

View file

@ -1718,21 +1718,12 @@ public class GT_ModHandler {
EntityPlayer tPlayer = (EntityPlayer) aPlayer; EntityPlayer tPlayer = (EntityPlayer) aPlayer;
if (tPlayer.capabilities.isCreativeMode) return true; if (tPlayer.capabilities.isCreativeMode) return true;
if (isElectricItem(aStack) && ic2.api.item.ElectricItem.manager.getCharge(aStack) > 1000.0d) { if (isElectricItem(aStack) && ic2.api.item.ElectricItem.manager.getCharge(aStack) > 1000.0d) {
for (int i = 0; i < tPlayer.inventory.mainInventory.length; i++) { if (consumeSolderingMaterial(tPlayer)) {
if (GT_Utility.isStackInList(tPlayer.inventory.mainInventory[i], GregTech_API.sSolderingMetalList)) { if (canUseElectricItem(aStack, 10000)) {
if (tPlayer.inventory.mainInventory[i].stackSize < 1) return false; return GT_ModHandler.useElectricItem(aStack, 10000, (EntityPlayer) aPlayer);
if (tPlayer.inventory.mainInventory[i].stackSize == 1) {
tPlayer.inventory.mainInventory[i] = null;
} else {
tPlayer.inventory.mainInventory[i].stackSize--;
}
if (tPlayer.inventoryContainer != null) tPlayer.inventoryContainer.detectAndSendChanges();
if (canUseElectricItem(aStack, 10000)) {
return GT_ModHandler.useElectricItem(aStack, 10000, (EntityPlayer) aPlayer);
}
GT_ModHandler.useElectricItem(aStack, (int) ic2.api.item.ElectricItem.manager.getCharge(aStack), (EntityPlayer) aPlayer);
return false;
} }
GT_ModHandler.useElectricItem(aStack, (int) ic2.api.item.ElectricItem.manager.getCharge(aStack), (EntityPlayer) aPlayer);
return false;
} }
} }
} else { } else {
@ -1743,6 +1734,26 @@ public class GT_ModHandler {
return false; return false;
} }
/**
* Simply consumes some soldering material
*/
public static boolean consumeSolderingMaterial(EntityPlayer aPlayer) {
if (aPlayer.capabilities.isCreativeMode) return true;
for (int i = 0; i < aPlayer.inventory.mainInventory.length; i++) {
if (GT_Utility.isStackInList(aPlayer.inventory.mainInventory[i], GregTech_API.sSolderingMetalList)) {
if (aPlayer.inventory.mainInventory[i].stackSize < 1) return false;
if (aPlayer.inventory.mainInventory[i].stackSize == 1) {
aPlayer.inventory.mainInventory[i] = null;
} else {
aPlayer.inventory.mainInventory[i].stackSize--;
}
if (aPlayer.inventoryContainer != null) aPlayer.inventoryContainer.detectAndSendChanges();
return true;
}
}
return false;
}
/** /**
* Is this an electric Item, which can charge other Items? * Is this an electric Item, which can charge other Items?
*/ */

View file

@ -16,6 +16,7 @@ import gregtech.api.enums.Materials;
import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.ITurnable; import gregtech.api.interfaces.tileentity.ITurnable;
import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_PlayedSound; import gregtech.api.util.GT_PlayedSound;
import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe;
@ -136,14 +137,81 @@ public class GT_Client extends GT_Proxy
GL11.glLineWidth(2.0F); GL11.glLineWidth(2.0F);
GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.5F); GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.5F);
GL11.glBegin(1); GL11.glBegin(1);
GL11.glVertex3d(0.5D, 0.0D, -0.25D); GL11.glVertex3d(+.50D, .0D, -.25D);
GL11.glVertex3d(-0.5D, 0.0D, -0.25D); GL11.glVertex3d(-.50D, .0D, -.25D);
GL11.glVertex3d(0.5D, 0.0D, 0.25D); GL11.glVertex3d(+.50D, .0D, +.25D);
GL11.glVertex3d(-0.5D, 0.0D, 0.25D); GL11.glVertex3d(-.50D, .0D, +.25D);
GL11.glVertex3d(0.25D, 0.0D, -0.5D); GL11.glVertex3d(+.25D, .0D, -.50D);
GL11.glVertex3d(0.25D, 0.0D, 0.5D); GL11.glVertex3d(+.25D, .0D, +.50D);
GL11.glVertex3d(-0.25D, 0.0D, -0.5D); GL11.glVertex3d(-.25D, .0D, -.50D);
GL11.glVertex3d(-0.25D, 0.0D, 0.5D); GL11.glVertex3d(-.25D, .0D, +.50D);
GL11.glLineWidth(2.0F);
TileEntity tTile = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
if (tTile instanceof BaseMetaPipeEntity) {
int[][] GridSwitchArr = new int[][]{
{0, 5, 3, 1, 2, 4},
{5, 0, 1, 3, 2, 4},
{1, 3, 0, 5, 2, 4},
{3, 1, 5, 0, 2, 4},
{4, 2, 3, 1, 0, 5},
{2, 4, 3, 1, 5, 0},
};
int tConnections = ((BaseMetaPipeEntity) tTile).mConnections;
for (byte i = 0; i < 6; i++) {
if ((tConnections & (1 << i)) != 0) {
switch (GridSwitchArr[aEvent.target.sideHit][i]) {
case 0:
GL11.glVertex3d(+.25D, .0D, +.25D);
GL11.glVertex3d(-.25D, .0D, -.25D);
GL11.glVertex3d(-.25D, .0D, +.25D);
GL11.glVertex3d(+.25D, .0D, -.25D);
break;
case 1:
GL11.glVertex3d(-.25D, .0D, +.50D);
GL11.glVertex3d(+.25D, .0D, +.25D);
GL11.glVertex3d(-.25D, .0D, +.25D);
GL11.glVertex3d(+.25D, .0D, +.50D);
break;
case 2:
GL11.glVertex3d(-.50D, .0D, -.25D);
GL11.glVertex3d(-.25D, .0D, +.25D);
GL11.glVertex3d(-.50D, .0D, +.25D);
GL11.glVertex3d(-.25D, .0D, -.25D);
break;
case 3:
GL11.glVertex3d(-.25D, .0D, -.50D);
GL11.glVertex3d(+.25D, .0D, -.25D);
GL11.glVertex3d(-.25D, .0D, -.25D);
GL11.glVertex3d(+.25D, .0D, -.50D);
break;
case 4:
GL11.glVertex3d(+.50D, .0D, -.25D);
GL11.glVertex3d(+.25D, .0D, +.25D);
GL11.glVertex3d(+.50D, .0D, +.25D);
GL11.glVertex3d(+.25D, .0D, -.25D);
break;
case 5:
GL11.glVertex3d(+.50D, .0D, +.50D);
GL11.glVertex3d(+.25D, .0D, +.25D);
GL11.glVertex3d(+.50D, .0D, +.25D);
GL11.glVertex3d(+.25D, .0D, +.50D);
GL11.glVertex3d(+.50D, .0D, -.50D);
GL11.glVertex3d(+.25D, .0D, -.25D);
GL11.glVertex3d(+.50D, .0D, -.25D);
GL11.glVertex3d(+.25D, .0D, -.50D);
GL11.glVertex3d(-.50D, .0D, +.50D);
GL11.glVertex3d(-.25D, .0D, +.25D);
GL11.glVertex3d(-.50D, .0D, +.25D);
GL11.glVertex3d(-.25D, .0D, +.50D);
GL11.glVertex3d(-.50D, .0D, -.50D);
GL11.glVertex3d(-.25D, .0D, -.25D);
GL11.glVertex3d(-.50D, .0D, -.25D);
GL11.glVertex3d(-.25D, .0D, -.50D);
break;
}
}
}
}
GL11.glEnd(); GL11.glEnd();
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
@ -354,7 +422,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)) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sSolderingToolList)))) {
drawGrid(aEvent); drawGrid(aEvent);
return; return;
} }
@ -563,9 +631,9 @@ public class GT_Client extends GT_Proxy
try { try {
EntityPlayer player = Minecraft.getMinecraft().thePlayer; EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player == null) return 0; if (player == null) return 0;
ItemStack held = player.getCurrentEquippedItem(); ItemStack tCurrentItem = player.getCurrentEquippedItem();
if (held == null) return 0; if (tCurrentItem == null) return 0;
int[] ids = OreDictionary.getOreIDs(held); int[] ids = OreDictionary.getOreIDs(tCurrentItem);
int hide = 0; int hide = 0;
for (int i : ids) { for (int i : ids) {
if (OreDictionary.getOreName(i).equals("craftingToolSolderingIron")) { if (OreDictionary.getOreName(i).equals("craftingToolSolderingIron")) {
@ -573,6 +641,16 @@ public class GT_Client extends GT_Proxy
break; break;
} }
} }
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)
|| GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)
|| GT_Utility.isStackInList(tCurrentItem, GregTech_API.sHardHammerList)
|| GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)
|| GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)
|| GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)
|| GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)
|| GregTech_API.sCovers.containsKey(new GT_ItemStack(tCurrentItem))) {
hide |= 0x2;
}
return hide; return hide;
}catch(Exception e){ }catch(Exception e){
return 0; return 0;

View file

@ -202,6 +202,9 @@ 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 boolean gt6Cable = false;
public boolean costlyCableConnection = false;
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.enums.Materials; import gregtech.api.enums.Materials;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable;
@ -157,6 +158,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);

View file

@ -1,5 +1,6 @@
package gregtech.loaders.oreprocessing; package gregtech.loaders.oreprocessing;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials; import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.SubTag; import gregtech.api.enums.SubTag;
@ -19,6 +20,8 @@ public class ProcessingPipe implements gregtech.api.interfaces.IOreRecipeRegistr
OrePrefixes.pipeRestrictiveMedium.add(this); OrePrefixes.pipeRestrictiveMedium.add(this);
OrePrefixes.pipeRestrictiveSmall.add(this); OrePrefixes.pipeRestrictiveSmall.add(this);
OrePrefixes.pipeRestrictiveTiny.add(this); OrePrefixes.pipeRestrictiveTiny.add(this);
OrePrefixes.pipeQuadruple.add(this);
OrePrefixes.pipeNonuple.add(this);
} }
@Override @Override
@ -44,6 +47,15 @@ public class ProcessingPipe implements gregtech.api.interfaces.IOreRecipeRegistr
case pipeRestrictiveTiny: case pipeRestrictiveTiny:
gregtech.api.enums.GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(aOreDictName.replaceFirst("Restrictive", ""), null, 1L, false, true), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Steel, aPrefix.mSecondaryMaterial.mAmount / OrePrefixes.ring.mMaterialAmount), GT_Utility.copyAmount(1L, new Object[]{aStack}), (int) (aPrefix.mSecondaryMaterial.mAmount * 400L / OrePrefixes.ring.mMaterialAmount), 4); gregtech.api.enums.GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(aOreDictName.replaceFirst("Restrictive", ""), null, 1L, false, true), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Steel, aPrefix.mSecondaryMaterial.mAmount / OrePrefixes.ring.mMaterialAmount), GT_Utility.copyAmount(1L, new Object[]{aStack}), (int) (aPrefix.mSecondaryMaterial.mAmount * 400L / OrePrefixes.ring.mMaterialAmount), 4);
break; break;
case pipeQuadruple:
GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(1, new Object[]{aStack}), GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PP ", "PP ", " ", 'P', GT_OreDictUnificator.get(aOreDictName.replaceFirst("Quadruple", "Medium"), null, 1L, false, true)});
gregtech.api.enums.GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(aOreDictName.replaceFirst("Quadruple", "Medium"), null, 4L, false, true), ItemList.Circuit_Integrated.getWithDamage(0, 4), GT_Utility.copyAmount(1L, new Object[]{aStack}), 40 ,8);
break;
case pipeNonuple:
GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(1, new Object[]{aStack}), GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "PPP", "PPP", 'P', GT_OreDictUnificator.get(aOreDictName.replaceFirst("Nonuple", "Small"), null, 1L, false, true)});
gregtech.api.enums.GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(aOreDictName.replaceFirst("Nonuple", "Small"), null, 9L, false, true), ItemList.Circuit_Integrated.getWithDamage(0, 9), GT_Utility.copyAmount(1L, new Object[]{aStack}), 60 ,8);
break;
} }
} }
} }

View file

@ -1431,6 +1431,14 @@ public class GT_Loader_MetaTileEntities implements Runnable {
GT_OreDictUnificator.registerOre(OrePrefixes.pipeHuge.get(Materials.Plastic), new GT_MetaPipeEntity_Fluid(5174, "GT_Pipe_Plastic_Huge", "Huge Plastic Fluid Pipe", 0.875F, Materials.Plastic, 1440, 350, true).getStackForm(1L));*/ GT_OreDictUnificator.registerOre(OrePrefixes.pipeHuge.get(Materials.Plastic), new GT_MetaPipeEntity_Fluid(5174, "GT_Pipe_Plastic_Huge", "Huge Plastic Fluid Pipe", 0.875F, Materials.Plastic, 1440, 350, true).getStackForm(1L));*/
generateFluidPipes(Materials.Plastic, Materials.Plastic.mName, "Plastic", 5170, 360, 350, true); generateFluidPipes(Materials.Plastic, Materials.Plastic.mName, "Plastic", 5170, 360, 350, true);
generateFluidPipes(Materials.Polytetrafluoroethylene, Materials.Polytetrafluoroethylene.mName, "PTFE", 5175, 480, 600, true); generateFluidPipes(Materials.Polytetrafluoroethylene, Materials.Polytetrafluoroethylene.mName, "PTFE", 5175, 480, 600, true);
generateFluidMultiPipes(Materials.Copper, Materials.Copper.mName, "Copper", 5200, 60, 1000, true);
generateFluidMultiPipes(Materials.Bronze, Materials.Bronze.mName, "Bronze", 5205, 120, 2000, true);
generateFluidMultiPipes(Materials.Steel, Materials.Steel.mName, "Steel", 5210, 240, 2500, true);
generateFluidMultiPipes(Materials.StainlessSteel, Materials.StainlessSteel.mName, "StainlessSteel", 5215, 360, 3000, true);
generateFluidMultiPipes(Materials.Titanium, Materials.Titanium.mName, "Titanium", 5220, 480, 5000, true);
generateFluidMultiPipes(Materials.TungstenSteel, Materials.TungstenSteel.mName, "Bronze", 5225, 600, 7500, true);
generateFluidMultiPipes(Materials.Plastic, Materials.Plastic.mName, "Plastic", 5230, 360, 350, true);
generateFluidMultiPipes(Materials.Polytetrafluoroethylene, Materials.Polytetrafluoroethylene.mName, "PTFE", 5235, 480, 600, true);
GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.pipeSmall, Materials.TungstenSteel, 1L), ItemList.Electric_Pump_EV.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.pipeSmall, Materials.Ultimate, 1L), 300, 96); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.pipeSmall, Materials.TungstenSteel, 1L), ItemList.Electric_Pump_EV.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.pipeSmall, Materials.Ultimate, 1L), 300, 96);
GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.TungstenSteel, 1L), ItemList.Electric_Pump_IV.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Ultimate, 1L), 400, 148); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.TungstenSteel, 1L), ItemList.Electric_Pump_IV.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Ultimate, 1L), 400, 148);
@ -1668,4 +1676,9 @@ public class GT_Loader_MetaTileEntities implements Runnable {
GT_OreDictUnificator.registerOre(OrePrefixes.pipeLarge.get(aMaterial), new GT_MetaPipeEntity_Fluid(startID + 3, "GT_Pipe_" + name + "_Large", "Large " + displayName + " Fluid Pipe", 0.75F, aMaterial, baseCapacity * 2, heatCapacity, gasProof).getStackForm(1L)); GT_OreDictUnificator.registerOre(OrePrefixes.pipeLarge.get(aMaterial), new GT_MetaPipeEntity_Fluid(startID + 3, "GT_Pipe_" + name + "_Large", "Large " + displayName + " Fluid Pipe", 0.75F, aMaterial, baseCapacity * 2, heatCapacity, gasProof).getStackForm(1L));
GT_OreDictUnificator.registerOre(OrePrefixes.pipeHuge.get(aMaterial), new GT_MetaPipeEntity_Fluid(startID + 4, "GT_Pipe_" + name + "_Huge", "Huge " + displayName + " Fluid Pipe", 0.875F, aMaterial, baseCapacity * 4, heatCapacity, gasProof).getStackForm(1L)); GT_OreDictUnificator.registerOre(OrePrefixes.pipeHuge.get(aMaterial), new GT_MetaPipeEntity_Fluid(startID + 4, "GT_Pipe_" + name + "_Huge", "Huge " + displayName + " Fluid Pipe", 0.875F, aMaterial, baseCapacity * 4, heatCapacity, gasProof).getStackForm(1L));
} }
private static void generateFluidMultiPipes(Materials aMaterial, String name, String displayName, int startID, int baseCapacity, int heatCapacity, boolean gasProof){
GT_OreDictUnificator.registerOre(OrePrefixes.pipeQuadruple.get(aMaterial), new GT_MetaPipeEntity_Fluid(startID, "GT_Pipe_" + name + "_Quadruple", "Quadruple " + displayName + " Fluid Pipe", 1.0F, aMaterial, baseCapacity, heatCapacity, gasProof, 4).getStackForm(1L));
GT_OreDictUnificator.registerOre(OrePrefixes.pipeNonuple.get(aMaterial), new GT_MetaPipeEntity_Fluid(startID + 1, "GT_Pipe_" + name + "_Nonuple", "Nonuple " + displayName + " Fluid Pipe", 1.0F, aMaterial, baseCapacity / 3, heatCapacity, gasProof, 9).getStackForm(1L));
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B