aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common
diff options
context:
space:
mode:
authorJohann Bernhardt <johann.bernhardt@tum.de>2021-12-01 14:34:14 +0100
committerJohann Bernhardt <johann.bernhardt@tum.de>2021-12-01 14:34:14 +0100
commit8e45b04722ee129ff412d8329b93d35eb8744c1f (patch)
tree5ed344f739e2349854b6acb5d451f00d8ca35319 /src/main/java/gregtech/common
parent899aa570f096e2850e35627950f9f67ccfe8b186 (diff)
parent5fc226f1385e13afbf3406f4d3283638fc7b8a70 (diff)
downloadGT5-Unofficial-8e45b04722ee129ff412d8329b93d35eb8744c1f.tar.gz
GT5-Unofficial-8e45b04722ee129ff412d8329b93d35eb8744c1f.tar.bz2
GT5-Unofficial-8e45b04722ee129ff412d8329b93d35eb8744c1f.zip
Merge remote-tracking branch 'origin/experimental' into unify-build-script
# Conflicts: # .github/workflows/gradle.yml # build.gradle # build.properties
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r--src/main/java/gregtech/common/GT_Pollution.java130
-rw-r--r--src/main/java/gregtech/common/GT_Proxy.java32
-rw-r--r--src/main/java/gregtech/common/GT_RecipeAdder.java26
-rw-r--r--src/main/java/gregtech/common/GT_UndergroundOil.java32
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Machines.java91
-rw-r--r--src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java3
-rw-r--r--src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java35
-rw-r--r--src/main/java/gregtech/common/render/GT_PollutionRenderer.java10
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java6
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java7
-rw-r--r--src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java7
-rw-r--r--src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java10
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java3
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java11
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java9
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java9
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java7
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java8
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java19
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Bronze.java7
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Steel.java6
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java6
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java6
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java7
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java8
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java7
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java5
44 files changed, 406 insertions, 180 deletions
diff --git a/src/main/java/gregtech/common/GT_Pollution.java b/src/main/java/gregtech/common/GT_Pollution.java
index 865fa83f7e..afaac41650 100644
--- a/src/main/java/gregtech/common/GT_Pollution.java
+++ b/src/main/java/gregtech/common/GT_Pollution.java
@@ -9,6 +9,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.net.GT_Packet_Pollution;
import gregtech.api.util.GT_ChunkAssociatedData;
import gregtech.api.util.GT_Utility;
+import gregtech.common.render.GT_PollutionRenderer;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
@@ -27,12 +28,16 @@ import net.minecraftforge.event.world.ChunkDataEvent;
import net.minecraftforge.event.world.ChunkWatchEvent;
import net.minecraftforge.event.world.WorldEvent;
+import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+import java.util.function.Consumer;
import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
import static gregtech.common.GT_Proxy.dimensionWisePollution;
@@ -73,11 +78,12 @@ public class GT_Pollution {
* Muffler Hatch Pollution reduction: ** inaccurate **
* LV (0%), MV (30%), HV (52%), EV (66%), IV (76%), LuV (84%), ZPM (89%), UV (92%), MAX (95%)
*/
- private List<ChunkCoordIntPair> pollutionList = new ArrayList<>();//chunks left to process
- private final List<ChunkCoordIntPair> chunkData = new ArrayList<>();//link to chunk data that is saved/loaded
+ private List<ChunkCoordIntPair> pollutionList = new ArrayList<>();//chunks left to process in this cycle
+ private final Set<ChunkCoordIntPair> pollutedChunks = new HashSet<>();// a global list of all chunks with positive pollution
private int operationsPerTick = 0;//how much chunks should be processed in each cycle
private static final short cycleLen = 1200;
private final World world;
+ private boolean blank = true;
public static int mPlayerPollution;
private static int POLLUTIONPACKET_MINVALUE = 1000;
@@ -96,6 +102,7 @@ public class GT_Pollution {
public static void onWorldTick(TickEvent.WorldTickEvent aEvent) {//called from proxy
//return if pollution disabled
if (!GT_Mod.gregtechproxy.mPollution) return;
+ if (aEvent.phase == TickEvent.Phase.START) return;
final GT_Pollution pollutionInstance = dimensionWisePollution.get(aEvent.world.provider.dimensionId);
if (pollutionInstance == null) return;
pollutionInstance.tickPollutionInWorld((int) (aEvent.world.getTotalWorldTime() % cycleLen));
@@ -103,16 +110,18 @@ public class GT_Pollution {
private void tickPollutionInWorld(int aTickID) {//called from method above
//gen data set
- if (aTickID == 0) {
+ if (aTickID == 0 || blank) {
// make a snapshot of what to work on
- // counterintuitive as it seems, but this is the fastest way java collections framework offers us.
- pollutionList = new ArrayList<>(chunkData);
+ pollutionList = new ArrayList<>(pollutedChunks);
//set operations per tick
- if (pollutionList.size() > 0) operationsPerTick = (pollutionList.size() / cycleLen);
- else operationsPerTick = 0;//SANity
+ if (pollutionList.size() > 0)
+ operationsPerTick = Math.max(1, pollutionList.size() / cycleLen);
+ else
+ operationsPerTick = 0; //SANity
+ blank = false;
}
- for (int chunksProcessed = 0; chunksProcessed <= operationsPerTick; chunksProcessed++) {
+ for (int chunksProcessed = 0; chunksProcessed < operationsPerTick; chunksProcessed++) {
if (pollutionList.size() == 0) break;//no more stuff to do
ChunkCoordIntPair actualPos = pollutionList.remove(pollutionList.size() - 1);//faster
//get pollution
@@ -120,10 +129,8 @@ public class GT_Pollution {
int tPollution = currentData.getAmount();
//remove some
tPollution = (int) (0.9945f * tPollution);
- //tPollution -= 2000;//This does not really matter...
- if (tPollution <= 0) tPollution = 0;//SANity check
- else if (tPollution > 400000) {//Spread Pollution
+ if (tPollution > 400000) {//Spread Pollution
ChunkCoordIntPair[] tNeighbors = new ChunkCoordIntPair[4];//array is faster
tNeighbors[0] = (new ChunkCoordIntPair(actualPos.chunkXPos + 1, actualPos.chunkZPos));
@@ -138,7 +145,7 @@ public class GT_Pollution {
tDiff = tDiff / 20;
neighborPollution = GT_Utility.safeInt((long) neighborPollution + tDiff);//tNPol += tDiff;
tPollution -= tDiff;
- neighbor.setAmount(neighborPollution);
+ setChunkPollution(neighborPosition, neighborPollution);
}
}
@@ -200,7 +207,7 @@ public class GT_Pollution {
}
}
//Write new pollution to Hashmap !!!
- currentData.setAmount(tPollution);
+ setChunkPollution(actualPos, tPollution);
//Send new value to players nearby
if (tPollution > POLLUTIONPACKET_MINVALUE) {
@@ -210,6 +217,10 @@ public class GT_Pollution {
}
}
+ private void setChunkPollution(ChunkCoordIntPair coord, int pollution) {
+ mutatePollution(world, coord.chunkXPos, coord.chunkZPos, c -> c.setAmount(pollution), pollutedChunks);
+ }
+
private static void damageBlock(World world, int x, int y, int z, boolean sourRain) {
if (world.isRemote) return;
Block tBlock = world.getBlock(x, y, z);
@@ -265,23 +276,81 @@ public class GT_Pollution {
}
}
+ private static GT_Pollution getPollutionManager(World world) {
+ return dimensionWisePollution.computeIfAbsent(world.provider.dimensionId, i -> new GT_Pollution(world));
+ }
+
+ /** @see #addPollution(World, int, int, int) */
public static void addPollution(IGregTechTileEntity te, int aPollution) {
- addPollution(te.getWorld().getChunkFromBlockCoords(te.getXCoord(), te.getZCoord()), aPollution);
+ if (!GT_Mod.gregtechproxy.mPollution || aPollution == 0 || te.isClientSide()) return;
+ mutatePollution(te.getWorld(), te.getXCoord() >> 4, te.getZCoord() >> 4, d -> d.changeAmount(aPollution), null);
}
+ /** @see #addPollution(World, int, int, int) */
public static void addPollution(Chunk ch, int aPollution) {
- if (!GT_Mod.gregtechproxy.mPollution || aPollution == 0) return;
- STORAGE.get(ch).changeAmount(aPollution);
+ if (!GT_Mod.gregtechproxy.mPollution || aPollution == 0 || ch.worldObj.isRemote) return;
+ mutatePollution(ch.worldObj, ch.xPosition, ch.zPosition, d -> d.changeAmount(aPollution), null);
+ }
+
+ /**
+ * Add some pollution to given chunk. Can pass in negative to remove pollution.
+ * Will clamp the final pollution number to 0 if it would be changed into negative.
+ *
+ * @param w world to modify. do nothing if it's a client world
+ * @param chunkX chunk coordinate X, i.e. blockX >> 4
+ * @param chunkZ chunk coordinate Z, i.e. blockZ >> 4
+ * @param aPollution desired delta. Positive means the pollution in chunk would go higher.
+ */
+ public static void addPollution(World w, int chunkX, int chunkZ, int aPollution) {
+ if (!GT_Mod.gregtechproxy.mPollution || aPollution == 0 || w.isRemote) return;
+ mutatePollution(w, chunkX, chunkZ, d -> d.changeAmount(aPollution), null);
+ }
+
+ private static void mutatePollution(World world, int x, int z, Consumer<ChunkData> mutator, @Nullable Set<ChunkCoordIntPair> chunks) {
+ ChunkData data = STORAGE.get(world, x, z);
+ boolean hadPollution = data.getAmount() > 0;
+ mutator.accept(data);
+ boolean hasPollution = data.getAmount() > 0;
+ if (hasPollution != hadPollution) {
+ if (chunks == null)
+ chunks = getPollutionManager(world).pollutedChunks;
+ if (hasPollution)
+ chunks.add(new ChunkCoordIntPair(x, z));
+ else
+ chunks.remove(new ChunkCoordIntPair(x, z));
+ }
}
+ /** @see #getPollution(World, int, int) */
public static int getPollution(IGregTechTileEntity te) {
- return getPollution(te.getWorld().getChunkFromBlockCoords(te.getXCoord(), te.getZCoord()));
+ return getPollution(te.getWorld(), te.getXCoord() >> 4, te.getZCoord() >> 4);
}
+ /** @see #getPollution(World, int, int) */
public static int getPollution(Chunk ch) {
+ return getPollution(ch.worldObj, ch.xPosition, ch.zPosition);
+ }
+
+ /**
+ * Get the pollution in specified chunk
+ * @param w world to look in. can be a client world, but that limits the knowledge to what server side send us
+ * @param chunkX chunk coordinate X, i.e. blockX >> 4
+ * @param chunkZ chunk coordinate Z, i.e. blockZ >> 4
+ * @return pollution amount. may be 0 if pollution is disabled, or if it's a client world and server did not send
+ * us info about this chunk
+ */
+ public static int getPollution(World w, int chunkX, int chunkZ) {
if (!GT_Mod.gregtechproxy.mPollution)
return 0;
- return STORAGE.get(ch).getAmount();
+ if (w.isRemote)
+ // it really should be querying the client side stuff instead
+ return GT_PollutionRenderer.getKnownPollution(chunkX << 4, chunkZ << 4);
+ return STORAGE.get(w, chunkX, chunkZ).getAmount();
+ }
+
+ @Deprecated
+ public static int getPollution(ChunkCoordIntPair aCh, int aDim) {
+ return getPollution(DimensionManager.getWorld(aDim), aCh.chunkXPos, aCh.chunkZPos);
}
public static boolean hasPollution(Chunk ch) {
@@ -290,12 +359,6 @@ public class GT_Pollution {
return STORAGE.isCreated(ch.worldObj, ch.getChunkCoordIntPair()) && STORAGE.get(ch).getAmount() > 0;
}
- public static int getPollution(ChunkCoordIntPair aCh, int aDim) {
- if (!GT_Mod.gregtechproxy.mPollution)
- return 0;
- return STORAGE.get(DimensionManager.getWorld(aDim), aCh.chunkXPos, aCh.chunkZPos).getAmount();
- }
-
//Add compatibility with old code
@Deprecated /*Don't use it... too weird way of passing position*/
public static void addPollution(World aWorld, ChunkPosition aPos, int aPollution) {
@@ -323,7 +386,8 @@ public class GT_Pollution {
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load e) {
// super class loads everything lazily. We force it to load them all.
- STORAGE.loadAll(e.world);
+ if (!e.world.isRemote)
+ STORAGE.loadAll(e.world);
}
}
@@ -340,15 +404,14 @@ public class GT_Pollution {
@Override
protected ChunkData readElement(DataInput input, int version, World world, int chunkX, int chunkZ) throws IOException {
+ if (version != 0)
+ throw new IOException("Region file corrupted");
ChunkData data = new ChunkData(input.readInt());
- getChunkData(world).add(new ChunkCoordIntPair(chunkX, chunkZ));
+ if (data.getAmount() > 0)
+ getPollutionManager(world).pollutedChunks.add(new ChunkCoordIntPair(chunkX, chunkZ));
return data;
}
- private List<ChunkCoordIntPair> getChunkData(World world) {
- return dimensionWisePollution.computeIfAbsent(world.provider.dimensionId, i -> new GT_Pollution(world)).chunkData;
- }
-
@Override
protected ChunkData createElement(World world, int chunkX, int chunkZ) {
return new ChunkData();
@@ -359,11 +422,6 @@ public class GT_Pollution {
super.loadAll(w);
}
- public void set(World world, ChunkCoordIntPair coord, ChunkData data) {
- set(world, coord.chunkXPos, coord.chunkZPos, data);
- getChunkData(world).add(coord);
- }
-
public boolean isCreated(World world, ChunkCoordIntPair coord) {
return isCreated(world.provider.dimensionId, coord.chunkXPos, coord.chunkZPos);
}
@@ -377,7 +435,7 @@ public class GT_Pollution {
}
private ChunkData(int amount) {
- this.amount = amount;
+ this.amount = Math.max(0, amount);
}
/**
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java
index 40716a2fa6..569e06643a 100644
--- a/src/main/java/gregtech/common/GT_Proxy.java
+++ b/src/main/java/gregtech/common/GT_Proxy.java
@@ -188,6 +188,28 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public int mPollutionPoisonLimit = 750000;
public int mPollutionVegetationLimit = 1000000;
public int mPollutionSourRainLimit = 2000000;
+ public int mPollutionOnExplosion = 100000;
+ public int mPollutionPrimitveBlastFurnacePerSecond = 200;
+ public int mPollutionEBFPerSecond = 400;
+ public int mPollutionCharcoalPitPerSecond = 100;
+ public int mPollutionLargeCombustionEnginePerSecond = 480;
+ public int mPollutionExtremeCombustionEnginePerSecond = 3840;
+ public int mPollutionImplosionCompressorPerSecond = 10000;
+ public int mPollutionLargeBronzeBoilerPerSecond = 1000;
+ public int mPollutionLargeSteelBoilerPerSecond = 2000;
+ public int mPollutionLargeTitaniumBoilerPerSecond = 3000;
+ public int mPollutionLargeTungstenSteelBoilerPerSecond = 4000;
+ public double mPollutionReleasedByThrottle = 1.0/24.0; // divided by 24 because 24 circuit conf
+ public int mPollutionLargeGasTurbinePerSecond = 300;
+ public int mPollutionMultiSmelterPerSecond = 400;
+ public int mPollutionPyrolyseOvenPerSecond = 300;
+ public int mPollutionSmallCoalBoilerPerSecond = 20;
+ public int mPollutionHighPressureLavaBoilerPerSecond = 20;
+ public int mPollutionHighPressureCoalBoilerPerSecond = 30;
+ public int mPollutionBaseDieselGeneratorPerSecond = 200;
+ public double[] mPollutionDieselGeneratorReleasedByTier = new double[]{0.1, 1.0, 0.9, 0.8};
+ public int mPollutionBaseGasTurbinePerSecond = 200;
+ public double[] mPollutionGasTurbineReleasedByTier = new double[]{0.1, 1.0, 0.9, 0.8};
public final GT_UO_DimensionList mUndergroundOil = new GT_UO_DimensionList();
public int mTicksUntilNextCraftSound = 0;
public double mMagneticraftBonusOutputPercent = 100.0d;
@@ -236,6 +258,16 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
*/
public boolean mRenderIndicatorsOnHatch = true;
+ /**
+ * This enables the rendering of dirt particles if pollution is enabled too
+ */
+ public boolean mRenderDirtParticles = true;
+
+ /**
+ * This enables the rendering of the pollution fog if pollution is enabled too
+ */
+ public boolean mRenderPollutionFog = true;
+
public static final int GUI_ID_COVER_SIDE_BASE = 10; // Takes GUI ID 10 - 15
public static Map<String, Integer> oreDictBurnTimes = new HashMap<>();
diff --git a/src/main/java/gregtech/common/GT_RecipeAdder.java b/src/main/java/gregtech/common/GT_RecipeAdder.java
index 1571ef7b46..4ba4601490 100644
--- a/src/main/java/gregtech/common/GT_RecipeAdder.java
+++ b/src/main/java/gregtech/common/GT_RecipeAdder.java
@@ -595,6 +595,20 @@ public class GT_RecipeAdder implements IGT_RecipeAdder {
}
@Override
+ public boolean addOreWasherRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, FluidStack aFluidInput, int[] aChances, int aDuration, int aEUt) {
+ if ((aInput == null) || (aFluidInput == null) || ((aOutput1 == null) || (aOutput2 == null) || (aOutput3 == null))) {
+ return false;
+ }
+ if ((aDuration = GregTech_API.sRecipeFile.get("orewasher", aInput, aDuration)) <= 0) {
+ return false;
+ }
+ GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.addRecipe(true, new ItemStack[]{aInput}, new ItemStack[]{aOutput1, aOutput2, aOutput3}, null, aChances, new FluidStack[]{aFluidInput}, null, aDuration, aEUt, 0);
+ return true;
+ }
+
+
+
+ @Override
public boolean addImplosionRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2) {
if ((aInput1 == null) || (aOutput1 == null)) {
return false;
@@ -775,6 +789,18 @@ public class GT_RecipeAdder implements IGT_RecipeAdder {
}
@Override
+ public boolean addThermalCentrifugeRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int[] aChances, int aDuration, int aEUt) {
+ if ((aInput == null) || (aOutput1 == null)) {
+ return false;
+ }
+ if (!GregTech_API.sRecipeFile.get("thermalcentrifuge", aInput, true)) {
+ return false;
+ }
+ GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes.addRecipe(true, new ItemStack[]{aInput}, new ItemStack[]{aOutput1, aOutput2, aOutput3}, null, aChances, null, null, aDuration, aEUt, 0);
+ return true;
+ }
+
+ @Override
public boolean addAmplifier(ItemStack aAmplifierItem, int aDuration, int aAmplifierAmountOutputted) {
if ((aAmplifierItem == null) || (aAmplifierAmountOutputted <= 0)) {
return false;
diff --git a/src/main/java/gregtech/common/GT_UndergroundOil.java b/src/main/java/gregtech/common/GT_UndergroundOil.java
index 21b681de4a..b725b4bbb6 100644
--- a/src/main/java/gregtech/common/GT_UndergroundOil.java
+++ b/src/main/java/gregtech/common/GT_UndergroundOil.java
@@ -31,22 +31,46 @@ public class GT_UndergroundOil {
private static final GT_UndergroundOilStore STORAGE = new GT_UndergroundOilStore();
private static final ChunkData NIL_FLUID_STACK = new ChunkData(-1, null, null, false);
+ /**
+ * Effectively just call {@code undergroundOil(te, -1)} for you
+ * @see #undergroundOil(World, int, int, float)
+ */
public static FluidStack undergroundOilReadInformation(IGregTechTileEntity te){
return undergroundOil(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord()),-1);
}
+ /**
+ * Effectively just call {@code undergroundOil(chunk, -1)} for you
+ * @see #undergroundOil(World, int, int, float)
+ */
public static FluidStack undergroundOilReadInformation(Chunk chunk) {
return undergroundOil(chunk,-1);
}
+ /** @see #undergroundOil(World, int, int, float) */
public static FluidStack undergroundOil(IGregTechTileEntity te, float readOrDrainCoefficient){
return undergroundOil(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord()),readOrDrainCoefficient);
}
//Returns whole content for information purposes -> when drainSpeedCoefficient < 0
//Else returns extracted fluidStack if amount > 0, or null otherwise
+ /** @see #undergroundOil(World, int, int, float) */
public static FluidStack undergroundOil(Chunk chunk, float readOrDrainCoefficient) {
- ChunkData chunkData = STORAGE.get(chunk);
+ return undergroundOil(chunk.worldObj, chunk.xPosition, chunk.zPosition, readOrDrainCoefficient);
+ }
+
+ /**
+ * Pump fluid or read info.
+ * @param w a remote World. For a WorldClient it will always tell you null
+ * @param chunkX chunk coordinate X, i.e. blockX >> 4
+ * @param chunkZ chunk coordinate Z, i.e. blockZ >> 4
+ * @param readOrDrainCoefficient how fast to pump. The higher the faster. use negative to read expected current output
+ * @return null if nothing here, or depleted already, or a client side world
+ */
+ public static FluidStack undergroundOil(World w, int chunkX, int chunkZ, float readOrDrainCoefficient) {
+ if (w.isRemote)
+ return null; // troublemakers go away
+ ChunkData chunkData = STORAGE.get(w, chunkX, chunkZ);
if (chunkData.getVein() == null || chunkData.getFluid() == null) // nothing here...
return null;
//do stuff on it if needed
@@ -102,7 +126,7 @@ public class GT_UndergroundOil {
ChunkData chunkData = STORAGE.get(e.getChunk());
Fluid fluid = chunkData.getFluid();
if (fluid != null && fluid.getID() == e.getData().getInteger("GTOILFLUID"))
- chunkData.setAmount(Math.min(0, Math.min(chunkData.getAmount(), e.getData().getInteger("GTOIL"))));
+ chunkData.setAmount(Math.min(chunkData.getAmount(), e.getData().getInteger("GTOIL")));
}
}
@@ -250,7 +274,7 @@ public class GT_UndergroundOil {
public void changeAmount(int delta) {
if (delta != 0)
dirty = true;
- this.amount = Math.max(0, amount - delta);
+ this.amount = Math.max(amount + delta, 0);
}
@Nullable
@@ -272,7 +296,7 @@ public class GT_UndergroundOil {
@Override
public boolean isSameAsDefault() {
- return dirty;
+ return !dirty;
}
}
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
index 55743f445d..b59dd1d848 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
@@ -30,10 +30,12 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidContainerItem;
import java.util.List;
-public class GT_Item_Machines extends ItemBlock {
+public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem {
private static final String[] directionNames = {"Bottom", "Top", "North", "South", "West", "East"};
@@ -89,6 +91,15 @@ public class GT_Item_Machines extends ItemBlock {
}
aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(tTileEntity.getEUCapacity()) + EnumChatFormatting.GRAY);
}
+ if (GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumTank || GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperTank) {
+ if (aStack.hasTagCompou