diff --git a/build.gradle b/build.gradle index 46db0f19..1c0b07a9 100644 --- a/build.gradle +++ b/build.gradle @@ -78,13 +78,17 @@ configurations { } repositories { + maven { + name = "chickenbones" + url = "http://chickenbones.net/maven/" + } maven { name = "gt" url = "https://gregtech.overminddl1.com/" } maven { name = "ic2" - url = "https://maven.ic2.player.to/" + url = "https://maven2.ic2.player.to/" } maven { name = "k4u" @@ -125,7 +129,9 @@ dependencies { compileOnly "com.shedar.IC2NuclearControl:IC2NuclearControl:2.4.3a:dev" compileOnly "pneumaticCraft:PneumaticCraft-1.7.10:1.12.7-152:userdev" - + + compileOnly "glenn:gasesFramework:1.7.10-1.2.4:dev" + compileOnly "glenn:gases:1.7.10-1.6.7:dev" } processResources diff --git a/src/main/java/gregtech/api/interfaces/internal/IGasesCompat.java b/src/main/java/gregtech/api/interfaces/internal/IGasesCompat.java new file mode 100644 index 00000000..59d67bae --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/internal/IGasesCompat.java @@ -0,0 +1,12 @@ +package gregtech.api.interfaces.internal; + +import net.minecraftforge.fluids.Fluid; + +public interface IGasesCompat { + + public boolean registerGregGas(Fluid gas); + + public boolean registerOtherGasesAsFluids(); + + public boolean registerFluidCannerRecipes(); +} diff --git a/src/main/java/gregtech/common/GT_GasesCompat.java b/src/main/java/gregtech/common/GT_GasesCompat.java index c01a32ef..27600812 100644 --- a/src/main/java/gregtech/common/GT_GasesCompat.java +++ b/src/main/java/gregtech/common/GT_GasesCompat.java @@ -1,20 +1,38 @@ package gregtech.common; +import gregtech.api.interfaces.internal.IGasesCompat; -import gregtech.api.interfaces.internal.GasesCompat; import net.minecraftforge.fluids.Fluid; -//import glenn.gasesframework.api.gastype.GasType; +import net.minecraftforge.fluids.FluidRegistry; -public class GT_GasesCompat implements GasesCompat { +import java.util.HashMap; + +import glenn.gasesframework.api.Combustibility; +import glenn.gasesframework.api.GFAPI; +import glenn.gasesframework.api.gastype.GasType; + +public class GT_GasesCompat implements IGasesCompat { + + private final HashMap _fluidMap = new HashMap(); @Override public boolean registerGregGas(Fluid gas) { - // TODO Auto-generated method stub - return false; + String name = gas.getName(); + int id = gas.getID() + 19; //Glenn's gases uses 18 IDs so we can safely start at 19 + int color = gas.getColor(); + int density = gas.getDensity(); + //TODO: introduction of per-gas properties not in fluid data + GasType gt = new GasType(false, id, name, color, 0, density, Combustibility.NONE); + GFAPI.registry.registerGasType(gt); + return true; } @Override public boolean registerOtherGasesAsFluids() { - // TODO Auto-generated method stub + for(int i = 0; i < 18; i++) { + GasType gt = GFAPI.registry.getGasTypeByID(i); + Fluid f = gregOrGenerateFluid(gt); + _fluidMap.put(gt, f); + } return false; } @@ -23,5 +41,32 @@ public class GT_GasesCompat implements GasesCompat { // TODO Auto-generated method stub return false; } - + + public Fluid getFluidFromGas(Object gas) + { + GasType gt = (GasType) gas; + return _fluidMap.get(gt); + } + + public Fluid gregOrGenerateFluid(GasType gas) + { + switch (gas.gasID) { + case 0: + return null; + case 1: + return null; + case 2: + return FluidRegistry.getFluid("Steam"); + case 3: + return FluidRegistry.getFluid("gas_natural_gas"); + case 7: + return FluidRegistry.getFluid("liquid_hydricsulfur"); + case 8: + return FluidRegistry.getFluid("NitrogenDioxide"); + case 13: + return FluidRegistry.getFluid("Chlorine"); + default: + return null; //TODO: Auto-generate gas with config options for customization + } + } } diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 55f92efb..072e304a 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -1578,6 +1578,12 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { rFuelValue = Math.max(rFuelValue, 150000); } else if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "gemPetrolCoke")) { rFuelValue = Math.max(rFuelValue, 2400); + } else if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustPetrolCoke")) { + rFuelValue = Math.max(rFuelValue, 2400); + } else if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustSmallPetrolCoke")) { + rFuelValue = Math.max(rFuelValue, 600); + } else if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustTinyPetrolCoke")) { + rFuelValue = Math.max(rFuelValue, 266); }if (GT_Utility.areStacksEqual(aFuel, ItemList.Block_SSFUEL.get(1, new Object[0]))) { rFuelValue = Math.max(rFuelValue, 100000); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java index 5a8810b5..f0f8bb45 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java @@ -11,6 +11,7 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; +import java.lang.Math; import static gregtech.api.enums.GT_Values.VN; import static gregtech.common.GT_UndergroundOil.undergroundOil; @@ -114,9 +115,9 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D if (mOilFieldChunks.isEmpty()) { Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord()); int range = getRangeInChunks(); - int xChunk = (tChunk.xPosition / range) * range - ((tChunk.xPosition < 0 && tChunk.xPosition % range != 0) ? range : 0); - int zChunk = (tChunk.zPosition / range) * range - ((tChunk.zPosition < 0 && tChunk.zPosition % range != 0) ? range : 0); - + int xChunk = Math.floorDiv(tChunk.xPosition,range) * range; //Java was written by idiots. For negative values, / returns rounded towards zero. Fucking morons. + int zChunk = Math.floorDiv(tChunk.zPosition,range) * range; //^ Actually, this is the behaviour of C intentionally (and Ritchie was no 'idiot') but I'm leaving this here to credit the guy who actually wrote the fix. + for (int i = 0; i < range; i++) { for (int j = 0; j < range; j++) { tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i, zChunk + j); @@ -127,19 +128,22 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D } } } - if (mOilFieldChunks.isEmpty()) return false; - return true; + return !mOilFieldChunks.isEmpty(); } private FluidStack pumpOil(float speed){ if (mOilId <= 0) return null; FluidStack tFluid, tOil; tOil = new FluidStack(FluidRegistry.getFluid(mOilId), 0); + ArrayList emptyChunks = new ArrayList(); for (Chunk tChunk : mOilFieldChunks) { tFluid = undergroundOil(tChunk, speed); - if (tFluid == null) mOilFieldChunks.remove(tChunk); + if (tFluid == null || tFluid.amount<1) emptyChunks.add(tChunk); if (tOil.isFluidEqual(tFluid)) tOil.amount += tFluid.amount; } + for( Chunk tChunk : emptyChunks) { + mOilFieldChunks.remove( tChunk ); + } return tOil.amount == 0 ? null : tOil; } } \ No newline at end of file diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java index 6f3d3e9a..2de10c3d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java @@ -103,6 +103,40 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock } } } + //TODO: Find out how to make this properly - until then, using an input hatch with the circuit is enough to get fluid-only recipes going. + /*if(tInputList.isEmpty() && !tFluidInputs.isEmpty()){ + byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage())); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[] {tFluidInputs.get(0)}, (ItemStack[]) null); + if (tRecipe != null) { + if (tRecipe.isRecipeInputEqual(true, new FluidStack[]{tFluidInputs.get(0)}, (ItemStack[]) null)) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + this.mEUt = tRecipe.mEUt; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = mMaxProgresstime * 2 / (1 + coilMetaID); + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + if (tRecipe.mOutputs.length > 0) this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + if (tRecipe.mFluidOutputs.length > 0) + this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; + updateSlots(); + return true; + } + } + }*/ return false; } diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index 03ca70d7..b0f5bd79 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -2806,7 +2806,7 @@ public class GT_MachineRecipeLoader implements Runnable { GT_Values.RA.addChemicalRecipeForBasicMachineOnly(Materials.Ethylene.getCells(5), Materials.Chlorine.getCells(1), GT_Values.NF, GT_Values.NF, Materials.VinylChloride.getCells(6), GT_Values.NI, 240, 30); //GT_Values.RA.addChemicalRecipe(Materials.LightFuel.getCells(1), GT_Values.NI, Materials.NitricAcid.getFluid(250), Materials.NitroFuel.getFluid(1000), Materials.Empty.getCells(1), 80, 8); - GT_Values.RA.addChemicalRecipe(Materials.Fuel.getCells(1), GT_Values.NI, Materials.NitricAcid.getFluid(250), Materials.NitroFuel.getFluid(1000), Materials.Empty.getCells(2), 80, 8); + GT_Values.RA.addChemicalRecipe(Materials.Fuel.getCells(1), GT_Values.NI, Materials.NitricAcid.getFluid(250), Materials.NitroFuel.getFluid(1000), Materials.Empty.getCells(1), 80, 8); GT_Values.RA.addChemicalRecipe(Materials.BioDiesel.getCells(4), GT_Values.NI, Materials.NitricAcid.getFluid(1000), Materials.NitroFuel.getFluid(3000), Materials.Empty.getCells(4), 320, 8); //GT_Values.RA.addChemicalRecipe(Materials.NitricAcid.getCells(1), GT_Values.NI, Materials.LightFuel.getFluid(4000), Materials.NitroFuel.getFluid(4000), Materials.Empty.getCells(1), 320, 8); GT_Values.RA.addChemicalRecipe(Materials.NitricAcid.getCells(1), GT_Values.NI, Materials.Fuel.getFluid(4000), Materials.NitroFuel.getFluid(4000), Materials.Empty.getCells(1), 320, 8); @@ -3472,7 +3472,7 @@ public class GT_MachineRecipeLoader implements Runnable { //Cracked Resid byproducts GT_Values.RA.addUniversalDistillationRecipe(Materials.CrackedResid.getFluid(100), - new FluidStack[]{Materials.HeavyFuel.getFluid(60), Materials.LightFuel.getFluid(30), Materials.Naphtha.getFluid(10), Materials.Butane.getGas(3), Materials.Gas.getGas(2)}, + new FluidStack[]{Materials.HeavyFuel.getFluid(80), Materials.LightFuel.getFluid(40), Materials.Naphtha.getFluid(20), Materials.Butane.getGas(10), Materials.Gas.getGas(20), Materials.Methane.getGas(30)}, Materials.Bitumen.getGems(1), 240, 120); }