aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
-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/generators/GregtechMetaTileEntityGeothermalGenerator.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java4
-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_IndustrialDehydrator.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java26
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java423
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java2
-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.java31
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java51
-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/GregtechMetaTileEntity_AlloyBlastSmelter.java17
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java123
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java135
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java16
-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/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java55
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java4
29 files changed, 1557 insertions, 1283 deletions
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;
- } else {
- aCoverVariable -= aPlayer.isSneaking() ? 4096 : 1024;
- }
- if (aCoverVariable > mMaxTransferRate) {
- aCoverVariable = mInitialTransferRate;
- }
- if (aCoverVariable <= 0) {
- aCoverVariable = mInitialTransferRate;
- }
- GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L/5T"));
- 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/5T"));
- aTileEntity.setCoverDataAtSide(aSide, aCoverVariable);
- return true;
- }
-
- public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
- return true;
- }
-
- public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
- return true;
- }
-
- public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
- return true;
- }
-
- public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
- return true;
- }
-
- public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
- return true;
- }
-
- public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
- return true;
- }
-
- public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
- return false;
- }
-
- public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
- return true;
- }
-
- public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
- return true;
- }
-
- public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
- return 5;
- }
-}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
index 97621203cd..5d4cf5ea94 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
@@ -2,20 +2,26 @@ package gtPlusPlus.xmod.gregtech.common.items;
import static gtPlusPlus.core.util.Utils.getTcAspectStack;
-import net.minecraft.item.EnumAction;
-import net.minecraft.item.ItemStack;
-
import gregtech.api.GregTech_API;
-import gregtech.api.enums.*;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.SubTag;
+import gregtech.api.enums.TC_Aspects;
+import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
-import gregtech.api.objects.*;
-import gregtech.api.util.*;
+import gregtech.api.objects.GT_MultiTexture;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.objects.ItemData;
+import gregtech.api.objects.MaterialStack;
+import gregtech.api.util.GT_FoodStat;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.Recipe_GT;
import gregtech.common.covers.GT_Cover_Arm;
import gregtech.common.covers.GT_Cover_Conveyor;
import gregtech.common.covers.GT_Cover_Pump;
import gregtech.common.items.behaviors.Behaviour_DataOrb;
import gregtech.common.items.behaviors.Behaviour_DataStick;
-
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.handler.OldCircuitHandler;
import gtPlusPlus.core.lib.CORE;
@@ -29,8 +35,9 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_X32;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_Overflow;
-import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_Overflow2;
import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_ToggleVisual;
+import net.minecraft.item.EnumAction;
+import net.minecraft.item.ItemStack;
public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 {
@@ -263,12 +270,12 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 {
GregtechItemList.Cover_Overflow_EV.set(this.addItem(75, "Overflow Valve (EV)", "Maximum void amount: 32768000", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
GregtechItemList.Cover_Overflow_IV.set(this.addItem(76, "Overflow Valve (IV)", "Maximum void amount: 262144000", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
- GregTech_API.registerCover(GregtechItemList.Cover_Overflow_ULV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow2(8));
- GregTech_API.registerCover(GregtechItemList.Cover_Overflow_LV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow2(64));
- GregTech_API.registerCover(GregtechItemList.Cover_Overflow_MV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow2(512));
- GregTech_API.registerCover(GregtechItemList.Cover_Overflow_HV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow2(4096));
- GregTech_API.registerCover(GregtechItemList.Cover_Overflow_EV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow2(32768));
- GregTech_API.registerCover(GregtechItemList.Cover_Overflow_IV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow2(262144));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_ULV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(8));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_LV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(64));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_MV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(512));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_HV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(4096));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_EV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(32768));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_IV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(262144));
//Fusion Reactor MK4 Singularity
GregtechItemList.Compressed_Fusion_Reactor.set(this.addItem(100, "Hypervisor Matrix (Fusion)", "A memory unit containing an RI (Restricted Intelligence)"));
@@ -339,7 +346,23 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 {
}
}
GregtechItemList.Laser_Lens_WoodsGlass.set(this.addItem(140, "Wood's Glass Lens", "Allows UV & IF to pass through, blocks visible light spectrums"));
-
+
+ int aStartID = 141;
+ GregtechItemList[] aTransParts = new GregtechItemList[] {
+ GregtechItemList.TransmissionComponent_ULV,
+ GregtechItemList.TransmissionComponent_LV,
+ GregtechItemList.TransmissionComponent_MV,
+ GregtechItemList.TransmissionComponent_HV,
+ GregtechItemList.TransmissionComponent_EV,
+ GregtechItemList.TransmissionComponent_IV,
+ GregtechItemList.TransmissionComponent_LuV,
+ GregtechItemList.TransmissionComponent_ZPM,
+ GregtechItemList.TransmissionComponent_UV,
+ GregtechItemList.TransmissionComponent_MAX,
+ };
+ for (int aIndex=0;aIndex<10;aIndex++){
+ aTransParts[aIndex].set(this.addItem(aStartID++, "Transmission Component ("+GT_Values.VN[aIndex]+")", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, aIndex), getTcAspectStack(TC_Aspects.MACHINA, aIndex), getTcAspectStack(TC_Aspects.MAGNETO, aIndex)}));
+ }
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java
index a063d334bf..422a29c34e 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java
@@ -1,6 +1,5 @@
package gtPlusPlus.xmod.gregtech.common.items.behaviours;
-import java.util.ArrayList;
import java.util.List;
import codechicken.lib.math.MathHelper;
@@ -63,7 +62,7 @@ public class Behaviour_Electric_Lighter extends Behaviour_None {
if (!aWorld.isRemote && aStack != null && aStack.stackSize == 1) {
if (aPlayer.isSneaking()) {
Logger.INFO("Changing Mode");
- boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod");
+ boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode");
Logger.INFO("Is currently in Fireball mode? "+aCurrentMode);
boolean aNewMode = Utils.invertBoolean(aCurrentMode);
Logger.INFO("Is now set to Fireball mode? "+aNewMode);
@@ -72,7 +71,7 @@ public class Behaviour_Electric_Lighter extends Behaviour_None {
PlayerUtils.messagePlayer(aPlayer, "Current Mode: "+EnumChatFormatting.RED+(aNewMode ? "Projectile" : "Fire Starter"));
}
else {
- boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod");
+ boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode");
if (aCurrentMode) {
//Shoot Lightning Attack
aWorld.playSoundAtEntity(aPlayer, "random.bow", 0.5F, 0.4F / (CORE.RANDOM.nextFloat() * 0.4F + 0.8F));
@@ -112,16 +111,16 @@ public class Behaviour_Electric_Lighter extends Behaviour_None {
if (!aWorld.isRemote && aStack != null && aStack.stackSize == 1) {
if (aPlayer.isSneaking()) {
Logger.INFO("Changing Mode");
- boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod");
+ boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode");
Logger.INFO("Is currently in Fireball mode? "+aCurrentMode);
boolean aNewMode = Utils.invertBoolean(aCurrentMode);
Logger.INFO("Is now set to Fireball mode? "+aNewMode);
- aStack.getTagCompound().setBoolean("aFireballMod", aNewMode);
+ aStack.getTagCompound().setBoolean("aFireballMode", aNewMode);
//NBTUtils.setBoolean(aStack, "aFireballMode", aNewMode);
PlayerUtils.messagePlayer(aPlayer, "Current Mode: "+EnumChatFormatting.RED+(aNewMode ? "Projectile" : "Fire Starter"));
}
else {
- boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod");
+ boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode");
if (aCurrentMode) {
//Shoot Lightning Attack
aWorld.playSoundAtEntity(aPlayer, "random.bow", 0.5F, 0.4F / (CORE.RANDOM.nextFloat() * 0.4F + 0.8F));
@@ -199,11 +198,14 @@ public class Behaviour_Electric_Lighter extends Behaviour_None {
}
}
boolean aCurrentMode;
+ if (!NBTUtils.hasTagCompound(aStack)) {
+ NBTUtils.createEmptyTagCompound(aStack);
+ }
if (NBTUtils.hasKey(aStack, "aFireballMode")) {
- aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod");
+ aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode");
}
else {
- aStack.getTagCompound().setBoolean("aFireballMod", false);
+ aStack.getTagCompound().setBoolean("aFireballMode", false);
aCurrentMode = false;
}
aList.add("Current Mode: "+EnumChatFormatting.RED+(aCurrentMode ? "Projectile" : "Fire Starter"));
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java
new file mode 100644
index 0000000000..08356dd6ef
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java
@@ -0,0 +1,344 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import cofh.api.energy.IEnergyConnection;
+import cofh.api.energy.IEnergyHandler;
+import cofh.api.energy.IEnergyProvider;
+import cofh.api.energy.IEnergyReceiver;
+import cofh.api.energy.IEnergyStorage;
+import crazypants.enderio.machine.capbank.TileCapBank;
+import crazypants.enderio.machine.capbank.network.ICapBankNetwork;
+import crazypants.enderio.power.IPowerContainer;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBuffer;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.common.util.ForgeDirection;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ *
+ * This is the main construct for my Basic Machines such as the Automatic Extractor
+ * Extend this class to make a simple Machine
+ */
+public class GT_MetaTileEntity_RfConvertor extends GregtechMetaEnergyBuffer implements IEnergyReceiver {
+
+
+ public GT_MetaTileEntity_RfConvertor(final String aName, final int aTier,
+ final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) {
+ super(aName, aTier, aDescription, aTextures, aSlotCount);
+ }
+
+ public GT_MetaTileEntity_RfConvertor(final int aID, final String aName,
+ final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {"Use Screwdriver to change voltage", "Hold Shift while using Screwdriver to change amperage", EnumChatFormatting.DARK_AQUA+"Variable Output Voltage"};
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ ITexture[][][] rTextures = new ITexture[12][17][];
+ GT_RenderedTexture aTex = new GT_RenderedTexture(TexturesGtBlock.Casing_Material_ZirconiumCarbide);
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]};
+ rTextures[1][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]};
+ rTextures[2][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]};
+ rTextures[3][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]};
+ rTextures[4][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]};
+ rTextures[5][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]};
+ rTextures[6][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]};
+ rTextures[7][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]};
+ rTextures[8][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]};
+ rTextures[9][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]};
+ rTextures[10][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]};
+ rTextures[11][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]};
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return mTextures[Math.min(2, aSide) + (aSide == aFacing ? 3 : 0) + (aActive ? 0 : 6)][aColorIndex + 1];
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_RfConvertor(this.mName, this.mTier, this.mDescription,
+ this.mTextures, this.mInventory.length);
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return Integer.MAX_VALUE;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return V[this.mTier];
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return false;
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return true;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return !isOutputFacing(aSide);
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return aSide == getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return null;
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return null;
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ if (!aBaseMetaTileEntity.isActive()) {
+ aBaseMetaTileEntity.setActive(true);
+ }
+ if (this.getEUVar() < this.maxEUStore()) {
+ for (byte i = 0; i < 6 && aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity(); i++) {
+ if (isInputFacing(i)) {
+ receiveEnergy(ForgeDirection.getOrientation(i), Integer.MAX_VALUE, false);
+ }
+ }
+ }
+ return;
+ }
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ String[] infoData = super.getInfoData();
+ return new String[] {
+ infoData[0],
+ "Converts RF -> GTEU | Tier: "+this.mTier,
+ infoData[1],
+ infoData[2]
+ };
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setByte("mTier", this.mTier);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ this.mTier = aNBT.getByte("mTier");
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (aPlayer.isSneaking()) {
+ byte aTest = (byte) (aCurrentOutputAmperage + 1);
+ if (aTest > 16 || aTest <= 0 ) {
+ aTest = 1;
+ }
+ aCurrentOutputAmperage = aTest;
+ PlayerUtils.messagePlayer(aPlayer, "Now handling "+maxAmperesOut()+" Amps.");
+ }
+ else {
+ if (this.mTier < (CORE.GTNH ? GT_Values.V.length : 9)) {
+ this.mTier++;
+ }
+ else {
+ this.mTier = 0;
+ }
+ PlayerUtils.messagePlayer(aPlayer, "Now running at "+GT_Values.VOLTAGE_NAMES[this.mTier]+".");
+ }
+
+ }
+
+ @Override
+ public boolean canConnectEnergy(ForgeDirection from) {
+ if (isOutputFacing((byte) from.ordinal())) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
+
+ // Cannot accept power on the output face.
+ if (!canConnectEnergy(from) || isOutputFacing((byte) from.ordinal())) {
+ return 0;
+ }
+
+ TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide((byte) from.ordinal());
+ if (tTileEntity == null) {
+ return 0;
+ }
+
+ Logger.WARNING("Someone is trying to inject RF from "+from+". Type:"+tTileEntity.getClass().getName());
+
+ // Calculate maximum RF we need to consume
+ int aInputRF = MathUtils.safeInt(this.maxEUOutput() * GregTech_API.mEUtoRF / 100);
+
+ // Make sure we only consume the correct amount of RF that is pushed into this Tile.
+ if (aInputRF > maxReceive) {
+ aInputRF = maxReceive;
+ }
+
+ int aInjectedRF = 0;
+ boolean aVal = false;
+
+ long aStoredEU = this.getEUVar();
+ long aMaxEU = this.maxEUStore();
+ Logger.WARNING("Stored: "+aStoredEU+", Capacity: "+aMaxEU+"");
+ if (aStoredEU < aMaxEU) {
+ Logger.WARNING("StoredEU < MaxEU");
+ long aRemainingSpace = aMaxEU - aStoredEU;
+ if (aRemainingSpace > 0) {
+ long tEU = 0;
+ byte aSide = (byte) from.ordinal();
+ Logger.WARNING("Free: "+aRemainingSpace+"EU");
+ if (tTileEntity instanceof IEnergyProvider && ((IEnergyProvider) tTileEntity).extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(aSide)), 1, true) == 1) {
+ tEU = (long) ((IEnergyProvider) tTileEntity).extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(aSide)), (int) maxEUOutput() * 100 / GregTech_API.mRFtoEU, false);
+ Logger.WARNING("Drained from IEnergyProvider Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+"");
+ tEU = tEU * GregTech_API.mRFtoEU / 100;
+ }
+ else if (tTileEntity instanceof IEnergyStorage && ((IEnergyStorage) tTileEntity).extractEnergy(1, true) == 1) {
+ tEU = (long) ((IEnergyStorage) tTileEntity).extractEnergy((int) maxEUOutput() * 100 / GregTech_API.mRFtoEU, false);
+ Logger.WARNING("Drained from IEnergyStorage Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+"");
+ tEU = tEU * GregTech_API.mRFtoEU / 100;
+ }
+ else if (GregTech_API.meIOLoaded && tTileEntity instanceof IPowerContainer && ((IPowerContainer) tTileEntity).getEnergyStored() > 0) {
+ int storedRF = ((IPowerContainer) tTileEntity).getEnergyStored();
+ int extractRF = (int) maxEUOutput() * 100 / GregTech_API.mRFtoEU;
+ tEU = 0;
+ if (tTileEntity instanceof TileCapBank) {
+ ICapBankNetwork network = ((TileCapBank) tTileEntity).getNetwork();
+ if (network != null && network.getEnergyStoredL() > 0) {
+ tEU = Math.min((Math.min(Math.min(network.getEnergyStoredL(), storedRF - extractRF), network.getMaxOutput())) * GregTech_API.mRFtoEU / 100, maxEUOutput());
+ Logger.WARNING("Drained from EIO CapBank Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+"");
+ network.addEnergy((int) -(tEU * 100 / GregTech_API.mRFtoEU));
+ }
+ } else {
+ if (storedRF > extractRF) {
+ ((IPowerContainer) tTileEntity).setEnergyStored(storedRF - extractRF);
+ tEU = maxEUOutput();
+ Logger.WARNING("Drained from EIO Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+"");
+ } else {
+ ((IPowerContainer) tTileEntity).setEnergyStored(0);
+ tEU = storedRF * GregTech_API.mRFtoEU / 100;
+ Logger.WARNING("Drained from EIO Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+"");
+ }
+ }
+ }
+ Logger.WARNING("EU to inject: "+tEU+"EU");
+ if (!simulate) {
+ aVal = this.getBaseMetaTileEntity().increaseStoredEnergyUnits(tEU, true);
+ }
+ if (tEU > 0) {
+ Logger.WARNING("Tried injecting "+tEU+" eu into self. Success? "+aVal);
+ }
+ }
+ }
+ return aInjectedRF;
+ }
+
+ @Override
+ public int getEnergyStored(ForgeDirection from) {
+ long aStoredEU = this.getEUVar();
+ long aMaxEU = this.maxEUStore();
+ if (aStoredEU == 0) {
+ return 0;
+ }
+ if (aStoredEU < aMaxEU) {
+ long aRemainingSpace = aMaxEU - aStoredEU;
+ if (aRemainingSpace > 0) {
+ if (aRemainingSpace > (this.maxEUOutput() / (GregTech_API.mEUtoRF / 100))) {
+ int aCalculatedFreeSpace = 0;
+ int aRfPer10Eu = GregTech_API.mEUtoRF / 10;
+ // Calculate how many lots of '10
+ aCalculatedFreeSpace = (int) Math.floor(aRemainingSpace / 10);
+ // Return value equal to how many lots of '10eu' packets we can fit in.
+ return Integer.MAX_VALUE - MathUtils.balance(aCalculatedFreeSpace * aRfPer10Eu, 0, Integer.MAX_VALUE);
+ }
+ }
+ }
+ return Integer.MAX_VALUE;
+ }
+
+ @Override
+ public int getMaxEnergyStored(ForgeDirection from) {
+ return Integer.MAX_VALUE;
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java
index 5ebdbf0ef8..cfbf7bd487 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java
@@ -38,7 +38,8 @@ extends GT_MetaTileEntity_BasicGenerator
@Override
public String[] getDescription() {
- return new String[]{this.mDescription, "Generates power at " + this.getEfficiency() + "% Efficiency per tick"};
+ String aPollution = "Causes between "+this.getPollution()+ " Pollution per second";
+ return new String[]{this.mDescription, "Generates power at " + this.getEfficiency() + "% Efficiency per tick", aPollution};
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java
index 6a42232e40..7d20f1eb59 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java
@@ -54,12 +54,12 @@ extends GregtechRocketFuelGeneratorBase {
}
public void onConfigLoad() {
- this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, ((40+((this.mTier) * 16))/4)+(this.mTier));
+ this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, 80 - (10 * (this.mTier - 4)));
}
@Override
public int getEfficiency() {
- int eff = ((40+((this.mTier) * 16))/4)+(this.mTier);
+ int eff = 80 - (10 * (this.mTier - 4));
return eff;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java
index 2a2b6d5090..140f1d9cd5 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java
@@ -1,7 +1,6 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
import static gregtech.api.enums.GT_Values.V;
-import static gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils.mPollution;
import java.util.HashSet;
import java.util.Set;
@@ -10,20 +9,13 @@ import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.interfaces.IChunkLoader;
-import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.chunkloading.GTPP_ChunkManager;
import gtPlusPlus.core.chunkloading.StaticChunkFunctions;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.PlayerUtils;
-import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
-import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -36,17 +28,7 @@ import net.minecraft.world.chunk.Chunk;
public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_BasicMachine implements IChunkLoader {
public GregtechMetaTileEntityChunkLoader(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 2, "Loads " + getMaxChunksToLoadForTier(aTier) + " chunks when powered", 0, 0, "Recycler.png", "",
- new ITexture[]{
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB)
- });
+ super(aID, aName, aNameRegional, aTier, 2, "Loads " + getMaxChunksToLoadForTier(aTier) + " chunks when powered", 0, 0, "Recycler.png", "", new ITexture[]{});
}
public GregtechMetaTileEntityChunkLoader(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
@@ -54,13 +36,27 @@ public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_BasicMa
}
public static int getMaxChunksToLoadForTier(int aTier) {
- return (aTier * aTier);
+ if (aTier < 4) {
+ return 3 * 3;
+ }
+ if (aTier < 6) {
+ return 7 * 7;
+ }
+ if (aTier < 8) {
+ return 15 * 15;
+ }
+ else {
+ return 0;
+ }
}
@Override
public String[] getDescription() {
return new String[] {
- this.mDescription,
+ "Loads " + getMaxChunksToLoadForTier(this.mTier) + " chunks when powered",
+ "Consumes 2A",
+ "Behaves Identically to a Railcraft World Anchor",
+ CORE.GT_Tooltip
};
}
@@ -89,57 +85,56 @@ public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_BasicMa
public ITexture[] getFront(final byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)};
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])};
}
public ITexture[] getBack(final byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)};
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])};
}
public ITexture[] getBottom(final byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)};
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])};
}
public ITexture[] getTop(final byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)};
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])};
}
public ITexture[] getSides(final byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redox_3)};
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])};
}
public ITexture[] getFrontActive(final byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)};
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])};
}
public ITexture[] getBackActive(final byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)};
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])};
}
public ITexture[] getBottomActive(final byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)};
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])};
}
public ITexture[] getTopActive(final byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)};
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])};
}
public ITexture[] getSidesActive(final byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redox_3)};
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])};
}
@Override
public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- PlayerUtils.messagePlayer(aPlayer, "Running every "+" minutes.");
super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
}
@@ -175,9 +170,7 @@ public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_BasicMa
@Override
public String[] getInfoData() {
- return new String[] {
- this.getLocalName()
- };
+ return super.getInfoData();
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java
index b7e4618e07..79d256909d 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java
@@ -43,23 +43,6 @@ public class GregtechMetaTileEntity_ChemicalReactor extends GT_MetaTileEntity_Ba
public FluidStack[] mInputFluids = new FluidStack[4];
public FluidStack[] mOutputFluids = new FluidStack[2];
- private static final GT_Recipe_Map mFluidChemicalReactorRecipes = new GT_Recipe_Map(
- new HashSet<GT_Recipe>(100),
- "gt.recipe.fluidchemicaleactor",
- "Chemical Plant",
- null,
- CORE.MODID+":textures/gui/FluidReactor",
- 0,
- 0,
- 0,
- 2,
- 1,
- "Tier: ",
- 1,
- E,
- true,
- false);
-
public GregtechMetaTileEntity_ChemicalReactor(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 1,
"For mixing fluids", 4, 4, "ChemicalReactor.png", "",
@@ -124,12 +107,7 @@ public class GregtechMetaTileEntity_ChemicalReactor extends GT_MetaTileEntity_Ba
@Override
public GT_Recipe.GT_Recipe_Map getRecipeList() {
- if (mFluidChemicalReactorRecipes.mRecipeList.isEmpty()) {
- for (Recipe_GT i :Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList) {
- mFluidChemicalReactorRecipes.add(i);
- }
- }
- return mFluidChemicalReactorRecipes;
+ return null;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java
new file mode 100644
index 0000000000..ddbd87da64
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java
@@ -0,0 +1,380 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.ArrayUtils;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.StaticFields59;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_IndustrialAlloySmelter extends GregtechMeta_MultiBlockBase {
+
+ public static int CASING_TEXTURE_ID;
+ private int mHeatingCapacity = 0;
+ private int mLevel = 0;
+
+ public GregtechMetaTileEntity_IndustrialAlloySmelter(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 1);
+ }
+
+ public GregtechMetaTileEntity_IndustrialAlloySmelter(String aName) {
+ super(aName);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 1);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialAlloySmelter(this.mName);
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_TEXTURE_ID], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)};
+ }
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_TEXTURE_ID]};
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiFurnace.png");
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing > 1;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 15;
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Alloy Smelter";
+ }
+
+ @Override
+ public String[] getTooltip() {
+ return new String[]{
+ "Controller Block for the Industrial Alloy Smelter",
+ "Gains one parallel per voltage tier",
+ "Gains one multiplier per coil tier",
+ "parallel = tier * coil tier",
+ "Gains 5% speed bonus per coil tier",
+ "Size(WxHxD): 3x5x3 (Hollow)",
+ "Controller (Front middle at bottom)",
+ "Inconel Reinforced Casings (layers 0/4, 10 at least!)",
+ "16x Heating Coils (layers 1/3, hollow)",
+ "8x Integral Encasement V (middle layer, hollow)",
+ "1x Input Bus",
+ "1x Output Bus",
+ "1x Output Hatch",
+ "1x Energy Hatch",
+ };
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (this.mLevel * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ @Override
+ public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+
+ this.mLevel = 0;
+ this.mHeatingCapacity = 0;
+ for (int i=1;i<4;i++) {
+ if (!aBaseMetaTileEntity.getAirOffset(xDir, i, zDir)) {
+ Logger.INFO("Did not find air inside on layer "+i);
+ return false;
+ }
+ }
+ /*if (!addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir),
+ CASING_TEXTURE_ID)) {
+ return false;
+ }*/
+ Block tUsedBlock = aBaseMetaTileEntity.getBlockOffset(xDir + 1, 1, zDir);
+ byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir);
+ this.mLevel = StaticFields59.getTierForCoil(tUsedBlock, tUsedMeta);
+ this.mHeatingCapacity = StaticFields59.getHeatingCapacityForCoil(tUsedBlock, tUsedMeta);
+
+ int aCasingCount = 0;
+
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+
+ if ((i != 0) || (j != 0)) {
+ //Coils 1
+ if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) {
+ Logger.INFO("Heating Coils missing. First Layer");
+ return false;
+ }
+
+ //Integral Casings
+ if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j), ModBlocks.blockCasingsTieredGTPP, 4)) {
+ Logger.INFO("Integral Framework missing. Second Layer");
+ return false;
+ }
+
+ //Coils 2
+ if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) {
+ Logger.INFO("Heating Coils missing. Third Layer");
+ return false;
+ }
+ }
+
+ //Top Layer
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, 4, zDir + j);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 4, zDir + j);
+ if (aCurrentBlock == ModBlocks.blockCasings3Misc && aCurrentMeta == 1) {
+ aCasingCount++;
+ }
+
+ final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 4, zDir + j);
+ if (!isValidBlockForStructure(tTileEntity2, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, ModBlocks.blockCasings3Misc, 1)) {
+ Logger.INFO("Top Layer missing.");
+ return false;
+ }
+ }
+ }
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j);
+ if (aCurrentBlock == ModBlocks.blockCasings3Misc && aCurrentMeta == 1) {
+ aCasingCount++;
+ }
+ if ((xDir + i != 0) || (zDir + j != 0)) {
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, ModBlocks.blockCasings3Misc, 1)) {
+ Logger.INFO("Bottom Layer missing.");
+ return false;
+ }
+ }
+ }
+ }
+
+ return aCasingCount >= 10;
+ }
+
+ public boolean checkRecipe(ItemStack aStack) {
+ return checkRecipeGeneric(this.getMaxParallelRecipes(), 0, 5 * this.mLevel); // Will have to clone the logic from parent class to handle heating coil
+ // tiers.
+ }
+
+ @Override
+ public boolean checkRecipeGeneric(ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes,
+ int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) {
+ // Based on the Processing Array. A bit overkill, but very flexible.
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[] {};
+ this.mOutputFluids = new FluidStack[] {};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ Logger.WARNING("Running checkRecipeGeneric(0)");
+
+ GT_Recipe tRecipe = this.getRecipeMap().findRecipe(getBaseMetaTileEntity(), mLastRecipe, false,
+ gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
+
+ Logger.WARNING("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+ if (tRecipe == null) {
+ Logger.WARNING("BAD RETURN - 1");
+ return false;
+ }
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ Logger.WARNING("BAD RETURN - 2");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ int tHeatCapacityDivTiers = mHeatingCapacity / 900;
+ if (tHeatCapacityDivTiers > 0) {
+ tRecipeEUt = (int) (tRecipeEUt * (Math.pow(0.95, tHeatCapacityDivTiers)));
+ }
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+ // Count recipes to do in parallel, consuming input items and fluids and
+ // considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ Logger.WARNING("Broke at " + parallelRecipes + ".");
+ break;
+ }
+ Logger.WARNING("Bumped EU from " + tTotalEUt + " to " + (tTotalEUt + tRecipeEUt) + ".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ Logger.WARNING("BAD RETURN - 3");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int) (tRecipe.mDuration * tTimeFactor);
+ int rInt = 2;
+
+ this.mEUt = (int) Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= (tHeatCapacityDivTiers >= rInt ? 4 : 2);
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0)
+ tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ Logger.WARNING("GOOD RETURN - 1");
+ return true;
+
+ }
+
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java
index c549cf9216..68e060c778 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java
@@ -137,13 +137,13 @@ extends GregtechMeta_MultiBlockBase {
int depth = 1;
int mPlascreteCount = 0;
for (int i = 1; i < 4; i++) {
- Block tBlock = aBaseMetaTileEntity.getBlockOffset(i, 0, 0);
- int tMeta = aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0);
- if (tBlock == ModBlocks.blockCasings3Misc && tMeta == 1) {
- Logger.INFO("Found Correct Top Casing at offset "+i);
+ if (aBaseMetaTileEntity.getAirOffset(i, -1, 0)) {
+ Logger.INFO("aitfound "+i);
continue;
}
- else {
+ Block tBlock = aBaseMetaTileEntity.getBlockOffset(i, -1, 0);
+ int tMeta = aBaseMetaTileEntity.getMetaIDOffset(i, -1, 0);
+ {
if (isValidCasingBlock(tBlock, tMeta)) {
x = i;
z = i;
@@ -176,7 +176,7 @@ extends GregtechMeta_MultiBlockBase {
}
//!addToMachineList(tTileEntity, mCasingTextureID)
if (depth >= -1) {
- Logger.INFO("Structure is not 5 blocks or taller.");
+ Logger.INFO("Structure is not 5 blocks or taller. depth = "+depth);
return false;
}
@@ -207,7 +207,7 @@ extends GregtechMeta_MultiBlockBase {
}
else if (dY < 0) {
//Check Walls
- if (dX == -x || dX == x || dZ == -z || dZ == z) {
+ if (dY != depth && (dX == -x || dX == x || dZ == -z || dZ == z)) {
if (!isValidCasingBlock(tBlock, tMeta) && !addToMachineList(tTileEntity, mCasingTextureID)) {
Logger.INFO("Found Incorrect Wall Casing at offset X:"+dX+" | Y:"+dY+" | Z:"+dZ);
return false;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java
index 78896dd650..b5cfff10e4 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java
@@ -227,7 +227,8 @@ public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_Mu
return false;
}
- if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) {
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
Logger.WARNING("BAD RETURN - 2");
return false;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java
index e721761d82..0c7067b3c0 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java
@@ -14,6 +14,7 @@ import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.util.data.ArrayUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
@@ -112,7 +113,30 @@ extends GregtechMeta_MultiBlockBase {
@Override
public boolean checkRecipe(final ItemStack aStack) {
- return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 250);
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>();
+ tBus.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tBus)) {
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null)
+ tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ ItemStack[] inputs = new ItemStack[tBusItems.size()];
+ int slot = 0;
+ for (ItemStack g : tBusItems) {
+ inputs[slot++] = g;
+ }
+ if (inputs.length > 0) {
+ log("Recipe. ["+inputs.length+"]["+getMaxParallelRecipes()+"]");
+ if (checkRecipeGeneric(inputs, (FluidStack[]) ArrayUtils.getArrayFromArrayList(this.getStoredFluids()), getMaxParallelRecipes(), getEuDiscountForParallelism(), 250, 10000)) {
+ log("Recipe 2.");
+ return true;
+ }
+ }
+
+ }
+ return false;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java
index 8b07117596..05aec14500 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java
@@ -55,12 +55,12 @@ extends GregtechMeta_MultiBlockBase {
private static final int MODE_EXTRACTOR = 5;
private static final int MODE_LASER = 6;
private static final int MODE_AUTOCLAVE = 7;
- private static final int MODE_REPLICATOR = 8;
+ private static final int MODE_FLUIDSOLIDIFY = 8;
private static final int[][] MODE_MAP = new int[][] {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}};
public static final String[] aToolTipNames = new String[9];
static {
- for (int id = 0; id < 8; id++) {
+ for (int id = 0; id < 9; id++) {
String aNEI = GT_LanguageManager.getTranslation(getRecipeMap(id).mUnlocalizedName);
aToolTipNames[id] = aNEI != null ? aNEI : "BAD NEI NAME (Report to Github)";
}
@@ -143,7 +143,17 @@ extends GregtechMeta_MultiBlockBase {
tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
}
}
-
+
+ boolean aFoundCircuitInBus = false;
+ for (ItemStack aBusItem : tBusItems) {
+ if (ItemUtils.isControlCircuit(aBusItem)) {
+ aFoundCircuitInBus = true;
+ }
+ }
+ if (!aFoundCircuitInBus) {
+ continue;
+ }
+
Object[] tempArray = tFluids.toArray(new FluidStack[] {});
FluidStack[] properArray;
properArray = ((tempArray != null && tempArray.length > 0) ? (FluidStack[]) tempArray : new FluidStack[] {});
@@ -188,7 +198,7 @@ extends GregtechMeta_MultiBlockBase {
if (!isValidBlockForStructure(tTileEntity, getTextureIndex(), true, aBlock, aMeta,
ModBlocks.blockCasings3Misc, 2)) {
- Logger.INFO("Bad centrifuge casing");
+ Logger.INFO("Bad casing");
return false;
}
++tAmount;
@@ -287,16 +297,14 @@ extends GregtechMeta_MultiBlockBase {
else if (aMode == MODE_AUTOCLAVE) {
return GT_Recipe.GT_Recipe_Map.sAutoclaveRecipes;
}
- else if (aMode == MODE_REPLICATOR) {
- return null;
+ else if (aMode == MODE_FLUIDSOLIDIFY) {
+ return GT_Recipe.GT_Recipe_Map.sFluidSolidficationRecipes;
}
else {
return null;
}
}
- private final AutoMap<ItemStack> mReplicatorOutputMap = new AutoMap<ItemStack>();
-
@Override
public boolean checkRecipeGeneric(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
@@ -311,12 +319,6 @@ extends GregtechMeta_MultiBlockBase {
Logger.MACHINE_INFO("Mode: "+tCircuitID);
- // Time to Defer to Special Handling if it's in replicator mode.
- if (tCircuitID == MODE_REPLICATOR) {
- return false;
- // return checkReplicatorRecipe(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll);
- }
-
// Reset outputs and progress stats
this.mEUt = 0;
this.mMaxProgresstime = 0;
@@ -351,7 +353,8 @@ extends GregtechMeta_MultiBlockBase {
return false;
}
- if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) {
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
Logger.MACHINE_INFO("BAD RETURN - 2|"+tCircuitID);
return false;
}
@@ -479,396 +482,6 @@ extends GregtechMeta_MultiBlockBase {
return true;
}
- private FluidStack mReplicatorFluidOutput;
- //Replicator handling
- public boolean checkReplicatorRecipe(
- ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
- int aMaxParallelRecipes, int aEUPercent,
- int aSpeedBonusPercent, int aOutputChanceRoll) {
-
- // Based on the Processing Array. A bit overkill, but very flexible.
- // Reset outputs and progress stats
- this.mEUt = 0;
- this.mMaxProgresstime = 0;
- this.mOutputItems = new ItemStack[]{};
- this.mOutputFluids = new FluidStack[]{};
- this.mReplicatorOutputMap.clear();
-
- long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
-
- if (canBufferOutputs(aItemInputs, aMaxParallelRecipes)) {
- Logger.WARNING("BAD RETURN - 2.0");
- return false;
- }
-
- ItemStack tDataOrb = null;
- ItemStack tCellStack = null;
- ItemStack tReplicatedItem;
- FluidStack tOutputFluid = null;
- FluidStack tInputFluid = null;
- final Materials tMaterial = Element.get(Behaviour_DataOrb.getDataName(tDataOrb)).mLinkedMaterials.get(0);
- final long tMass = tMaterial.getMass();
-
- // Find First Data Orb with Scan Data
- for (ItemStack I : aItemInputs) {
- if (ItemList.Tool_DataOrb.isStackEqual((Object) I, false, true) && Behaviour_DataOrb.getDataTitle(I).equals("Elemental-Scan")) {
- tDataOrb = I.copy();
- break;
- }
- }
-
- // Find First empty cell stack
- for (ItemStack I : aItemInputs) {
- if (ItemList.Cell_Empty.isStackEqual((Object) I)) {
- tCellStack = I.copy();
- break;
- }
- }
-
- // Find UUM
- for (FluidStack F : aFluidInputs) {
- if (F != null && F.isFluidEqual(Materials.UUMatter.getFluid(1L))) {
- final FluidStack tFluid = F;
- if (tFluid.amount >= tMass && tMass > 0L) {
- tInputFluid = tFluid;
- }
- }
- }
-
- // No Data Orb or UUM found?
- if (tDataOrb == null || tInputFluid == null) {
- return false;
- }
- // Temp Values
- int tEUt = (int) GT_Values.V[(int) this.getInputTier()];
- int tMaxProgresstime = (int) (tMass * 512L / (1 << tTier - 1));
- float tRecipeEUt = (tEUt * aEUPercent) / 100.0f;
- float tTotalEUt = 0.0f;
- int parallelRecipes = 0;
- ItemStack[] expectedInputs = {tDataOrb};
- FluidStack[] expectedFluidInputs = {Materials.UUMatter.getFluid(tMass)};
-
- /**
- * Magic
- */
-
- int COST_UUM = 0;
- int COST_CELLS = 0;
-
- // Determine Output Item & Cost.
- if ((tReplicatedItem = GT_OreDictUnificator.get(OrePrefixes.dust, (Object) tMaterial, 1L)) == null) {
- if ((tReplicatedItem = GT_OreDictUnificator.get(OrePrefixes.cell, (Object) tMaterial, 1L)) != null) {
- if ((tOutputFluid = GT_Utility.getFluidForFilledItem(tReplicatedItem, true)) == null) {
- if (ItemList.Cell_Empty.isStackEqual((Object) tCellStack) && this.canBufferOutputs(new ItemStack[]{tReplicatedItem}, 1)) {
- COST_CELLS = 1;
- COST_UUM = (int) tMass;
- }
- } else {
- tReplicatedItem = null;
- if (this.getDrainableStack() == null || (this.getDrainableStack().isFluidEqual(tOutputFluid) && this.getDrainableStack().amount < 16000)) {
- COST_UUM = (int) tMass;
- }
- }
- }
- } else if (this.canBufferOutputs(new ItemStack[]{tReplicatedItem}, 1)) {
- COST_UUM = (int) tMass;
- }
-
- // Costs no UUM and no valid outputs? Let's bail gracefully before we consume inputs.
- if (COST_UUM <= 0 || (tReplicatedItem == null && tOutputFluid == null)) {
- return false;
- }
-
- // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
- for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) {
- if (!isRecipeInputEqual(true, aFluidInputs, aItemInputs, expectedFluidInputs, expectedInputs)) {
- Logger.WARNING("Broke at "+parallelRecipes+"..0");
- break;
- }
- Logger.WARNING("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"..0");
- tTotalEUt += tRecipeEUt;
- }
-
- if (parallelRecipes == 0) {
- Logger.WARNING("BAD RETURN - 3.0");
- return false;
- }
-
- // Set Vars to Parralel amount
- COST_CELLS *= parallelRecipes;
-
- // Requires a cell? Ok, let's use some.
- if (COST_CELLS > 0) {
- this.depleteInput(ItemUtils.getEmptyCell(COST_CELLS));
- }
-
- // Build an output map, for simplicity.
- for (int r=0;r<parallelRecipes;r++) {
- this.mReplicatorOutputMap.put(ItemUtils.getSimpleStack(tReplicatedItem, 1));
- }
-
- // -- Try not to fail after this point - inputs have already been consumed! --
- ItemStack[] mBuiltOutput = new ItemStack[this.mReplicatorOutputMap.size()];
- int aIndex = 0;
- for (ItemStack i : this.mReplicatorOutputMap) {
- mBuiltOutput[aIndex++] = i;
- }
-
-
- // Convert speed bonus to duration multiplier
- // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
- aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
- float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
- this.mMaxProgresstime = (int)(tMaxProgresstime * tTimeFactor);
-
- this.mEUt = (int)Math.ceil(tTotalEUt);
-
- this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
-
- // Overclock
- if (this.mEUt <= 16) {
- this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
- this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
- } else {
- 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 = Math.max(1, this.mMaxProgresstime);
-
- // Collect output item types
- ItemStack[] tOutputItems = new ItemStack[1];
- for (int h = 0; h < 1; h++) {
- if (mBuiltOutput[h] != null) {
- tOutputItems[h] = mBuiltOutput[h].copy();
- tOutputItems[h].stackSize = 0;
- }
- }
-
- // Set output item stack sizes (taking output chance into account)
- for (int f = 0; f < tOutputItems.length; f++) {
- if (mBuiltOutput[f] != null && tOutputItems[f] != null) {
- for (int g = 0; g < parallelRecipes; g++) {
- tOutputItems[f].stackSize += mBuiltOutput[f].stackSize;
- }
- }
- }
-
- tOutputItems = removeNulls(tOutputItems);
-
- // Sanitize item stack size, splitting any stacks greater than max stack size
- List<ItemStack> splitStacks = new ArrayList<ItemStack>();
- for (ItemStack tItem : tOutputItems) {
- while (tItem.getMaxStackSize() < tItem.stackSize) {
- ItemStack tmp = tItem.copy();
- tmp.stackSize = tmp.getMaxStackSize();
- tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
- splitStacks.add(tmp);
- }
- }
-
- if (splitStacks.size() > 0) {
- ItemStack[] tmp = new ItemStack[splitStacks.size()];
- tmp = splitStacks.toArray(tmp);
- tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
- }
-
- // Strip empty stacks
- List<ItemStack> tSList = new ArrayList<ItemStack>();
- for (ItemStack tS : tOutputItems) {
- if (tS.stackSize > 0) tSList.add(tS);
- }
- tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
-
- // Commit outputs
- this.mOutputItems = tOutputItems;
- //this.mOutputFluids = tOutputFluids;
- updateSlots();
-
- // Play sounds (GT++ addition - GT multiblocks play no sounds)
- startProcess();
-
- Logger.WARNING("GOOD RETURN - 1.0");
- return true;
- }
-
-
- //Special Space Checking
- private boolean canBufferOutputs(ItemStack[] aInputs, int aParallelRecipes) {
- // Count slots available in output buses
- ArrayList<ItemStack> tBusStacks = new ArrayList<>();
-
- int tEmptySlots = 0;
- for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) {
- if (!isValidMetaTileEntity(tBus)) {
- continue;
- }
- final IInventory tBusInv = tBus.getBaseMetaTileEntity();
- for (int i = 0; i < tBusInv.getSizeInventory(); i++) {
- if (tBus.getStackInSlot(i) == null) {
- tEmptySlots++;
- }
- else {
- tBusStacks.add(tBus.getStackInSlot(i));
- }
- }
- }
-
- int slotsNeeded = aInputs.length;
- for (final ItemStack tRecipeOutput: aInputs) {
- if (tRecipeOutput == null) continue;
- int amount = tRecipeOutput.stackSize * aParallelRecipes;
- for (final ItemStack tBusStack : tBusStacks) {
- if (GT_Utility.areStacksEqual(tBusStack, tRecipeOutput)) {
- if (tBusStack.stackSize + amount <= tBusStack.getMaxStackSize()) {
- slotsNeeded--;
- break;
- }
- }
- }
- }
- // Enough open slots?
- if (tEmptySlots < slotsNeeded) return false;
- return true;
-
- }
-
- public FluidStack getDrainableStack() {
- return this.mReplicatorFluidOutput;
- }
-
- public FluidStack setDrainableStack(final FluidStack aFluid) {
- return this.mReplicatorFluidOutput = aFluid;
- }
-
- public boolean isRecipeInputEqual(final boolean aDecreaseStacksizeBySuccess,
- final FluidStack[] aFluidInputs,
- final ItemStack[] aInputs,
- final FluidStack[] mFluidInputs,
- final ItemStack[] mInputs) {
- return this.isRecipeInputEqual(aDecreaseStacksizeBySuccess, false, aFluidInputs, aInputs, mFluidInputs, mInputs);
- }
-
- public boolean isRecipeInputEqual(
- final boolean aDecreaseStacksizeBySuccess,
- final boolean aDontCheckStackSizes,
- final FluidStack[] aFluidInputs,
- final ItemStack[] aInputs,
- final FluidStack[] aExpectedFluidInputs,
- final ItemStack[] mExpectedInputs) {
- if (aExpectedFluidInputs.length > 0 && aFluidInputs == null) {
- return false;
- }
- for (final FluidStack tFluid : aExpectedFluidInputs) {
- if (tFluid != null) {
- boolean temp = true;
- int amt = tFluid.amount;
- for (final FluidStack aFluid : aFluidInputs) {
- if (aFluid != null && aFluid.isFluidEqual(tFluid)) {
- if (aDontCheckStackSizes) {
- temp = false;
- break;
- }
- amt -= aFluid.amount;
- if (amt < 1) {
- temp = false;
- break;
- }
- }
- }
- if (temp) {
- return false;
- }
- }
- }
- if (mExpectedInputs.length > 0 && aInputs == null) {
- return false;
- }
- for (final ItemStack tStack : mExpectedInputs) {
- if (tStack != null) {
- int amt = tStack.stackSize;
- boolean temp = true;
- for (final ItemStack aStack : aInputs) {
- if (GT_Utility.areUnificationsEqual(aStack, tStack, true)
- || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) {
- if (aDontCheckStackSizes) {
- temp = false;
- break;
- }
- amt -= aStack.stackSize;
- if (amt < 1) {
- temp = false;
- break;
- }
- }
- }
- if (temp) {
- return false;
- }
- }
- }
- if (aDecreaseStacksizeBySuccess) {
- if (aFluidInputs != null) {
- for (final FluidStack tFluid : aExpectedFluidInputs) {
- if (tFluid != null) {
- int amt = tFluid.amount;
- for (final FluidStack aFluid2 : aFluidInputs) {
- if (aFluid2 != null && aFluid2.isFluidEqual(tFluid)) {
- if (aDontCheckStackSizes) {
- final FluidStack fluidStack = aFluid2;
- fluidStack.amount -= amt;
- break;
- }
- if (aFluid2.amount >= amt) {
- final FluidStack fluidStack2 = aFluid2;
- fluidStack2.amount -= amt;
- amt = 0;
- break;
- }
- amt -= aFluid2.amount;
- aFluid2.amount = 0;
- }
- }
- }
- }
- }
- if (aInputs != null) {
- for (final ItemStack tStack : mExpectedInputs) {
- if (tStack != null) {
- int amt = tStack.stackSize;
- for (final ItemStack aStack2 : aInputs) {
- if (GT_Utility.areUnificationsEqual(aStack2, tStack, true) || GT_Utility
- .areUnificationsEqual(GT_OreDictUnificator.get(false, aStack2), tStack, true)) {
- if (aDontCheckStackSizes) {
- final ItemStack itemStack = aStack2;
- itemStack.stackSize -= amt;
- break;
- }
- if (aStack2.stackSize >= amt) {
- final ItemStack itemStack2 = aStack2;
- itemStack2.stackSize -= amt;
- amt = 0;
- break;
- }
- amt -= aStack2.stackSize;
- aStack2.stackSize = 0;
- }
- }
- }
- }
- }
- }
- return true;
- }
-
@Override
public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (mInternalMode < 2) {
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java
index 8c62937bae..c99a6e286b 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java
@@ -53,8 +53,6 @@ extends GregtechMeta_MultiBlockBase {
"Controller (Center Bottom)",
"1x Input Bus (Any top or bottom edge casing)",
"4x Output Bus (Any top or bottom edge casing)",
- "1x Maintenance Hatch (Any top or bottom edge casing)",
- "1x Muffler Hatch (Any top or bottom edge casing)",
"1x Energy Hatch (Any top or bottom edge casing)",
"18x Sieve Grate (Top and Middle 3x3)",
"Sieve Casings for the rest (35 min)"
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
index ce1fe57e63..ca6eeda207 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
@@ -56,13 +56,14 @@ extends GregtechMeta_MultiBlockBase {
"Can be configured with a screwdriver to also process Chemical Bathing",
"400% faster than using single block machines of the same voltage",
"Processes four item per voltage tier",
+ "Always requires an Input Hatch full of water to refill structure",
"Size: 5x3x7 [WxHxL] (open)",
"X X",
"X X",
"XXXXX",
"Controller (front centered)",
"1x Input Bus (Any casing)",
- "1x Input Hatch (Any casing)",
+ "2x Input Hatch (Any casing)",
"1x Output Bus (Any casing)",
"1x Energy Hatch (Any casing)",
"Wash Plant Casings for the rest"
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java
index ab7fb79c4b..96a85a3d1c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java
@@ -86,7 +86,7 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
"Speed: 120% | Eu Usage: 90% | Parallel: 8",
"Consumes 10L of " + mHotFuelName + " per second during operation",
"Constructed exactly the same as a normal EBF",
- "Use "+mCasingName+"s (10 at least!)",
+ "Use "+mCasingName+"s (9 at least!)",
"1x " + mHatchName + " (Required)",
"TAG_HIDE_HATCHES"
};
@@ -152,9 +152,14 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
Block tUsedBlock = aBaseMetaTileEntity.getBlockOffset(xDir + 1, 2, zDir);
byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir);
this.mHeatingCapacity = StaticFields59.getHeatingCapacityForCoil(tUsedBlock, tUsedMeta);
+
+ int aCasingCount = 0;
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
+
+
+
if ((i != 0) || (j != 0)) {
//Coils 1
if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) {
@@ -170,8 +175,15 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
}
//Top Layer
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j);
+ if (aCurrentBlock == ModBlocks.blockCasings3Misc && aCurrentMeta == 11) {
+ aCasingCount++;
+ }
+
final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j);
- if (!isValidBlockForStructure(tTileEntity2, CASING_TEXTURE_ID, true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j), ModBlocks.blockCasings3Misc, 11)) {
+ if (!isValidBlockForStructure(tTileEntity2, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, ModBlocks.blockCasings3Misc, 11)) {
Logger.INFO("Top Layer missing.");
return false;
}
@@ -179,9 +191,16 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
}
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
+
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j);
+ if (aCurrentBlock == ModBlocks.blockCasings3Misc && aCurrentMeta == 11) {
+ aCasingCount++;
+ }
if ((xDir + i != 0) || (zDir + j != 0)) {
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0,zDir + j);
- if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j), ModBlocks.blockCasings3Misc, 11)) {
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, ModBlocks.blockCasings3Misc, 11)) {
Logger.INFO("Bottom Layer missing.");
return false;
}
@@ -189,8 +208,7 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
}
}
- // TODO - Fix Casing Count
- return true;
+ return aCasingCount >= 9;
}
public int getMaxEfficiency(ItemStack aStack) {
@@ -282,7 +300,8 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
return false;
}
- if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) {
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
Logger.WARNING("BAD RETURN - 2");
return false;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
index c31a7c0758..9754eebbb8 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
@@ -33,6 +33,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.Gregtech
import gtPlusPlus.xmod.gregtech.common.helpers.CraftingHelper;
import gtPlusPlus.xmod.gregtech.common.helpers.autocrafter.AC_Helper_Utils;
import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase {
@@ -223,7 +224,10 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase {
}
} catch (IllegalArgumentException | IllegalAccessException e) {
}
- }
+ }
+ else if (this.mMachineMode == MODE.DISASSEMBLY) {
+ return null;
+ }
return GT_Recipe.GT_Recipe_Map.sAssemblerRecipes;
}
@@ -266,20 +270,53 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase {
}
}
+// @Override
+// public boolean checkRecipe(final ItemStack aStack) {
+//
+// final long tVoltage = this.getMaxInputVoltage();
+// final byte tTier = this.mTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+//
+// if (mMachineMode == MODE.DISASSEMBLY) {
+// return doDisassembly();
+// } else if (mMachineMode == MODE.CRAFTING) {
+// return doCrafting(aStack);
+// } else {
+// return super.checkRecipeGeneric(getMaxParallelRecipes(), 100, 200);
+// }
+// }
+
@Override
public boolean checkRecipe(final ItemStack aStack) {
-
- final long tVoltage = this.getMaxInputVoltage();
- final byte tTier = this.mTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
-
if (mMachineMode == MODE.DISASSEMBLY) {
return doDisassembly();
} else if (mMachineMode == MODE.CRAFTING) {
return doCrafting(aStack);
} else {
- return super.checkRecipeGeneric(getMaxParallelRecipes(), 100, 200);
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+ //Logger.MACHINE_INFO("1");
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>();
+ tBus.mRecipeMap = getRecipeMap();
+ //Logger.MACHINE_INFO("2");
+ if (isValidMetaTileEntity(tBus)) {
+ //Logger.MACHINE_INFO("3");
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null)
+ tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+
+ Object[] tempArray = tFluids.toArray(new FluidStack[] {});
+ FluidStack[] properArray;
+ properArray = ((tempArray != null && tempArray.length > 0) ? (FluidStack[]) tempArray : new FluidStack[] {});
+
+ //Logger.MACHINE_INFO("4");
+ if (checkRecipeGeneric(tBusItems.toArray(new ItemStack[]{}), properArray,
+ getMaxParallelRecipes(), 100, 200, 10000)) return true;
+ }
+ return false;
}
- }
+ }
@Override
public int getMaxParallelRecipes() {
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java
index 89bb00f64d..1d3591731a 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java
@@ -1,6 +1,5 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import gregtech.api.GregTech_API;
@@ -10,35 +9,45 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.LangUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
-import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_Fusion_MK4;
import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase {
-
+
public ArrayList<GT_MetaTileEntity_Hatch_Naquadah> mNaqHatches = new ArrayList<GT_MetaTileEntity_Hatch_Naquadah>();
public static String[] mCasingName = new String[5];
- public static String mHatchName = "Naquadah Fuel Hatch";
+ public static String mHatchName = "Naquadah Fuel Hatch";
+
+ private final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 13);
+ private final int META_BaseCasing = 0; //4
+ private final int META_ContainmentCasing = 15; //3
+ private final int META_Shielding = 13; //1
+ private final int META_PipeCasing = 1; //4
+ private final int META_IntegralCasing = 6; //0
+ private final int META_ContainmentChamberCasing = 2; //4
public GregtechMTE_LargeNaqReactor(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
- mCasingName[0] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 0);
- mCasingName[1] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 1);
- mCasingName[2] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 2);
- mCasingName[3] = ItemUtils.getLocalizedNameOfBlock(getCasing(3), 15);
- mCasingName[4] = ItemUtils.getLocalizedNameOfBlock(getCasing(3), 3);
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 969);
+ mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
+ mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
+ mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
+ mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
+ mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
+ mHatchName = LangUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 969);
}
public GregtechMTE_LargeNaqReactor(String aName) {
@@ -51,22 +60,22 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase {
public String[] getTooltip() {
if (mCasingName[0].toLowerCase().contains(".name")) {
- mCasingName[0] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 0);
+ mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
}
if (mCasingName[1].toLowerCase().contains(".name")) {
- mCasingName[1] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 1);
+ mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
}
if (mCasingName[2].toLowerCase().contains(".name")) {
- mCasingName[2] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 2);
+ mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
}
if (mCasingName[3].toLowerCase().contains(".name")) {
- mCasingName[3] = ItemUtils.getLocalizedNameOfBlock(getCasing(3), 15);
+ mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
}
if (mCasingName[4].toLowerCase().contains(".name")) {
- mCasingName[4] = ItemUtils.getLocalizedNameOfBlock(getCasing(3), 3);
+ mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
}
if (mHatchName.toLowerCase().contains(".name")) {
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 969);
+ mHatchName = LangUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 969);
}
return new String[]{
"Naquadah reacts violently with potassium, ",
@@ -83,18 +92,18 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase {
"1x " + mHatchName + " (Any bottom layer casing)",
"1x " + "Maintenance Hatch" + " (Any bottom layer side casing)",
"1x " + "Energy Hatch" + " (Any top layer casing)",
-
- };
+
+ };
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex,
boolean aActive, boolean aRedstone) {
return aSide == aFacing
- ? new ITexture[]{BlockIcons.CASING_BLOCKS[TAE.getIndexFromPage(2, 3)],
+ ? new ITexture[]{BlockIcons.CASING_BLOCKS[TAE.getIndexFromPage(3, 0)],
new GT_RenderedTexture(aActive
? TexturesGtBlock.Overlay_Machine_Controller_Default_Active
- : TexturesGtBlock.Overlay_Machine_Controller_Default)}
- : new ITexture[]{BlockIcons.CASING_BLOCKS[TAE.getIndexFromPage(2, 3)]};
+ : TexturesGtBlock.Overlay_Machine_Controller_Default)}
+ : new ITexture[]{BlockIcons.CASING_BLOCKS[TAE.getIndexFromPage(3, 0)]};
}
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
@@ -111,13 +120,13 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase {
}
public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
+ return aFacing == 1;
}
public boolean checkRecipe(ItemStack aStack) {
return false;
}
-
+
@Override
public int getMaxParallelRecipes() {
return 1;
@@ -140,7 +149,7 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase {
public String getSound() {
return (String) GregTech_API.sSoundList.get(Integer.valueOf(212));
}
-
+
private Block getCasing(int casingID) {
if (casingID == 1) {
return ModBlocks.blockCasingsMisc;
@@ -155,12 +164,12 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase {
return ModBlocks.blockCasings4Misc;
}
else {
- return ModBlocks.blockCasingsMisc;
+ return ModBlocks.blockCasingsTieredGTPP;
}
}
-
-
-
+
+
+
//Casing3, Meta 10 - "Grate Machine Casing");
//Casing2, Meta 0 - "Solid Steel Machine Casing"
//Casing2, Meta 5 - "Assembling Line Casing"
@@ -168,185 +177,295 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase {
//Magic Glass - blockAlloyGlass
public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- int r;
- int i;
- IGregTechTileEntity tTileEntity;
- if (xDir != 0) {
- for (r = 0; r <= 16; ++r) {
- i = r * xDir;
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(0, 0, i);
- if (i != 0
- && (aBaseMetaTileEntity.getBlockOffset(0, 0, i) != getCasing(3)
- || aBaseMetaTileEntity.getMetaIDOffset(0, 0, i) != 3)
- && r == 1 && !this.addNaquadahHatchToMachineInput(tTileEntity, TAE.getIndexFromPage(2, 3))) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getBlockOffset(0, -1, i) != getCasing(3) || aBaseMetaTileEntity.getMetaIDOffset(0, -1, i) != 15) {
- return false;
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(0, -2, i);
- if (!this.addMaintenanceToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))
- && !this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- if (aBaseMetaTileEntity.getBlockOffset(0, -2, i) != getCasing(4)) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getMetaIDOffset(0, -2, i) != 0) {
- return false;
- }
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 1, i);
- if (!this.addDynamoToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir, 1, i) != getCasing(4)) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir, 1, i) != 0) {
- return false;
- }
- }
-
- if (i != 0 && (aBaseMetaTileEntity.getBlockOffset(xDir, 0, i) != getCasing(4)
- || aBaseMetaTileEntity.getMetaIDOffset(xDir, 0, i) != 1)) {
- return false;
- }
-
- if (i != 0 && (aBaseMetaTileEntity.getBlockOffset(xDir, -1, i) != getCasing(4)
- || aBaseMetaTileEntity.getMetaIDOffset(xDir, -1, i) != 2)) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getBlockOffset(xDir * 2, 0, i) != getCasing(3)
- || aBaseMetaTileEntity.getMetaIDOffset(xDir * 2, 0, i) != 3) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getBlockOffset(xDir * 2, -1, i) != getCasing(3) || aBaseMetaTileEntity.getMetaIDOffset(xDir * 2, -1, i) != 15) {
- return false;
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir * 2, -2, i);
- if (!this.addMaintenanceToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))
- && !this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir * 2, -2, i) != getCasing(4)) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir * 2, -2, i) != 0) {
- return false;
- }
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, -2, i);
- if (!this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0)) && this.addOutputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- return r > 0 && this.mEnergyHatches.size() > 0;
- }
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 4;
+
+ // Counts for all Casing Types
+ int aBaseCasingCount = 0;
+ int aContainmentCasingCount = 0;
+ int aShieldingCount = 0;
+ int aPipeCount = 0;
+ int aIntegralCasingCount = 0;
+ int aContainmentChamberCount = 0;
+
+ // Bottom Layer
+ aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, -7, xDir, zDir);
+ log("Bottom Layer is Valid. Moving to Layer 1.");
+
+ // Layer 1
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -6, xDir, zDir);
+ aIntegralCasingCount += checkIntegralRing(aBaseMetaTileEntity, getCasing(0), this.META_IntegralCasing, -6, xDir, zDir);
+ aContainmentChamberCount += checkContainmentRing(aBaseMetaTileEntity, getCasing(4), this.META_ContainmentChamberCasing, -6, xDir, zDir);
+ log("Layer 1 is Valid. Moving to Layer 2.");
+
+ // Layer 2
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -5, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -5, xDir, zDir);
+ log("Layer 2 is Valid. Moving to Layer 3.");
+
+ // Layer 3
+ aContainmentCasingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(3), this.META_ContainmentCasing, -4, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -4, xDir, zDir);
+ log("Layer 3 is Valid. Moving to Layer 4.");
+
+ // Layer 4
+ aContainmentCasingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(3), this.META_ContainmentCasing, -3, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -3, xDir, zDir);
+ log("Layer 4 is Valid. Moving to Layer 5.");
+
+ // Layer 5
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -2, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -2, xDir, zDir);
+ log("Layer 5 is Valid. Moving to Layer 6.");
+
+ // Layer 6
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -1, xDir, zDir);
+ aIntegralCasingCount += checkIntegralRing(aBaseMetaTileEntity, getCasing(0), this.META_IntegralCasing, -1, xDir, zDir);
+ aContainmentChamberCount += checkContainmentRing(aBaseMetaTileEntity, getCasing(4), this.META_ContainmentChamberCasing, -1, xDir, zDir);
+ log("Layer 6 is Valid. Moving to Top Layer.");
+
+ // Top Layer
+ aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, 0, xDir, zDir);
+
+ log("Found "+aBaseCasingCount+" "+mCasingName[0]+"s");
+ log("Found "+aShieldingCount+" "+mCasingName[4]+"s");
+ log("Found "+aPipeCount+" "+mCasingName[1]+"s");
+ log("Found "+aContainmentCasingCount+" "+mCasingName[3]+"s");
+ log("Found "+aIntegralCasingCount+" "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s");
+ log("Found "+aContainmentChamberCount+" "+mCasingName[2]+"s");
+
+ // Try mesage player
+ String aOwnerName = this.getBaseMetaTileEntity().getOwnerName();
+ EntityPlayer aOwner = null;
+ if (aOwnerName != null && aOwnerName.length() > 0) {
+ aOwner = PlayerUtils.getPlayer(aOwnerName);
+ }
+
+ if (aShieldingCount != 128) {
+ log("Not enough "+mCasingName[4]+"s, require 128.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[4]+"s, require 128.");
+ }
+ return false;
+ }
+ if (aPipeCount != 20) {
+ log("Not enough "+mCasingName[1]+"s, require 20.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[1]+"s, require 20.");
+ }
+ return false;
+ }
+ if (aContainmentCasingCount != 64) {
+ log("Not enough "+mCasingName[3]+"s, require 64.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[3]+"s, require 64.");
+ }
+ return false;
+ }
+ if (aContainmentChamberCount != 42) {
+ log("Not enough "+mCasingName[2]+"s, require 42.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[2]+"s, require 42.");
}
+ return false;
+ }
+ if (aBaseCasingCount < 140) {
+ log("Not enough "+mCasingName[0]+"s, require 140 at a minimum.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[0]+"s, require 140 at a minimum.");
+ }
+ return false;
+ }
+ if (aIntegralCasingCount != 48) {
+ log("Not enough "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s, require 48.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s, require 48.");
+ }
+ return false;
+ }
+ log("LNR Formed.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Large Naquadah Reactor has formed successfully.");
+ }
+ return true;
+ }
+
+ public boolean addNaquadahHatchToMachineInput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
} else {
- for (r = 0; r <= 16; ++r) {
- i = r * -zDir;
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, 0, 0);
- if (i != 0
- && (aBaseMetaTileEntity.getBlockOffset(i, 0, 0) != getCasing(3)
- || aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0) != 3)
- && r == 1 && !this.addNaquadahHatchToMachineInput(tTileEntity, TAE.getIndexFromPage(2, 3))) {
- return false;
- }
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Naquadah) {
+ this.updateTexture(aMetaTileEntity, aBaseCasingIndex);
+ return this.mNaqHatches.add((GT_MetaTileEntity_Hatch_Naquadah) aMetaTileEntity);
+ } else {
+ return false;
+ }
+ }
+ }
- if (aBaseMetaTileEntity.getBlockOffset(i, -1, 0) != getCasing(3) || aBaseMetaTileEntity.getMetaIDOffset(i, -1, 0) != 15) {
- return false;
+ public int checkEntireLayer(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -4; x < 5; x++) {
+ for (int z = -4; z < 5; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) {
+ continue;
+ }
+ // Skip controller
+ if (aY == 0 && x == 0 && z == 0) {
+ continue;
}
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, 0);
- if (!this.addMaintenanceToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))
- && !this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- if (aBaseMetaTileEntity.getBlockOffset(i, -2, 0) != getCasing(4)) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, 0) != 0) {
- return false;
- }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
}
+ }
+ }
+ return aCasingCount;
+ }
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, 1, zDir);
- if (!this.addDynamoToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- if (aBaseMetaTileEntity.getBlockOffset(i, 1, zDir) != getCasing(4)) {
- return false;
+ public int checkOuterRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -4; x < 5; x++) {
+ for (int z = -4; z < 5; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) {
+ continue;
+ }
+
+ // If we are on the 5x5 ring, proceed
+ if ((x > -4 && x < 4 ) && (z > -4 && z < 4)) {
+ if ((x == 3 && z == 3) || (x == -3 && z == -3) || (x == 3 && z == -3) || (x == -3 && z == 3)) {
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
}
-
- if (aBaseMetaTileEntity.getMetaIDOffset(i, 1, zDir) != 0) {
- return false;
+ else {
+ continue;
}
}
- if (i != 0 && (aBaseMetaTileEntity.getBlockOffset(i, 0, zDir) != getCasing(4)
- || aBaseMetaTileEntity.getMetaIDOffset(i, 0, zDir) != 1)) {
- return false;
- }
-
- if (i != 0 && (aBaseMetaTileEntity.getBlockOffset(i, -1, zDir) != getCasing(4)
- || aBaseMetaTileEntity.getMetaIDOffset(i, -1, zDir) != 2)) {
- return false;
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
}
-
- if (aBaseMetaTileEntity.getBlockOffset(i, 0, zDir * 2) != getCasing(3)
- || aBaseMetaTileEntity.getMetaIDOffset(i, 0, zDir * 2) != 3) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getBlockOffset(i, -1, zDir * 2) != getCasing(3) || aBaseMetaTileEntity.getMetaIDOffset(i, -1, zDir * 2) != 15) {
- return false;
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir * 2);
- if (!this.addMaintenanceToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))
- && !this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- if (aBaseMetaTileEntity.getBlockOffset(i, -2, zDir * 2) != getCasing(4)) {
- return false;
+ }
+ }
+ return aCasingCount;
+ }
+ public int checkIntegralRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -3; x < 4; x++) {
+ for (int z = -3; z < 4; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 3 && z == 3) || (x == -3 && z == -3) || (x == 3 && z == -3) || (x == -3 && z == 3)) {
+ continue;
+ }
+
+ // If we are on the 5x5 ring, proceed
+ if ((x > -3 && x < 3 ) && (z > -3 && z < 3)) {
+ if ((x == 2 && z == 2) || (x == -2 && z == -2) || (x == 2 && z == -2) || (x == -2 && z == 2)) {
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
}
-
- if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, zDir * 2) != 0) {
- return false;
+ else {
+ continue;
}
}
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir);
- if (!this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0)) && this.addOutputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- return r > 0 && this.mEnergyHatches.size() > 0;
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
}
- }
+ }
}
-
- return false;
+ return aCasingCount;
}
- public boolean addNaquadahHatchToMachineInput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
- if (aTileEntity == null) {
- return false;
- } else {
- IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity == null) {
- return false;
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Naquadah) {
-
- try {
- GregtechMetaTileEntity_Adv_Fusion_MK4.mUpdateHatchTexture.invoke((GT_MetaTileEntity_Hatch) aMetaTileEntity, aBaseCasingIndex);
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ public int checkPipes(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -1; x < 2; x++) {
+ for (int z = -1; z < 2; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 1 && z == 1) || (x == -1 && z == -1) || (x == 1 && z == -1) || (x == -1 && z == 1) || (x == 0 && z == 0)) {
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Pipe has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ };
}
-
- //((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
- return this.mNaqHatches.add((GT_MetaTileEntity_Hatch_Naquadah) aMetaTileEntity);
- } else {
- return false;
- }
+ }
}
- }
+ return aCasingCount;
+ }
+
+ public int checkContainmentRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -2; x < 3; x++) {
+ for (int z = -2; z < 3; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 2 && z == 2) || (x == -2 && z == -2) || (x == 2 && z == -2) || (x == -2 && z == 2)) {
+ continue;
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
public int getMaxEfficiency(ItemStack aStack) {
return 10000;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java
index 4e5c95ad73..3592475a5c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java
@@ -2,6 +2,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import gregtech.api.GregTech_API;
import gregtech.api.enums.TAE;
@@ -16,6 +17,7 @@ import gregtech.api.util.Recipe_GT;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.item.Item;
@@ -29,7 +31,7 @@ extends GregtechMeta_MultiBlockBase {
private int mHeatingCapacity = 0;
private int mMode = 0;
private boolean isUsingControllerCircuit = false;
- private static final Item circuit = CI.getNumberedCircuit(0).getItem();
+ private static Item circuit;
public GregtechMetaTileEntity_AlloyBlastSmelter(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -46,7 +48,7 @@ extends GregtechMeta_MultiBlockBase {
@Override
public String getMachineType() {
- return "Alloy Smelter";
+ return "Fluid Alloy Cooker";
}
@Override
@@ -104,6 +106,9 @@ extends GregtechMeta_MultiBlockBase {
public boolean isCorrectMachinePart(final ItemStack aStack) {
if (this.getBaseMetaTileEntity().isServerSide()) {
//Get Controller Circuit
+ if (circuit == null) {
+ circuit = CI.getNumberedCircuit(0).getItem();
+ }
if (aStack != null && aStack.getItem() == circuit) {
this.mMode = aStack.getItemDamage();
return this.isUsingControllerCircuit = true;
@@ -197,6 +202,14 @@ extends GregtechMeta_MultiBlockBase {
}
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)};
+ List<ItemStack> tOutPutItems = new ArrayList<ItemStack>();
+ for (ItemStack tOut : tRecipe.mOutputs) {
+ if (ItemUtils.checkForInvalidItems(tOut)) {
+ tOutPutItems.add(tOut);
+ }
+ }
+ if (tOutPutItems.size() > 0)
+ this.mOutputItems = tOutPutItems.toArray(new ItemStack[tOutPutItems.size()]);
this.updateSlots();
return true;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
index ed6c913e6b..6070e3604a 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
@@ -2,7 +2,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
import java.util.ArrayList;
-import gregtech.GT_Mod;
import gregtech.api.enums.Dyes;
import gregtech.api.enums.TAE;
import gregtech.api.enums.Textures;
@@ -10,7 +9,6 @@ import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
@@ -25,7 +23,6 @@ import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.item.chemistry.IonParticles;
import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.block.Block;
@@ -37,8 +34,6 @@ import net.minecraftforge.fluids.FluidStack;
public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBase {
- public long mEUStore;
-
public GregtechMetaTileEntity_Cyclotron(int aID, String aName, String aNameRegional, int tier) {
super(aID, aName, aNameRegional);
}
@@ -95,13 +90,11 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas
@Override
public void saveNBTData(NBTTagCompound aNBT) {
- aNBT.setLong("mEUStore", mEUStore);
super.saveNBTData(aNBT);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
- mEUStore = aNBT.getLong("mEUStore");
super.loadNBTData(aNBT);
}
@@ -395,113 +388,6 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas
}
@Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if (aBaseMetaTileEntity.isServerSide()) {
- if (mEfficiency < 0)
- mEfficiency = 0;
-
- //Time Counter
- this.mTotalRunTime++;
- this.fixAllMaintenanceIssue();
-
- onRunningTick(null);
-
- boolean aFormCheck = (aTick % 100 == 0 ? checkMultiblock(aBaseMetaTileEntity, mInventory[1]) : true);
-
-
-
- if (mRunningOnLoad && aFormCheck) {
- this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
- checkRecipe(mInventory[1]);
- }
- if (--mUpdate == 0 || --mStartUpCheck == 0) {
- mInputHatches.clear();
- mInputBusses.clear();
- mOutputHatches.clear();
- mOutputBusses.clear();
- mDynamoHatches.clear();
- mEnergyHatches.clear();
- mMufflerHatches.clear();
- mMaintenanceHatches.clear();
- mChargeHatches.clear();
- mDischargeHatches.clear();
- mControlCoreBus.clear();
- mAirIntakes.clear();
- mMultiDynamoHatches.clear();
- mMachine = aFormCheck;
- }
- if (mStartUpCheck < 0) {
- if (mMachine) {
- if (this.mEnergyHatches != null) {
- for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches)
- if (isValidMetaTileEntity(tHatch)) {
- if (aBaseMetaTileEntity.getStoredEU() + (2048*4) < maxEUStore()
- && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits((2048*4), false)) {
- aBaseMetaTileEntity.increaseStoredEnergyUnits((2048*4), true);
- }
- }
- }
- if (this.mEUStore <= 0 && mMaxProgresstime > 0) {
- stopMachine();
- }
- if (getRepairStatus() > 0) {
- if (mMaxProgresstime > 0) {
- this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true);
- if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) {
- if (mOutputItems != null)
- for (ItemStack tStack : mOutputItems) if (tStack != null) addOutput(tStack);
- if (mOutputFluids != null)
- for (FluidStack tStack : mOutputFluids) if (tStack != null) addOutput(tStack);
- mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000)));
- mOutputItems = null;
- mProgresstime = 0;
- mMaxProgresstime = 0;
- mEfficiencyIncrease = 0;
- if (mOutputFluids != null && mOutputFluids.length > 0) {
- try {
- GT_Mod.instance.achievements.issueAchivementHatchFluid(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), mOutputFluids[0]);
- } catch (Exception e) {
- }
- }
- this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
- if (aBaseMetaTileEntity.isAllowedToWork())
- checkRecipe(mInventory[1]);
- }
- } else {
- if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) {
- turnCasingActive(mMaxProgresstime > 0);
- if (aBaseMetaTileEntity.isAllowedToWork()) {
- this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
- if (checkRecipe(mInventory[1])) {
- if (this.mEUStore < this.mLastRecipe.mSpecialValue) {
- mMaxProgresstime = 0;
- turnCasingActive(false);
- }
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(this.mLastRecipe.mSpecialValue, true);
- }
- }
- if (mMaxProgresstime <= 0)
- mEfficiency = Math.max(0, mEfficiency - 1000);
- }
- }
- } else {
- this.mLastRecipe = null;
- stopMachine();
- }
- } else {
- turnCasingActive(false);
- this.mLastRecipe = null;
- stopMachine();
- }
- }
- //doRandomMaintenanceDamage();
- aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8)
- | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64));
- aBaseMetaTileEntity.setActive(mMaxProgresstime > 0);
- }
- }
-
- @Override
public boolean onRunningTick(ItemStack aStack) {
if (this.mOutputBusses.size() > 0) {
for (GT_MetaTileEntity_Hatch_OutputBus g : this.mOutputBusses) {
@@ -529,10 +415,9 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas
}
}
}
- }
- PollutionUtils.addPollution(getBaseMetaTileEntity(), this.getPollutionPerTick(aStack));
-
- return true;
+ }
+ this.fixAllMaintenanceIssue();
+ return super.onRunningTick(aStack);
}
@@ -570,7 +455,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas
return new String[]{
"COMET - Compact Cyclotron MK "+tier,
"EU Required: "+powerRequired+"EU/t",
- "Stored EU: "+mEUStore+" / "+maxEUStore()};
+ "Stored EU: "+this.getEUVar()+" / "+maxEUStore()};
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
index 031bf16b17..cb9c68b53c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
@@ -549,7 +549,8 @@ public class GregtechMetaTileEntity_IndustrialFishingPond extends GregtechMeta_M
ItemStack[] mFishOutput = generateLoot(this.mMode);
mFishOutput = removeNulls(mFishOutput);
GT_Recipe g = new Recipe_GT(true, new ItemStack[] {}, mFishOutput, null, new int[] {}, aFluidInputs, mOutputFluids, 200, 16, 0);
- if (!this.canBufferOutputs(g, aMaxParallelRecipes)) {
+ aMaxParallelRecipes = this.canBufferOutputs(g, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
log("No Space");
return false;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java
index 8e3e40b3ab..af4132f5ff 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java
@@ -12,6 +12,7 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
@@ -22,6 +23,7 @@ import gregtech.api.util.Recipe_GT;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.item.chemistry.RocketFuels;
+import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.material.MISC_MATERIALS;
import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
@@ -52,6 +54,8 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
private final static int CASING_ID = TAE.getIndexFromPage(3, 11);
+
+ public ArrayList<GT_MetaTileEntity_Hatch> mAllDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch>();
public GregtechMetaTileEntity_LargeRocketEngine(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -91,13 +95,13 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
"Supply Rocket Fuels and 1000L(3000L boosted) of "+mLubricantName+" per hour to run",
"Supply 4L of "+mCoolantName+" per second per 2100 eu/t to boost output (optional)",
"Consumes upto 37500L of Air per second",
- "Produces between 4K and 32K eu/t depending on how much fuel is fed",
- "When producing more then 16K eu/t fuel wil be consume less efficiently (3x - 1.5x eff)",
+ "Produces as much energy as you put fuel in becomes less ",
+ "When producing more then 30K eu/t fuel wil be consume less efficiently (3x - 1.5x eff@55Keu/t)",
"Boosting will produce 3x the amount of power but will consume 3x fuel",
"Size(WxHxD): 3x3x10, Controller (front centered)",
"3x3x10 of Stable "+mCasingName+" (hollow, Min 64!)",
"8x "+mGearboxName+" inside the Hollow Casing",
- "1x Dynamo Hatch (Top Middle, Max 8)",
+ "1x Dynamo Hatch (Top Middle, Max 8) suports tectech dynamos",
"8x Air Intake Hatch (one of the Casings next to a Gear Box, top row allowed)",
"2x Input Hatch (Rocket Fuel/Booster) (one of the Casings next to a Gear Box, top row not allowed)",
"1x Maintenance Hatch (one of the Casings next to a Gear Box)",
@@ -149,21 +153,20 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
@Override
public boolean checkRecipe(final ItemStack aStack) {
- if (this.mEfficiency < 0)
log(" geting air");
final ArrayList<FluidStack> tFluids = this.getStoredFluids();
FluidStack air = FluidUtils.getFluidStack("air", 1);
log(" geting air 2");
int aircount = getAir() ;
- if (aircount < euProduction/32) {
+ if (aircount < euProduction/100) {
log(" not enough air");
//log("Not Enough Air to Run "+aircount);
return false;
}
else {
log(" no boost");
- boolean hasIntakeAir = this.depleteInput(FluidUtils.getFluidStack(air, euProduction/32));
+ boolean hasIntakeAir = this.depleteInput(FluidUtils.getFluidStack(air, euProduction/100));
if (!hasIntakeAir) {
//log("Could not consume Air to run "+aircount);
freeFuelTicks = 0;
@@ -221,7 +224,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
this.mEUt = (int) ((this.mEfficiency < 2000) ? 0 : GT_Values.V[5]<<1);
this.mProgresstime = 1;
this.mMaxProgresstime = 1;
- this.mEfficiencyIncrease = euProduction/4000;
+ this.mEfficiencyIncrease = euProduction/2000;
return true;
//log("");
}
@@ -229,7 +232,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
} else
{
- this.mEfficiencyIncrease = euProduction/4000;
+ this.mEfficiencyIncrease = euProduction/2000;
freeFuelTicks--;
this.mEUt = (int) ((this.mEfficiency < 1000) ? 0 : GT_Values.V[5]<<1);
this.mProgresstime = 1;
@@ -259,17 +262,9 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
log("amount: "+amount);
log("Value: "+value);
int energy = value * amount;
- //engine needs at leas 2A EV of fuel to waork
- if (energy < 40000){
- log("not enough fuel to work");
- return false;
- }
- //limits engine to LuV fuel consumption
- if (energy > 427500){
- amount = (int) ((double) 427500/value);
- energy = 427500;
- }
log("amount2: "+amount);
+ if (amount < 5)
+ return false;
FluidStack tLiquid = FluidUtils.getFluidStack(aFuel.mFluidInputs[0], (this.boostEu ? amount * 3 : amount));
if (!this.depleteInput(tLiquid)) {
log("could not deplete fluid");
@@ -286,8 +281,16 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
public void setEUProduction(int energy){
energy /= 20;
- // 3x eff unles it gose above 16K eu/t
- double energyEfficiency = energy > 5500 ? ((double) Math.sqrt(5500)/Math.sqrt(energy) * energy) : energy;
+ double energyEfficiency;
+ if (energy > 10000) {
+ energyEfficiency = ((double) Math.cbrt(10000)/Math.cbrt(energy));
+ if (energy >= 40000)
+ energyEfficiency *= ((double) Math.cbrt(40000)/Math.cbrt(energy));
+ energyEfficiency *= energy;
+ }
+ else {
+ energyEfficiency = energy;
+ }
euProduction = (int) ((double) energyEfficiency * 1.84);
if (this.boostEu)
euProduction *= 3;
@@ -313,6 +316,10 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
int tX = getBaseMetaTileEntity().getXCoord();
int tY = getBaseMetaTileEntity().getYCoord();
int tZ = getBaseMetaTileEntity().getZCoord();
+
+ this.mTecTechDynamoHatches.clear();
+ this.mAllDynamoHatches.clear();
+
final int MAX_LENGTH = 8;
for (int length=0;length<MAX_LENGTH;length++) {
if(getBaseMetaTileEntity().getBlockAtSideAndDistance(tSide, length+1) != getGearboxBlock()) {
@@ -425,8 +432,14 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
this.updateTexture(tTileEntity, getCasingTextureIndex());
}
}
+
+ mAllDynamoHatches.addAll(this.mDynamoHatches);
+
+ if (LoadedMods.TecTech) {
+ mAllDynamoHatches.addAll(this.mTecTechDynamoHatches);
+ }
- if (this.mDynamoHatches.size() <= 0 || this.mDynamoHatches.isEmpty()) {
+ if (this.mAllDynamoHatches.size() <= 0 || this.mAllDynamoHatches.isEmpty()) {
log("Wrong count for Dynamos");
return false;
}
@@ -446,7 +459,85 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
log("Formed Rocket Engine.");
return true;
- }
+ }
+
+ @Override
+ public boolean addEnergyOutput(long aEU) {
+ if (aEU <= 0) {
+ return true;
+ }
+ if (mAllDynamoHatches.size() > 0) {
+ return addEnergyOutputMultipleDynamos(aEU, true);
+ }
+ return false;
+ }
+
+
+ public boolean addEnergyOutputMultipleDynamos(long aEU, boolean aAllowMixedVoltageDynamos) {
+ int injected = 0;
+ long totalOutput = 0;
+ long aFirstVoltageFound = -1;
+ boolean aFoundMixedDynamos = false;
+ for (GT_MetaTileEntity_Hatch aDynamo : mAllDynamoHatches) {
+ if( aDynamo == null ) {
+ return false;
+ }
+ if (isValidMetaTileEntity(aDynamo)) {
+ long aVoltage = aDynamo.maxEUOutput();
+ long aTotal = aDynamo.maxAmperesOut() * aVoltage;
+ // Check against voltage to check when hatch mixing
+ if (aFirstVoltageFound == -1) {
+ aFirstVoltageFound = aVoltage;
+ }
+ else {
+ /**
+ * Calcualtes overclocked ness using long integers
+ * @param aEUt - recipe EUt
+ * @param aDuration - recipe Duration
+ * @param mAmperage - should be 1 ?
+ */
+ //Long time calculation
+ if (aFirstVoltageFound != aVoltage) {
+ aFoundMixedDynamos = true;
+ }
+ }
+ totalOutput += aTotal;
+ }
+ }
+
+ if (totalOutput < aEU || (aFoundMixedDynamos && !aAllowMixedVoltageDynamos)) {
+ explodeMultiblock();
+ return false;
+ }
+
+ long leftToInject;
+ //Long EUt calculation
+ long aVoltage;
+ //Isnt too low EUt check?
+ int aAmpsToInject;
+ int aRemainder;
+
+ //xEUt *= 4;//this is effect of everclocking
+ for (GT_MetaTileEntity_Hatch aDynamo : mAllDynamoHatches) {
+ if (isValidMetaTileEntity(aDynamo)) {
+ leftToInject = aEU - injected;
+ aVoltage = aDynamo.maxEUOutput();
+ aAmpsToInject = (int) (leftToInject / aVoltage);
+ aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage));
+ long powerGain;
+ for (int i = 0; i < Math.min(aDynamo.maxAmperesOut(), aAmpsToInject + 1); i++) {
+ if (i == Math.min(aDynamo.maxAmperesOut(), aAmpsToInject)){
+ powerGain = aRemainder;
+ }else{
+ powerGain = aVoltage;
+ }
+ aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(powerGain, false);
+ injected += powerGain;
+ }
+ }
+ }
+ return injected > 0;
+ }
public Block getCasingBlock() {
return ModBlocks.blockCasings4Misc;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java
index a05ecca551..a7afaa6b56 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java
@@ -232,7 +232,7 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase {
}
public boolean checkForWater() {
-
+
// Get Facing direction
IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity();
int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
@@ -340,7 +340,7 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase {
if (aBaseMetaTileEntity.isClientSide()) {
this.mLevel = getCasingTierOnClientSide();
}
-
+
}
@Override
@@ -379,9 +379,15 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase {
return false;
}
- if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes, false)) {
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
return false;
}
+ if (tRecipe.mInputs.length > 0) {
+ for (ItemStack aInputToConsume : tRecipe.mInputs) {
+ this.depleteInput(aInputToConsume);
+ }
+ }
// -- Try not to fail after this point - inputs have already been consumed! --
@@ -475,7 +481,7 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase {
}
return false;
}
-
+
@SideOnly(Side.CLIENT)
private final int getCasingTierOnClientSide() {
if (this == null || this.getBaseMetaTileEntity().getWorld() == null) {
@@ -497,7 +503,7 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase {
return 0;
}
}
-
+
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
index 87f8d81bb2..60c0ade62f 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
@@ -37,6 +37,7 @@ import gtPlusPlus.core.item.chemistry.AgriculturalChem;
import gtPlusPlus.core.item.chemistry.GenericChem;
import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
@@ -51,33 +52,11 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
-
+
private int mSolidCasingTier = 0;
private int mMachineCasingTier = 0;
private int mPipeCasingTier = 0;
- private int mCoilTier = 0;
-
-
- /**
- * Internal Recipe Map which holds the actual recipes, backed by the real map, shown by NEI.
- */
- private static final GT_Recipe_Map mFluidChemicalReactorRecipes = new GT_Recipe_Map(
- new HashSet<GT_Recipe>(100),
- "gt.recipe.fluidchemicaleactor",
- "Chemical Plant",
- null,
- CORE.MODID+":textures/gui/FluidReactor",
- 0,
- 0,
- 0,
- 2,
- 1,
- "Tier: ",
- 1,
- E,
- true,
- false);
-
+ private int mCoilTier = 0;
public GregtechMTE_ChemicalPlant(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -173,15 +152,13 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
@Override
public GT_Recipe.GT_Recipe_Map getRecipeMap() {
- if (mFluidChemicalReactorRecipes.mRecipeList.isEmpty() || mFluidChemicalReactorRecipes.mRecipeList.size() != Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList.size()) {
- if (!mFluidChemicalReactorRecipes.mRecipeList.isEmpty()) {
- mFluidChemicalReactorRecipes.mRecipeList.clear();
- }
- for (Recipe_GT i : Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList) {
- mFluidChemicalReactorRecipes.add(i);
- }
+ return Recipe_GT.Gregtech_Recipe_Map.sChemicalPlant_GT;
+ }
+
+ public static void generateRecipes() {
+ for (Recipe_GT i : Recipe_GT.Gregtech_Recipe_Map.sChemicalPlantRecipes.mRecipeList) {
+ Recipe_GT.Gregtech_Recipe_Map.sChemicalPlant_GT.add(i);
}
- return mFluidChemicalReactorRecipes;
}
@Override
@@ -761,7 +738,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
public String getCustomGUIResourceName() {
return null;
}
-
+
// Same speed bonus as pyro oven
public int getSpeedBonus() {
return 50 * (this.mCoilTier - 2);
@@ -790,14 +767,14 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
public boolean checkRecipe(final ItemStack aStack) {
return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), getSpeedBonus());
}
-
-
+
+
@Override
public boolean checkRecipeGeneric(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) {
-
+
// Based on the Processing Array. A bit overkill, but very flexible.
// Reset outputs and progress stats
@@ -810,33 +787,34 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
long tEnergy = getMaxInputEnergy();
log("Running checkRecipeGeneric(0)");
-
+
GT_Recipe tRecipe = findRecipe(
getBaseMetaTileEntity(), mLastRecipe, false,
gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
-
-
+
+
log("Running checkRecipeGeneric(1)");
// Remember last recipe - an optimization for findRecipe()
this.mLastRecipe = tRecipe;
-
-
+
+
if (tRecipe == null) {
log("BAD RETURN - 1");
return false;
}
-
+
if (tRecipe.mSpecialValue > this.mSolidCasingTier) {
log("solid tier is too low");
return false;
}
-
-
- if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) {
+
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
log("BAD RETURN - 2");
return false;
}
-
+
// checks if it has enough catalyst durabilety
ArrayList<ItemStack>tCatalysts = null;
int tMaxParrallelCatalyst = aMaxParallelRecipes;
@@ -846,7 +824,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
tCatalysts = new ArrayList<ItemStack>();
tMaxParrallelCatalyst = getCatalysts(aItemInputs, tCatalystRecipe, aMaxParallelRecipes,tCatalysts);
}
-
+
if (tMaxParrallelCatalyst == 0) {
log("found not enough catalists catalyst");
return false;
@@ -880,7 +858,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
log("BAD RETURN - 3");
return false;
}
-
+
if (tCatalysts != null) {
log("damaging catalyst");
for (int j = 0;j<parallelRecipes;j++) {
@@ -896,7 +874,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
}
// -- Try not to fail after this point - inputs have already been consumed! --
-
+
// Convert speed bonus to duration multiplier
// e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
@@ -923,7 +901,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
}
-
+
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
@@ -997,19 +975,19 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
int allowedParrallel = 0;
for (final ItemStack aInput : aItemInputs) {
if (aRecipeCatalyst.isItemEqual(aInput)) {
- if (aInput.stackSize == 1) {
- int damage = getDamage(aInput) + aMaxParrallel;
- if (damage > getMaxCatalystDurability() ) {
- aOutPut.add(aInput);
- allowedParrallel += aMaxParrallel + (getMaxCatalystDurability() - damage);
- if (allowedParrallel >aMaxParrallel ) {
- return aMaxParrallel;
- }
- continue;
- }
+ if (aInput.stackSize == 1) {
+ int damage = getDamage(aInput) + aMaxParrallel;
+ if (damage > getMaxCatalystDurability() ) {
+ aOutPut.add(aInput);
+ allowedParrallel += aMaxParrallel + (getMaxCatalystDurability() - damage);
+ if (allowedParrallel >aMaxParrallel ) {
+ return aMaxParrallel;
+ }
+ continue;
}
- aOutPut.add(aInput);
- return aMaxParrallel;
+ }
+ aOutPut.add(aInput);
+ return aMaxParrallel;
}
}
return allowedParrallel;
@@ -1019,34 +997,23 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
if (aItemInputs != null) {
for (final ItemStack aInput : aItemInputs) {
if (aInput != null) {
- if (aInput.isItemEqual(GenericChem.mRedCatalyst))
- return aInput;
- else if (aInput.isItemEqual(GenericChem.mYellowCatalyst))
- return aInput;
- else if (aInput.isItemEqual(GenericChem.mBlueCatalyst))
- return aInput;
- else if (aInput.isItemEqual(GenericChem.mOrangeCatalyst))
- return aInput;
- else if (aInput.isItemEqual(GenericChem.mPurpleCatalyst))
- return aInput;
- else if (aInput.isItemEqual(AgriculturalChem.mGreenCatalyst))
- return aInput;
- else if (aInput.isItemEqual(GenericChem.mBrownCatalyst))
+ if (ItemUtils.isCatalyst(aInput)) {
return aInput;
+ }
}
}
}
return null;
}
-
-
+
+
private void damageCatalyst(ItemStack aStack) {
if (MathUtils.randFloat(0, 10000000)/10000000f < (1.2f - (0.2 * this.mPipeCasingTier))) {
int damage = getDamage(aStack) + 1;
log("damage catalyst "+damage);
if (damage >= getMaxCatalystDurability()) {
log("consume catalyst");
- ItemStack emptyCatalyst = ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier,1);
+ ItemStack emptyCatalyst = CI.getEmptyCatalyst(1);
addOutput(emptyCatalyst);
setDamage(aStack,0);
aStack.stackSize -= 1;
@@ -1059,7 +1026,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
log("not consuming catalyst");
}
}
-
+
private int getDamage(ItemStack aStack) {
if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) {
final NBTTagCompound tagMain = new NBTTagCompound();
@@ -1071,13 +1038,13 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
NBTTagCompound aNBT = aStack.getTagCompound();
return aNBT.getCompoundTag("catalyst").getInteger("Damage");
}
-
+
private void setDamage(ItemStack aStack,int aAmount) {
NBTTagCompound aNBT = aStack.getTagCompound();
aNBT = aNBT.getCompoundTag("catalyst");
aNBT.setInteger("Damage", aAmount);
}
-
+
@SideOnly(Side.CLIENT)
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java
index 7300b3507b..9b898e34af 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java
@@ -10,7 +10,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.objects.Logger;
@@ -47,6 +46,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
private final int ENERGY_TAX = 2;
//TecTech Support
+ public ArrayList<GT_MetaTileEntity_Hatch> mAllEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch>();
public ArrayList<GT_MetaTileEntity_Hatch> mAllDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch>();
public GregtechMetaTileEntity_PowerSubStationController(final int aID, final String aName, final String aNameRegional) {
@@ -138,12 +138,26 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
} else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 7) {
return 8;
} else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 8) {
- return CORE.GTNH ? GT_Values.V.length : 9;
+ return 9;
} else {
return -1;
}
}
+ public static int getMaxHatchTier(int aCellTier) {
+ switch(aCellTier) {
+ case 9:
+ return CORE.GTNH ? 15 : 9;
+ default:
+ if (aCellTier < 4) {
+ return 0;
+ }
+ else {
+ return aCellTier;
+ }
+ }
+ }
+
public static final int CELL_HEIGHT_MAX = 16;
public static final int CELL_HEIGHT_MIN = 2;
@@ -153,8 +167,11 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2;
final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2;
- this.mMultiDynamoHatches.clear();
- this.mAllDynamoHatches.clear();
+ this.mTecTechDynamoHatches.clear();
+ this.mAllDynamoHatches.clear();
+
+ this.mTecTechEnergyHatches.clear();
+ this.mAllEnergyHatches.clear();
boolean tFoundCeiling = false;
int tCasingCount = 0;
@@ -246,10 +263,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
/**
* TecTech Support, this allows adding Multi-Amp dynamos.
*/
+ mAllEnergyHatches.addAll(this.mEnergyHatches);
mAllDynamoHatches.addAll(this.mDynamoHatches);
if (LoadedMods.TecTech) {
- mAllDynamoHatches.addAll(this.mMultiDynamoHatches);
+ mAllDynamoHatches.addAll(this.mTecTechEnergyHatches);
+ mAllDynamoHatches.addAll(this.mTecTechDynamoHatches);
}
@@ -257,7 +276,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
checkMachineProblem("Needed 1 maintenance hatch, found " + this.mMaintenanceHatches.size());
return false;
}
- if (this.mEnergyHatches.size() < 1) {
+ if (this.mAllEnergyHatches.size() < 1) {
checkMachineProblem("Needed at least 1 energy hatch, found 0");
return false;
}
@@ -269,15 +288,17 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
// Find average EU throughput
int totalEuThroughput = 0;
int hatchCount = 0;
+
+ int aMaxHatchTier = getMaxHatchTier(tOverallCellTier);
- for (GT_MetaTileEntity_Hatch_Energy re : this.mEnergyHatches) {
+ for (GT_MetaTileEntity_Hatch re : this.mAllEnergyHatches) {
long tier = re.getOutputTier();
- if(tier > tOverallCellTier) {
- checkMachineProblem("Energy hatch (tier " + tier + ") is too strong for cells (tier " + tOverallCellTier + ")");
+ if(tier > aMaxHatchTier) {
+ checkMachineProblem("Energy hatch (tier " + tier + ") is too strong for cells (tier " + aMaxHatchTier + ")");
return false;
}
if(tier < 3) {
- checkMachineProblem("Energy hatch (tier " + tier + ") is too weak for cells (tier " + tOverallCellTier + ")");
+ checkMachineProblem("Energy hatch (tier " + tier + ") is too weak for cells (tier " + aMaxHatchTier + ")");
return false;
}
totalEuThroughput += re.maxEUInput();
@@ -286,12 +307,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
for (GT_MetaTileEntity_Hatch re : this.mAllDynamoHatches) {
long tier = re.getInputTier();
- if(tier > tOverallCellTier) {
- checkMachineProblem("Dynamo hatch (tier " + tier + ") is too strong for cells (tier " + tOverallCellTier + ")");
+ if(tier > aMaxHatchTier) {
+ checkMachineProblem("Dynamo hatch (tier " + tier + ") is too strong for cells (tier " + aMaxHatchTier + ")");
return false;
}
if(tier < 3) {
- checkMachineProblem("Energy hatch (tier " + tier + ") is too weak for cells (tier " + tOverallCellTier + ")");
+ checkMachineProblem("Energy hatch (tier " + tier + ") is too weak for cells (tier " + aMaxHatchTier + ")");
return false;
}
totalEuThroughput += re.maxEUOutput();
@@ -431,6 +452,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
return MathUtils.roundToClosestInt(mTax);
}
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ this.fixAllMaintenanceIssue();
+ }
+
@Override
public boolean onRunningTick(ItemStack aStack) {
// First, decay overcharge (0.1% of stored energy plus 1000 EU per tick)
@@ -448,7 +475,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
for (GT_MetaTileEntity_Hatch_OutputBattery tHatch : this.mDischargeHatches) {
drawEnergyFromHatch(tHatch);
}
- for (GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) {
+ for (GT_MetaTileEntity_Hatch tHatch : this.mAllEnergyHatches) {
drawEnergyFromHatch(tHatch);
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java
index 86d02eae9a..4f0197c060 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java
@@ -26,7 +26,7 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity {
- private byte aCurrentOutputAmperage = 4;
+ protected byte aCurrentOutputAmperage = 4;
public GregtechMetaEnergyBuffer(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
@@ -253,7 +253,7 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity {
final double c = ((double) tempStorage / this.maxEUStore()) * 100;
final double roundOff = Math.round(c * 100.00) / 100.00;
PlayerUtils.messagePlayer(playerIn, "Energy: " + GT_Utility.formatNumbers(tempStorage) + " EU at "+V[this.mTier]+"v ("+roundOff+"%)");
- PlayerUtils.messagePlayer(playerIn, "Amperage: " + GT_Utility.formatNumbers(maxAmperesIn())+"A");
+ PlayerUtils.messagePlayer(playerIn, "Amperage: " + GT_Utility.formatNumbers(maxAmperesOut())+"A");
}
//Utils.LOG_WARNING("Begin Show Energy");