Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipe/cable overhaul; Fluidfilter fix, GC Energy Compat & Misc fixes #1495

Merged
merged 7 commits into from
Apr 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ repositories {
name 'tterrag Repo'
url "http://maven.tterrag.com"
}
maven { // TConstruct
name 'DVS1 Maven FS'
url 'http://dvs1.progwml6.com/files/maven'
}

maven { // AppleCore
url "http://www.ryanliptak.com/maven/"
}
Expand Down Expand Up @@ -96,12 +101,16 @@ repositories {
}

dependencies {
// compile fileTree(dir: 'libs', include: '*.jar')

compile "tconstruct:TConstruct:${config.minecraft.version}-${config.tconstruct.version}:deobf"
provided ("appeng:appliedenergistics2:${config.ae2.version}:dev") {
exclude module: '*'
}
provided "codechicken:CodeChickenLib:${config.minecraft.version}-${config.codechickenlib.version}:dev"
provided "codechicken:CodeChickenCore:${config.minecraft.version}-${config.codechickencore.version}:dev"
provided "codechicken:NotEnoughItems:${config.minecraft.version}-${config.nei.version}:dev"
provided "codechicken:Translocator:${config.minecraft.version}-${config.translocators.version}:dev"
provided "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev"
provided "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}:dev"
provided "applecore:AppleCore:${config.applecore.version}:api"
Expand All @@ -116,6 +125,10 @@ dependencies {
provided name: 'IC2NuclearControl', version: config.nc.version, ext: 'jar'
provided name: 'ImmersiveEngineering', version: config.immeng.version, ext: 'jar'
provided name: 'magneticraft', version: config.magneticraft.version, ext: 'jar'
// compile files("libs/Galacticraft-API-1.7-${config.gc.version}.jar")
// compile files("libs/GalacticraftCore-Dev-${config.gc.version}.jar")
provided name: "Galacticraft-API", version: config.gc.version, ext: 'jar'
provided name: "GalacticraftCore-Dev", version: config.gc.version, ext: 'jar'
}

processResources
Expand Down
3 changes: 3 additions & 0 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ enderio.cf=2219/296
enderio.version=1.7.10-2.3.0.417_beta
enderiocore.version=1.7.10-0.1.0.25_beta
forestry.version=4.2.10.58
gc.version=1.7-3.0.12.504
ic2.version=2.2.790-experimental
nei.version=1.0.3.57
railcraft.cf=2219/321
Expand All @@ -25,3 +26,5 @@ immeng.cf=2299/20
immeng.version=0.7.7-deobf
magneticraft.cf=2276/268
magneticraft.version=0.6.1-final
tconstruct.version=1.8.4.build951
translocators.version=1.1.2.16
13 changes: 10 additions & 3 deletions src/main/java/gregtech/GT_Mod.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Mod(modid = "gregtech", name = "GregTech", version = "MC1710", useMetadata = false, dependencies = "required-after:IC2; after:Forestry; after:PFAAGeologica; after:Thaumcraft; after:Railcraft; after:appliedenergistics2; after:ThermalExpansion; after:TwilightForest; after:harvestcraft; after:magicalcrops; after:BuildCraft|Transport; after:BuildCraft|Silicon; after:BuildCraft|Factory; after:BuildCraft|Energy; after:BuildCraft|Core; after:BuildCraft|Builders; after:GalacticraftCore; after:GalacticraftMars; after:GalacticraftPlanets; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; after:RedPowerCore; after:RedPowerBase; after:RedPowerMachine; after:RedPowerCompat; after:RedPowerWiring; after:RedPowerLogic; after:RedPowerLighting; after:RedPowerWorld; after:RedPowerControl; after:UndergroundBiomes;")
@Mod(modid = "gregtech", name = "GregTech", version = "MC1710", useMetadata = false, dependencies = "required-after:IC2; after:Forestry; after:PFAAGeologica; after:Thaumcraft; after:Railcraft; after:appliedenergistics2; after:ThermalExpansion; after:TwilightForest; after:harvestcraft; after:magicalcrops; after:BuildCraft|Transport; after:BuildCraft|Silicon; after:BuildCraft|Factory; after:BuildCraft|Energy; after:BuildCraft|Core; after:BuildCraft|Builders; after:GalacticraftCore; after:GalacticraftMars; after:GalacticraftPlanets; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; after:RedPowerCore; after:RedPowerBase; after:RedPowerMachine; after:RedPowerCompat; after:RedPowerWiring; after:RedPowerLogic; after:RedPowerLighting; after:RedPowerWorld; after:RedPowerControl; after:UndergroundBiomes; after:TConstruct; after:Translocator;")
public class GT_Mod implements IGT_Mod {
public static final int VERSION = 509, SUBVERSION = 31;
public static final int TOTAL_VERSION = calculateTotalGTVersion(VERSION, SUBVERSION);
Expand Down Expand Up @@ -133,7 +133,10 @@ public void onPreLoad(FMLPreInitializationEvent aEvent) {
GregTech_API.mIC2Classic = Loader.isModLoaded("IC2-Classic-Spmod");
GregTech_API.mMagneticraft = Loader.isModLoaded("Magneticraft");
GregTech_API.mImmersiveEngineering = Loader.isModLoaded("ImmersiveEngineering");
GregTech_API.mGTPlusPlus = Loader.isModLoaded("miscutils");
GregTech_API.mGTPlusPlus = Loader.isModLoaded("miscutils");
GregTech_API.mTranslocator = Loader.isModLoaded("Translocator");
GregTech_API.mTConstruct = Loader.isModLoaded("TConstruct");
GregTech_API.mGalacticraft = Loader.isModLoaded("GalacticraftCore");
GT_Log.mLogFile = new File(aEvent.getModConfigurationDirectory().getParentFile(), "logs/GregTech.log");
if (!GT_Log.mLogFile.exists()) {
try {
Expand Down Expand Up @@ -180,6 +183,9 @@ public void onPreLoad(FMLPreInitializationEvent aEvent) {
} catch (Throwable e) {
}
gregtechproxy.onPreLoad();
GT_Log.out.println("GT_Mod: Are you there Translocator? " + GregTech_API.mTranslocator);
GT_Log.out.println("GT_Mod: Are you there TConstruct? " + GregTech_API.mTConstruct);
GT_Log.out.println("GT_Mod: Are you there GalacticraftCore? " + GregTech_API.mGalacticraft);

GT_Log.out.println("GT_Mod: Setting Configs");
GT_Values.D1 = tMainConfig.get(aTextGeneral, "Debug", false).getBoolean(false);
Expand Down Expand Up @@ -285,7 +291,8 @@ public void onPreLoad(FMLPreInitializationEvent aEvent) {
gregtechproxy.enableGCOres = GregTech_API.sWorldgenFile.get("general", "enableGCOres", gregtechproxy.enableGCOres);
gregtechproxy.enableUBOres = GregTech_API.sWorldgenFile.get("general", "enableUBOres", gregtechproxy.enableUBOres);
gregtechproxy.gt6Pipe = tMainConfig.get("general", "GT6StyledPipesConnection", true).getBoolean(true);
gregtechproxy.gt6Cable = tMainConfig.get("general", "GT6StyledWiresConnection", false).getBoolean(false);
gregtechproxy.gt6Cable = tMainConfig.get("general", "GT6StyledWiresConnection", true).getBoolean(true);
gregtechproxy.ic2EnergySourceCompat = tMainConfig.get("general", "Ic2EnergySourceCompat", true).getBoolean(true);
gregtechproxy.costlyCableConnection = tMainConfig.get("general", "CableConnectionRequiresSolderingMaterial", false).getBoolean(false);
GT_LanguageManager.i18nPlaceholder = tMainConfig.get("general", "UsePlaceholderForMaterialNamesInLangFile", true).getBoolean(true);

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/gregtech/api/GregTech_API.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ public class GregTech_API {
public static boolean mMagneticraft = false;
public static boolean mImmersiveEngineering = false;
public static boolean mGTPlusPlus = false;
public static boolean mTranslocator = false;
public static boolean mTConstruct = false;
public static boolean mGalacticraft = false;

public static boolean mUseOnlyGoodSolderingMaterials = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
import net.minecraft.tileentity.TileEntity;

import java.util.ArrayList;
import java.util.HashSet;

public interface IMetaTileEntityCable extends IMetaTileEntity {
@Deprecated
public long transferElectricity(byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList);

public long transferElectricity(byte aSide, long aVoltage, long aAmperage, HashSet<TileEntity> aAlreadyPassedSet);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,13 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd
* Sided Energy Input
*/
public boolean inputEnergyFrom(byte aSide);
public boolean inputEnergyFrom(byte aSide, boolean waitForActive);

/**
* Sided Energy Output
*/
public boolean outputsEnergyTo(byte aSide);

/**
* Are we ready for energy state?
*/
public boolean energyStateReady();
public boolean outputsEnergyTo(byte aSide, boolean waitForActive);

/**
* Utility for the Network
Expand All @@ -67,10 +64,6 @@ public static final long emitEnergyToNetwork(long aVoltage, long aAmperage, IEne
if (tColor >= 0 && tColor != aEmitter.getColorization()) continue;
}
rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits(j, aVoltage, aAmperage - rUsedAmperes);
// } else if (tTileEntity instanceof IEnergySink) {
// if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)aEmitter, ForgeDirection.getOrientation(j))) {
// while (aAmperage > rUsedAmperes && ((IEnergySink)tTileEntity).demandedEnergyUnits() > 0 && ((IEnergySink)tTileEntity).injectEnergyUnits(ForgeDirection.getOrientation(j), aVoltage) < aVoltage) rUsedAmperes++;
// }
} else if (tTileEntity instanceof IEnergySink) {
if (((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) aEmitter, ForgeDirection.getOrientation(j))) {
while (aAmperage > rUsedAmperes && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0 && ((IEnergySink) tTileEntity).injectEnergy(ForgeDirection.getOrientation(j), aVoltage, aVoltage) < aVoltage)
Expand Down
42 changes: 34 additions & 8 deletions src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
import gregtech.api.interfaces.tileentity.IPipeRenderedTileEntity;
import gregtech.api.net.GT_Packet_TileEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.*;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
Expand All @@ -25,6 +29,7 @@
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -44,6 +49,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
private byte[] mSidedRedstone = new byte[]{0, 0, 0, 0, 0, 0};
private int[] mCoverSides = new int[]{0, 0, 0, 0, 0, 0}, mCoverData = new int[]{0, 0, 0, 0, 0, 0}, mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING];
private boolean mInventoryChanged = false, mWorkUpdate = false, mWorks = true, mNeedsUpdate = true, mNeedsBlockUpdate = true, mSendClientData = false;
private boolean mCheckConnections = false;
private byte mColor = 0, oColor = 0, mStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, mLagWarningCount = 0;
private int oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0;
private short mID = 0;
Expand Down Expand Up @@ -635,11 +641,21 @@ public boolean inputEnergyFrom(byte aSide) {
return false;
}

@Override
public boolean inputEnergyFrom(byte aSide, boolean waitForActive) {
return false;
}

@Override
public boolean outputsEnergyTo(byte aSide) {
return false;
}

@Override
public boolean outputsEnergyTo(byte aSide, boolean waitForActive) {
return false;
}

@Override
public long getOutputAmperage() {
return 0;
Expand Down Expand Up @@ -1177,7 +1193,9 @@ private boolean canMoveFluidOnSide(ForgeDirection aSide, Fluid aFluid, boolean i
if (aSide == ForgeDirection.UNKNOWN)
return true;

if (!mMetaTileEntity.isConnectedAtSide((byte) aSide.ordinal()))
IFluidHandler tTileEntity = getITankContainerAtSide((byte) aSide.ordinal());
// Only require a connection if there's something to connect to - Allows fluid cells & buckets to interact with the pipe
if (tTileEntity != null && !mMetaTileEntity.isConnectedAtSide((byte) aSide.ordinal()))
return false;

if(isFill && mMetaTileEntity.isLiquidInput((byte) aSide.ordinal())
Expand Down Expand Up @@ -1275,8 +1293,9 @@ public byte getColorization() {
@Override
public byte setColorization(byte aColor) {
if (aColor > 15 || aColor < -1) aColor = -1;
mColor = (byte) (aColor + 1);
if (canAccessData()) mMetaTileEntity.onColorChangeServer(aColor);
return mColor = (byte) (aColor + 1);
return mColor;
}

@Override
Expand Down Expand Up @@ -1334,6 +1353,18 @@ public void markDirty() {
mInventoryChanged = true;
}

public void onNeighborBlockChange(int aX, int aY, int aZ) {
if (canAccessData()) {
final IMetaTileEntity meta = getMetaTileEntity();
if (meta instanceof MetaPipeEntity) {
// Trigger a checking of connections in case someone placed down a block that the pipe/wire shouldn't be connected to.
// However; don't do it immediately in case the world isn't finished loading
// (This caused issues with AE2 GTEU p2p connections.
((MetaPipeEntity) meta).setCheckConnections();
}
}
}

@Override
public int getLightOpacity() {
return mMetaTileEntity == null ? 0 : mMetaTileEntity.getLightOpacity();
Expand All @@ -1353,9 +1384,4 @@ public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int a
public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) {
mMetaTileEntity.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
}

@Override
public boolean energyStateReady() {
return true;
}
}
Loading