diff options
| author | miozune <miozune@gmail.com> | 2023-05-08 18:28:16 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-08 11:28:16 +0200 |
| commit | d4c24c4d666f21d3132cf355e6e15b425c0f4369 (patch) | |
| tree | b557671642b155deb546e75a8b0e8d7d4e154bc7 /src/main/java/gtPlusPlus/xmod/gregtech/common | |
| parent | 410b4d15111cd0d53adfbd302907b80b6a45c3c3 (diff) | |
| download | GT5-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>
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common')
3 files changed, 0 insertions, 1960 deletions
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("mUpd |
