aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod')
-rw-r--r--src/Java/gtPlusPlus/xmod/cofh/HANDLER_COFH.java15
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java16
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java43
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java5
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java48
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java32
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java210
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow2.java131
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java53
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java18
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java344
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java63
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java24
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java380
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java14
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java420
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java46
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java495
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java129
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java8
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java16
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialAlloySmelter.java22
28 files changed, 1409 insertions, 1141 deletions
diff --git a/src/Java/gtPlusPlus/xmod/cofh/HANDLER_COFH.java b/src/Java/gtPlusPlus/xmod/cofh/HANDLER_COFH.java
new file mode 100644
index 0000000000..7bce4ab173
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/cofh/HANDLER_COFH.java
@@ -0,0 +1,15 @@
+package gtPlusPlus.xmod.cofh;
+
+import gtPlusPlus.core.item.ModItems;
+import gtPlusPlus.core.item.general.RF2EU_Battery;
+import gtPlusPlus.core.lib.LoadedMods;
+
+public class HANDLER_COFH {
+
+ public static void initItems() {
+ if (LoadedMods.CoFHCore && (LoadedMods.IndustrialCraft2 || LoadedMods.IndustrialCraft2Classic)) {
+ ModItems.RfEuBattery = new RF2EU_Battery();
+ }
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
index 28692e25cb..cd4b0947e4 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
@@ -39,6 +39,13 @@ public enum GregtechItemList implements GregtechItemContainer {
Emitter_ULV,
Sensor_ULV,
+ // Mixed Components
+ TransmissionComponent_ULV, TransmissionComponent_LV,
+ TransmissionComponent_MV, TransmissionComponent_HV,
+ TransmissionComponent_EV, TransmissionComponent_IV,
+ TransmissionComponent_LuV, TransmissionComponent_ZPM,
+ TransmissionComponent_UV, TransmissionComponent_MAX,
+
//Recipe Circuit
Circuit_BioRecipeSelector,
@@ -148,6 +155,9 @@ public enum GregtechItemList implements GregtechItemContainer {
Industrial_Centrifuge,
Casing_Centrifuge1,
+ // Large Alloy Smelter
+ Industrial_AlloySmelter,
+
//Coke Oven
Industrial_CokeOven,
Casing_CokeOven,
@@ -517,6 +527,8 @@ public enum GregtechItemList implements GregtechItemContainer {
//512v Creative Buffer
Energy_Buffer_CREATIVE,
+ //Variable voltage RF convertor
+ Energy_Buffer_RF_Convertor,
//Energy Buffers
Energy_Buffer_1by1_ULV, Energy_Buffer_1by1_LV,
Energy_Buffer_1by1_MV, Energy_Buffer_1by1_HV,
@@ -625,7 +637,9 @@ public enum GregtechItemList implements GregtechItemContainer {
FakeMachineCasingPlate_MV, FakeMachineCasingPlate_HV,
FakeMachineCasingPlate_EV, FakeMachineCasingPlate_IV,
FakeMachineCasingPlate_LuV, FakeMachineCasingPlate_ZPM,
- FakeMachineCasingPlate_UV, FakeMachineCasingPlate_MAX,
+ FakeMachineCasingPlate_UV, FakeMachineCasingPlate_MAX,
+
+
//----------------------------------------------------------------------------
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
index 83f052a983..cb889e0233 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
@@ -271,7 +271,7 @@ public interface IGregtech_RecipeAdder {
public boolean addUvLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu);
public boolean addIrLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu);
- public boolean addFluidReactorRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier);
+ public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier);
public boolean addBlastRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aHeat);
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java
index ef92f9919d..a5430846a9 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java
@@ -192,22 +192,9 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem {
@Override
public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) {
- if (stack.getDisplayName().contains("ULV")){
- HEX_OxFFFFFF = Utils.rgbtoHexValue(200, 180, 180);
- }
- else if (stack.getDisplayName().contains("LuV")){
- HEX_OxFFFFFF = 0xffffcc;
- }
- else if (stack.getDisplayName().contains("ZPM")){
- HEX_OxFFFFFF = 0xffe600;
- }
- else if (stack.getDisplayName().contains("UV")){
- HEX_OxFFFFFF = 0xffb300;
- }
- else if (stack.getDisplayName().contains("MAX")){
- HEX_OxFFFFFF = Utils.rgbtoHexValue(MathUtils.randInt(220, 250), MathUtils.randInt(221, 251), MathUtils.randInt(220, 250));
- }
- else if (stack.getDisplayName().contains("Sodium")){
+
+ int aMeta = stack.getItemDamage();
+ if (stack.getDisplayName().contains("Sodium")){
HEX_OxFFFFFF = Utils.rgbtoHexValue(90, 90, 255);
}
else if (stack.getDisplayName().contains("Cadmium")){
@@ -228,8 +215,28 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem {
else if (stack.getDisplayName().contains("Invar")){
HEX_OxFFFFFF = Utils.rgbtoHexValue(180, 180, 120);
}
- else {
- HEX_OxFFFFFF = 0xffffff;
+ else {
+ if (aMeta > 50 && aMeta != 150) {
+ HEX_OxFFFFFF = 0xffffff;
+ }
+ else if (stack.getDisplayName().contains("ULV")){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(200, 180, 180);
+ }
+ else if (stack.getDisplayName().contains("LuV")){
+ HEX_OxFFFFFF = 0xffffcc;
+ }
+ else if (stack.getDisplayName().contains("ZPM")){
+ HEX_OxFFFFFF = 0xffe600;
+ }
+ else if (stack.getDisplayName().contains("UV")){
+ HEX_OxFFFFFF = 0xffb300;
+ }
+ else if (stack.getDisplayName().contains("MAX")){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(MathUtils.randInt(220, 250), MathUtils.randInt(221, 251), MathUtils.randInt(220, 250));
+ }
+ else {
+ HEX_OxFFFFFF = 0xffffff;
+ }
}
return HEX_OxFFFFFF;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index e1849985d0..ef5429af62 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -415,7 +415,8 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
aToolTip = ArrayUtils.addAll(aToolTip, x);
aToolTip = ArrayUtils.addAll(aToolTip, z);
- if (aCachedToolTip == null || aCachedToolTip.length <= 0) {
+ //Valid Cached Tooltip during Run-Time
+ if (aCachedToolTip == null || aCachedToolTip.length <= 0 || aCachedToolTip.length != aToolTip.length || this.mTotalRunTime % 100 == 0) {
aCachedToolTip = aToolTip;
}
return aCachedToolTip;
@@ -2581,7 +2582,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
else if (aFoundBlock != aExpectedBlock) {
if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) {
log("A1 - Found: "+aFoundBlock.getLocalizedName()+":"+aFoundMeta+", Expected: "+aExpectedBlock.getLocalizedName()+":"+aExpectedMeta);
- log("Loc: "+(new BlockPos(aBaseMetaTileEntity).getLocationString()));
+ //log("Loc: "+(new BlockPos(aBaseMetaTileEntity).getLocationString()));
}
return false;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
index 430ae44d64..ef013fa3a2 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
@@ -1,16 +1,11 @@
package gtPlusPlus.xmod.gregtech.common;
-import static gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_Overflow.mOverflowCache;
-
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.Timer;
-import java.util.TimerTask;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@@ -29,7 +24,6 @@ import gregtech.api.util.Recipe_GT;
import gregtech.common.GT_Proxy;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
-import gtPlusPlus.api.objects.data.ObjMap;
import gtPlusPlus.api.objects.minecraft.FormattedTooltipString;
import gtPlusPlus.core.handler.AchievementHandler;
import gtPlusPlus.core.lib.CORE;
@@ -117,7 +111,6 @@ public class Meta_GT_Proxy {
}
public static void init() {
- scheduleCoverMapCleaner();
setValidHeatingCoilMetas();
PollutionUtils.setPollutionFluids();
fixIC2FluidNames();
@@ -435,47 +428,6 @@ public class Meta_GT_Proxy {
}
}
-
- public static void scheduleCoverMapCleaner(){
- TimerTask repeatedTask = new TimerTask() {
- public void run() {
- cleanupOverFlowCoverCache();
- }
- };
- Timer timer = new Timer("CoverCleanupManager");
- long delay = 120000L;
- long period = 300000L;
- timer.scheduleAtFixedRate(repeatedTask, delay, period);
- }
-
- public static int cleanupOverFlowCoverCache() {
- ObjMap<String, ?> cache = mOverflowCache;
- int aRemoved = 0;
- long aCurrentTime = System.currentTimeMillis()/1000;
- for (Object o : cache.values()) {
- if (o != null && o instanceof HashMap) {
- @SuppressWarnings("unchecked")
- HashMap<String, Object> m = (HashMap<String, Object>) o;
- if (m != null) {
- String s = (String) m.get("aCoverKey");
- if (m.containsKey("aLastUpdatedTime")) {
- long mapTime = (long) m.get("mLastUpdatedTime");
- if ((aCurrentTime-(mapTime/1000) > 30)){
- mOverflowCache.remove(s);
- aRemoved++;
- }
- }
- else {
- mOverflowCache.remove(s);
- aRemoved++;
- }
- }
- }
- }
- return aRemoved;
- }
-
-
static GT_Proxy[] mProxies = new GT_Proxy[2];
/**
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java
index 814ed589f0..74e269e932 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java
@@ -238,44 +238,51 @@ public class StaticFields59 {
return null;
}
- public static int getHeatingCapacityForCoil(Block aBlock, int aMeta) {
+
+
+ public static int getTierForCoil(Block aBlock, int aMeta) {
if (aBlock == GregTech_API.sBlockCasings1 && (aMeta >= 12 && aMeta <= 14)) {
- return getHeatingCapacityForCoilTier(aMeta == 12 ? 1 : aMeta == 13 ? 2 : 3);
+ return aMeta == 12 ? 1 : aMeta == 13 ? 2 : 3;
}
else if (aBlock == getBlockCasings5() && (aMeta >= 0 && aMeta <= 8)) {
- return getHeatingCapacityForCoilTier(aMeta);
+ return aMeta;
}
return 0;
}
+ public static int getHeatingCapacityForCoil(Block aBlock, int aMeta) {
+ int aTier = getTierForCoil(aBlock, aMeta);
+ return aTier > 0 ? getHeatingCapacityForCoilTier(aTier) : 0;
+ }
+
public static int getHeatingCapacityForCoilTier(int aCoilTier) {
int mHeatingCapacity = 0;
switch (aCoilTier) {
- case 0:
+ case 1:
mHeatingCapacity = 1800;
break;
- case 1:
+ case 2:
mHeatingCapacity = 2700;
break;
- case 2:
+ case 3:
mHeatingCapacity = 3600;
break;
- case 3:
+ case 4:
mHeatingCapacity = 4500;
break;
- case 4:
+ case 5:
mHeatingCapacity = 5400;
break;
- case 5:
+ case 6:
mHeatingCapacity = 7200;
break;
- case 6:
+ case 7:
mHeatingCapacity = 9000;
break;
- case 7:
+ case 8:
mHeatingCapacity = 9900;
break;
- case 8:
+ case 9:
mHeatingCapacity = 10800;
break;
default:
@@ -285,7 +292,6 @@ public class StaticFields59 {
if (CORE.GTNH && aCoilTier <= 6) {
mHeatingCapacity += 1;
}
-
return mHeatingCapacity;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java
index b220dd74e8..1c1f9c20f9 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java
@@ -1,13 +1,9 @@
package gtPlusPlus.xmod.gregtech.common.covers;
-import java.util.HashMap;
-
import gregtech.api.interfaces.tileentity.ICoverable;
-import gregtech.api.interfaces.tileentity.IMachineProgress;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.data.ObjMap;
+import gtPlusPlus.core.util.minecraft.LangUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
@@ -15,123 +11,90 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
public class GTPP_Cover_Overflow extends GT_CoverBehavior {
+
+ public final int mTransferRate;
+ public final int mInitialTransferRate;
public final int mMaxTransferRate;
-
- public static final ObjMap<String, HashMap<String, Object>> mOverflowCache = new ObjMap<String, HashMap<String, Object>>(10000, 0.5f);
public GTPP_Cover_Overflow(int aTransferRate) {
- this.mMaxTransferRate = aTransferRate*1000;
+ this.mTransferRate = aTransferRate * 1000 / 10;
+ this.mInitialTransferRate = aTransferRate;
+ this.mMaxTransferRate = aTransferRate * 1000;
}
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
long aTimer) {
-
- HashMap<String, Object> aCoverData = getCover(aSide, aCoverID, aCoverVariable, aTileEntity);
- //Do things
-
- if (aCoverData != null) {
- if (aCoverData.containsKey("aCoverVariable"))
- return (int) aCoverData.get("aCoverVariable");
- }
-
-
- if (aCoverVariable % 6 > 1 && aTileEntity instanceof IMachineProgress
- && ((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4) {
+ if (aCoverVariable == 0) {
return aCoverVariable;
- } else {
- if (aTileEntity instanceof IFluidHandler) {
- IFluidHandler tTank2 = aTileEntity.getITankContainerAtSide(aSide);
- if (tTank2 != null) {
- IFluidHandler tTank1 = (IFluidHandler) aTileEntity;
- FluidStack tLiquid;
- if (aCoverVariable % 2 == 0) {
- tLiquid = tTank1.drain(ForgeDirection.getOrientation(aSide), this.mMaxTransferRate, false);
- if (tLiquid != null) {
- tLiquid = tLiquid.copy();
- tLiquid.amount = tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tLiquid,
- false);
- if (tLiquid.amount > 0) {
- if ((aCoverVariable % 2 == 0 || aSide != 1) && (aCoverVariable % 2 != 0 || aSide != 0)
- && aTileEntity.getUniversalEnergyCapacity() >= (long) Math.min(1,
- tLiquid.amount / 10)) {
- if (aTileEntity.isUniversalEnergyStored((long) Math.min(1, tLiquid.amount / 10))) {
- aTileEntity.decreaseStoredEnergyUnits((long) Math.min(1, tLiquid.amount / 10),
- true);
- tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tTank1.drain(
- ForgeDirection.getOrientation(aSide), tLiquid.amount, true), true);
- }
- } else {
- tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(),
- tTank1.drain(ForgeDirection.getOrientation(aSide), tLiquid.amount, true),
- true);
- }
- }
- }
- } else {
- tLiquid = tTank2.drain(ForgeDirection.getOrientation(aSide).getOpposite(), this.mMaxTransferRate,
- false);
- if (tLiquid != null) {
- tLiquid = tLiquid.copy();
- tLiquid.amount = tTank1.fill(ForgeDirection.getOrientation(aSide), tLiquid, false);
- if (tLiquid.amount > 0) {
- if ((aCoverVariable % 2 == 0 || aSide != 1) && (aCoverVariable % 2 != 0 || aSide != 0)
- && aTileEntity.getUniversalEnergyCapacity() >= (long) Math.min(1,
- tLiquid.amount / 10)) {
- if (aTileEntity.isUniversalEnergyStored((long) Math.min(1, tLiquid.amount / 10))) {
- aTileEntity.decreaseStoredEnergyUnits((long) Math.min(1, tLiquid.amount / 10),
- true);
- tTank1.fill(ForgeDirection.getOrientation(aSide),
- tTank2.drain(ForgeDirection.getOrientation(aSide).getOpposite(),
- tLiquid.amount, true),
- true);
- }
- } else {
- tTank1.fill(ForgeDirection.getOrientation(aSide),
- tTank2.drain(ForgeDirection.getOrientation(aSide).getOpposite(),
- tLiquid.amount, true),
- true);
- }
+ }
+ if ((aTileEntity instanceof IFluidHandler)) {
+ //Logger.INFO("Trying to Void via Overflow.");
+ IFluidHandler tTank1;
+ ForgeDirection directionFrom;
+ directionFrom = ForgeDirection.UNKNOWN;
+ tTank1 = (IFluidHandler) aTileEntity;
+ if (tTank1 != null) {
+ //Logger.INFO("Found Self. "+aSide);
+ //FluidStack aTankStack = tTank1.drain(ForgeDirection.UNKNOWN, 1, false);
+ FluidStack aTankStack = tTank1.getTankInfo(directionFrom)[0].fluid;
+ if (aTankStack != null) {
+ //Logger.INFO("Found Fluid inside self - "+aTankStack.getLocalizedName()+", overflow point set at "+aCoverVariable+"L and we have "+aTankStack.amount+"L inside.");
+ if (aTankStack.amount > aCoverVariable) {
+ int aAmountToDrain = aTankStack.amount - aCoverVariable;
+ //Logger.INFO("There is "+aAmountToDrain+" more fluid in the tank than we would like.");
+ if (aAmountToDrain > 0) {
+ FluidStack tLiquid = tTank1.drain(directionFrom, Math.abs(aAmountToDrain), true);
+ if (tLiquid != null) {
+ //Logger.INFO("Drained "+aAmountToDrain+"L.");
}
}
}
}
+ else {
+ //Logger.INFO("Could not simulate drain on self.");
+ }
}
-
- return aCoverVariable;
}
+ return aCoverVariable;
}
public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
EntityPlayer aPlayer, float aX, float aY, float aZ) {
-
-
- if ((double) aX > 0.375D && (double) aX < 0.625D || aSide <= 3 || (double) aY > 0.375D && (double) aY < 0.625D
- || (double) aZ <= 0.375D || (double) aZ >= 0.625D) {
- HashMap<String, Object> aCoverData = getCover(aSide, aCoverID, aCoverVariable, aTileEntity);
- float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ);
- switch ((byte) ((byte) ((int) (tCoords[0] * 2.0F)) + 2 * (byte) ((int) (tCoords[1] * 2.0F)))) {
- case 0 :
- aCoverVariable -= 1000;
- break;
- case 1 :
- aCoverVariable += 1000;
- break;
- case 2 :
- aCoverVariable -= 32000;
- break;
- case 3 :
- aCoverVariable += 32000;
- }
- aCoverData.remove("aCoverVariable");
- aCoverData.put("aCoverVariable", aCoverVariable);
- updateCoverMap(aCoverData);
-
+ if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) {
+ aCoverVariable += aPlayer.isSneaking() ? 4096 : 1024;
+ } else {
+ aCoverVariable -= aPlayer.isSneaking() ? 4096 : 1024;
}
- GT_Utility.sendChatToPlayer(aPlayer, "Overflow Limit: " + aCoverVariable);
-
+ if (aCoverVariable > mMaxTransferRate) {
+ aCoverVariable = mInitialTransferRate;
+ }
+ if (aCoverVariable <= 0) {
+ aCoverVariable = mInitialTransferRate;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L"));
return aCoverVariable;
}
+ public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ boolean aShift = aPlayer.isSneaking();
+ int aAmount = aShift ? 128 : 8;
+ if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) {
+ aCoverVariable += aAmount;
+ } else {
+ aCoverVariable -= aAmount;
+ }
+ if (aCoverVariable > mMaxTransferRate) {
+ aCoverVariable = mInitialTransferRate;
+ }
+ if (aCoverVariable <= 0) {
+ aCoverVariable = mInitialTransferRate;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L"));
+ aTileEntity.setCoverDataAtSide(aSide, aCoverVariable);
+ return true;
+ }
+
public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return true;
}
@@ -157,17 +120,11 @@ public class GTPP_Cover_Overflow extends GT_CoverBehavior {
}
public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
- return aCoverVariable > 1 && aTileEntity instanceof IMachineProgress
- && ((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4
- ? false
- : aCoverVariable >= 6 || aCoverVariable % 2 != 0;
+ return false;
}
public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
- return aCoverVariable > 1 && aTileEntity instanceof IMachineProgress
- && ((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4
- ? false
- : aCoverVariable >= 6 || aCoverVariable % 2 == 0;
+ return true;
}
public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
@@ -175,39 +132,6 @@ public class GTPP_Cover_Overflow extends GT_CoverBehavior {
}
public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
- return 1;
- }
-
- public HashMap<String, Object> getCover(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity){
- //Map this cover
- String aTileDataKey = "|"+aTileEntity.getXCoord()+"|"+aTileEntity.getYCoord()+"|"+aTileEntity.getZCoord()+"|"+aTileEntity.getWorld().provider.dimensionId+"|"+aSide+"|";
- HashMap<String, Object> aTileData;
- long aCurrentTime = System.currentTimeMillis();
- if (mOverflowCache.get(aTileDataKey) != null) {
- aTileData = mOverflowCache.get(aTileDataKey);
- aTileData.remove("aLastUpdatedTime");
- aTileData.put("aLastUpdateTime", aCurrentTime);
- //Logger.INFO("Found Existing Cover in Cache.");
- }
- else {
- aTileData = new HashMap<String, Object>();
- aTileData.put("aCoverKey", aTileDataKey);
- aTileData.put("aSide", aSide);
- aTileData.put("aCoverID", aCoverID);
- aTileData.put("aCoverVariable", aCoverVariable);
- aTileData.put("aLastUpdateTime", aCurrentTime);
- mOverflowCache.put(aTileDataKey, aTileData);
- Logger.INFO("Adding new Cover to Cache. Storing under key: "+aTileDataKey);
- }
- return aTileData;
- }
-
- public void updateCoverMap(HashMap<String, Object> aCoverData) {
- String mAccessKey = (String) aCoverData.get("aCoverKey");
- if (mOverflowCache.get(mAccessKey) != null) {
- mOverflowCache.remove(mAccessKey);
- }
- mOverflowCache.put(mAccessKey, aCoverData);
- return;
+ return 5;
}
-} \ No newline at end of file
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow2.java
deleted file mode 100644
index 8a378cf6ad..0000000000
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow2.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package gtPlusPlus.xmod.gregtech.common.covers;
-
-import gregtech.api.interfaces.tileentity.ICoverable;
-import gregtech.api.util.GT_CoverBehavior;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.core.util.minecraft.LangUtils;
-import gtPlusPlus.core.util.sys.KeyboardUtils;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.IFluidHandler;
-
-public class GTPP_Cover_Overflow2 extends GT_CoverBehavior {
-
- public final int mTransferRate;
- public final int mInitialTransferRate;
- public final int mMaxTransferRate;
-
- public GTPP_Cover_Overflow2(int aTransferRate) {
- this.mTransferRate = aTransferRate * 1000 / 10;
- this.mInitialTransferRate = aTransferRate;
- this.mMaxTransferRate = aTransferRate * 1000;
- }
-
- public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
- long aTimer) {
- if (aCoverVariable == 0) {
- return aCoverVariable;
- }
- if ((aTileEntity instanceof IFluidHandler)) {
- IFluidHandler tTank1;
- ForgeDirection directionFrom;
- directionFrom = ForgeDirection.UNKNOWN;
- if (aCoverVariable > 0) {
- tTank1 = (IFluidHandler) aTileEntity;
- } else {
- tTank1 = aTileEntity.getITankContainerAtSide(aSide);
- }
- if (tTank1 != null) {
- FluidStack aTankStack = tTank1.drain(ForgeDirection.UNKNOWN, 0, false);
- if (aTankStack != null) {
- if (aTankStack.amount > aCoverVariable) {
- int aAmountToDrain = aTankStack.amount - aCoverVariable;
- if (aAmountToDrain > 0) {
- FluidStack tLiquid = tTank1.drain(directionFrom, Math.abs(aAmountToDrain), false);
- }
- }
- }
- }
- }
- return aCoverVariable;
- }
-
- public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
- EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) {
- aCoverVariable += aPlayer.isSneaking() ? 4096 : 1024;