aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormiozune <miozune@gmail.com>2023-05-08 18:28:16 +0900
committerGitHub <noreply@github.com>2023-05-08 11:28:16 +0200
commitd4c24c4d666f21d3132cf355e6e15b425c0f4369 (patch)
treeb557671642b155deb546e75a8b0e8d7d4e154bc7
parent410b4d15111cd0d53adfbd302907b80b6a45c3c3 (diff)
downloadGT5-Unofficial-d4c24c4d666f21d3132cf355e6e15b425c0f4369.tar.gz
GT5-Unofficial-d4c24c4d666f21d3132cf355e6e15b425c0f4369.tar.bz2
GT5-Unofficial-d4c24c4d666f21d3132cf355e6e15b425c0f4369.zip
Remove unused code & migrate to FluidSlotWidget (#619)
* Remove unused code & migrate to FluidSlotWidget * Update dependencies.gradle --------- Co-authored-by: Martin Robertz <dream-master@gmx.net>
-rw-r--r--dependencies.gradle4
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java4
-rw-r--r--src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java349
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java911
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java268
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java906
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java362
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java7
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java477
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java571
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java693
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java696
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java18
14 files changed, 6 insertions, 5262 deletions
diff --git a/dependencies.gradle b/dependencies.gradle
index cd0bed2342..4c36087c53 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -1,6 +1,6 @@
dependencies {
- api('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.07:dev')
- api("com.github.GTNewHorizons:bartworks:0.7.1:dev")
+ api('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.20:dev')
+ api("com.github.GTNewHorizons:bartworks:0.7.4:dev")
api("com.github.GTNewHorizons:TecTech:5.2.1:dev")
implementation('curse.maven:cofh-core-69162:2388751')
diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java b/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java
index ac061c44fd..bf98c7d633 100644
--- a/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java
+++ b/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java
@@ -78,10 +78,6 @@ public class BTF_FluidTank extends FluidTank {
return this.mFluid;
}
- public FluidStack getDisplayedFluid() {
- return this.getDrainableStack();
- }
-
public boolean isFluidChangingAllowed() {
return true;
}
diff --git a/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
index f893486d4f..a326c7e693 100644
--- a/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
+++ b/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
@@ -54,7 +54,6 @@ import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechCyclotron;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechDehydrator;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechEnergyBuffer;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechFactoryGradeReplacementMultis;
-import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechFluidReactor;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechGeneratorsULV;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechGeothermalThermalGenerator;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechHiAmpTransformer;
@@ -204,7 +203,6 @@ public class COMPAT_HANDLER {
GregtechSolarTower.run();
GregtechLargeTurbinesAndHeatExchanger.run();
GregtechPowerBreakers.run();
- GregtechFluidReactor.run();
GregtechAlgaeContent.run();
GregtechIndustrialAlloySmelter.run();
GregtechIsaMill.run();
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java
deleted file mode 100644
index 25a1cc3cca..0000000000
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java
+++ /dev/null
@@ -1,349 +0,0 @@
-package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power;
-
-import java.util.Collection;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.Textures.BlockIcons;
-import gregtech.api.gui.modularui.GT_UIInfos;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
-
-public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank {
-
- public GTPP_MTE_BasicLosslessGenerator(int aID, String aName, String aNameRegional, int aTier, String aDescription,
- ITexture... aTextures) {
- super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures);
- }
-
- public GTPP_MTE_BasicLosslessGenerator(int aID, String aName, String aNameRegional, int aTier,
- String[] aDescription, ITexture... aTextures) {
- super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures);
- }
-
- public GTPP_MTE_BasicLosslessGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, 3, aDescription, aTextures);
- }
-
- public GTPP_MTE_BasicLosslessGenerator(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, 3, aDescription, aTextures);
- }
-
- @Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- ITexture[][][] rTextures = new ITexture[10][17][];
-
- for (byte i = -1; i < 16; ++i) {
- rTextures[0][i + 1] = this.getFront(i);
- rTextures[1][i + 1] = this.getBack(i);
- rTextures[2][i + 1] = this.getBottom(i);
- rTextures[3][i + 1] = this.getTop(i);
- rTextures[4][i + 1] = this.getSides(i);
- rTextures[5][i + 1] = this.getFrontActive(i);
- rTextures[6][i + 1] = this.getBackActive(i);
- rTextures[7][i + 1] = this.getBottomActive(i);
- rTextures[8][i + 1] = this.getTopActive(i);
- rTextures[9][i + 1] = this.getSidesActive(i);
- }
-
- return rTextures;
- }
-
- @Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing,
- int aColorIndex, boolean aActive, boolean aRedstone) {
- return this.mTextures[(aActive ? 5 : 0)
- + (side == facing ? 0
- : (side == facing.getOpposite() ? 1
- : (side == ForgeDirection.DOWN ? 2 : (side == ForgeDirection.UP ? 3 : 4))))][aColorIndex
- + 1];
- }
-
- @Override
- public String[] getDescription() {
- String[] desc = new String[this.mDescriptionArray.length + 1];
- System.arraycopy(this.mDescriptionArray, 0, desc, 0, this.mDescriptionArray.length);
- desc[this.mDescriptionArray.length] = "Fuel Efficiency: " + this.getEfficiency() + "%";
- return desc;
- }
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- Logger.WARNING("Right Clicked");
- GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer);
- return true;
- }
-
- public ITexture[] getFront(byte aColor) {
- return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] };
- }
-
- public ITexture[] getBack(byte aColor) {
- return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] };
- }
-
- public ITexture[] getBottom(byte aColor) {
- return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] };
- }
-
- public ITexture[] getTop(byte aColor) {
- return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] };
- }
-
- public ITexture[] getSides(byte aColor) {
- return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] };
- }
-
- public ITexture[] getFrontActive(byte aColor) {
- return this.getFront(aColor);
- }
-
- public ITexture[] getBackActive(byte aColor) {
- return this.getBack(aColor);
- }
-
- public ITexture[] getBottomActive(byte aColor) {
- return this.getBottom(aColor);
- }
-
- public ITexture[] getTopActive(byte aColor) {
- return this.getTop(aColor);
- }
-
- public ITexture[] getSidesActive(byte aColor) {
- return this.getSides(aColor);
- }
-
- public boolean isFacingValid(ForgeDirection side) {
- return side.offsetY == 0;
- }
-
- @Override
- public boolean isSimpleMachine() {
- return false;
- }
-
- @Override
- public boolean isValidSlot(int aIndex) {
- return aIndex < 2;
- }
-
- @Override
- public boolean isEnetOutput() {
- return true;
- }
-
- public boolean isOutputFacing(ForgeDirection side) {
- return true;
- }
-
- @Override
- public boolean isAccessAllowed(EntityPlayer aPlayer) {
- return true;
- }
-
- @Override
- public long maxEUOutput() {
- return this.getBaseMetaTileEntity().isAllowedToWork() ? GT_Values.V[this.mTier] : 0L;
- }
-
- @Override
- public long maxEUStore() {
- return Math.max(this.getEUVar(), GT_Values.V[this.mTier] * 40L + this.getMinimumStoredEU());
- }
-
- @Override
- public boolean doesFillContainers() {
- return this.getBaseMetaTileEntity().isAllowedToWork();
- }
-
- @Override
- public boolean doesEmptyContainers() {
- return this.getBaseMetaTileEntity().isAllowedToWork();
- }
-
- @Override
- public boolean canTankBeFilled() {
- return this.getBaseMetaTileEntity().isAllowedToWork();
- }
-
- @Override
- public boolean canTankBeEmptied() {
- return this.getBaseMetaTileEntity().isAllowedToWork();
- }
-
- @Override
- public boolean displaysItemStack() {
- return true;
- }
-
- @Override
- public boolean displaysStackSize() {
- return false;
- }
-
- @Override
- public boolean isFluidInputAllowed(FluidStack aFluid) {
- int aVal = this.getFuelValue(aFluid);
- Logger.WARNING("Fuel Value: " + aVal);
- return aVal > 0;
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10L == 0L) {
- int tFuelValue;
- if (this.mFluid == null) {
- if (aBaseMetaTileEntity.getUniversalEnergyStored() < this.maxEUOutput() + this.getMinimumStoredEU()) {
- this.mInventory[this.getStackDisplaySlot()] = null;
- } else {
- if (this.mInventory[this.getStackDisplaySlot()] == null) {
- this.mInventory[this.getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1);
- }
-
- this.mInventory[this.getStackDisplaySlot()].setStackDisplayName(
- "Generating: "
- + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU())
- + " EU");
- }
- } else {
- tFuelValue = this.getFuelValue(this.mFluid);
- int tConsumed = this.consumedFluidPerOperation(this.mFluid);
- if (tFuelValue > 0 && tConsumed > 0 && this.mFluid.amount > tConsumed) {
- long tFluidAmountToUse = Math.min(
- (long) (this.mFluid.amount / tConsumed),
- (this.maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / (long) tFuelValue);
- if (tFluidAmountToUse > 0L && aBaseMetaTileEntity
- .increaseStoredEnergyUnits(tFluidAmountToUse * (long) tFuelValue, true)) {
- PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution());
- this.mFluid.amount = (int) ((long) this.mFluid.amount - tFluidAmountToUse * (long) tConsumed);
- }
- }
- }
-
- if (this.mInventory[this.getInputSlot()] != null
- && aBaseMetaTileEntity.getUniversalEnergyStored()
- < this.maxEUOutput() * 20L + this.getMinimumStoredEU()
- && GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true) == null) {
- tFuelValue = this.getFuelValue(this.mInventory[this.getInputSlot()]);
- if (tFuelValue > 0) {
- ItemStack tEmptyContainer = this.getEmptyContainer(this.mInventory[this.getInputSlot()]);
- if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tEmptyContainer)) {
- aBaseMetaTileEntity.increaseStoredEnergyUnits((long) tFuelValue, true);
- aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1);
- PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution());
- }
- }
- }
- }
-
- if (aBaseMetaTileEntity.isServerSide()) {
- Logger.WARNING("Ticking Servside");
- aBaseMetaTileEntity.setActive(
- aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored()
- >= this.maxEUOutput() + this.getMinimumStoredEU());
- }
- }
-
- public abstract int getPollution();
-
- public abstract GT_Recipe_Map getRecipes();
-
- public abstract int getEfficiency();
-
- public int consumedFluidPerOperation(FluidStack aLiquid) {
- return 1;
- }
-
- public int getFuelValue(FluidStack aLiquid) {
- if (aLiquid != null && this.getRecipes() != null) {
- Collection<GT_Recipe> tRecipeList = this.getRecipes().mRecipeList;
- if (tRecipeList != null) {
- Logger.WARNING("Fuels: " + tRecipeList.size());
-
- for (GT_Recipe tFuel : tRecipeList) {
- FluidStack tLiquid;
- if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null
- && aLiquid.isFluidEqual(tLiquid)) {
- Logger.WARNING("Fuel Ok");
- return (int) ((long) tFuel.mSpecialValue * (long) this.getEfficiency()
- * (long) this.consumedFluidPerOperation(tLiquid)
- / 100L);
- }
- if ((tLiquid = tFuel.getRepresentativeFluidInput(0)) != null && aLiquid.isFluidEqual(tLiquid)) {
- Logger.WARNING("Fuel Ok");
- return (int) ((long) tFuel.mSpecialValue * (long) this.getEfficiency()
- * (long) this.consumedFluidPerOperation(tLiquid)
- / 100L);
- }
- }
- }
-
- return 0;
- } else {
- return 0;
- }
- }
-
- public int getFuelValue(ItemStack aStack) {
- if (!GT_Utility.isStackInvalid(aStack) && this.getRecipes() != null) {
- Logger.WARNING("Fuel Item OK");
- GT_Recipe tFuel = this.getRecipes().findRecipe(
- this.getBaseMetaTileEntity(),
- false,
- Long.MAX_VALUE,
- (FluidStack[]) null,
- new ItemStack[] { aStack });
- return tFuel != null ? (int) ((long) tFuel.mSpecialValue * 1000L * (long) this.getEfficiency() / 100L) : 0;
- } else {
- return 0;
- }
- }
-
- public ItemStack getEmptyContainer(ItemStack aStack) {
- if (!GT_Utility.isStackInvalid(aStack) && this.getRecipes() != null) {
- GT_Recipe tFuel = this.getRecipes().findRecipe(
- this.getBaseMetaTileEntity(),
- false,
- Long.MAX_VALUE,
- (FluidStack[]) null,
- new ItemStack[] { aStack });
- return tFuel != null ? GT_Utility.copy(new Object[] { tFuel.getOutput(0) })
- : GT_Utility.getContainerItem(aStack, true);
- } else {
- return null;
- }
- }
-
- @Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
- ItemStack aStack) {
- return super.allowPutStack(aBaseMetaTileEntity, aIndex, side, aStack) && (this.getFuelValue(aStack) > 0
- || this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0);
- }
-
- @Override
- public int getCapacity() {
- return 16000;
- }
-
- @Override
- public int getTankPressure() {
- return -100;
- }
-
- @Override
- public boolean useModularUI() {
- return true;
- }
-}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java
deleted file mode 100644
index 4bb30d102c..0000000000
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java
+++ /dev/null
@@ -1,911 +0,0 @@
-package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power;
-
-import static gregtech.api.enums.GT_Values.V;
-
-import java.util.Arrays;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraftforge.common.DimensionManager;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.IFluidHandler;
-
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.ItemList;
-import gregtech.api.enums.Textures;
-import gregtech.api.gui.modularui.GT_UIInfos;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
-import gregtech.api.objects.GT_ItemStack;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_OreDictUnificator;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
-import gregtech.api.util.GT_Utility;
-
-/**
- * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
- * <p/>
- * This is the main construct for my Basic Machines such as the Automatic Extractor Extend this class to make a simple
- * Machine
- */
-public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank {
-
- /**
- * return values for checkRecipe()
- */
- protected static final int DID_NOT_FIND_RECIPE = 0, FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1,
- FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2;
-
- public static final int OTHER_SLOT_COUNT = 4;
- public final ItemStack[] mOutputItems;
- public final int mInputSlotCount, mAmperage;
- public boolean mAllowInputFromOutputSide = false, mFluidTransfer = false, mItemTransfer = false,
- mHasBeenUpdated = false, mStuttering = false, mCharge = false, mDecharge = false;
- public int mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0;
- public ForgeDirection mMainFacing = ForgeDirection.UNKNOWN;
- public FluidStack mOutputFluid;
- public String mGUIName = "", mNEIName = "";
- public GT_MetaTileEntity_MultiBlockBase mCleanroom;
- /**
- * Contains the Recipe which has been previously used, or null if there was no previous Recipe, which could have
- * been buffered
- */
- protected GT_Recipe mLastRecipe = null;
-
- private FluidStack mFluidOut;
-
- /**
- * @param aOverlays 0 = SideFacingActive 1 = SideFacingInactive 2 = FrontFacingActive 3 = FrontFacingInactive 4 =
- * TopFacingActive 5 = TopFacingInactive 6 = BottomFacingActive 7 = BottomFacingInactive ----- Not
- * all Array Elements have to be initialised, you can also just use 8 Parameters for the Default
- * Pipe Texture Overlays ----- 8 = BottomFacingPipeActive 9 = BottomFacingPipeInactive 10 =
- * TopFacingPipeActive 11 = TopFacingPipeInactive 12 = SideFacingPipeActive 13 =
- * SideFacingPipeInactive
- */
- public GTPP_MTE_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage,
- String aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName,
- ITexture... aOverlays) {
- super(
- aID,
- aName,
- aNameRegional,
- aTier,
- OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1,
- aDescription,
- aOverlays);
- mInputSlotCount = Math.max(0, aInputSlotCount);
- mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
- mAmperage = aAmperage;
- mGUIName = aGUIName;
- mNEIName = aNEIName;
- }
-
- public GTPP_MTE_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage,
- String[] aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName,
- ITexture... aOverlays) {
- super(
- aID,
- aName,
- aNameRegional,
- aTier,
- OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1,
- aDescription,
- aOverlays);
- mInputSlotCount = Math.max(0, aInputSlotCount);
- mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
- mAmperage = aAmperage;
- mGUIName = aGUIName;
- mNEIName = aNEIName;
- }
-
- public GTPP_MTE_BasicMachine(String aName, int aTier, int aAmperage, String aDescription, ITexture[][][] aTextures,
- int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) {
- super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures);
- mInputSlotCount = Math.max(0, aInputSlotCount);
- mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
- mAmperage = aAmperage;
- mGUIName = aGUIName;
- mNEIName = aNEIName;
- }
-
- public GTPP_MTE_BasicMachine(String aName, int aTier, int aAmperage, String[] aDescription,
- ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) {
- super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures);
- mInputSlotCount = Math.max(0, aInputSlotCount);
- mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
- mAmperage = aAmperage;
- mGUIName = aGUIName;
- mNEIName = aNEIName;
- }
-
- protected boolean isValidMainFacing(ForgeDirection side) {
- return side.offsetY == 0;
- }
-
- public boolean setMainFacing(ForgeDirection side) {
- if (!isValidMainFacing(side)) return false;
- mMainFacing = side;
- if (getBaseMetaTileEntity().getFrontFacing() == mMainFacing) {
- getBaseMetaTileEntity().setFrontFacing(side.getOpposite());
- }
- onFacingChange();
- onMachineBlockUpdate();
- return true;
- }
-
- @Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- ITexture[][][] rTextures = new ITexture[14][17][];
- aTextures = Arrays.copyOf(aTextures, 14);
-
- for (int i = 0; i < aTextures.length; i++) if (aTextures[i] != null) for (byte c = -1; c < 16; c++) {
- if (rTextures[i][c + 1] == null) rTextures[i][c + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][c + 1], aTextures[i] };
- }
-
- for (byte c = -1; c < 16; c++) {
- if (rTextures[0][c + 1] == null) rTextures[0][c + 1] = getSideFacingActive(c);
- if (rTextures[1][c + 1] == null) rTextures[1][c + 1] = getSideFacingInactive(c);
- if (rTextures[2][c + 1] == null) rTextures[2][c + 1] = getFrontFacingActive(c);
- if (rTextures[3][c + 1] == null) rTextures[3][c + 1] = getFrontFacingInactive(c);
- if (rTextures[4][c + 1] == null) rTextures[4][c + 1] = getTopFacingActive(c);
- if (rTextures[5][c + 1] == null) rTextures[5][c + 1] = getTopFacingInactive(c);
- if (rTextures[6][c + 1] == null) rTextures[6][c + 1] = getBottomFacingActive(c);
- if (rTextures[7][c + 1] == null) rTextures[7][c + 1] = getBottomFacingInactive(c);
- if (rTextures[8][c + 1] == null) rTextures[8][c + 1] = getBottomFacingPipeActive(c);
- if (rTextures[9][c + 1] == null) rTextures[9][c + 1] = getBottomFacingPipeInactive(c);
- if (rTextures[10][c + 1] == null) rTextures[10][c + 1] = getTopFacingPipeActive(c);
- if (rTextures[11][c + 1] == null) rTextures[11][c + 1] = getTopFacingPipeInactive(c);
- if (rTextures[12][c + 1] == null) rTextures[12][c + 1] = getSideFacingPipeActive(c);
- if (rTextures[13][c + 1] == null) rTextures[13][c + 1] = getSideFacingPipeInactive(c);
- }
- return rTextures;
- }
-
- @Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing,
- int aColorIndex, boolean aActive, boolean aRedstone) {
- return mTextures[mMainFacing.offsetY != 0
- ? side == facing ? aActive ? 2 : 3
- : side == ForgeDirection.DOWN ? aActive ? 6 : 7
- : side == ForgeDirection.UP ? aActive ? 4 : 5 : aActive ? 0 : 1
- : side == mMainFacing ? aActive ? 2 : 3
- : (showPipeFacing() && side == facing)
- ? side == ForgeDirection.DOWN ? aActive ? 8 : 9
- : side == ForgeDirection.UP ? aActive ? 10 : 11 : aActive ? 12 : 13
- : side == ForgeDirection.DOWN ? aActive ? 6 : 7
- : side == ForgeDirection.UP ? aActive ? 4 : 5 : aActive ? 0 : 1][aColorIndex
- + 1];
- }
-
- @Override
- public boolean isSimpleMachine() {
- return false;
- }
-
- @Override
- public boolean isOverclockerUpgradable() {
- return false;
- }
-
- @Override
- public boolean isTransformerUpgradable() {
- return false;
- }
-
- @Override
- public boolean isElectric() {
- return true;
- }
-
- @Override
- public boolean isValidSlot(int aIndex) {
- return aIndex > 0 && super.isValidSlot(aIndex)
- && aIndex != OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length;
- }
-
- @Override
- public boolean isFacingValid(ForgeDirection facing) {
- return mMainFacing.offsetY == 0 || facing.offsetY == 0;
- }
-
- @Override
- public boolean isEnetInput() {
- return true;
- }
-
- @Override
- public boolean isInputFacing(ForgeDirection side) {
- return side != mMainFacing;
- }
-
- @Override
- public boolean isOutputFacing(ForgeDirection side) {
- return false;
- }
-
- @Override
- public boolean isTeleporterCompatible() {
- return false;
- }
-
- @Override
- public boolean isLiquidInput(ForgeDirection side) {
- return side != mMainFacing && (mAllowInputFromOutputSide || side != getBaseMetaTileEntity().getFrontFacing());
- }
-
- @Override
- public boolean isLiquidOutput(ForgeDirection side) {
- return side != mMainFacing;
- }
-
- @Override
- public long getMinimumStoredEU() {
- return V[mTier] * 16;
- }
-
- @Override
- public long maxEUStore() {
- return V[mTier] * 64;
- }
-
- @Override
- public long maxEUInput() {
- return V[mTier];
- }
-
- @Override
- public long maxSteamStore() {
- return maxEUStore();
- }
-
- @Override
- public long maxAmperesIn() {
- return (mEUt * 2) / V[mTier] + 1;
- }
-
- @Override
- public int getInputSlot() {
- return OTHER_SLOT_COUNT;
- }
-
- @Override
- public int getOutputSlot() {
- return OTHER_SLOT_COUNT + mInputSlotCount;
- }
-
- @Override
- public int getStackDisplaySlot() {
- return 2;
- }
-
- @Override
- public int rechargerSlotStartIndex() {
- return 1;
- }
-
- @Override
- public int dechargerSlotStartIndex() {
- return 1;
- }
-
- @Override
- public int rechargerSlotCount() {
- return mCharge ? 1 : 0;
- }
-
- @Override
- public int dechargerSlotCount() {
- return mDecharge ? 1 : 0;
- }
-
- @Override
- public boolean isAccessAllowed(EntityPlayer aPlayer) {
- return true;
- }
-
- @Override
- public int getProgresstime() {
- return mProgresstime;
- }
-
- @Override
- public int maxProgresstime() {
- return mMaxProgresstime;
- }
-
- @Override
- public int increaseProgress(int aProgress) {
- mProgresstime += aProgress;
- return mMaxProgresstime - mProgresstime;
- }
-
- @Override
- public boolean isFluidInputAllowed(FluidStack aFluid) {
- return getFillableStack() != null || (getRecipeList() != null && getRecipeList().containsInput(aFluid));
- }
-
- @Override
- public boolean isFluidChangingAllowed() {
- return true;
- }
-
- @Override
- public boolean doesFillContainers() {
- return false;
- }
-
- @Override
- public boolean doesEmptyContainers() {
- return false;
- }
-
- @Override
- public boolean canTankBeFilled() {
- return true;
- }
-
- @Override
- public boolean canTankBeEmptied() {
- return true;
- }
-
- @Override
- public boolean displaysItemStack() {
- return true;
- }
-
- @Override
- public boolean displaysStackSize() {
- return true;
- }
-
- @Override
- public FluidStack getDisplayedFluid() {
- return displaysOutputFluid() ? getDrainableStack() : null;
- }
-
- @Override
- public FluidStack getDrainableStack() {
- return mFluidOut;
- }
-
- @Override
- public FluidStack setDrainableStack(FluidStack aFluid) {
- mFluidOut = aFluid;
- return mFluidOut;
- }
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer);
- return true;
- }
-
- @Override
- public void initDefaultModes(NBTTagCompound aNBT) {
- mMainFacing = ForgeDirection.UNKNOWN;
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- aNBT.setBoolean("mFluidTransfer", mFluidTransfer);
- aNBT.setBoolean("mItemTransfer", mItemTransfer);
- aNBT.setBoolean("mHasBeenUpdated", mHasBeenUpdated);
- aNBT.setBoolean("mAllowInputFromOutputSide", mAllowInputFromOutputSide);
- aNBT.setInteger("mEUt", mEUt);
- aNBT.setInteger("mMainFacing", mMainFacing.ordinal());
- aNBT.setInteger("mProgresstime", mProgresstime);
- aNBT.setInteger("mMaxProgresstime", mMaxProgresstime);
- if (mOutputFluid != null) aNBT.setTag("mOutputFluid", mOutputFluid.writeToNBT(new NBTTagCompound()));
- if (mFluidOut != null) aNBT.setTag("mFluidOut", mFluidOut.writeToNBT(new NBTTagCompound()));
-
- for (int i = 0; i < mOutputItems.length; i++) if (mOutputItems[i] != null)
- aNBT.setTag("mOutputItem" + i, mOutputItems[i].writeToNBT(new NBTTagCompound()));
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- mFluidTransfer = aNBT.getBoolean("mFluidTransfer");
- mItemTransfer = aNBT.getBoolean("mItemTransfer");
- mHasBeenUpdated = aNBT.getBoolean("mHasBeenUpdated");
- mAllowInputFromOutputSide = aNBT.getBoolean("mAllowInputFromOutputSide");
- mEUt = aNBT.getInteger("mEUt");
- mMainFacing = ForgeDirection.getOrientation(aNBT.getInteger("mMainFacing"));
- mProgresstime = aNBT.getInteger("mProgresstime");
- mMaxProgresstime = aNBT.getInteger("mMaxProgresstime");
- mOutputFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mOutputFluid"));
- mFluidOut = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluidOut"));
-
- for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i);
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- super.onPostTick(aBaseMetaTileEntity, aTick);
-
- if (aBaseMetaTileEntity.isServerSide()) {
- mCharge = aBaseMetaTileEntity.getStoredEU() / 2 > aBaseMetaTileEntity.getEUCapacity() / 3;
- mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3;
-
- doDisplayThings();
-
- boolean tSucceeded = false;
-
- if (mMaxProgresstime > 0 && (mProgresstime >= 0 || aBaseMetaTileEntity.isAllowedToWork())) {
- aBaseMetaTileEntity.setActive(true);
- if (mProgresstime < 0 || drainEnergyForProcess(mEUt)) {
- if (++mProgresstime >= mMaxProgresstime) {
- for (int i = 0; i < mOutputItems.length; i++)
- for (int j = 0; j < mOutputItems.length; j++) if (aBaseMetaTileEntity
- .addStackToSlot(getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i]))
- break;
- if (mOutputFluid != null)
- if (getDrainableStack() == null) setDrainableStack(mOutputFluid.copy());
- else if (mOutputFluid.isFluidEqual(getDrainableStack()))
- getDrainableStack().amount += mOutputFluid.amount;
- Arrays.fill(mOutputItems, null);
- mOutputFluid = null;
- mEUt = 0;
- mProgresstime = 0;
- mMaxProgresstime = 0;
- mStuttering = false;
- tSucceeded = true;
- endProcess();
- }
- if (mProgresstime > 5) mStuttering = false;
- } else {
- if (!mStuttering) {
- stutterProcess();
- if (canHaveInsufficientEnergy()) mProgresstime = -100;
- mStuttering = true;
- }
- }
- } else {
- aBaseMetaTileEntity.setActive(false);
- }
-
- boolean tRemovedOutputFluid = false;
-
- if (doesAutoOutputFluids() && getDrainableStack() != null
- && aBaseMetaTileEntity.getFrontFacing() != mMainFacing
- && (tSucceeded || aTick % 20 == 0)) {
- IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing());
- if (tTank != null) {
- FluidStack tDrained = drain(1000, false);
- if (tDrained != null) {
- int tFilledAmount = tTank.fill(aBaseMetaTileEntity.getBackFacing(), tDrained, false);
- if (tFilledAmount > 0)
- tTank.fill(aBaseMetaTileEntity.getBackFacing(), drain(tFilledAmount, true), true);
- }
- }
- if (getDrainableStack() == null) tRemovedOutputFluid = true;
- }
-
- if (doesAutoOutput() && !isOutputEmpty()
- && aBaseMetaTileEntity.getFrontFacing() != mMainFacing
- && (tSucceeded || mOutputBlocked % 300 == 1
- || aBaseMetaTileEntity.hasInventoryBeenModified()
- || aTick % 600 == 0)) {
- TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing());
- for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0
- && aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) {
- tCosts = GT_Utility.moveOneItemStack(
- aBaseMetaTileEntity,
- tTileEntity2,
- aBaseMetaTileEntity.getFrontFacing(),
- aBaseMetaTileEntity.getBackFacing(),
- null,
- false,
- (byte) 64,
- (byte) 1,
- (byte) 64,
- (byte) 1);
- if (tCosts > 0) aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCosts, true);
- }
- }
-
- if (mOutputBlocked != 0) if (isOutputEmpty()) mOutputBlocked = 0;
- else mOutputBlocked++;
-
- if (allowToCheckRecipe()) {
- if (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork()
- && (tRemovedOutputFluid || tSucceeded
- || aBaseMetaTileEntity.hasInventoryBeenModified()
- || aTick % 600 == 0
- || aBaseMetaTileEntity.hasWorkJustBeenEnabled())
- && hasEnoughEnergyToCheckRecipe()) {
- if (checkRecipe() == 2) {
- if (mInventory[3] != null && mInventory[3].stackSize <= 0) mInventory[3] = null;
- for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++)
- if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null;
- for (int i = 0; i < mOutputItems.length; i++) {
- mOutputItems[i] = GT_Utility.copy(mOutputItems[i]);
- if (mOutputItems[i] != null && mOutputItems[i].stackSize > 64)
- mOutputItems[i].stackSize = 64;
- mOutputItems[i] = GT_OreDictUnificator.get(true, mOutputItems[i]);
- }
- if (mFluid != null && mFluid.amount <= 0) mFluid = null;
- mMaxProgresstime = Math.max(1, mMaxProgresstime);
- if (GT_Utility.isDebugItem(mInventory[dechargerSlotStartIndex()])) {
- mEUt = mMaxProgresstime = 1;
- }
- startProcess();
- } else {
- mMaxProgresstime = 0;
- for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = null;
- mOutputFluid = null;
- }
- }
- } else {
- if (!mStuttering) {
- stutterProcess();
- mStuttering = true;
- }
- }
- }
- }
-
- protected void doDisplayThings() {
- if (mMainFacing.offsetY != 0 && getBaseMetaTileEntity().getFrontFacing().offsetY == 0) {
- mMainFacing = getBaseMetaTileEntity().getFrontFacing();
- }
- if (mMainFacing.offsetY == 0 && !mHasBeenUpdated) {
- mHasBeenUpdated = true;
- getBaseMetaTileEntity().setFrontFacing(getBaseMetaTileEntity().getBackFacing());
- }
-
- if (displaysInputFluid()) {
- int tDisplayStackSlot = OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length;
- if (getFillableStack() == null) {
- if (ItemList.Display_Fluid.isStackEqual(mInventory[tDisplayStackSlot], true, true))
- mInventory[tDisplayStackSlot] = null;
- } else {
- mInventory[tDisplayStackSlot] = GT_Utility
- .getFluidDisplayStack(getFillableStack(), displaysStackSize());
- }
- }
- }
-
- protected boolean hasEnoughEnergyToCheckRecipe() {
- return getBaseMetaTileEntity().isUniversalEnergyStored(getMinimumStoredEU() / 2);
- }
-
- protected boolean drainEnergyForProcess(long aEUt) {
- return getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEUt, false);
- }
-
- protected void calculateOverclockedNess(GT_Recipe aRecipe) {
- calculateOverclockedNess(aRecipe.mEUt, aRecipe.mDuration);
- }
-
- protected void calculateOverclockedNess(int aEUt, int aDuration) {
- if (aEUt <= 16) {
- mEUt = aEUt * (1 << (mTier - 1)) * (1 << (mTier - 1));
- mMaxProgresstime = aDuration / (1 << (mTier - 1));
- } else {
- mEUt = aEUt;
- mMaxProgresstime = aDuration;
- while (mEUt <= V[mTier - 1] * mAmperage) {
- mEUt *= 4;
- mMaxProgresstime /= 2;
- }
- }
- }
-
- protected ItemStack getSpecialSlot() {
- return mInventory[3];
- }
-
- protected ItemStack getOutputAt(int aIndex) {
- return mInventory[getOutputSlot() + aIndex];
- }
-
- protected ItemStack[] getAllOutputs() {
- ItemStack[] rOutputs = new ItemStack[mOutputItems.length];
- for (int i = 0; i < mOutputItems.length; i++) rOutputs[i] = getOutputAt(i);
- return rOutputs;
- }
-
- protected boolean canOutput(GT_Recipe aRecipe) {
- return aRecipe != null && (aRecipe.mNeedsEmptyOutput ? isOutputEmpty() && getDrainableStack() == null
- : canOutput(aRecipe.getFluidOutput(0)) && canOutput(aRecipe.mOutputs));
- }
-
- protected boolean canOutput(ItemStack... aOutputs) {
- if (aOutputs == null) return true;
- ItemStack[] tOutputSlots = getAllOutputs();
- for (int i = 0; i < tOutputSlots.length && i < aOutputs.length; i++)
- if (tOutputSlots[i] != null && aOutputs[i] != null
- && (!GT_Utility.areStacksEqual(tOutputSlots[i], aOutputs[i], false)
- || tOutputSlots[i].stackSize + aOutputs[i].stackSize > tOutputSlots[i].getMaxStackSize())) {
- mOutputBlocked++;
- return false;
- }
- return true;
- }
-
- protected boolean canOutput(FluidStack aOutput) {
- return getDrainableStack() == null || aOutput == null
- || (getDrainableStack().isFluidEqual(aOutput) && (getDrainableStack().amount <= 0
- || getDrainableStack().amount + aOutput.amount <= getCapacity()));
- }
-
- protected ItemStack getInputAt(int aIndex) {
- return mInventory[getInputSlot() + aIndex];
- }
-
- protected ItemStack[] getAllInputs() {
- ItemStack[] rInputs = new ItemStack[mInputSlotCount];
- for (int i = 0; i < mInputSlotCount; i++) rInputs[i] = getInputAt(i);
- return rInputs;
- }
-
- protected boolean isOutputEmpty() {
- boolean rIsEmpty = true;
- for (ItemStack tOutputSlotContent : getAllOutputs()) if (tOutputSlotContent != null) rIsEmpty = false;
- return rIsEmpty;
- }
-
- protected boolean displaysInputFluid() {
- return true;
- }
-
- protected boolean displaysOutputFluid() {
- return true;
- }
-
- @Override
- public void onValueUpdate(byte aValue) {
- mMainFacing = ForgeDirection.getOrientation(aValue);
- }
-
- @Override
- public byte getUpdateData() {
- return (byte) mMainFacing.ordinal();
- }
-
- @Override
- public void doSound(byte aIndex, double aX, double aY, double aZ) {
- super.doSound(aIndex, aX, aY, aZ);
- if (aIndex == 8) GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(210), 100, 1.0F, aX, aY, aZ);
- }
-
- public boolean doesAutoOutput() {
- return mItemTransfer;
- }
-
- public boolean doesAutoOutputFluids() {
- return mFluidTransfer;
- }
-
- public boolean allowToCheckRecipe() {
- return true;
- }
-
- public boolean showPipeFacing() {
- return true;
- }
-
- /**
- * Called whenever the Machine successfully started a Process, useful for Sound Effects
- */
- public void startProcess() {
- //
- }
-
- /**
- * Called whenever the Machine successfully finished a Process, useful for Sound Effects
- */
- public void endProcess() {
- //
- }
-
- /**
- * Called whenever the Machine aborted a Process, useful for Sound Effects
- */
- public void abortProcess() {
- //
- }
-
- /**
- * Called whenever the Machine aborted a Process but still works on it, useful for Sound Effects
- */
- public void stutterProcess() {
- if (useStandardStutterSound()) sendSound((byte) 8);
- }
-
- /**
- * If this Machine can have the Insufficient Energy Line Problem
- */
- public boolean canHaveInsufficientEnergy() {
- return true;
- }
-
- public boolean useStandardStutterSound() {
- return true;
- }
-
- @Override
- public String[] getInfoData() {
- return new String[] { mNEIName, "Progress:", (mProgresstime / 20) + " secs", (mMaxProgresstime / 20) + " secs",
- "Stored Energy:", getBaseMetaTileEntity().getStoredEU() + "EU",
- getBaseMetaTileEntity().getEUCapacity() + "EU" };
- }
-
- @Override
- public boolean isGivingInformation() {
- return true;
- }
-
- @Override
- public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (side == getBaseMetaTileEntity().getFrontFacing() || side == mMainFacing) {
- mAllowInputFromOutputSide = !mAllowInputFromOutputSide;
- GT_Utility.sendChatToPlayer(
- aPlayer,
- mAllowInputFromOutputSide ? "Input from Output Side allowed" : "Input from Output Side forbidden");
- }
- }
-
- @Override
- public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aCoverID) {
- return (side != mMainFacing || GregTech_API.getCoverBehavior(aCoverID.toStack())
- .isGUIClickable(side, GT_Utility.stackToInt(aCoverID.toStack()), 0, getBaseMetaTileEntity()));
- }
-
- @Override
- public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
- ItemStack aStack) {
- return side != mMainFacing && aIndex >= getOutputSlot() && aIndex < getOutputSlot() + mOutputItems.length;
- }
-
- @Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
- ItemStack aStack) {
- if (side == mMainFacing || aIndex < getInputSlot()
- || aIndex >= getInputSlot() + mInputSlotCount
- || (!mAllowInputFromOutputSide && side == aBaseMetaTileEntity.getFrontFacing()))
- return false;
- for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++)
- if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(aStack), mInventory[i])) return i == aIndex;
- return true;
- }
-
- /**
- * @return the Recipe List which is used for this Machine, this is a useful Default Handler
- */
- public GT_Recipe_Map getRecipeList() {
- return null;
- }
-
- /**
- * Override this to check the Recipes yourself, super calls to this could be useful if you just want to add a
- * special case
- * <p/>
- * I thought about Enum too, but Enum doesn't add support for people adding other return Systems.
- * <p/>
- * Funny how Eclipse marks the word Enum as not correctly spelled.
- *
- * @return see constants above
- */
- public int checkRecipe() {
- return checkRecipe(false);
- }
-
- public static boolean isValidForLowGravity(GT_Recipe tRecipe, int dimId) {
- return // TODO check or get a better solution
- DimensionManager.getProvider(dimId).getClass().getName().contains("Orbit")
- || DimensionManager.getProvider(dimId).getClass().getName().endsWith("Space")
- || DimensionManager.getProvider(dimId).getClass().getName().endsWith("Asteroids")
- || DimensionManager.getProvider(dimId).getClass().getName().endsWith("SS")
- || DimensionManager.getProvider(dimId).getClass().getName().contains("SpaceStation");
- }
-
- /**
- *
- * @param skipOC disables OverclockedNess calculation and check - if you do you must implement your own method...
- * @return
- */
- public int checkRecipe(boolean skipOC) {
- GT_Recipe_Map tMap = getRecipeList();
- if (tMap == null) return DID_NOT_FIND_RECIPE;
- GT_Recipe tRecipe = tMap.findRecipe(
- getBaseMetaTileEntity(),
- mLastRecipe,
- false,
- V[mTier],
- new FluidStack[] { getFillableStack() },
- getSpecialSlot(),
- getAllInputs());
- if (tRecipe == null) return DID_NOT_FIND_RECIPE;
-
- if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe;
- if (!canOutput(tRecipe)) {
- mOutputBlocked++;
- return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
- }
- if (tRecipe.mSpecialValue == -200 && (mCleanroom == null || mCleanroom.mEfficiency == 0))
- return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
- if (!tRecipe.isRecipeInputEqual(true, new FluidStack[] { getFillableStack() }, getAllInputs()))
- return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
- for (int i = 0; i < mOutputItems.length; i++)
- if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(i))
- mOutputItems[i] = tRecipe.getOutput(i);
- if (tRecipe.mSpecialValue == -200) for (int i = 0; i < mOutputItems.length; i++)
- if (mOutputItems[i] != null && getBaseMetaTileEntity().getRandomNumber(10000) > mCleanroom.mEfficiency)
- mOutputItems[i] = null;
- mOutputFluid = tRecipe.getFluidOutput(0);
- calculateOverclockedNess(tRecipe);
- return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
- }
-
- public ITexture[] getSideFacingActive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getSideFacingInactive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getFrontFacingActive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getFrontFacingInactive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getTopFacingActive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getTopFacingInactive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getBottomFacingActive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getBottomFacingInactive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getBottomFacingPipeActive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1],
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-
- public ITexture[] getBottomFacingPipeInactive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1],
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-
- public ITexture[] getTopFacingPipeActive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1],
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-
- public ITexture[] getTopFacingPipeInactive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1],
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-
- public ITexture[] getSideFacingPipeActive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1],
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-
- public ITexture[] getSideFacingPipeInactive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1],
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java
deleted file mode 100644
index 42f775fd29..0000000000
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java
+++ /dev/null
@@ -1,268 +0,0 @@
-package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power;
-
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-
-import gregtech.api.enums.ItemList;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.util.GT_Utility;
-
-/**
- * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
- * <p/>
- * This is the main construct for my generic Tanks. Filling and emptying behavior have to be implemented manually
- */
-public abstract class GTPP_MTE_BasicTank extends GTPP_MTE_TieredMachineBlock {
-
- public FluidStack mFluid;
-
- /**
- * @param aInvSlotCount should be 3
- */
- public GTPP_MTE_BasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,
- String aDescription, ITexture... aTextures) {
- super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- public GTPP_MTE_BasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,
- String[] aDescription, ITexture... aTextures) {
- super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- public GTPP_MTE_BasicTank(String aName, int aTier, int aInvSlotCount, String aDescription,
- ITexture[][][] aTextures) {
- super(aName, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- public GTPP_MTE_BasicTank(String aName, int aTier, int aInvSlotCount, String[] aDescription,
- ITexture[][][] aTextures) {
- super(aName, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- @Override
- public boolean isSimpleMachine() {
- return false;
- }
-
- @Override
- public boolean isValidSlot(int aIndex) {
- return aIndex != getStackDisplaySlot();
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound()));
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
- }
-
- public abstract boolean doesFillContainers();
-
- public abstract boolean doesEmptyContainers();
-
- public abstract boolean canTankBeFilled();
-
- public abstract boolean canTankBeEmptied();
-
- public abstract boolean displaysItemStack();
-
- public abstract boolean displaysStackSize();
-
- public int getInputSlot() {
- return 0;
- }
-
- public int getOutputSlot() {
- return 1;
- }
-
- public int getStackDisplaySlot() {
- return 2;
- }
-
- public boolean isFluidInputAllowed(FluidStack aFluid) {
- return true;
- }
-
- public boolean isFluidChangingAllowed() {
- return true;
- }
-
- public FluidStack getFillableStack() {
- return mFluid;
- }
-
- public FluidStack setFillableStack(FluidStack aFluid) {
- mFluid = aFluid;
- return mFluid;
- }
-
- public FluidStack getDrainableStack() {
- return mFluid;
- }
-
- public FluidStack setDrainableStack(FluidStack aFluid) {
- mFluid = aFluid;
- return mFluid;
- }
-
- public FluidStack getDisplayedFluid() {
- return getDrainableStack();
- }
-
- @Override
- public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if (aBaseMetaTileEntity.isServerSide()) {
- if (isFluidChangingAllowed() && getFillableStack() != null && getFillableStack().amount <= 0)
- setFillableStack(null);
-
- if (displaysItemStack() && getStackDisplaySlot() >= 0 && getStackDisplaySlot() < mInventory.length) {
- if (getDisplayedFluid() == null) {
- if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot()], true, true))
- mInventory[getStackDisplaySlot()] = null;
- } else {
- mInventory[getStackDisplaySlot()] = GT_Utility
- .getFluidDisplayStack(getDisplayedFluid(), displaysStackSize());
- }
- }
-
- if (doesEmptyContainers()) {
- FluidStack tFluid = GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true);
- if (tFluid != null && isFluidInputAllowed(tFluid)) {
- if (getFillableStack() == null) {
- if (isFluidInputAllowed(tFluid) && tFluid.amount <= getCapacity()) {
- if (aBaseMetaTileEntity.addStackToSlot(
- getOutputSlot(),
- GT_Utility.getContainerItem(mInventory[getInputSlot()], true),
- 1)) {
- setFillableStack(tFluid.copy());
- this.onEmptyingContainerWhenEmpty();
- aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
- }
- }
- } else {
- if (tFluid.isFluidEqual(getFillableStack())
- && tFluid.amount + getFillableStack().amount <= getCapacity()) {
- if (aBaseMetaTileEntity.addStackToSlot(
- getOutputSlot(),
- GT_Utility.getContainerItem(mInventory[getInputSlot()], true),
- 1)) {
- getFillableStack().amount += tFluid.amount;
- aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
- }
- }
- }
- }
- }
-
- if (doesFillContainers()) {
- ItemStack tOutput = GT_Utility
- .fillFluidContainer(getDrainableStack(), mInventory[getInputSlot()], false, true);
- if (tOutput != null && aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tOutput, 1)) {
- FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true);
- aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
- if (tFluid != null) getDrainableStack().amount -= tFluid.amount;
- if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) setDrainableStack(null);
- }
- }
- }
- }
-
- @Override
- public FluidStack getFluid() {
- return getDrainableStack();
- }
-
- @Override
- public int getFluidAmount() {
- return getDrainableStack() != null ? getDrainableStack().amount : 0;
- }
-
- @Override
- public int fill(FluidStack aFluid, boolean doFill) {
- if (aFluid == null || aFluid.getFluid().getID() <= 0
- || aFluid.amount <= 0
- || !canTankBeFilled()
- || !isFluidInputAllowed(aFluid))
- return 0;
-
- if (getFillableStack() == null || getFillableStack().getFluid().getID() <= 0) {
- if (aFluid.amount <= getCapacity()) {
- if (doFill) {
- setFillableStack(aFluid.copy());
- getBaseMetaTileEntity().markDirty();
- }
- return aFluid.amount;
- }
- if (doFill) {
- setFillableStack(aFluid.copy());
- getFillableStack().amount = getCapacity();
- getBaseMetaTileEntity().markDirty();
- }
- return getCapacity();
- }
-
- if (!getFillableStack().isFluidEqual(aFluid)) return 0;
-
- int space = getCapacity() - getFillableStack().amount;
- if (aFluid.amount <= space) {
- if (doFill) {
- getFillableStack().amount += aFluid.amount;
- getBaseMetaTileEntity().markDirty();
- }
- return aFluid.amount;
- }
- if (doFill) getFillableStack().amount = getCapacity();
- return space;
- }
-
- @Override
- public FluidStack drain(int maxDrain, boolean doDrain) {
- if (getDrainableStack() == null || !canTankBeEmptied()) return null;
- if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) {
- setDrainableStack(null);
- getBaseMetaTileEntity().markDirty();
- return null;
- }
-
- int used = maxDrain;
- if (getDrainableStack().amount < used) used = getDrainableStack().amount;
-
- if (doDrain) {
- getDrainableStack().amount -= used;
- getBaseMetaTileEntity().markDirty();
- }
-
- FluidStack drained = getDrainableStack().copy();
- drained.amount = used;
-
- if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) {
- setDrainableStack(null);
- getBaseMetaTileEntity().markDirty();
- }
-
- return drained;
- }
-
- @Override
- public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
- ItemStack aStack) {
- return aIndex == getOutputSlot();
- }
-
- @Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
- ItemStack aStack) {
- return aIndex == getInputSlot();
- }
-
- protected void onEmptyingContainerWhenEmpty() {
- // Do nothing
- }
-}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java
deleted file mode 100644
index c6d5c4ba5b..0000000000
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java
+++ /dev/null
@@ -1,906 +0,0 @@
-package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
-
-import static gregtech.api.enums.GT_Values.V;
-
-import java.util.Arrays;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraftforge.common.DimensionManager;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.IFluidHandler;
-
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.ItemList;
-import gregtech.api.enums.Textures;
-import gregtech.api.gui.modularui.GT_UIInfos;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.objects.GT_ItemStack;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_OreDictUnificator;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.random.XSTR;
-
-/**
- * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
- * <p/>
- * This is the main construct for my Basic Machines such as the Automatic Extractor Extend this class to make a simple
- * Machine
- */
-public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_DeluxeTank {
-
- /**
- * return values for checkRecipe()
- */
- protected static final int DID_NOT_FIND_RECIPE = 0, FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1,
- FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2;
-
- public static final int OTHER_SLOT_COUNT = 4;
- public final ItemStack[] mOutputItems;
- public final int mInputSlotCount, mAmperage;
- public boolean mAllowInputFromOutputSide = false, mFluidTransfer = false, mItemTransfer = false,
- mHasBeenUpdated = false, mStuttering = false, mCharge = false, mDecharge = false;
- public int mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0;
- public ForgeDirection mMainFacing = ForgeDirection.UNKNOWN;
- public FluidStack mOutputFluid;
- public String mGUIName = "", mNEIName = "";
- /**
- * Contains the Recipe which has been previously used, or null if there was no previous Recipe, which could have
- * been buffered
- */
- protected GT_Recipe mLastRecipe = null;
-
- private FluidStack mFluidOut;
-
- /**
- * @param aOverlays 0 = SideFacingActive 1 = SideFacingInactive 2 = FrontFacingActive 3 = FrontFacingInactive 4 =
- * TopFacingActive 5 = TopFacingInactive 6 = BottomFacingActive 7 = BottomFacingInactive ----- Not
- * all Array Elements have to be initialised, you can also just use 8 Parameters for the Default
- * Pipe Texture Overlays ----- 8 = BottomFacingPipeActive 9 = BottomFacingPipeInactive 10 =
- * TopFacingPipeActive 11 = TopFacingPipeInactive 12 = SideFacingPipeActive 13 =
- * SideFacingPipeInactive
- */
- public GT_MetaTileEntity_DeluxeMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage,
- String aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName,
- ITexture... aOverlays) {
- super(
- aID,
- aName,
- aNameRegional,
- aTier,
- OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1,
- aDescription,
- aOverlays);
- mInputSlotCount = Math.max(0, aInputSlotCount);
- mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
- mAmperage = aAmperage;
- mGUIName = aGUIName;
- mNEIName = aNEIName;
- }
-
- public GT_MetaTileEntity_DeluxeMachine(String aName, int aTier, int aAmperage, String aDescription,
- ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) {
- super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures);
- mInputSlotCount = Math.max(0, aInputSlotCount);
- mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
- mAmperage = aAmperage;
- mGUIName = aGUIName;
- mNEIName = aNEIName;
- }
-
- public boolean setMainFacing(ForgeDirection direction) {
- mMainFacing = direction;
- if (getBaseMetaTileEntity().getFrontFacing() == mMainFacing) {
- getBaseMetaTileEntity().setFrontFacing(direction.getOpposite());
- }
- onFacingChange();
- onMachineBlockUpdate();
- return true;
- }
-
- @Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- ITexture[][][] rTextures = new ITexture[14][17][];
- aTextures = Arrays.copyOf(aTextures, 14);
-
- for (int i = 0; i < aTextures.length; i++) if (aTextures[i] != null) for (byte c = -1; c < 16; c++) {
- if (rTextures[i][c + 1] == null) rTextures[i][c + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][c + 1], aTextures[i] };
- }
-
- for (byte c = -1; c < 16; c++) {
- if (rTextures[0][c + 1] == null) rTextures[0][c + 1] = getSideFacingActive(c);
- if (rTextures[1][c + 1] == null) rTextures[1][c + 1] = getSideFacingInactive(c);
- if (rTextures[2][c + 1] == null) rTextures[2][c + 1] = getFrontFacingActive(c);
- if (rTextures[3][c + 1] == null) rTextures[3][c + 1] = getFrontFacingInactive(c);
- if (rTextures[4][c + 1] == null) rTextures[4][c + 1] = getTopFacingActive(c);
- if (rTextures[5][c + 1] == null) rTextures[5][c + 1] = getTopFacingInactive(c);
- if (rTextures[6][c + 1] == null) rTextures[6][c + 1] = getBottomFacingActive(c);
- if (rTextures[7][c + 1] == null) rTextures[7][c + 1] = getBottomFacingInactive(c);
- if (rTextures[8][c + 1] == null) rTextures[8][c + 1] = getBottomFacingPipeActive(c);
- if (rTextures[9][c + 1] == null) rTextures[9][c + 1] = getBottomFacingPipeInactive(c);
- if (rTextures[10][c + 1] == null) rTextures[10][c + 1] = getTopFacingPipeActive(c);
- if (rTextures[11][c + 1] == null) rTextures[11][c + 1] = getTopFacingPipeInactive(c);
- if (rTextures[12][c + 1] == null) rTextures[12][c + 1] = getSideFacingPipeActive(c);
- if (rTextures[13][c + 1] == null) rTextures[13][c + 1] = getSideFacingPipeInactive(c);
- }
- return rTextures;
- }
-
- @Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing,
- int aColorIndex, boolean aActive, boolean aRedstone) {
- return mTextures[mMainFacing.offsetY != 0
- ? side == facing ? aActive ? 2 : 3
- : side == ForgeDirection.DOWN ? aActive ? 6 : 7
- : side == ForgeDirection.UP ? aActive ? 4 : 5 : aActive ? 0 : 1
- : side == mMainFacing ? aActive ? 2 : 3
- : (showPipeFacing() && side == facing)
- ? side == ForgeDirection.DOWN ? aActive ? 8 : 9
- : side == ForgeDirection.UP ? aActive ? 10 : 11 : aActive ? 12 : 13
- : side == ForgeDirection.DOWN ? aActive ? 6 : 7
- : side == ForgeDirection.UP ? aActive ? 4 : 5 : aActive ? 0 : 1][aColorIndex
- + 1];
- }
-
- @Override
- public boolean isSimpleMachine() {
- return false;
- }
-
- @Override
- public boolean isOverclockerUpgradable() {
- return false;
- }
-
- @Override
- public boolean isTransformerUpgradable() {
- return false;
- }
-
- @Override
- public boolean isElectric() {
- return true;
- }
-
- @Override
- public boolean isValidSlot(int aIndex) {
- return aIndex > 0 && super.isValidSlot(aIndex)
- && aIndex != OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length;
- }
-
- @Override
- public boolean isFacingValid(ForgeDirection facing) {
- return mMainFacing.offsetY == 0 || facing.offsetY == 0;
- }
-
- @Override
- public boolean isEnetInput() {
- return true;
- }
-
- @Override
- public boolean isInputFacing(ForgeDirection side) {
- return side != mMainFacing;
- }
-
- @Override
- public boolean isOutputFacing(ForgeDirection side) {
- return false;
- }
-
- @Override
- public boolean isTeleporterCompatible() {
- return false;
- }
-
- @Override
- public boolean isLiquidInput(ForgeDirection side) {
- return side != mMainFacing && (mAllowInputFromOutputSide || side != getBaseMetaTileEntity().getFrontFacing());
- }
-
- @Override
- public boolean isLiquidOutput(ForgeDirection side) {
- return side != mMainFacing;
- }
-
- @Override
- public long getMinimumStoredEU() {
- return V[mTier] * 16;
- }
-
- @Override
- public long maxEUStore() {
- return V[mTier] * 64;
- }
-
- @Override
- public long maxEUInput() {
- return V[mTier];
- }
-
- @Override
- public long maxSteamStore() {
- return maxEUStore();
- }
-
- @Override
- public long maxAmperesIn() {
- return (mEUt * 2) / V[mTier] + 1;
- }
-
- @Override
- public int getInputSlot() {
- return OTHER_SLOT_COUNT;
- }
-
- @Override
- public int getOutputSlot() {
- return OTHER_SLOT_COUNT + mInputSlotCount;
- }
-
- @Override
- public int getStackDisplaySlot() {
- return 2;
- }
-
- @Override
- public int rechargerSlotStartIndex() {
- return 1;
- }
-
- @Override
- public int dechargerSlotStartIndex() {
- return 1;
- }
-
- @Override
- public int rechargerSlotCount() {
- return mCharge ? 1 : 0;
- }
-
- @Override
- public int dechargerSlotCount() {
- return mDecharge ? 1 : 0;
- }
-
- @Override
- public boolean isAccessAllowed(EntityPlayer aPlayer) {
- return true;
- }
-
- @Override
- public int getProgresstime() {
- return mProgresstime;
- }
-
- @Override
- public int maxProgresstime() {
- return mMaxProgresstime;
- }
-
- @Override
- public int increaseProgress(int aProgress) {
- mProgresstime += aProgress;
- return mMaxProgresstime - mProgresstime;
- }
-
- @Override
- public boolean isFluidInputAllowed(FluidStack aFluid) {
- return getFillableStack() != null || (getRecipeList() != null && getRecipeList().containsInput(aFluid));
- }
-
- @Override
- public boolean isFluidChangingAllowed() {
- return true;
- }
-
- @Override
- public boolean doesFillContainers() {
- return false;
- }
-
- @Override
- public boolean doesEmptyContainers() {
- return false;
- }
-
- @Override
- public boolean canTankBeFilled() {
- return true;
- }
-
- @Override
- public boolean canTankBeEmptied() {
- return true;
- }
-
- @Override
- public boolean displaysItemStack() {
- return true;
- }
-
- @Override
- public boolean displaysStackSize() {
- return true;
- }
-
- @Override
- public FluidStack getDisplayedFluid() {
- return displaysOutputFluid() ? getDrainableStack() : null;
- }
-
- @Override
- public FluidStack getDrainableStack() {
- return mFluidOut;
- }
-
- @Override
- public FluidStack setDrainableStack(FluidStack aFluid) {
- mFluidOut = aFluid;
- return mFluidOut;
- }
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer);
- return true;
- }
-
- @Override
- public void initDefaultModes(NBTTagCompound aNBT) {
- mMainFacing = ForgeDirection.UNKNOWN;
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- aNBT.setBoolean("mFluidTransfer", mFluidTransfer);
- aNBT.setBoolean("mItemTransfer", mItemTransfer);
- aNBT.setBoolean("mHasBeenUpdated", mHasBeenUpdated);
- aNBT.setBoolean("mAllowInputFromOutputSide", mAllowInputFromOutputSide);
- aNBT.setInteger("mEUt", mEUt);
- aNBT.setInteger("mMainFacing", mMainFacing.ordinal());
- aNBT.setInteger("mProgresstime", mProgresstime);
- aNBT.setInteger("mMaxProgresstime", mMaxProgresstime);
- if (mOutputFluid != null) aNBT.setTag("mOutputFluid", mOutputFluid.writeToNBT(new NBTTagCompound()));
- if (mFluidOut != null) aNBT.setTag("mFluidOut", mFluidOut.writeToNBT(new NBTTagCompound()));
-
- for (int i = 0; i < mOutputItems.length; i++) if (mOutputItems[i] != null)
- aNBT.setTag("mOutputItem" + i, mOutputItems[i].writeToNBT(new NBTTagCompound()));
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- mFluidTransfer = aNBT.getBoolean("mFluidTransfer");
- mItemTransfer = aNBT.getBoolean("mItemTransfer");
- mHasBeenUpdated = aNBT.getBoolean("mHasBeenUpdated");
- mAllowInputFromOutputSide = aNBT.getBoolean("mAllowInputFromOutputSide");
- mEUt = aNBT.getInteger("mEUt");
- mMainFacing = ForgeDirection.getOrientation(aNBT.getInteger("mMainFacing"));
- mProgresstime = aNBT.getInteger("mProgresstime");
- mMaxProgresstime = aNBT.getInteger("mMaxProgresstime");
- mOutputFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mOutputFluid"));
- mFluidOut = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluidOut"));
-
- for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i);
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- super.onPostTick(aBaseMetaTileEntity, aTick);
-
- if (aBaseMetaTileEntity.isServerSide()) {
-
- // Utils.LOG_WARNING("Ticking Tank.");
- mCharge = aBaseMetaTileEntity.getStoredEU() / 2 > aBaseMetaTileEntity.getEUCapacity() / 3;
- mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3;
-
- doDisplayThings();
-
- boolean tSucceeded = false;
-
- if (mMaxProgresstime > 0 && (mProgresstime >= 0 || aBaseMetaTileEntity.isAllowedToWork())) {
- aBaseMetaTileEntity.setActive(true);
- if (mProgresstime < 0 || drainEnergyForProcess(mEUt)) {
- if (++mProgresstime >= mMaxProgresstime) {
- for (int i = 0; i < mOutputItems.length; i++)
- for (int j = 0; j < mOutputItems.length; j++) if (aBaseMetaTileEntity
- .addStackToSlot(getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i]))
- break;
- if (mOutputFluid != null)
- if (getDrainableStack() == null) setDrainableStack(mOutputFluid.copy());
- else if (mOutputFluid.isFluidEqual(getDrainableStack()))
- getDrainableStack().amount += mOutputFluid.amount;
- for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = null;
- mOutputFluid = null;
- mEUt = 0;
- mProgresstime = 0;
- mMaxProgresstime = 0;
- mStuttering = false;
- tSucceeded = true;
- endProcess();
- }
- if (mProgresstime > 5) mStuttering = false;
- XSTR aXSTR = new XSTR();
- if (false && aXSTR.nextInt(5000) == 0) GT_Utility.sendSoundToPlayers(
- aBaseMetaTileEntity.getWorld(),
- GregTech_API.sSoundList.get(5),
- 10.0F,
- -1.0F,
- aBaseMetaTileEntity.getXCoord(),
- aBaseMetaTileEntity.getYCoord(),
- aBaseMetaTileEntity.getZCoord());
- } else {
- if (!mStuttering) {
- stutterProcess();
- if (canHaveInsufficientEnergy()) mProgresstime = -100;
- mStuttering = true;
- }
- }
- } else {
- aBaseMetaTileEntity.setActive(false);
- }
-
- boolean tRemovedOutputFluid = false;
- Logger.WARNING("R0");
-
- if (doesAutoOutputFluids() && getDrainableStack() != null
- && aBaseMetaTileEntity.getFrontFacing() != mMainFacing
- && (tSucceeded || aTick % 20 == 0)) {
- IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing());
- if (tTank != null) {
- FluidStack tDrained = drain(1000, false);
- if (tDrained != null) {
- int tFilledAmount = tTank.fill(aBaseMetaTileEntity.getBackFacing(), tDrained, false);
- if (tFilledAmount > 0)
- tTank.fill(aBaseMetaTileEntity.getBackFacing(), drain(tFilledAmount, true), true);
- }
- }
- if (getDrainableStack() == null) tRemovedOutputFluid = true;
- }
-
- if (doesAutoOutput() && !isOutputEmpty()
- && aBaseMetaTileEntity.getFrontFacing() != mMainFacing
- && (tSucceeded || mOutputBlocked % 300 == 1
- || aBaseMetaTileEntity.hasInventoryBeenModified()
- || aTick % 600 == 0)) {
- TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing());
- for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0
- && aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) {
- tCosts = GT_Utility.moveOneItemStack(
- aBaseMetaTileEntity,
- tTileEntity2,
- aBaseMetaTileEntity.getFrontFacing(),
- aBaseMetaTileEntity.getBackFacing(),
- null,
- false,
- (byte) 64,
- (byte) 1,
- (byte) 64,
- (byte) 1);
- if (tCosts > 0) aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCosts, true);
- }
- }
-
- if (mOutputBlocked != 0) if (isOutputEmpty()) mOutputBlocked = 0;
- else mOutputBlocked++;
- Logger.WARNING("R1");
- if (allowToCheckRecipe()) {
- Logger.WARNING("R2--------------------------------------------------");
- Logger.WARNING(
- "R2: (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) && hasEnoughEnergyToCheckRecipe())");
- Logger.WARNING("R2--------------------------------------------------");
- Logger.WARNING("R2-mMaxProgresstime: " + mMaxProgresstime);
- Logger.WARNING("R2-isAllowedToWork(): " + aBaseMetaTileEntity.isAllowedToWork());
- Logger.WARNING("R2--------------------------------------------------");
- Logger.WARNING("R2-tRemovedOutputFluid: " + tRemovedOutputFluid);
- Logger.WARNING("R2-tSucceeded: " + tSucceeded);
- Logger.WARNING("R2-hasInventoryBeenModified(): " + aBaseMetaTileEntity.hasInventoryBeenModified());
- Logger.WARNING("R2-(aTick % 600 == 0): " + (aTick % 600 == 0));
- Logger.WARNING("R2-hasWorkJustBeenEnabled(): " + aBaseMetaTileEntity.hasWorkJustBeenEnabled());
- Logger.WARNING("R2--------------------------------------------------");
- Logger.WARNING("R2-hasEnoughEnergyToCheckRecipe(): " + hasEnoughEnergyToCheckRecipe());
- Logger.WARNING("R2--------------------------------------------------");
- if (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork()
- && (tRemovedOutputFluid || tSucceeded
- || aBaseMetaTileEntity.hasInventoryBeenModified()
- || aTick % 600 == 0
- || aBaseMetaTileEntity.hasWorkJustBeenEnabled())
- && hasEnoughEnergyToCheckRecipe()) {
- Logger.WARNING("R3");
- if (checkRecipe() == 2) {
- if (mInventory[3] != null && mInventory[3].stackSize <= 0) mInventory[3] = null;
- Logger.WARNING("R4");
- for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++)
- if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null;
- for (int i = 0; i < mOutputItems.length; i++) {
- mOutputItems[i] = GT_Utility.copy(mOutputItems[i]);
- if (mOutputItems[i] != null && mOutputItems[i].stackSize > 64)
- mOutputItems[i].stackSize = 64;
- mOutputItems[i] = GT_OreDictUnificator.get(true, mOutputItems[i]);
- }
- if (mFluid != null && mFluid.amount <= 0) mFluid = null;
- mMaxProgresstime = Math.max(1, mMaxProgresstime);
- if (GT_Utility.isDebugItem(mInventory[dechargerSlotStartIndex()])) {
- mEUt = mMaxProgresstime = 1;
- }
- startProcess();
- } else {
- mMaxProgresstime = 0;
- for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = null;
- mOutputFluid = null;
- }
- }
- } else {
- if (!mStuttering) {
- stutterProcess();
- mStuttering = true;
- }
- }
- }
- }
-
- protected void doDisplayThings() {
- if (mMainFacing.offsetY != 0 && getBaseMetaTileEntity().getFrontFacing().offsetY == 0) {
- mMainFacing = getBaseMetaTileEntity().getFrontFacing();
- }
- if (mMainFacing.offsetY == 0 && !mHasBeenUpdated) {
- mHasBeenUpdated = true;
- // getBaseMetaTileEntity().setFrontFacing(getBaseMetaTileEntity().getBackFacing());
- }
-
- if (displaysInputFluid()) {
- int tDisplayStackSlot = OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length;
- if (getFillableStack() == null) {
- if (ItemList.Display_Fluid.isStackEqual(mInventory[tDisplayStackSlot], true, true))
- mInventory[tDisplayStackSlot] = null;
- } else {
- mInventory[tDisplayStackSlot] = GT_Utility
- .getFluidDisplayStack(getFillableStack(), displaysStackSize());
- }
- }
- }
-
- protected boolean hasEnoughEnergyToCheckRecipe() {
- return getBaseMetaTileEntity().isUniversalEnergyStored(getMinimumStoredEU() / 2);
- }
-
- protected boolean drainEnergyForProcess(long aEUt) {
- return getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEUt, false);
- }
-
- protected void calculateOverclockedNess(GT_Recipe aRecipe) {
- calculateOverclockedNess(aRecipe.mEUt, aRecipe.mDuration);
- }
-
- protected void calculateOverclockedNess(int aEUt, int aDuration) {
- if (aEUt <= 16) {
- mEUt = aEUt * (1 << (mTier - 1)) * (1 << (mTier - 1));
- mMaxProgresstime = aDuration / (1 << (mTier - 1));
- } else {
- mEUt = aEUt;
- mMaxProgresstime = aDuration;
- while (mEUt <= V[mTier - 1] * mAmperage) {
- mEUt *= 4;
- mMaxProgresstime /= 2;
- }
- }
- }
-
- protected ItemStack getSpecialSlot() {
- return mInventory[3];
- }
-
- protected ItemStack getOutputAt(int aIndex) {
- return mInventory[getOutputSlot() + aIndex];
- }
-
- protected ItemStack[] getAllOutputs() {
- ItemStack[] rOutputs = new ItemStack[mOutputItems.length];
- for (int i = 0; i < mOutputItems.length; i++) rOutputs[i] = getOutputAt(i);
- return rOutputs;
- }
-
- protected boolean canOutput(GT_Recipe aRecipe) {
- return aRecipe != null && (aRecipe.mNeedsEmptyOutput ? isOutputEmpty() && getDrainableStack() == null
- : canOutput(aRecipe.getFluidOutput(0)) && canOutput(aRecipe.mOutputs));
- }
-
- protected boolean canOutput(ItemStack... aOutputs) {
- if (aOutputs == null) return true;
- ItemStack[] tOutputSlots = getAllOutputs();
- for (int i = 0; i < tOutputSlots.length && i < aOutputs.length; i++)
- if (tOutputSlots[i] != null && aOutputs[i] != null
- && (!GT_Utility.areStacksEqual(tOutputSlots[i], aOutputs[i], false)
- || tOutputSlots[i].stackSize + aOutputs[i].stackSize > tOutputSlots[i].getMaxStackSize())) {
- mOutputBlocked++;
- return false;
- }
- return true;
- }
-
- protected boolean canOutput(FluidStack aOutput) {
- return getDrainableStack() == null || aOutput == null
- || (getDrainableStack().isFluidEqual(aOutput) && (getDrainableStack().amount <= 0
- || getDrainableStack().amount + aOutput.amount <= getCapacity()));
- }
-
- protected ItemStack getInputAt(int aIndex) {
- return mInventory[getInputSlot() + aIndex];
- }
-
- protected ItemStack[] getAllInputs() {
- ItemStack[] rInputs = new ItemStack[mInputSlotCount];
- for (int i = 0; i < mInputSlotCount; i++) rInputs[i] = getInputAt(i);
- return rInputs;
- }
-
- protected boolean isOutputEmpty() {
- boolean rIsEmpty = true;
- for (ItemStack tOutputSlotContent : getAllOutputs()) if (tOutputSlotContent != null) rIsEmpty = false;
- return rIsEmpty;
- }
-
- protected boolean displaysInputFluid() {
- return true;
- }
-
- protected boolean displaysOutputFluid() {
- return true;
- }
-
- @Override
- public void onValueUpdate(byte aValue) {
- mMainFacing = ForgeDirection.getOrientation(aValue);
- }
-
- @Override
- public byte getUpdateData() {
- return (byte) mMainFacing.ordinal();
- }
-
- @Override
- public void doSound(byte aIndex, double aX, double aY, double aZ) {
- super.doSound(aIndex, aX, aY, aZ);
- if (aIndex == 8) GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(210), 100, 1.0F, aX, aY, aZ);
- }
-
- public boolean doesAutoOutput() {
- return mItemTransfer;
- }
-
- public boolean doesAutoOutputFluids() {
- return mFluidTransfer;
- }
-
- public boolean allowToCheckRecipe() {
- return true;
- }
-
- public boolean showPipeFacing() {
- return true;
- }
-
- /**
- * Called whenever the Machine successfully started a Process, useful for Sound Effects
- */
- public void startProcess() {
- //
- }
-
- /**
- * Called whenever the Machine successfully finished a Process, useful for Sound Effects
- */
- public void endProcess() {
- //
- }
-
- /**
- * Called whenever the Machine aborted a Process, useful for Sound Effects
- */
- public void abortProcess() {
- //
- }
-
- /**
- * Called whenever the Machine aborted a Process but still works on it, useful for Sound Effects
- */
- public void stutterProcess() {
- if (useStandardStutterSound()) sendSound((byte) 8);
- }
-
- /**
- * If this Machine can have the Insufficient Energy Line Problem
- */
- public boolean canHaveInsufficientEnergy() {
- return true;
- }
-
- public boolean useStandardStutterSound() {
- return true;
- }
-
- @Override
- public String[] getInfoData() {
- return new String[] { mNEIName, "Progress:", (mProgresstime / 20) + " secs", (mMaxProgresstime / 20) + " secs",
- "Stored Energy:", getBaseMetaTileEntity().getStoredEU() + "EU",
- getBaseMetaTileEntity().getEUCapacity() + "EU" };
- }
-
- @Override
- public boolean isGivingInformation() {
- return true;
- }
-
- @Override
- public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (side == getBaseMetaTileEntity().getFrontFacing() || side == mMainFacing) {
- mAllowInputFromOutputSide = !mAllowInputFromOutputSide;
- GT_Utility.sendChatToPlayer(
- aPlayer,
- mAllowInputFromOutputSide ? ("Input from Output Side allowed")
- : ("Input from Output Side forbidden"));
- }
- }
-
- @Override
- public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aCoverID) {
- return (side != mMainFacing || GregTech_API.getCoverBehavior(aCoverID.toStack())
- .isGUIClickable(side, GT_Utility.stackToInt(aCoverID.toStack()), 0, getBaseMetaTileEntity()));
- }
-
- @Override
- public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
- ItemStack aStack) {
- return side != mMainFacing && aIndex >= getOutputSlot() && aIndex < getOutputSlot() + mOutputItems.length;
- }
-
- @Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
- ItemStack aStack) {
- if (side == mMainFacing || aIndex < getInputSlot()
- || aIndex >= getInputSlot() + mInputSlotCount
- || (!mAllowInputFromOutputSide && side == aBaseMetaTileEntity.getFrontFacing()))
- return false;
- for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++)
- if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(aStack), mInventory[i])) return i == aIndex;
- return true;
- }
-
- /**
- * @return the Recipe List which is used for this Machine, this is a useful Default Handler
- */
- public GT_Recipe_Map getRecipeList() {
- return null;
- }
-
- /**
- * Override this to check the Recipes yourself, super calls to this could be useful if you just want to add a
- * special case
- * <p/>
- * I thought about Enum too, but Enum doesn't add support for people adding other return Systems.
- * <p/>
- * Funny how Eclipse marks the word Enum as not correctly spelled.
- *
- * @return see constants above
- */
- public int checkRecipe() {
- return checkRecipe(false);
- }
-
- public static boolean isValidForLowGravity(GT_Recipe tRecipe, int dimId) {
- return // TODO check or get a better solution
- DimensionManager.getProvider(dimId).getClass().getName().contains("Orbit")
- || DimensionManager.getProvider(dimId).getClass().getName().endsWith("Space")
- || DimensionManager.getProvider(dimId).getClass().getName().endsWith("Asteroids")
- || DimensionManager.getProvider(dimId).getClass().getName().endsWith("SS")
- || DimensionManager.getProvider(dimId).getClass().getName().contains("SpaceStation");
- }
-
- /**
- *
- * @param skipOC disables OverclockedNess calculation and check - if you do you must implement your own method...
- * @return
- */
- public int checkRecipe(boolean skipOC) {
- GT_Recipe_Map tMap = getRecipeList();
- if (tMap == null) return DID_NOT_FIND_RECIPE;
- GT_Recipe tRecipe = tMap.findRecipe(
- getBaseMetaTileEntity(),
- mLastRecipe,
- false,
- V[mTier],
- new FluidStack[] { getFillableStack() },
- getSpecialSlot(),
- getAllInputs());
- if (tRecipe == null) return DID_NOT_FIND_RECIPE;
-
- if (false && tRecipe.mSpecialValue == -100
- && !isValidForLowGravity(tRecipe, getBaseMetaTileEntity().getWorld().provider.dimensionId))
- return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
- if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe;
- if (!canOutput(tRecipe)) {
- mOutputBlocked++;
- return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
- }
- if (!tRecipe.isRecipeInputEqual(true, new FluidStack[] { getFillableStack() }, getAllInputs()))
- return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
- for (int i = 0; i < mOutputItems.length; i++)
- if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(i))
- mOutputItems[i] = tRecipe.getOutput(i);
- mOutputFluid = tRecipe.getFluidOutput(0);
- calculateOverclockedNess(tRecipe);
- return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
- }
-
- public ITexture[] getSideFacingActive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getSideFacingInactive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getFrontFacingActive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getFrontFacingInactive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getTopFacingActive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getTopFacingInactive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getBottomFacingActive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getBottomFacingInactive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
- }
-
- public ITexture[] getBottomFacingPipeActive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1],
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-
- public ITexture[] getBottomFacingPipeInactive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1],
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-
- public ITexture[] getTopFacingPipeActive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1],
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-
- public ITexture[] getTopFacingPipeInactive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1],
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-
- public ITexture[] getSideFacingPipeActive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1],
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-
- public ITexture[] getSideFacingPipeInactive(byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1],
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java
deleted file mode 100644
index 0298fe866d..0000000000
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java
+++ /dev/null
@@ -1,362 +0,0 @@
-package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
-
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-
-import gregtech.api.enums.ItemList;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.api.objects.Logger;
-
-/**
- * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
- * <p/>
- * This is the main construct for my generic Tanks. Filling and emptying behavior have to be implemented manually
- */
-public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_BasicTank {
-
- public FluidStack mFluid2;
-
- /**
- * @param aInvSlotCount should be 3
- */
- public GT_MetaTileEntity_DeluxeTank(final int aID, final String aName, final String aNameRegional, final int aTier,
- final int aInvSlotCount, final String aDescription, final ITexture... aTextures) {
- super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- public GT_MetaTileEntity_DeluxeTank(final String aName, final int aTier, final int aInvSlotCount,
- final String aDescription, final ITexture[][][] aTextures) {
- super(aName, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- @Override
- public boolean isSimpleMachine() {
- return false;
- }
-
- @Override
- public boolean isValidSlot(final int aIndex) {
- return aIndex != this.getStackDisplaySlot();
- }
-
- @Override
- public void saveNBTData(final NBTTagCompound aNBT) {
- if (this.mFluid != null) {
- aNBT.setTag("mFluid", this.mFluid.writeToNBT(new NBTTagCompound()));
- }
- if (this.mFluid2 != null) {
- aNBT.setTag("mFluid2", this.mFluid2.writeToNBT(new NBTTagCompound()));
- }
- }
-
- @Override
- public void loadNBTData(final NBTTagCompound aNBT) {
- this.mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
- this.mFluid2 = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid2"));
- }
-
- @Override
- public abstract boolean doesFillContainers();
-
- @Override
- public abstract boolean doesEmptyContainers();
-
- @Override
- public abstract boolean canTankBeFilled();
-
- @Override
- public abstract boolean canTankBeEmptied();
-
- @Override
- public abstract boolean displaysItemStack();
-
- @Override
- public abstract boolean displaysStackSize();
-
- @Override
- public int getInputSlot() {
- return 0;
- }
-
- @Override
- public int getOutputSlot() {
- return 1;
- }
-
- @Override
- public int getStackDisplaySlot() {
- return 2;
- }
-
- public int getStackDisplaySlot2() {
- return 3;
- }
-
- @Override
- public boolean isFluidInputAllowed(final FluidStack aFluid) {
- return true;
- }
-
- @Override
- public boolean isFluidChangingAllowed() {
- return true;
- }
-
- @Override
- public FluidStack getFillableStack() {
- return this.getFillableStackEx(1);
- }
-
- public FluidStack getFillableStackEx(final int stackID) {
- if (stackID <= 1) {
- return this.mFluid;
- }
- return this.mFluid2;
- }
-
- @Override
- public FluidStack setFillableStack(final FluidStack aFluid) {
- this.mFluid = aFluid;
- return this.mFluid;
- }
-
- public FluidStack setFillableStack2(final FluidStack aFluid) {
- this.mFluid2 = aFluid;
- return this.mFluid2;
- }
-
- @Override
- public FluidStack getDrainableStack() {
- return this.getDrainableStackEx(1);
- }
-
- public FluidStack getDrainableStackEx(final int stackID) {
- if (stackID <= 1) {
- return this.mFluid;
- }
- return this.mFluid2;
- }
-
- @Override
- public FluidStack setDrainableStack(final FluidStack aFluid) {
- this.mFluid = aFluid;
- return this.mFluid;
- }
-
- @Override
- public FluidStack getDisplayedFluid() {
- return this.getDrainableStack();
- }
-
- @Override
- public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
- if (aBaseMetaTileEntity.isServerSide()) {
- if (this.isFluidChangingAllowed() && (this.getFillableStack() != null)
- && (this.getFillableStack().amount <= 0)) {
- this.setFillableStack(null);
- }
-
- if (this.displaysItemStack() && (this.getStackDisplaySlot() >= 0)
- && (this.getStackDisplaySlot() < this.mInventory.length)) {
- if (this.getDisplayedFluid() == null) {
- if (ItemList.Display_Fluid.isStackEqual(this.mInventory[this.getStackDisplaySlot()], true, true)) {
- this.mInventory[this.getStackDisplaySlot()] = null;
- }
- } else {
- this.mInventory[this.getStackDisplaySlot()] = GT_Utility
- .getFluidDisplayStack(this.getDisplayedFluid(), this.displaysStackSize());
- }
- }
-
- if (this.displaysItemStack() && (this.getStackDisplaySlot2() >= 0)
- && (this.getStackDisplaySlot2() < this.mInventory.length)) {
- if (this.getDrainableStackEx(2) == null) {
- if (ItemList.Display_Fluid.isStackEqual(this.mInventory[this.getStackDisplaySlot2()], true, true)) {
- this.mInventory[this.getStackDisplaySlot2()] = null;
- }
- } else {
- this.mInventory[this.getStackDisplaySlot2()] = GT_Utility
- .getFluidDisplayStack(this.getDrainableStackEx(2), this.displaysStackSize());
- }
- }
-
- if (this.doesEmptyContainers()) {
- final FluidStack tFluid = GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true);
- if ((tFluid != null) && this.isFluidInputAllowed(tFluid)) {
-
- if (tFluid.isFluidEqual(this.getDrainableStackEx(1)) || (this.getDrainableStackEx(1) == null)) {
- if (this.getFillableStackEx(1) == null) {
- if (this.isFluidInputAllowed(tFluid) && (tFluid.amount <= this.getCapacity())) {
- if (aBaseMetaTileEntity.addStackToSlot(
- this.getOutputSlot(),
- GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true),
- 1)) {
- this.setFillableStack(tFluid.copy());
- aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1);
- }
- }
- } else {
- if (tFluid.isFluidEqual(this.getFillableStack())
- && ((tFluid.amount + this.getFillableStack().amount) <= this.getCapacity())) {
- if (aBaseMetaTileEntity.addStackToSlot(
- this.getOutputSlot(),
- GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true),
- 1)) {
- this.getFillableStack().amount += tFluid.amount;
- aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1);
- }
- }
- }
- } else
- if (tFluid.isFluidEqual(this.getDrainableStackEx(2)) || (this.getDrainableStackEx(2) == null)) {
- if (this.getFillableStackEx(2) == null) {
- if (this.isFluidInputAllowed(tFluid) && (tFluid.amount <= this.getCapacity())) {
- if (aBaseMetaTileEntity.addStackToSlot(
- this.getOutputSlot(),
- GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true),
- 1)) {
- this.setFillableStack2(tFluid.copy());
- aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1);
- }
- }
- } else {
- if (tFluid.isFluidEqual(this.getFillableStackEx(2))
- && ((tFluid.amount + this.getFillableStackEx(2).amount)
- <= this.getCapacity())) {
- if (aBaseMetaTileEntity.addStackToSlot(
- this.getOutputSlot(),
- GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true),
- 1)) {
- this.getFillableStackEx(2).amount += tFluid.amount;
- aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1);
- }
- }
- }
- } else {
- Logger.INFO("Something broke when trying to empty cells between two fluid tank areas.");
- }
- }
- }
-
- if (this.doesFillContainers()) {
- final ItemStack tOutput = GT_Utility.fillFluidContainer(
- this.getDrainableStack(),
- this.mInventory[this.getInputSlot()],
- false,
- true);
- if ((tOutput != null) && aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tOutput, 1)) {
- final FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true);
- aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1);
- if (tFluid != null) {
- this.getDrainableStack().amount -= tFluid.amount;
- }
- if ((this.getDrainableStack().amount <= 0) && this.isFluidChangingAllowed()) {
- this.setDrainableStack(null);
- }
- }
- }
- }
- }
-
- @Override
- public FluidStack getFluid() {
- return this.getDrainableStack();
- }
-
- @Override
- public int getFluidAmount() {
- return this.getDrainableStack() != null ? this.getDrainableStack().amount : 0;
- }
-
- @Override
- public int fill(final FluidStack aFluid, final boolean doFill) {
- if ((aFluid == null) || (aFluid.getFluid().getID() <= 0)
- || (aFluid.amount <= 0)
- || !this.canTankBeFilled()
- || !this.isFluidInputAllowed(aFluid)) {
- return 0;
- }
-
- if ((this.getFillableStack() == null) || (this.getFillableStack().getFluid().getID() <= 0)) {
- if (aFluid.amount <= this.getCapacity()) {
- if (doFill) {
- this.setFillableStack(aFluid.copy());
- this.getBaseMetaTileEntity().markDirty();
- }
- return aFluid.amount;
- }
- if (doFill) {
- this.setFillableStack(aFluid.copy());
- this.getFillableStack().amount = this.getCapacity();
- this.getBaseMetaTileEntity().markDirty();
- }
- return this.getCapacity();
- }
-
- if (!this.getFillableStack().isFluidEqual(aFluid)) {
- return 0;
- }
-
- final int space = this.getCapacity() - this.getFillableStack().amount;
- if (aFluid.amount <= space) {
- if (doFill) {
- this.getFillableStack().amount += aFluid.amount;
- this.getBaseMetaTileEntity().markDirty();
- }
- return aFluid.amount;
- }
- if (doFill) {
- this.getFillableStack().amount = this.getCapacity();
- }
- return space;
- }
-
- @Override
- public FluidStack drain(final int maxDrain, final boolean doDrain) {
- if ((this.getDrainableStack() == null) || !this.canTankBeEmptied()) {
- return null;
- }
- if ((this.getDrainableStack().amount <= 0) && this.isFluidChangingAllowed()) {
- this.setDrainableStack(null);
- this.getBaseMetaTileEntity().markDirty();
- return null;
- }
-
- int used = maxDrain;
- if (this.getDrainableStack().amount < used) {
- used = this.getDrainableStack().amount;
- }
-
- if (doDrain) {
- this.getDrainableStack().amount -= used;
- this.getBaseMetaTileEntity().markDirty();
- }
-
- final FluidStack drained = this.getDrainableStack().copy();
- drained.amount = used;
-
- if ((this.getDrainableStack().amount <= 0) && this.isFluidChangingAllowed()) {
- this.setDrainableStack(null);
- this.getBaseMetaTileEntity().markDirty();
- }
-
- return drained;
- }
-
- @Override
- public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex,
- final ForgeDirection side, final ItemStack aStack) {
- return aIndex == this.getOutputSlot();
- }
-
- @Override
- public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex,
- final ForgeDirection side, final ItemStack aStack) {
- return aIndex == this.getInputSlot();
- }
-}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java
index 7d1b186536..69a9c67d57 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java
@@ -10,6 +10,8 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
+import com.gtnewhorizons.modularui.common.widget.FluidSlotWidget;
+
import gregtech.GT_Mod;
import gregtech.api.gui.modularui.GT_UIInfos;
import gregtech.api.interfaces.ITexture;
@@ -18,7 +20,6 @@ import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Utility;
-import gregtech.common.gui.modularui.widget.FluidDisplaySlotWidget;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.FluidUtils;
@@ -211,7 +212,7 @@ public class GT_MetaTileEntity_Hatch_CustomFluidBase extends GT_MetaTileEntity_H
}
@Override
- protected FluidDisplaySlotWidget createDrainableFluidSlot() {
- return super.createDrainableFluidSlot().setEmptyCanFillFilter(s -> s == mLockedFluid);
+ protected FluidSlotWidget createFluidSlot() {
+ return super.createFluidSlot().setFilter(f -> f == mLockedFluid);
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java
deleted file mode 100644
index c70bf27467..0000000000
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java
+++ /dev/null
@@ -1,477 +0,0 @@
-package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators;
-
-import static gregtech.api.enums.GT_Values.V;
-
-import java.util.Collection;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-
-import gregtech.api.enums.Textures;
-import gregtech.api.gui.modularui.GT_UIInfos;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_DeluxeTank;
-
-public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_DeluxeTank {
-
- private boolean useFuel = false;
-
- public GregtechDoubleFuelGeneratorBase(final int aID, final String aName, final String aNameRegional,
- final int aTier, final String aDescription, final ITexture... aTextures) {
- super(aID, aName, aNameRegional, aTier, 4, aDescription, aTextures);
- }
-
- public GregtechDoubleFuelGeneratorBase(final String aName, final int aTier, final String aDescription,
- final ITexture[][][] aTextures) {
- super(aName, aTier, 4, aDescription, aTextures);
- }
-
- @Override
- public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
- final ITexture[][][] rTextures = new ITexture[10][17][];
- for (byte i = -1; i < 16; i++) {
- rTextures[0][i + 1] = this.getFront(i);
- rTextures[1][i + 1] = this.getBack(i);
- rTextures[2][i + 1] = this.getBottom(i);
- rTextures[3][i + 1] = this.getTop(i);
- rTextures[4][i + 1] = this.getSides(i);
- rTextures[5][i + 1] = this.getFrontActive(i);
- rTextures[6][i + 1] = this.getBackActive(i);
- rTextures[7][i + 1] = this.getBottomActive(i);
- rTextures[8][i + 1] = this.getTopActive(i);
- rTextures[9][i + 1] = this.getSidesActive(i);
- }
- return rTextures;
- }
-
- @Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side,
- final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) {
- return this.mTextures[(aActive ? 5 : 0)
- + (side == facing ? 0
- : side == facing.getOpposite() ? 1
- : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex
- + 1];
- }
-
- @Override
- public String[] getDescription() {
- return new String[] { this.mDescription, "Fuel Efficiency: " + this.getEfficiency() + "%" };
- }
-
- /*
- * @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if
- * (aBaseMetaTileEntity.isClientSide()) return true; aBaseMetaTileEntity.openGUI(aPlayer); return true; }
- */
-
- @Override
- public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
- if (aBaseMetaTileEntity.isClientSide()) {
- Logger.WARNING("Entity is Client side, simply returning true");
- return true;
- }
- Logger.WARNING(
- "Entity is not Client side, opening entity Container and by extension, it's GUI, then returning true");
- GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer);
- return true;
- }
-
- public ITexture[] getFront(final byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] };
- }
-
- public ITexture[] getBack(final byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] };
- }
-
- public ITexture[] getBottom(final byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] };
- }
-
- public ITexture[] getTop(final byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] };
- }
-
- public ITexture[] getSides(final byte aColor) {
- return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] };
- }
-
- public ITexture[] getFrontActive(final byte aColor) {
- return this.getFront(aColor);
- }
-
- public ITexture[] getBackActive(final byte aColor) {
- return this.getBack(aColor);
- }
-
- public ITexture[] getBottomActive(final byte aColor) {
- return this.getBottom(aColor);
- }
-
- public ITexture[] getTopActive(final byte aColor) {
- return this.getTop(aColor);
- }
-
- public ITexture[] getSidesActive(final byte aColor) {
- return this.getSides(aColor);
- }
-
- @Override
- public boolean isFacingValid(final ForgeDirection side) {
- return side.offsetY == 0;
- }
-
- @Override
- public boolean isSimpleMachine() {
- return false;
- }
-
- @Override
- public boolean isValidSlot(final int aIndex) {
- return aIndex < 2;
- }
-
- @Override
- public boolean isEnetOutput() {
- return true;
- }
-
- @Override
- public boolean isOutputFacing(final ForgeDirection side) {
- return true;
- }
-
- @Override
- public boolean isAccessAllowed(final EntityPlayer aPlayer) {
- return true;
- }
-
- @Override
- public long maxEUOutput() {
- return this.getBaseMetaTileEntity().isAllowedToWork() ? V[this.mTier] : 0;
- }
-
- @Override
- public long maxEUStore() {
- return Math.max(this.getEUVar(), (V[this.mTier] * 115) + this.getMinimumStoredEU());
- }
-
- @Override
- public boolean doesFillContainers() {
- return this.getBaseMetaTileEntity().isAllowedToWork();
- }
-
- @Override
- public boolean doesEmptyContainers() {
- return this.getBaseMetaTileEntity().isAllowedToWork();
- }
-
- @Override
- public boolean canTankBeFilled() {
- return this.getBaseMetaTileEntity().isAllowedToWork();
- }
-
- @Override
- public boolean canTankBeEmptied() {
- return this.getBaseMetaTileEntity().isAllowedToWork();
- }
-
- @Override
- public boolean displaysItemStack() {
- return true;
- }
-
- @Override
- public boolean displaysStackSize() {
- return false;
- }
-
- @Override
- public boolean isFluidInputAllowed(final FluidStack aFluid) {
- return this.getFuelValue(aFluid) > 0;
- }
-
- @Override
- public long getMinimumStoredEU() {
- return 512;
- }
-
- @Override
- public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
- if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && ((aTick % 10) == 0)) {
- if (this.mFluid == null) {
- if (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUOutput() + this.getMinimumStoredEU())) {
- this.mInventory[this.getStackDisplaySlot()] = null;
- } else {
- if (this.mInventory[this.getStackDisplaySlot()] == null) {
- this.mInventory[this.getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1);
- }
- this.mInventory[this.getStackDisplaySlot()].setStackDisplayName(
- "Generating: "
- + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU())
- + " EU");
- }
- } else {
- if ((this.mFluid != null) && (this.mFluid2 != null)) {
- final int tFuelValue = this.getFuelValue(this.mFluid),
- tConsumed = this.consumedFluidPerOperation(this.mFluid);
- final int tFuelValue2 = this.getFuelValue(this.mFluid2),
- tConsumed2 = this.consumedFluidPerOperation(this.mFluid2);
- if (((tFuelValue > 0) && (tConsumed > 0)
- && (this.mFluid.amount > tConsumed)) /*
- * && (tFuelValue2 > 0 && tConsumed2 > 0 &&
- * mFluid2.amount > tConsumed2)
- */) {
-
- Logger.WARNING("tFuelValue: " + tFuelValue);
- Logger.WARNING("tConsumed: " + tConsumed);
- Logger.WARNING("mFluid.name: " + this.mFluid.getFluid().getName());
- Logger.WARNING("mFluid.amount: " + this.mFluid.amount);
- Logger.WARNING("mFluid.amount > tConsumed: " + (this.mFluid.amount > tConsumed));
-
- Logger.WARNING("=========================================================");
-
- Logger.WARNING("tFuelValue2: " + tFuelValue2);
- Logger.WARNING("tConsumed2: " + tConsumed2);
- Logger.WARNING("mFluid2.name: " + this.mFluid2.getFluid().getName());
- Logger.WARNING("mFluid2.amount: " + this.mFluid2.amount);
- Logger.WARNING("mFluid2.amount > tConsumed2: " + (this.mFluid2.amount > tConsumed2));
- long tFluidAmountToUse = Math.min(
- this.mFluid.amount / tConsumed,
- (((this.maxEUOutput() * 30) + this.getMinimumStoredEU())
- - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue);
- long tFluidAmountToUse2 = Math.min(
- this.mFluid2.amount / tConsumed2,
- (((this.maxEUOutput() * 30) + this.getMinimumStoredEU())
- - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue2);
-
- if (tFluidAmountToUse <= 0) {
- /*
- * if ((mFluid.amount / tConsumed) == getCapacity()){ tFluidAmountToUse = 1; }
- */
-
- if (aBaseMetaTileEntity.getUniversalEnergyStored() <= (aBaseMetaTileEntity.getEUCapacity()
- - aBaseMetaTileEntity.getUniversalEnergyStored())) {
- tFluidAmountToUse = 1;
- Logger.WARNING("=========================================================");
- Logger.WARNING("tFluidAmountToUse - Updated: " + tFluidAmountToUse);
- Logger.WARNING("=========================================================");
- }
- }
-
- if (tFluidAmountToUse2 <= 0) {
- /*
- * if ((mFluid2.amount / tConsumed) == getCapacity()){ tFluidAmountToUse2 = 1; }
- */
- if (aBaseMetaTileEntity.getUniversalEnergyStored() <= (aBaseMetaTileEntity.getEUCapacity()
- - aBaseMetaTileEntity.getUniversalEnergyStored())) {
- tFluidAmountToUse2 = 1;
- Logger.WARNING("=========================================================");
- Logger.WARNING("tFluidAmountToUse2 - Updated: " + tFluidAmountToUse2);
- Logger.WARNING("=========================================================");
- }
- }
-
- Logger.WARNING("=========================================================");
- Logger.WARNING("tFluidAmountToUse: " + tFluidAmountToUse);
- Logger.WARNING("=========================================================");
-
- /*
- * Utils.LOG_WARNING("mFluid.amount / tConsumed: "+("fluidAmount:"+mFluid.amount)+(" tConsumed:"
- * +tConsumed)+" | "+(mFluid.amount / tConsumed));
- * Utils.LOG_WARNING("maxEUOutput() * 20 + getMinimumStoredEU(): "+(maxEUOutput() * 30 +
- * getMinimumStoredEU())); Utils.LOG_WARNING("maxEUOutput(): "+maxEUOutput());
- * Utils.LOG_WARNING("maxEUOutput() * 20: "+(maxEUOutput() * 30));
- * Utils.LOG_WARNING("getMinimumStoredEU(): "+(getMinimumStoredEU()));
- * Utils.LOG_WARNING("aBaseMetaTileEntity.getUniversalEnergyStored(): "+(aBaseMetaTileEntity.
- * getUniversalEnergyStored())); Utils.
- * LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()): "
- * +((maxEUOutput() * 30 + getMinimumStoredEU() -
- * aBaseMetaTileEntity.getUniversalEnergyStored())));
- * Utils.LOG_WARNING("tFuelValue: "+(tFuelValue)); Utils.
- * LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue): "
- * +((maxEUOutput() * 30 + getMinimumStoredEU() -
- * aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue));
- */
-
- Logger.WARNING("=========================================================");
- Logger.WARNING("tFluidAmountToUse2: " + tFluidAmountToUse2);
- Logger.WARNING("=========================================================");
-
- /*
- * Utils.LOG_WARNING("mFluid2.amount / tConsumed2: "+("fluidAmount2:"+mFluid2.amount)+
- * (" tConsumed2:"+tConsumed2)+" | "+(mFluid2.amount / tConsumed2));
- * Utils.LOG_WARNING("maxEUOutput() * 20 + getMinimumStoredEU(): "+(maxEUOutput() * 30 +
- * getMinimumStoredEU())); Utils.LOG_WARNING("maxEUOutput(): "+maxEUOutput());
- * Utils.LOG_WARNING("maxEUOutput() * 20: "+(maxEUOutput() * 30));
- * Utils.LOG_WARNING("getMinimumStoredEU(): "+(getMinimumStoredEU()));
- * Utils.LOG_WARNING("aBaseMetaTileEntity.getUniversalEnergyStored(): "+(aBaseMetaTileEntity.
- * getUniversalEnergyStored())); Utils.
- * LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()): "
- * +((maxEUOutput() * 30 + getMinimumStoredEU() -
- * aBaseMetaTileEntity.getUniversalEnergyStored())));
- * Utils.LOG_WARNING("tFuelValue2: "+(tFuelValue2)); Utils.
- * LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue2): "
- * +((maxEUOutput() * 30 + getMinimumStoredEU() -
- * aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue2));
- */
- if (((tFluidAmountToUse > 0)
- && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true))
- && ((tFluidAmountToUse2 > 0) && aBaseMetaTileEntity
- .increaseStoredEnergyUnits(tFluidAmountToUse2 * tFuelValue2, true))) {
-
- Logger.WARNING("tFuelValue: " + tFuelValue);
- Logger.WARNING("tConsumed: " + tConsumed);
- Logger.WARNING("mFluid.name: " + this.mFluid.getFluid().getName());
- Logger.WARNING("mFluid.amount: " + this.mFluid.amount);
- Logger.WARNING("mFluid.amount > tConsumed: " + (this.mFluid.amount > tConsumed));
-
- Logger.WARNING("=========================================================");
-
- Logger.WARNING("tFuelValue2: " + tFuelValue2);
- Logger.WARNING("tConsumed2: " + tConsumed2);
- Logger.WARNING("mFluid2.name: " + this.mFluid2.getFluid().getName());
- Logger.WARNING("mFluid2.amount: " + this.mFluid2.amount);
- Logger.WARNING("mFluid2.amount > tConsumed2: " + (this.mFluid2.amount > tConsumed2));
-
- if (this.useFuel) {
- this.mFluid.amount -= tFluidAmountToUse * tConsumed;
- this.mFluid2.amount -= tFluidAmountToUse2 * tConsumed2;
- this.useFuel = false;
- } else {
- this.useFuel = true;
- }
-
- } else {
- Logger.WARNING("=========================================================");
- Logger.WARNING(
- "Either tFluidAmountToUse1 <= 0, power cannot be increased of tFluidAmountToUse2 <= 0");
- Logger.WARNING("tFluidAmountToUse1: " + tFluidAmountToUse);
- Logger.WARNING("tFluidAmountToUse2: " + tFluidAmountToUse2);
- }
- } else {
- /*
- * Utils.
- * LOG_WARNING("(tFuelValue > 0 && tConsumed > 0 && mFluid.amount > tConsumed) && (tFuelValue2 > 0 && tConsumed2 > 0 && mFluid2.amount > tConsumed2)"
- * ); Utils.LOG_WARNING("tFuelValue: "+tFuelValue); Utils.LOG_WARNING("tConsumed: "+tConsumed);
- * Utils.LOG_WARNING("mFluid.amount: "+mFluid.amount);
- * Utils.LOG_WARNING("mFluid.amount > tConsumed: "+(mFluid.amount > tConsumed));
- * Utils.LOG_WARNING("=========================================================");
- * Utils.LOG_WARNING("tFuelValue2: "+tFuelValue2); Utils.LOG_WARNING("tConsumed2: "+tConsumed2);
- * Utils.LOG_WARNING("mFluid2.amount: "+mFluid2.amount);
- * Utils.LOG_WARNING("mFluid2.amount > tConsumed2: "+(mFluid2.amount > tConsumed2));
- */
- }
- } else {
- Logger.WARNING("One mFluid is null");
- if (this.mFluid != null) {
- Logger.WARNING("mFluid1 is not null");
- }
- if (this.mFluid2 != null) {
- Logger.WARNING("mFluid2 is not null");
- }
- }
- }
- if ((this.mInventory[this.getInputSlot()] != null)
- && (aBaseMetaTileEntity.getUniversalEnergyStored()
- < ((this.maxEUOutput() * 20) + this.getMinimumStoredEU()))
- && (GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true) == null)) {
- final int tFuelValue = this.getFuelValue(this.mInventory[this.getInputSlot()]);
- if (tFuelValue > 0) {
- final ItemStack tEmptyContainer = this.getEmptyContainer(this.mInventory[this.getInputSlot()]);
- if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tEmptyContainer)) {
- aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true);
- aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1);
- }
- }
- }
- }
-
- if (aBaseMetaTileEntity.isServerSide()) {
- aBaseMetaTileEntity.setActive(
- aBaseMetaTileEntity.isAllowedToWork() && (aBaseMetaTileEntity.getUniversalEnergyStored()
- >= (this.maxEUOutput() + this.getMinimumStoredEU())));
- }
- }
-
- public abstract GT_Recipe_Map getRecipes();
-
- public abstract int getEfficiency();
-
- public int consumedFluidPerOperation(final FluidStack aLiquid) {
- return 1;
- }
-
- public int getFuelValue(final FluidStack aLiquid) {
- if ((aLiquid == null) || (this.getRecipes() == null)) {
- return 0;
- }
- FluidStack tLiquid;
- final Collection<GT_Recipe> tRecipeList = this.getRecipes().mRecipeList;
- if (tRecipeList != null) {
- for (final GT_Recipe tFuel : tRecipeList) {
- if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null) {
- if (aLiquid.isFluidEqual(tLiquid)) {
- return (int) (((long) tFuel.mSpecialValue * this.getEfficiency()
- * this.consumedFluidPerOperation(tLiquid)) / 100);
- }
- }
- }
- }
- return 0;
- }
-
- public int getFuelValue(final ItemStack aStack) {
- if (GT_Utility.isStackInvalid(aStack) || (this.getRecipes() == null)) {
- return 0;
- }
- final GT_Recipe tFuel = this.getRecipes()
- .findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack);
- if (tFuel != null) {
- return (int) ((tFuel.mSpecialValue * 1000L * this.getEfficiency()) / 100);
- }
- return 0;
- }
-
- public ItemStack getEmptyContainer(final ItemStack aStack) {
- if (GT_Utility.isStackInvalid(aStack) || (this.getRecipes() == null)) {
- return null;
- }
- final GT_Recipe tFuel = this.getRecipes()
- .findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack);
- if (tFuel != null) {
- return GT_Utility.copy(tFuel.getOutput(0));
- }
- return GT_Utility.getContainerItem(aStack, true);
- }
-
- @Override
- public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex,
- final ForgeDirection side, final ItemStack aStack) {
- return super.allowPutStack(aBaseMetaTileEntity, aIndex, side, aStack) && ((this.getFuelValue(aStack) > 0)
- || (this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0));
- }
-
- @Override
- public int getCapacity() {
- return 32000;
- }
-
- @Override
- public int getTankPressure() {
- return -100;
- }
-
- @Override
- public boolean useModularUI() {
- return true;
- }
-}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java
deleted file mode 100644
index 5e4d6d7348..0000000000
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java
+++ /dev/null
@@ -1,571 +0,0 @@
-package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
-
-import java.util.List;
-
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.FluidTankInfo;
-import net.minecraftforge.fluids.IFluidHandler;
-
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.MetaTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_OreDictUnificator;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.slots.SlotChemicalPlantInput;
-import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
-
-public class GregtechMetaTileEntity_ChemicalReactor extends GT_MetaTileEntity_BasicMachine {
-
- public boolean mFluidTransfer_1 = false;
- public boolean mFluidTransfer_2 = false;
-
- public FluidStack[] mInputFluids = new FluidStack[4];
- public FluidStack[] mOutputFluids = new FluidStack[2];
-
- public GregtechMetaTileEntity_ChemicalReactor(int aID, String aName, String aNameRegional, int aTier) {
- super(
- aID,
- aName,
- aNameRegional,
- aTier,
- 1,
- "For mixing fluids",
- 4,
- 4,
- "ChemicalReactor.png",
- "",
- new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Side_Active),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Side),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Front_Active),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Front),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top_Active),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top_Active),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top) });
- }
-
- public GregtechMetaTileEntity_ChemicalReactor(String aName, int aTier, String aDescription,
- ITexture[][][] aTextures, String aGUIName, String aNEIName) {
- super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
- }
-
- /*
- * public GregtechMetaTileEntity_BasicWasher(String aName, int aTier, String[] aDescription, ITexture[][][]
- * aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName,
- * aNEIName); }
- */
-
- @Override
- public String[] getDescription() {
- return new String[] { this.mDescription, "Because why not?", CORE.GT_Tooltip.get() };
- }
-
- @Override
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- try {
- GregtechMetaTileEntity_ChemicalReactor y = new GregtechMetaTileEntity_ChemicalReactor(
- this.mName,
- this.mTier,
- this.mDescription,
- this.mTextures,
- this.mGUIName,
- this.mNEIName);
- return y;
- } catch (Throwable t) {
- t.printStackTrace();
- }
- return null;
- }
-
- @Override
- public GT_Recipe.GT_Recipe_Map getRecipeList() {
- return null;
- }
-
- @Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
- ItemStack aStack) {
- return (super.allowPutStack(aBaseMetaTileEntity, aIndex, side, aStack))
- && (getRecipeList().containsInput(aStack));
- }
-
- @Override
- public boolean isFluidInputAllowed(FluidStack aFluid) {
- return (super.isFluidInputAllowed(aFluid));
- }
-
- @Override
- public int getCapacity() {
- return 32000 * Math.max(1, this.mTier) / 4;
- }
-
- @Override
- public int getInputSlot() {
- return 3;
- }
-
- @Override
- public boolean isLiquidInput(ForgeDirection side) {
- return side.offsetY == 0;
- }
-
- @Override
- public boolean isLiquidOutput(ForgeDirection side) {
- return side.offsetY != 0;
- }
-
- @Override
- public int getOutputSlot() {
- return super.getOutputSlot();
- }
-
- @Override
- public int getStackDisplaySlot() {
- return super.getStackDisplaySlot();
- }
-
- @Override
- public boolean doesEmptyContainers() {
- return true;
- }
-
- @Override
- public boolean canTankBeFilled() {
- return super.canTankBeFilled();
- }
-
- @Override
- public boolean canTankBeEmptied() {
- return super.canTankBeEmptied();
- }
-
- @Override
- public FluidStack getDisplayedFluid() {
- return super.getDisplayedFluid();
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- aNBT.setBoolean("mFluidTransfer_1", mFluidTransfer_1);
- aNBT.setBoolean("mFluidTransfer_2", mFluidTransfer_2);
- for (int i = 0; i < 4; i++) {
- if (this.mInputFluids[i] != null) {
- aNBT.setTag("mInputFluid" + i, this.mInputFluids[i].writeToNBT(new NBTTagCompound()));
- }
- }
- for (int i = 0; i < 2; i++) {
- if (this.mOutputFluids[i] != null) {
- aNBT.setTag("mOutputFluid" + i, this.mOutputFluids[i].writeToNBT(new NBTTagCompound()));
- }
- }
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- mFluidTransfer_1 = aNBT.getBoolean("mFluidTransfer_1");
- mFluidTransfer_2 = aNBT.getBoolean("mFluidTransfer_2");
- for (int i = 0; i < 4; i++) {
- if (this.mInputFluids[i] == null) {
- this.mInputFluids[i] = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mInputFluid" + i));
- }
- }
- for (int i = 0; i < 2; i++) {
- if (this.mOutputFluids[i] == null) {
- this.mOutputFluids[i] = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mOutputFluid" + i));
- }
- }
- }
-
- /*
- * Custom Fluid Handling - TODO
- */
-
- @Override
- public FluidStack getFillableStack() {
- return this.mFluid;
- }
-
- @Override
- public FluidStack setFillableStack(FluidStack aFluid) {
- this.mFluid = aFluid;
- return this.mFluid;
- }
-
- @Override
- public FluidStack getDrainableStack() {
- return this.mFluid;
- }
-
- @Override
- public FluidStack setDrainableStack(FluidStack aFluid) {
- this.mFluid = aFluid;
- return this.mFluid;
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- // Re-implement basic machine logic from the ground up.=
-
- if (aBaseMetaTileEntity.isServerSide()) {
- this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L;
- this.mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3L;
- this.doDisplayThings();
- boolean tSucceeded = false;
- int i;
- if (this.mMaxProgresstime > 0 && (this.mProgresstime >= 0 || aBaseMetaTileEntity.isAllowedToWork())) {
- aBaseMetaTileEntity.setActive(true);
- if (this.mProgresstime >= 0 && !this.drainEnergyForProcess((long) this.mEUt)) {
- if (!this.mStuttering) {
- this.stutterProcess();
- if (this.canHaveInsufficientEnergy()) {
- this.mProgresstime = -100;
- }
-
- this.mStuttering = true;
- }
- } else {
- if (++this.mProgresstime >= this.mMaxProgresstime) {
- for (i = 0; i < this.mOutputItems.length; ++i) {
- for (i = 0; i < this.mOutputItems.length && !aBaseMetaTileEntity.addStackToSlot(
- this.getOutputSlot() + (i + i) % this.mOutputItems.length,
- this.mOutputItems[i]); ++i) {
- ;
- }
- }
-
- if (this.mOutputFluid != null) {
- if (this.getDrainableStack() == null) {
- this.setDrainableStack(this.mOutputFluid.copy());
- } else if (this.mOutputFluid.isFluidEqual(this.getDrainableStack())) {
- FluidStack var10000 = this.getDrainableStack();
- var10000.amount += this.mOutputFluid.amount;
- }
- }
-
- for (i = 0; i < this.mOutputItems.length; ++i) {
- this.mOutputItems[i] = null;
- }
-
- this.mOutputFluid = null;
- this.mEUt = 0;
- this.mProgresstime = 0;
- this.mMaxProgresstime = 0;
- this.mStuttering = false;
- tSucceeded = true;
- this.endProcess();
- }
-
- if (this.mProgresstime > 5) {
- this.mStuttering = false;
- }
- }
- } else {
- aBaseMetaTileEntity.setActive(false);
- }
-
- boolean tRemovedOutputFluid = false;
- if (this.doesAutoOutputFluids() && this.getDrainableStack() != null
- && aBaseMetaTileEntity.getFrontFacing() != this.mMainFacing
- && (tSucceeded || aTick % 20L == 0L)) {
- IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing());
- if (tTank != null) {
- FluidStack tDrained = this.drain(1000, false);
- if (tDrained != null) {
- int tFilledAmount = tTank.fill(aBaseMetaTileEntity.getBackFacing(), tDrained, false);
- if (tFilledAmount > 0) {
- tTank.fill(aBaseMetaTileEntity.getBackFacing(), this.drain(tFilledAmount, true), true);
- }
- }
- }
-
- if (this.getDrainableStack() == null) {
- tRemovedOutputFluid = true;
- }
- }
-
- int j;
- if (this.doesAutoOutput() && !this.isOutputEmpty()
- && aBaseMetaTileEntity.getFrontFacing() != this.mMainFacing
- && (tSucceeded || this.mOutputBlocked % 300 == 1
- || aBaseMetaTileEntity.hasInventoryBeenModified()
- || aTick % 600L == 0L)) {
- TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing());
- j = 0;
-
- for (byte tCosts = 1; j < this.mOutputItems.length && tCosts > 0
- && aBaseMetaTileEntity.isUniversalEnergyStored(128L); ++j) {
- tCosts = GT_Utility.moveOneItemStack(
- aBaseMetaTileEntity,
- tTileEntity2,
- aBaseMetaTileEntity.getFrontFacing(),
- aBaseMetaTileEntity.getBackFacing(),
- (List) null,
- false,
- (byte) 64,
- (byte) 1,
- (byte) 64,
- (byte) 1);
- if (tCosts > 0) {
- aBaseMetaTileEntity.decreaseStoredEnergyUnits((long) tCosts, true);
- }
- }
- }
-
- if (this.mOutputBlocked != 0) {
- if (this.isOutputEmpty()) {
- this.mOutputBlocked = 0;
- } else {
- ++this.mOutputBlocked;
- }
- }
-
- if (this.allowToCheckRecipe()) {
- if (this.mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork()
- && (tRemovedOutputFluid || tSucceeded
- || aBaseMetaTileEntity.hasInventoryBeenModified()
- || aTick % 600L == 0L
- || aBaseMetaTileEntity.hasWorkJustBeenEnabled())
- && this.hasEnoughEnergyToCheckRecipe()) {
- if (this.checkRecipe() == 2) {
- if (this.mInventory[3] != null && this.mInventory[3].stackSize <= 0) {
- this.mInventory[3] = null;
- }
-
- i = this.getInputSlot();
-
- for (j = i + this.mInputSlotCount; i < j; ++i) {
- if (this.mInventory[i] != null && this.mInventory[i].stackSize <= 0) {
- this.mInventory[i] = null;
- }
- }
-
- for (i = 0; i < this.mOutputItems.length; ++i) {
- this.mOutputItems[i] = GT_Utility.copy(new Object[] { this.mOutputItems[i] });
- if (this.mOutputItems[i] != null && this.mOutputItems[i].stackSize > 64) {
- this.mOutputItems[i].stackSize = 64;
- }
-
- this.mOutputItems[i] = GT_OreDictUnificator.get(true, this.mOutputItems[i]);
- }
-
- if (this.mFluid != null && this.mFluid.amount <= 0) {
- this.mFluid = null;
- }
-
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- if (GT_Utility.isDebugItem(this.mInventory[this.dechargerSlotStartIndex()])) {
- this.mEUt = this.mMaxProgresstime = 1;
- }
-
- this.startProcess();
- } else {
- this.mMaxProgresstime = 0;
-
- for (i = 0; i < this.mOutputItems.length; ++i) {
- this.mOutputItems[i] = null;
- }
-
- this.mOutputFluid = null;
- }
- }
- } else if (!this.mStuttering) {
- this.stutterProcess();
- this.mStuttering = true;
- }
- }
- }
-
- @Override
- protected void doDisplayThings() {
- // TODO Auto-generated method stub
- super.doDisplayThings();
- }
-
- @Override
- protected ItemStack getSpecialSlot() {
- // TODO Auto-generated method stub
- return super.getSpecialSlot();
- }
-
- @Override
- protected ItemStack getOutputAt(int aIndex) {
- // TODO Auto-generated method stub
- return super.getOutputAt(aIndex);
- }
-
- @Override
- protected ItemStack[] getAllOutputs() {
- // TODO Auto-generated method stub
- return super.getAllOutputs();
- }
-
- @Override
- protected ItemStack getInputAt(int aIndex) {
- // TODO Auto-generated method stub
- return super.getInputAt(aIndex);
- }
-
- @Override
- protected ItemStack[] getAllInputs() {
- // TODO Auto-generated method stub
- return super.getAllInputs();
- }
-
- @Override
- protected boolean displaysInputFluid() {
- return true;
- }
-
- @Override
- protected boolean displaysOutputFluid() {
- return true;
- }
-
- @Override
- public boolean doesAutoOutput() {
- return super.doesAutoOutput();
- }
-
- @Override
- public boolean doesAutoOutputFluids() {
- return this.mFluidTransfer_1 && this.mFluidTransfer_2;
- }
-
- @Override
- public void startProcess() {
- super.startProcess();
- }
-
- @Override
- public void endProcess() {
- super.endProcess();
- }
-
- @Override
- public String[] getInfoData() {
- return super.getInfoData();
- }
-
- @Override
- public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
- ItemStack aStack) {
- return super.allowPullStack(aBaseMetaTileEntity, aIndex, side, aStack);
- }
-
- @Override
- public int checkRecipe() {
- return super.checkRecipe();
- }
-
- @Override
- public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- super.onPreTick(aBaseMetaTileEntity, aTick);
- }
-
- @Override
- public FluidStack getFluid() {
- return super.getFluid();
- }
-
- @Override
- public int getFluidAmount() {
- return super.getFluidAmount();
- }
-
- @Override
- public int fill(FluidStack aFluid, boolean doFill) {
- return super.fill(aFluid, doFill);
- }
-
- @Override
- public FluidStack drain(int maxDrain, boolean doDrain) {
- return super.drain(maxDrain, doDrain);
- }
-
- @Override
- public void setItemNBT(NBTTagCompound aNBT) {
- super.setItemNBT(aNBT);
- }
-
- @Override
- public boolean isItemValidForSlot(int aIndex, ItemStack aStack) {
- if (aIndex >= 3 && aIndex <= 6) {
- return SlotChemicalPlantInput.isItemValidForChemicalPlantSlot(aStack);
- }
- return false;
- }
-
- @Override
- public int[] getAccessibleSlotsFromSide(int ordinalSide) {
- return super.getAccessibleSlotsFromSide(ordinalSide);
- }
-
- @Override
- public boolean canInsertItem(int aIndex, ItemStack aStack, int ordinalSide) {
- if (aIndex >= 3 && aIndex <= 6) {
- return super.canInsertItem(aIndex, aStack, ordinalSide);
- }
- return false;
- }
-
- @Override
- public boolean canExtractItem(int aIndex, ItemStack aStack, int ordinalSide) {
- if (aIndex >= 7 && aIndex <= 11) {
- return super.canExtractItem(aIndex, aStack, ordinalSide);
- }
- return false;
- }
-
- @Override
- public boolean canFill(ForgeDirection aSide, Fluid aFluid) {
- // TODO Auto-generated method stub
- return super.canFill(aSide, aFluid);
- }
-
- @Override
- public boolean canDrain(ForgeDirection aSide, Fluid aFluid) {
- // TODO Auto-generated method stub
- return super.canDrain(aSide, aFluid);
- }
-
- @Override
- public FluidTankInfo[] getTankInfo(ForgeDirection aSide) {
- // TODO Auto-generated method stub
- return super.getTankInfo(aSide);
- }
-
- @Override
- public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
- // TODO Auto-generated method stub
- return super.fill_default(aSide, aFluid, doFill);
- }
-
- @Override
- public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
- // TODO Auto-generated method stub
- return super.fill(aSide, aFluid, doFill);
- }
-
- @Override
- public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) {
- // TODO Auto-generated method stub
- return super.drain(aSide, aFluid, doDrain);
- }
-
- @Override
- public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) {
- // TODO Auto-generated method stub
- return super.drain(aSide, maxDrain, doDrain);
- }
-}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java
deleted file mode 100644
index ba84bf6faf..0000000000
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java
+++ /dev/null
@@ -1,693 +0,0 @@
-package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
-
-import java.util.ArrayList;
-import java.util.Random;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidStack;
-
-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.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.MetaTileEntity;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GTPP_Recipe;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_DeluxeMachine;
-import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
-
-public class GregtechMetaTileEntity_CompactFusionReactor extends GT_MetaTileEntity_DeluxeMachine {
-
- private boolean mCanProcessRecipe = false;
- private boolean mCharging = false;
- private long mChargeConsumed = 0;
-
- private GT_Recipe mLastRecipe;
- private long mEUStore;
- private boolean mRunningOnLoad = false;
- private boolean mMachine = false;
- private int mEfficiency, mEfficiencyIncrease, mEfficiencyMax = 0;
- private int mStartUpCheck = 100, mUpdate = 0;
- private FluidStack[] mOutputFluids = null;
-
- public GregtechMetaTileEntity_CompactFusionReactor(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 1, "It's like a midget Ra.", 1, 1, "PotionBrewer.png", "");
- }
-
- public GregtechMetaTileEntity_CompactFusionReactor(String aName, int aTier, String aDescription,
- ITexture[][][] aTextures, String aGUIName, String aNEIName) {
- super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
- }
-
- @Override
- public String[] getDescription() {
- return new String[] { this.mDescription, "Not Very Fast, but not very big either.",
- "Each side pair in/out puts to different slots.", "Top & Bottom Sides are Outputs.",
- "Front & Back are Input Plasma 1.", "Sides are Input Plasma 2." };
- }
-
- @Override
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GregtechMetaTileEntity_CompactFusionReactor(
- this.mName,
- this.mTier,
- this.mDescription,
- this.mTextures,
- this.mGUIName,
- this.mNEIName);
- }
-
- public int tier() {
- return this.mTier;
- }
-
- public int tierOverclock() {
- return this.mTier == 6 ? 0 : this.mTier == 7 ? 1 : 2;
- }
-
- private GT_RenderedTexture getCasingTexture() {
- return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced);
- }
-
- @Override
- public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
- final ITexture[][][] rTextures = new ITexture[10][17][];
- for (byte i = -1; i < 16; i++) {
- rTextures[0][i + 1] = this.getFront(i);
- rTextures[1][i + 1] = this.getBack(i);
- rTextures[2][i + 1] = this.getBottom(i);
- rTextures[3][i + 1] = this.getTop(i);
- rTextures[4][i + 1] = this.getSides(i);
- rTextures[5][i + 1] = this.getFrontActive(i);
- rTextures[6][i + 1] = this.getBackActive(i);
- rTextures[7][i + 1] = this.getBottomActive(i);
- rTextures[8][i + 1] = this.getTopActive(i);
- rTextures[9][i + 1] = this.getSidesActive(i);
- }
- return rTextures;
- }
-
- @Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side,
- final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) {
- return this.mTextures[(aActive ? 5 : 0)
- + (side == facing ? 0
- : side == facing.getOpposite() ? 1
- : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex
- + 1];
- }
-
- @Override
- public GT_Recipe.GT_Recipe_Map getRecipeList() {
- return GTPP_Recipe.GTPP_Recipe_Map.sSlowFusionRecipes;
- }
-
- @Override
- public boolean isOutputFacing(final ForgeDirection side) {
- return side == this.getBaseMetaTileEntity().getBackFacing();
- }
-
- @Override
- public boolean isFluidInputAllowed(FluidStack aFluid) {
- return (aFluid.getFluid().getName().contains("plasma")) || (super.isFluidInputAllowed(aFluid));
- }
-
- @Override
- public int getCapacity() {
- return 32000;
- }
-
- @Override
- public void abortProcess() {
- super.abortProcess();
- }
-
- long mFusionPoint = 20000000L;
-
- @Override
- public int checkRecipe() {
- Logger.MACHINE_INFO("Recipe Tick 1.");
- if (!this.mCanProcessRecipe) {
- Logger.MACHINE_INFO("Recipe Tick 1.1 - Cannot Process Recipe.");
- if (this.mChargeConsumed < mFusionPoint) {
- Logger.MACHINE_INFO("Recipe Tick 1.2 - Cannot Ignite Fusion, Charge too low.");
- this.mCharging = true;
- this.mCanProcessRecipe = false;
- if (this.getBaseMetaTileEntity().decreaseStoredEnergyUnits((mFusionPoint / 100), false)) {
- Logger.MACHINE_INFO(
- "Recipe Tick 1.3 - Charging Internal storage. " + (mFusionPoint / 100)
- + "/"
- + mFusionPoint);
- mChargeConsumed += (mFusionPoint / 100);
- }
- } else {
- mChargeConsumed = 0;
- this.mCharging = false;
- this.mCanProcessRecipe = true;
- }
- } else {
- Logger.MACHINE_INFO("Recipe Tick 1.1 - Try to Process Recipe.");
- if (checkRecipeMulti()) {
- Logger.MACHINE_INFO("Recipe Tick 1.2 - Process Recipe was Successful.");
- return 2;
- }
- }
- Logger.MACHINE_INFO("Recipe Tick 2. - Process Recipe failed.");
- return 0;
- }
-
- public ArrayList<FluidStack> getStoredFluids() {
- ArrayList<FluidStack> mList = new ArrayList<FluidStack>();
- mList.add(this.mFluid);
- mList.add(this.mFluid2);
- return mList;
- }
-
- public boolean checkRecipeMulti() {
- ArrayList<FluidStack> tFluidList = getStoredFluids();
- int tFluidList_sS = tFluidList.size();
- for (int i = 0; i < tFluidList_sS - 1; i++) {
- for (int j = i + 1; j < tFluidList_sS; j++) {
- if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) {
- if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
- tFluidList.remove(j--);
- tFluidList_sS = tFluidList.size();
- } else {
- tFluidList.remove(i--);
- tFluidList_sS = tFluidList.size();
- break;
- }
- }
- }
- }
- if (tFluidList.size() > 1) {
- FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]);
- GT_Recipe tRecipe = getRecipeList().findRecipe(
- this.getBaseMetaTileEntity(),
- this.mLastRecipe,
- false,
- GT_Values.V[8],
- tFluids,
- new ItemStack[] {});
- if (tRecipe == null) {
- return false;
- }
- if ((tRecipe == null && !mRunningOnLoad) || (tRecipe != null && maxEUStore() < tRecipe.mSpecialValue)) {
- this.mLastRecipe = null;
- Logger.MACHINE_INFO("Just plain bad.");
- return false;
- }
- if (mRunningOnLoad || tRecipe.isRecipeInputEqual(true, tFluids, new ItemStack[] {})) {
- this.mLastRecipe = tRecipe;
- this.mEUt = (this.mLastRecipe.mEUt * overclock(this.mLastRecipe.mSpecialValue));
- this.mMaxProgresstime = this.mLastRecipe.mDuration / overclock(this.mLastRecipe.mSpecialValue);
-
- this.mEfficiencyIncrease = 10000;
-
- this.mOutputFluids = this.mLastRecipe.mFluidOutputs;
- mRunningOnLoad = false;
- return true;
- }
- }
- return false;
- }
-
- public int overclock(int mStartEnergy) {
- if (tierOverclock() == 1) {
- return 1;
- }
- if (tierOverclock() == 2) {
- return mStartEnergy < 160000000 ? 2 : 1;
- }
- return mStartEnergy < 160000000 ? 4 : mStartEnergy < 320000000 ? 2 : 1;
- }
-
- @Override
- public boolean displaysItemStack() {
- return false;
- }
-
- @Override
- public boolean doesAutoOutputFluids() {
- return true;
- }
-
- @Override
- public boolean doesEmptyContainers() {
- return true;
- }
-
- @Override
- public boolean doesFillContainers() {
- return true;
- }
-
- @Override
- public long maxAmperesIn() {
- return 16L;
- }
-
- @Override
- public long maxEUStore() {
- return Long.MAX_VALUE;
- }
-
- @Override
- public void doExplosion(long aExplosionPower) {
- super.doExplosion(aExplosionPower * 2);
- }
-
- @Override
- public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- super.onPreTick(aBaseMetaTileEntity, aTick);
- onRunningTickMulti();
- if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())
- && (aBaseMetaTileEntity.getFrontFacing() != ForgeDirection.UP)
- && (aBaseMetaTileEntity.getCoverIDAtSide(ForgeDirection.UP) == 0)
- && (!aBaseMetaTileEntity.getOpacityAtSide(ForgeDirection.UP))) {
- if (MathUtils.randInt(0, 4) == 4) {
- final Random tRandom = aBaseMetaTileEntity.getWorld().rand;
- aBaseMetaTileEntity.getWorld().spawnParticle(
- "magicCrit",
- (aBaseMetaTileEntity.getXCoord() + 0.8F) - (tRandom.nextFloat() * 0.6F),
- aBaseMetaTileEntity.getYCoord() + 0.3f + (tRandom.nextFloat() * 0.2F),
- (aBaseMetaTileEntity.getZCoord() + 1.2F) - (tRandom.nextFloat() * 1.6F),
- 0.0D,
- 0.0D,
- 0.0D);
- aBaseMetaTileEntity.getWorld().spawnParticle(
- "magicCrit",
- (aBaseMetaTileEntity.getXCoord() + 0.4F) - (tRandom.nextFloat() * 0.3F),
- aBaseMetaTileEntity.getYCoord() + 0.2f + (tRandom.nextFloat() * 0.1F),
- (aBaseMetaTileEntity.getZCoord() + 0.8F) - (tRandom.nextFloat() * 0.6F),
- 0.0D,
- 0.0D,
- 0.0D);
- aBaseMetaTileEntity.getWorld().spawnParticle(
- "magicCrit",
- (aBaseMetaTileEntity.getXCoord() + 0.6F) - (tRandom.nextFloat() * 0.9F),
- aBaseMetaTileEntity.getYCoord() + 0.4f + (tRandom.nextFloat() * 0.3F),
- (aBaseMetaTileEntity.getZCoord() + 1.8F) - (tRandom.nextFloat() * 2.6F),
- 0.0D,
- 0.0D,
- 0.0D);
- }
- }
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- aNBT.setBoolean("mCanProcessRecipe", this.mCanProcessRecipe);
- aNBT.setBoolean("mCharging", this.mCharging);
- aNBT.setLong("mChargeConsumed", this.mChargeConsumed);
- aNBT.setInteger("mEfficiency", this.mEfficiency);
- aNBT.setInteger("mEfficiencyIncrease", this.mEfficiencyIncrease);
- aNBT.setInteger("mEfficiencyMax", this.mEfficiencyMax);
- aNBT.setInteger("mStartUpCheck", this.mStartUpCheck);
- aNBT.setInteger("mUpdate", mUpdate);
- aNBT.setInteger("mEfficiencyIncrease", mEfficiencyIncrease);
- aNBT.setBoolean("mRunningOnLoad", this.mRunningOnLoad);
- aNBT.setBoolean("mMachine", this.mMachine);
- aNBT.setLong("mEUStore", this.mEUStore);
- super.saveNBTData(aNBT);
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- if (mMaxProgresstime > 0) mRunningOnLoad = true;
- this.mCanProcessRecipe = aNBT.getBoolean("mCanProcessRecipe");
- this.mCharging = aNBT.getBoolean("mCharging");
- this.mChargeConsumed = aNBT.getLong("mChargeConsumed");
- this.mEfficiency = aNBT.getInteger("mEfficiency");
- this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
- this.mEfficiencyMax = aNBT.getInteger("mEfficiencyMax");
- this.mStartUpCheck = aNBT.getInteger("mStartUpCheck");
- this.mUpdate = aNBT.getInteger("mUpdate");
- this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
- this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
- this.mRunningOnLoad = aNBT.getBoolean("mRunningOnLoad");
- this.mMachine = aNBT.getBoolean("mMachine");
- this.mEUStore = aNBT.getLong("mEUStore");
- super.loadNBTData(aNBT);
- }
-
- @Override
- public String[] getInfoData() {
- String tier = tier() == 6 ? "I" : tier() == 7 ? "II" : "III";
- float plasmaOut = 0;
- String fusionName = "";
- int powerRequired = 0;
- if (this.mLastRecipe != null) {
- fusionName = this.mLastRecipe.mFluidOutputs[0].getLocalizedName() + " Fusion.";
- powerRequired = this.mLastRecipe.mEUt;
- if (this.mLastRecipe.getFluidOutput(0) != null) {
- plasmaOut = (float) this.mLastRecipe.getFluidOutput(0).amount / (float) this.mLastRecipe.mDuration;
- }
- }
-
- return new String[] { "Fusion Reactor MK " + tier, "EU Required: " + powerRequired + "EU/t",
- "Stored EU: " + this.getEUVar() + " / " + maxEUStore(), "Plasma Output: " + plasmaOut + "L/t",
- "Current Recipe: " + fusionName };
- }
-
- @Override
- public boolean isGivingInformation() {
- return true;
- }
-
- public ITexture[] getFront(final byte aColor) {
- return new ITexture[] { this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab) };
- }
-
- public ITexture[] getBack(final byte aColor) {
- return new ITexture[] { this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-
- public ITexture[] getBottom(final byte aColor) {
- return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS) };
- }
-
- public ITexture[] getTop(final byte aColor) {
- return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS) };
- }
-
- public ITexture[] getSides(final byte aColor) {
- return new ITexture[] { this.getCasingTexture(),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange) };
- }
-
- public ITexture[] getFrontActive(final byte aColor) {
- return new ITexture[] { this.getCasingTexture(),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active) };
- }
-
- public ITexture[] getBackActive(final byte aColor) {
- return new ITexture[] { this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-
- public ITexture[] getBottomActive(final byte aColor) {
- return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW) };
- }
-
- public ITexture[] getTopActive(final byte aColor) {
- return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW) };
- }
-
- public ITexture[] getSidesActive(final byte aColor) {
- return new ITexture[] { this.getCasingTexture(),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Blue) };
- }
-
- @Override
- public void onMachineBlockUpdate() {
- this.mUpdate = 50;
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- // super.onPostTick(aBaseMetaTileEntity, aTick);
- if (aBaseMetaTileEntity.isServerSide()) {
- // Logger.MACHINE_INFO("1");
- if (mEfficiency < 0) mEfficiency = 0;
- if (mRunningOnLoad) {
- Logger.MACHINE_INFO("2");
- this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
- checkRecipeMulti();
- }
- if (--mUpdate == 0 || --mStartUpCheck == 0) {
- Logger.MACHINE_INFO("3");
- mMachine = true;
- }
- if (mStartUpCheck < 0) {
- // Logger.MACHINE_INFO("4");
- if (mMachine) {
- // Logger.MACHINE_INFO("5");
-
- if (aBaseMetaTileEntity.getStoredEU() + (2048 * tierOverclock()) < maxEUStore()) {
- if (aBaseMetaTileEntity.increaseStoredEnergyUnits(2048 * tierOverclock(), true)) {
- // Logger.MACHINE_INFO("5.5 A");
- } else {
- // Logger.MACHINE_INFO("5.5 B");
- }
- }
- if (this.mEUStore <= 0 && mMaxProgresstime > 0) {
- Logger.MACHINE_INFO("6");
- stopMachine();
- this.mLastRecipe = null;
- }
- if (mMaxProgresstime > 0) {
- Logger.MACHINE_INFO("7");
- this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true);
- if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) {
- if (mOutputFluids != null)
- for (FluidStack tStack : mOutputFluids) if (tStack != null) addOutput(tStack);
- mEfficiency = Math.max(0, (mEfficiency + mEfficiencyIncrease));
- mProgresstime = 0;
- mMaxProgresstime = 0;
- mEfficiencyIncrease = 0;
- if (mOutputFluids != null && mOutputFluids.length > 0) {}
-
- this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
- if (aBaseMetaTileEntity.isAllowedToWork()) checkRecipeMulti();
- }
- } else {
- // Logger.MACHINE_INFO("8");
- this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
- if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()
- || aBaseMetaTileEntity.hasInventoryBeenModified()) {
- Logger.MACHINE_INFO("9");
- // turnCasingActive(mMaxProgresstime > 0);
- if (aBaseMetaTileEntity.isAllowedToWork()) {
- Logger.MACHINE_INFO("10");
- if (checkRecipeMulti()) {
- Logger.MACHINE_INFO("11");
- if (this.mEUStore < this.mLastRecipe.mSpecialValue) {
- Logger.MACHINE_INFO("12");
- mMaxProgresstime = 0;
- // turnCasingActive(false);
- }
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(this.mLastRecipe.mSpecialValue, true);
- }
- }
- if (mMaxProgresstime <= 0) mEfficiency = Math.max(0, mEfficiency - 1000);
- }
- }
- } else {
- // turnCasingActive(false);
- Logger.MACHINE_INFO("Bad");
- this.mLastRecipe = null;
- stopMachine();
- }
- }
- Logger.MACHINE_INFO("Good | " + mMaxProgresstime);
- aBaseMetaTileEntity.setActive(mMaxProgresstime > 0);
- }
- }
-
- public boolean onRunningTickMulti() {
- if (this.getBaseMetaTileEntity().isServerSide()) {
- if (mEUt < 0) {
- if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) {
- this.mLastRecipe = null;
- stopMachine();
- Logger.MACHINE_INFO("a1");
- return false;
- }
- }
- if (this.mEUStore <= 0) {
- this.mLastRecipe = null;
- stopMachine();
- Logger.MACHINE_INFO("a2");
- return false;
- }
- }
- return true;
- }
-
- public boolean drainEnergyInput(long aEU) {
- return false;
- }
-
- public boolean addOutput(FluidStack aLiquid) {
- if (aLiquid == null) return false;
- FluidStack copiedFluidStack = aLiquid.copy();
- this.mOutputFluid = copiedFluidStack;
- return false;
- }
-
- public void stopMachine() {
- mEUt = 0;
- mEfficiency = 0;
- mProgresstime = 0;
- mMaxProgresstime = 0;
- mEfficiencyIncrease = 0;
- getBaseMetaTileEntity().disableWorking();
- }
-
- @Override
- public boolean isLiquidInput(ForgeDirection side) {
- switch (side) {
- case DOWN:
- return true;
- case UP:
- return true;
- case NORTH:
- return true;
- case SOUTH:
- return false;
- case WEST:
- return false;
- case EAST:
- return false;
- default:
- return false;
- }
- }
-
- @Override
- public boolean isLiquidOutput(ForgeDirection side) {
- switch (side) {
- case DOWN:
- return false;
- case UP:
- return false;
- case NORTH:
- return false;
- case SOUTH:
- return true;
- case WEST:
- return true;
- case EAST:
- return true;
- default:
- return true;
- }
- }
-
- @Override
- public int fill(FluidStack aFluid, boolean doFill) {
- return super.fill(aFluid, doFill);
- }
-
- @Override
- public FluidStack drain(int maxDrain, boolean doDrain) {
- return super.drain(maxDrain, doDrain);
- }
-
- @Override
- public int getTankPressure() {
- return 500;
- }
-
- @Override
- public boolean canFill(ForgeDirection aSide, Fluid aFluid) {
- if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
- return false;
- } else {
- return super.canFill(aSide, aFluid);
- }
- }
-
- @Override
- public boolean canDrain(ForgeDirection aSide, Fluid aFluid) {
- if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
- return super.canDrain(aSide, aFluid);
- } else {
- return false;
- }
- }
-
- @Override
- public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
- if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
- return 0;
- } else {
- return super.fill_default(aSide, aFluid, doFill);
- }
- }
-
- @Override
- public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
- if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
- return super.fill(aSide, aFluid, doFill);
- } else {
- return 0;
- }
- }
-
- @Override
- public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) {
- if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
- return super.drain(aSide, aFluid, doDrain);
- } else {
- return null;
- }
- }
-
- @Override
- public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) {
- if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
- return super.drain(aSide, maxDrain, doDrain);
- } else {
- return null;
- }
- }
-
- @Override
- public boolean isOverclockerUpgradable() {
- return true;
- }
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- // TODO Auto-generated method stub
- return super.onRightclick(aBaseMetaTileEntity, aPlayer);
- }
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side,
- float aX, float aY, float aZ) {
- // TODO Auto-generated method stub
- return super.onRightclick(aBaseMetaTileEntity, aPlayer, side, aX, aY, aZ);
- }
-
- @Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
- ItemStack aStack) {
- return false;
- }
-
- @Override
- public boolean canInsertItem(int aIndex, ItemStack aStack, int ordinalSide) {
- return false;
- }
-
- @Override
- public void onExplosion() {
- // TODO Auto-generated method stub
- super.onExplosion();
- }
-
- @Override
- public void startProcess() {
- this.sendLoopStart((byte) 1);
- }
-
- @Override
- public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
- super.startSoundLoop(aIndex, aX, aY, aZ);
- if (aIndex == 1) {
- GT_Utility
- .doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(212)), 10, 1.0F, aX, aY, aZ);
- }
- }
-}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java
deleted file mode 100644
index 7a16d0affa..0000000000
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java
+++ /dev/null
@@ -1,696 +0,0 @@
-package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
-
-import java.util.ArrayList;
-import java.util.Random;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidStack;
-
-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.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.MetaTileEntity;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GTPP_Recipe;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_DeluxeMachine;
-import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
-
-public class GregtechMetaTileEntity_PocketFusion extends GT_MetaTileEntity_DeluxeMachine {
-
- private boolean mCanProcessRecipe = false;
- private boolean mCharging = false;
- private long mChargeConsumed = 0;
-
- private GT_Recipe mLastRecipe;
- private long mEUStore;
- private boolean mRunningOnLoad = false;
- private boolean mMachine = false;
- private int mEfficiency, mEfficiencyIncrease, mEfficiencyMax = 0;
- private int mStartUpCheck = 100, mUpdate = 0;
- private FluidStack[] mOutputFluids = null;
-
- public GregtechMetaTileEntity_PocketFusion(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 1, "It's like a midget Ra.", 1, 1, "PotionBrewer.png", "");
- }
-
- public GregtechMetaTileEntity_PocketFusion(String aName, int aTier, String aDescription, ITexture[][][] aTextures,
- String aGUIName, String aNEIName) {
- super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
- }
-
- @Override
- public String[] getDescription() {
- return new String[] { this.mDescription, "Not Very Fast, but not very big either.",
- "Each side pair in/out puts to different slots.", "Top & Bottom Sides are Outputs.",
- "Front & Back are Input Plasma 1.", "Sides are Input Plasma 2.", CORE.GT_Tooltip.get() };
- }
-
- @Override
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GregtechMetaTileEntity_PocketFusion(
- this.mName,
- this.mTier,
- this.mDescription,
- this.mTextures,
- this.mGUIName,
- this.mNEIName);
- }
-
- public int tier() {
- return this.mTier;
- }
-
- public int tierOverclock() {
- return this.mTier == 6 ? 0 : this.mTier == 7 ? 1 : 2;
- }
-
- private GT_RenderedTexture getCasingTexture() {
- return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced);
- }
-
- @Override
- public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
- final ITexture[][][] rTextures = new ITexture[10][17][];
- for (byte i = -1; i < 16; i++) {
- rTextures[0][i + 1] = this.getFront(i);
- rTextures[1][i + 1] = this.getBack(i);
- rTextures[2][i + 1] = this.getBottom(i);
- rTextures[3][i + 1] = this.getTop(i);
- rTextures[4][i + 1] = this.getSides(i);
- rTextures[5][i + 1] = this.getFrontActive(i);
- rTextures[6][i + 1] = this.getBackActive(i);
- rTextures[7][i + 1] = this.getBottomActive(i);
- rTextures[8][i + 1] = this.getTopActive(i);
- rTextures[9][i + 1] = this.getSidesActive(i);
- }
- return rTextures;
- }
-
- @Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side,
- final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) {
- return this.mTextures[(aActive ? 5 : 0)
- + (side == facing ? 0
- : side == facing.getOpposite() ? 1
- : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex
- + 1];
- }
-
- @Override
- public GT_Recipe.GT_Recipe_Map getRecipeList() {
- return GTPP_Recipe.GTPP_Recipe_Map.sSlowFusionRecipes;
- }
-
- @Override
- public boolean isOutputFacing(final ForgeDirection side) {
- return side == this.getBaseMetaTileEntity().getBackFacing();
- }
-
- @Override
- public boolean isFluidInputAllowed(FluidStack aFluid) {
- return (aFluid.getFluid().getName().contains("plasma")) || (super.isFluidInputAllowed(aFluid));
- }
-
- @Override
- public int getCapacity() {
- return 32000;
- }
-
- @Override
- public void abortProcess() {
- super.abortProcess();
- }
-
- long mFusionPoint = 20000000L;
-
- @Override
- public int checkRecipe() {
- Logger.MACHINE_INFO("Recipe Tick 1.");
- if (!this.mCanProcessRecipe) {
- Logger.MACHINE_INFO("Recipe Tick 1.1 - Cannot Process Recipe.");
- if (this.mChargeConsumed < mFusionPoint) {
- Logger.MACHINE_INFO("Recipe Tick 1.2 - Cannot Ignite Fusion, Charge too low.");
- this.mCharging = true;
- this.mCanProcessRecipe = false;
- if (this.getBaseMetaTileEntity().decreaseStoredEnergyUnits((mFusionPoint / 100), false)) {
- Logger.MACHINE_INFO(
- "Recipe Tick 1.3 - Charging Internal storage. " + (mFusionPoint / 100)
- + "/"
- + mFusionPoint);
- mChargeConsumed += (mFusionPoint / 100);
- }
- } else {
- mChargeConsumed = 0;
- this.mCharging = false;
- this.mCanProcessRecipe = true;
- }
- } else {
- Logger.MACHINE_INFO("Recipe Tick 1.1 - Try to Process Recipe.");
- if (checkRecipeMulti()) {
- Logger.MACHINE_INFO("Recipe Tick 1.2 - Process Recipe was Successful.");
- return 2;
- }
- }
- Logger.MACHINE_INFO("Recipe Tick 2. - Process Recipe failed.");
- return 0;
- }
-
- public ArrayList<FluidStack> getStoredFluids() {
- ArrayList<FluidStack> mList = new ArrayList<FluidStack>();
- mList.add(this.mFluid);
- mList.add(this.mFluid2);
- return mList;
- }
-
- public boolean checkRecipeMulti() {
- ArrayList<FluidStack> tFluidList = getStoredFluids();
- int tFluidList_sS = tFluidList.size();
- for (int i = 0; i < tFluidList_sS - 1; i++) {
- for (int j = i + 1; j < tFluidList_sS; j++) {
- if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) {
- if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
- tFluidList.remove(j--);
- tFluidList_sS = tFluidList.size();
- } else {
- tFluidList.remove(i--);
- tFluidList_sS = tFluidList.size();
- break;
- }
- }
- }
- }
- if (tFluidList.size() > 1) {
- FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]);
- GT_Recipe tRecipe = getRecipeList().findRecipe(
- this.getBaseMetaTileEntity(),
- this.mLastRecipe,
- false,
- GT_Values.V[8],
- tFluids,
- new ItemStack[] {});
-
- if (tRecipe == null) {
- return false;
- }
-
- if ((tRecipe == null && !mRunningOnLoad) || (tRecipe != null && maxEUStore() < tRecipe.mSpecialValue)) {
- this.mLastRecipe = null;
- Logger.MACHINE_INFO("Just plain bad.");
- return false;
- }
- if (mRunningOnLoad || tRecipe.isRecipeInputEqual(true, tFluids, new ItemStack[] {})) {
- this.mLastRecipe = tRecipe;
- this.mEUt = (this.mLastRecipe.mEUt * overclock(this.mLastRecipe.mSpecialValue));
- this.mMaxProgresstime = this.mLastRecipe.mDuration / overclock(this.mLastRecipe.mSpecialValue);
-
- this.mEfficiencyIncrease = 10000;
-
- this.mOutputFluids = this.mLastRecipe.mFluidOutputs;
- mRunningOnLoad = false;
- return true;
- }
- }
- return false;
- }
-
- public int overclock(int mStartEnergy) {
- if (tierOverclock() == 1) {
- return 1;
- }
- if (tierOverclock() == 2) {
- return mStartEnergy < 160000000 ? 2 : 1;
- }
- return mStartEnergy < 160000000 ? 4 : mStartEnergy < 320000000 ? 2 : 1;
- }
-
- @Override
- public boolean displaysItemStack() {
- return false;
- }
-
- @Override
- public boolean doesAutoOutputFluids() {
- return true;
- }
-
- @Override
- public boolean doesEmptyContainers() {
- return true;
- }
-
- @Override
- public boolean doesFillContainers() {
- return true;
- }
-
- @Override
- public long maxAmperesIn() {
- return 16L;
- }
-
- @Override
- public long maxEUStore() {
- return Long.MAX_VALUE;
- }
-
- @Override
- public void doExplosion(long aExplosionPower) {
- super.doExplosion(aExplosionPower * 2);
- }
-
- @Override
- public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- super.onPreTick(aBaseMetaTileEntity, aTick);
- onRunningTickMulti();
- if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())
- && (aBaseMetaTileEntity.getFrontFacing() != ForgeDirection.UP)
- && (aBaseMetaTileEntity.getCoverIDAtSide(ForgeDirection.UP) == 0)
- && (!aBaseMetaTileEntity.getOpacityAtSide(ForgeDirection.UP))) {
- if (MathUtils.randInt(0, 4) == 4) {
- final Random tRandom = aBaseMetaTileEntity.getWorld().rand;
- aBaseMetaTileEntity.getWorld().spawnParticle(
- "magicCrit",
- (aBaseMetaTileEntity.getXCoord() + 0.8F) - (tRandom.nextFloat() * 0.6F),
- aBaseMetaTileEntity.getYCoord() + 0.3f + (tRandom.nextFloat() * 0.2F),
- (aBaseMetaTileEntity.getZCoord() + 1.2F) - (tRandom.nextFloat() * 1.6F),
- 0.0D,
- 0.0D,
- 0.0D);
- aBaseMetaTileEntity.getWorld().spawnParticle(
- "magicCrit",
- (aBaseMetaTileEntity.getXCoord() + 0.4F) - (tRandom.nextFloat() * 0.3F),
- aBaseMetaTileEntity.getYCoord() + 0.2f + (tRandom.nextFloat() * 0.1F),
- (aBaseMetaTileEntity.getZCoord() + 0.8F) - (tRandom.nextFloat() * 0.6F),
- 0.0D,
- 0.0D,
- 0.0D);
- aBaseMetaTileEntity.getWorld().spawnParticle(
- "magicCrit",
- (aBaseMetaTileEntity.getXCoord() + 0.6F) - (tRandom.nextFloat() * 0.9F),
- aBaseMetaTileEntity.getYCoord() + 0.4f + (tRandom.nextFloat() * 0.3F),
- (aBaseMetaTileEntity.getZCoord() + 1.8F) - (tRandom.nextFloat() * 2.6F),
- 0.0D,
- 0.0D,
- 0.0D);
- }
- }
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- aNBT.setBoolean("mCanProcessRecipe", this.mCanProcessRecipe);
- aNBT.setBoolean("mCharging", this.mCharging);
- aNBT.setLong("mChargeConsumed", this.mChargeConsumed);
- aNBT.setInteger("mEfficiency", this.mEfficiency);
- aNBT.setInteger("mEfficiencyIncrease", this.mEfficiencyIncrease);
- aNBT.setInteger("mEfficiencyMax", this.mEfficiencyMax);
- aNBT.setInteger("mStartUpCheck", this.mStartUpCheck);
- aNBT.setInteger("mUpdate", mUpdate);
- aNBT.setInteger("mEfficiencyIncrease", mEfficiencyIncrease);
- aNBT.setBoolean("mRunningOnLoad", this.mRunningOnLoad);
- aNBT.setBoolean("mMachine", this.mMachine);
- aNBT.setLong("mEUStore", this.mEUStore);
- super.saveNBTData(aNBT);
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- if (mMaxProgresstime > 0) mRunningOnLoad = true;
- this.mCanProcessRecipe = aNBT.getBoolean("mCanProcessRecipe");
- this.mCharging = aNBT.getBoolean("mCharging");
- this.mChargeConsumed = aNBT.getLong("mChargeConsumed");
- this.mEfficiency = aNBT.getInteger("mEfficiency");
- this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
- this.mEfficiencyMax = aNBT.getInteger("mEfficiencyMax");
- this.mStartUpCheck = aNBT.getInteger("mStartUpCheck");
- this.mUpdate = aNBT.getInteger("mUpdate");
- this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
- this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
- this.mRunningOnLoad = aNBT.getBoolean("mRunningOnLoad");
- this.mMachine = aNBT.getBoolean("mMachine");
- this.mEUStore = aNBT.getLong("mEUStore");
- super.loadNBTData(aNBT);
- }
-
- @Override
- public String[] getInfoData() {
- String tier = tier() == 6 ? "I" : tier() == 7 ? "II" : "III";
- float plasmaOut = 0;
- String fusionName = "";
- int powerRequired = 0;
- if (this.mLastRecipe != null) {
- fusionName = this.mLastRecipe.mFluidOutputs[0].getLocalizedName() + " Fusion.";
- powerRequired = this.mLastRecipe.mEUt;
- if (this.mLastRecipe.getFluidOutput(0) != null) {
- plasmaOut = (float) this.mLastRecipe.getFluidOutput(0).amount / (float) this.mLastRecipe.mDuration;
- }
- }
-
- return new String[] { "Fusion Reactor MK " + tier, "EU Required: " + powerRequired + "EU/t",
- "Stored EU: " + this.getEUVar() + " / " + maxEUStore(), "Plasma Output: " + plasmaOut + "L/t",
- "Current Recipe: " + fusionName };
- }
-
- @Override
- public boolean isGivingInformation() {
- return true;
- }
-
- public ITexture[] getFront(final byte aColor) {
- return new ITexture[] { this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab) };
- }
-
- public ITexture[] getBack(final byte aColor) {
- return new ITexture[] { this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-
- public ITexture[] getBottom(final byte aColor) {
- return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS) };
- }
-
- public ITexture[] getTop(final byte aColor) {
- return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS) };
- }
-
- public ITexture[] getSides(final byte aColor) {
- return new ITexture[] { this.getCasingTexture(),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange) };
- }
-
- public ITexture[] getFrontActive(final byte aColor) {
- return new ITexture[] { this.getCasingTexture(),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active) };
- }
-
- public ITexture[] getBackActive(final byte aColor) {
- return new ITexture[] { this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
- }
-
- public ITexture[] getBottomActive(final byte aColor) {
- return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW) };
- }
-
- public ITexture[] getTopActive(final byte aColor) {
- return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW) };
- }
-
- public ITexture[] getSidesActive(final byte aColor) {
- return new ITexture[] { this.getCasingTexture(),
- new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Blue) };
- }
-
- @Override
- public void onMachineBlockUpdate() {
- this.mUpdate = 50;
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- // super.onPostTick(aBaseMetaTileEntity, aTick);
- if (aBaseMetaTileEntity.isServerSide()) {
- // Logger.MACHINE_INFO("1");
- if (mEfficiency < 0) mEfficiency = 0;
- if (mRunningOnLoad) {
- Logger.MACHINE_INFO("2");
- this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
- checkRecipeMulti();
- }
- if (--mUpdate == 0 || --mStartUpCheck == 0) {
- Logger.MACHINE_INFO("3");
- mMachine = true;
- }
- if (mStartUpCheck < 0) {
- // Logger.MACHINE_INFO("4");
- if (mMachine) {
- // Logger.MACHINE_INFO("5");
-
- if (aBaseMetaTileEntity.getStoredEU() + (2048 * tierOverclock()) < maxEUStore()) {
- if (aBaseMetaTileEntity.increaseStoredEnergyUnits(2048 * tierOverclock(), true)) {
- // Logger.MACHINE_INFO("5.5 A");
- } else {
- // Logger.MACHINE_INFO("5.5 B");
- }
- }
- if (this.mEUStore <= 0 && mMaxProgresstime > 0) {
- Logger.MACHINE_INFO("6");
- stopMachine();
- this.mLastRecipe = null;
- }
- if (mMaxProgresstime > 0) {
- Logger.MACHINE_INFO("7");
- this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true);
- if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) {
- if (mOutputFluids != null)
- for (FluidStack tStack : mOutputFluids) if (tStack != null) addOutput(tStack);
- mEfficiency = Math.max(0, (mEfficiency + mEfficiencyIncrease));
- mProgresstime = 0;
- mMaxProgresstime = 0;
- mEfficiencyIncrease = 0;
- if (mOutputFluids != null && mOutputFluids.length > 0) {}
-
- this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
- if (aBaseMetaTileEntity.isAllowedToWork()) checkRecipeMulti();
- }
- } else {
- // Logger.MACHINE_INFO("8");
- this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
- if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()
- || aBaseMetaTileEntity.hasInventoryBeenModified()) {
- Logger.MACHINE_INFO("9");
- // turnCasingActive(mMaxProgresstime > 0);
- if (aBaseMetaTileEntity.isAllowedToWork()) {
- Logger.MACHINE_INFO("10");
- if (checkRecipeMulti()) {
- Logger.MACHINE_INFO("11");
- if (this.mEUStore < this.mLastRecipe.mSpecialValue) {
- Logger.MACHINE_INFO("12");
- mMaxProgresstime = 0;
- // turnCasingActive(false);
- }
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(this.mLastRecipe.mSpecialValue, true);
- }
- }
- if (mMaxProgresstime <= 0) mEfficiency = Math.max(0, mEfficiency - 1000);
- }
- }
- } else {
- // turnCasingActive(false);
- Logger.MACHINE_INFO("Bad");
- this.mLastRecipe = null;
- stopMachine();
- }
- }
- Logger.MACHINE_INFO("Good | " + mMaxProgresstime);
- aBaseMetaTileEntity.setActive(mMaxProgresstime > 0);
- }
- }
-
- public boolean onRunningTickMulti() {
- if (this.getBaseMetaTileEntity().isServerSide()) {
- if (mEUt < 0) {
- if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) {
- this.mLastRecipe = null;
- stopMachine();
- Logger.MACHINE_INFO("a1");
- return false;
- }
- }
- if (this.mEUStore <= 0) {
- this.mLastRecipe = null;
- stopMachine();
- Logger.MACHINE_INFO("a2");
- return false;
- }
- }
- return true;
- }
-
- public boolean drainEnergyInput(long aEU) {
- return false;
- }
-
- public boolean addOutput(FluidStack aLiquid) {
- if (aLiquid == null) return false;
- FluidStack copiedFluidStack = aLiquid.copy();
- this.mOutputFluid = copiedFluidStack;
- return false;
- }
-
- public void stopMachine() {
- mEUt = 0;
- mEfficiency = 0;
- mProgresstime = 0;
- mMaxProgresstime = 0;
- mEfficiencyIncrease = 0;
- getBaseMetaTileEntity().disableWorking();
- }
-
- @Override
- public boolean isLiquidInput(ForgeDirection side) {
- switch (side) {
- case DOWN:
- return true;
- case UP:
- return true;
- case NORTH:
- return true;
- case SOUTH:
- return false;
- case WEST:
- return false;
- case EAST:
- return false;
- default:
- return false;
- }
- }
-
- @Override
- public boolean isLiquidOutput(ForgeDirection side) {
- switch (side) {
- case DOWN:
- return false;
- case UP:
- return false;
- case NORTH:
- return false;
- case SOUTH:
- return true;
- case WEST:
- return true;
- case EAST:
- return true;
- default:
- return true;
- }
- }
-
- @Override
- public int fill(FluidStack aFluid, boolean doFill) {
- return super.fill(aFluid, doFill);
- }
-
- @Override
- public FluidStack drain(int maxDrain, boolean doDrain) {
- return super.drain(maxDrain, doDrain);
- }
-
- @Override
- public int getTankPressure() {
- return 500;
- }
-
- @Override
- public boolean canFill(ForgeDirection aSide, Fluid aFluid) {
- if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
- return false;
- } else {
- return super.canFill(aSide, aFluid);
- }
- }
-
- @Override
- public boolean canDrain(ForgeDirection aSide, Fluid aFluid) {
- if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
- return super.canDrain(aSide, aFluid);
- } else {
- return false;
- }
- }
-
- @Override
- public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
- if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
- return 0;
- } else {
- return super.fill_default(aSide, aFluid, doFill);
- }
- }
-
- @Override
- public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
- if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
- return super.fill(aSide, aFluid, doFill);
- } else {
- return 0;
- }
- }
-
- @Override
- public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) {
- if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
- return super.drain(aSide, aFluid, doDrain);
- } else {
- return null;
- }
- }
-
- @Override
- public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) {
- if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
- return super.drain(aSide, maxDrain, doDrain);
- } else {
- return null;
- }
- }
-
- @Override
- public boolean isOverclockerUpgradable() {
- return true;
- }
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- // TODO Auto-generated method stub
- return super.onRightclick(aBaseMetaTileEntity, aPlayer);
- }
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side,
- float aX, float aY, float aZ) {
- // TODO Auto-generated method stub
- return super.onRightclick(aBaseMetaTileEntity, aPlayer, side, aX, aY, aZ);
- }
-
- @Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
- ItemStack aStack) {
- return false;
- }
-
- @Override
- public boolean canInsertItem(int aIndex, ItemStack aStack, int ordinalSide) {
- return false;
- }
-
- @Override
- public void onExplosion() {
- // TODO Auto-generated method stub
- super.onExplosion();
- }
-
- @Override
- public void startProcess() {
- this.sendLoopStart((byte) 1);
- }
-
- @Override
- public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
- super.startSoundLoop(aIndex, aX, aY, aZ);
- if (aIndex == 1) {
- GT_Utility
- .doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(212)), 10, 1.0F, aX, aY, aZ);
- }
- }
-}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java
deleted file mode 100644
index ebc6be40c9..0000000000
--- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package gtPlusPlus.xmod.gregtech.registration.gregtech;
-
-public class GregtechFluidReactor {
-
- public static void run() {
-
- /*
- * GregtechItemList.FluidReactor_LV .set(new GregtechMetaTileEntity_ChemicalReactor(31021,
- * "chemicalplant.01.tier.01", "Chemical Plant I", 1) .getStackForm(1L)); GregtechItemList.FluidReactor_HV
- * .set(new GregtechMetaTileEntity_ChemicalReactor(31022, "chemicalplant.01.tier.02", "Chemical Plant II", 3)
- * .getStackForm(1L)); GregtechItemList.FluidReactor_IV .set(new GregtechMetaTileEntity_ChemicalReactor(31023,
- * "chemicalplant.01.tier.03", "Chemical Plant III", 5) .getStackForm(1L)); GregtechItemList.FluidReactor_ZPM
- * .set(new GregtechMetaTileEntity_ChemicalReactor(31024, "chemicalplant.01.tier.04", "Chemical Plant IV", 7)
- * .getStackForm(1L));
- */
-
- }
-}