From 237e5e682df387e5b99894eef8f8b34e763a5615 Mon Sep 17 00:00:00 2001 From: Muramasa Date: Wed, 1 Jun 2016 06:34:33 +0100 Subject: [PATCH] Possibly final commit --- .../java/gregtech/api/enums/ItemList.java | 2 +- .../api/gui/GT_Container_TurboHatch.java | 16 ---- .../api/gui/GT_GUIContainer_TurboHatch.java | 27 ------ .../GT_MetaTileEntity_Hatch_Turbo.java | 95 ------------------- .../GT_MetaTileEntity_MultiBlockBase.java | 16 ---- .../multi/GT_MetaTileEntity_DieselEngine.java | 57 ++++++----- .../preload/GT_Loader_MetaTileEntities.java | 3 - 7 files changed, 32 insertions(+), 184 deletions(-) delete mode 100644 src/main/java/gregtech/api/gui/GT_Container_TurboHatch.java delete mode 100644 src/main/java/gregtech/api/gui/GT_GUIContainer_TurboHatch.java delete mode 100644 src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbo.java diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index f1b13954..c1cd5ce1 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -552,7 +552,7 @@ public enum ItemList implements IItemContainer { Hatch_Output_ULV, Hatch_Output_LV, Hatch_Output_MV, Hatch_Output_HV, Hatch_Output_EV, Hatch_Output_IV, Hatch_Output_LuV, Hatch_Output_ZPM, Hatch_Output_UV, Hatch_Output_MAX, Hatch_Output_Bus_ULV, Hatch_Output_Bus_LV, Hatch_Output_Bus_MV, Hatch_Output_Bus_HV, Hatch_Output_Bus_EV, Hatch_Output_Bus_IV, Hatch_Output_Bus_LuV, Hatch_Output_Bus_ZPM, Hatch_Output_Bus_UV, Hatch_Output_Bus_MAX, Hatch_Muffler_LV, Hatch_Muffler_MV, Hatch_Muffler_HV, Hatch_Muffler_EV, Hatch_Muffler_IV, Hatch_Muffler_LuV, Hatch_Muffler_ZPM, Hatch_Muffler_UV, Hatch_Muffler_MAX, - Hatch_Maintenance, Hatch_Turbo, + Hatch_Maintenance, Battery_Buffer_1by1_ULV, Battery_Buffer_1by1_LV, Battery_Buffer_1by1_MV, Battery_Buffer_1by1_HV, Battery_Buffer_1by1_EV, Battery_Buffer_1by1_IV, Battery_Buffer_1by1_LuV, Battery_Buffer_1by1_ZPM, Battery_Buffer_1by1_UV, Battery_Buffer_1by1_MAX, Battery_Buffer_2by2_ULV, Battery_Buffer_2by2_LV, Battery_Buffer_2by2_MV, Battery_Buffer_2by2_HV, Battery_Buffer_2by2_EV, Battery_Buffer_2by2_IV, Battery_Buffer_2by2_LuV, Battery_Buffer_2by2_ZPM, Battery_Buffer_2by2_UV, Battery_Buffer_2by2_MAX, diff --git a/src/main/java/gregtech/api/gui/GT_Container_TurboHatch.java b/src/main/java/gregtech/api/gui/GT_Container_TurboHatch.java deleted file mode 100644 index 720c2bfd..00000000 --- a/src/main/java/gregtech/api/gui/GT_Container_TurboHatch.java +++ /dev/null @@ -1,16 +0,0 @@ -package gregtech.api.gui; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; - -public class GT_Container_TurboHatch extends GT_ContainerMetaTile_Machine { - - public GT_Container_TurboHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 80, 35, false, false, 1)); - } -} \ No newline at end of file diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_TurboHatch.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_TurboHatch.java deleted file mode 100644 index 82158fcb..00000000 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_TurboHatch.java +++ /dev/null @@ -1,27 +0,0 @@ -package gregtech.api.gui; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; - -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - -public class GT_GUIContainer_TurboHatch extends GT_GUIContainerMetaTile_Machine { - - public GT_GUIContainer_TurboHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(new GT_Container_TurboHatch(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Maintenance.png"); - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - fontRendererObj.drawString("Turbo Hatch", 8, 4, 4210752); - fontRendererObj.drawString("Insert small turbine rotor.", 8, 12, 4210752); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } -} diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbo.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbo.java deleted file mode 100644 index cd07db7b..00000000 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbo.java +++ /dev/null @@ -1,95 +0,0 @@ -package gregtech.api.metatileentity.implementations; - -import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_Container_TurboHatch; -import gregtech.api.gui.GT_GUIContainer_TurboHatch; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public class GT_MetaTileEntity_Hatch_Turbo extends GT_MetaTileEntity_Hatch { - public GT_MetaTileEntity_Hatch_Turbo(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "For maintaining Multiblocks"); - } - - public GT_MetaTileEntity_Hatch_Turbo(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 1, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - return new String[]{mDescription, "Cannot be shared between Multiblocks!"}; - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_MAINTENANCE)}; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_MAINTENANCE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_DUCTTAPE)}; - } - - @Override - public void initDefaultModes(NBTTagCompound aNBT) { - getBaseMetaTileEntity().setActive(true); - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return false; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_Turbo(mName, mTier, mDescription, mTextures); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { - if (aBaseMetaTileEntity.isClientSide()) return true; - if (aSide == aBaseMetaTileEntity.getFrontFacing()) aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_TurboHatch(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_TurboHatch(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return true; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return true; - } -} diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 9f8d3244..a06b96b3 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -46,7 +46,6 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { public ArrayList mMufflerHatches = new ArrayList(); public ArrayList mEnergyHatches = new ArrayList(); public ArrayList mMaintenanceHatches = new ArrayList(); - public ArrayList mTurboHatches = new ArrayList(); public GT_MetaTileEntity_MultiBlockBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 2); @@ -196,7 +195,6 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { mEnergyHatches.clear(); mMufflerHatches.clear(); mMaintenanceHatches.clear(); - mTurboHatches.clear(); mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]); } if (mStartUpCheck < 0) { @@ -485,7 +483,6 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { for (MetaTileEntity tTileEntity : mMufflerHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); for (MetaTileEntity tTileEntity : mEnergyHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); for (MetaTileEntity tTileEntity : mMaintenanceHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mTurboHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); getBaseMetaTileEntity().doExplosion(V[8]); } @@ -702,8 +699,6 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbo) - return mTurboHatches.add((GT_MetaTileEntity_Hatch_Turbo) aMetaTileEntity); return false; } @@ -718,17 +713,6 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { return false; } - public boolean addTurboToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbo) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mTurboHatches.add((GT_MetaTileEntity_Hatch_Turbo) aMetaTileEntity); - } - return false; - } - public boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { if (aTileEntity == null) { return false; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java index bf3cee41..5ba97051 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java @@ -1,6 +1,7 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; @@ -9,7 +10,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbo; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; @@ -25,8 +25,9 @@ import java.util.Collection; public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlockBase { protected int fuelConsumption = 0; + protected int fuelValue = 0; protected int fuelRemaining = 0; - protected boolean enableTurboOut = false; + protected boolean boostEu = false; public GT_MetaTileEntity_DieselEngine(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -67,42 +68,40 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock @Override public boolean checkRecipe(ItemStack aStack) { - ArrayList tHatches = mTurboHatches; ArrayList tFluids = getStoredFluids(); Collection tRecipeList = GT_Recipe.GT_Recipe_Map.sDieselFuels.mRecipeList; - //TODO Better method to detect turbine item. This will do for testing. - if(tHatches.size() > 0) { - if (tHatches.get(0).getStackInSlot(0) != null) { - ItemStack hatchStack = tHatches.get(0).getStackInSlot(0); - if (hatchStack.getItem() instanceof GT_MetaGenerated_Tool) { //Has a GT tool - GT_MetaGenerated_Tool hatchTool = (GT_MetaGenerated_Tool) tHatches.get(0).getStackInSlot(0).getItem(); - if(GT_MetaGenerated_Tool.getPrimaryMaterial(hatchStack).mDurability > 0) enableTurboOut = true; - } - } - } - - int baseEUt = enableTurboOut ? 8192 : 2048; //Choose base output if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a diesel fuel? for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches for(GT_Recipe aFuel : tRecipeList) { //Loops through diesel fuel recipes FluidStack tLiquid; if ((tLiquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null) { //Create fluidstack from current recipe if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a diesel fluid - System.out.println("Fuel Value: "+aFuel.mSpecialValue); //For testing, needs to be removed - fuelConsumption = tLiquid.amount = baseEUt / aFuel.mSpecialValue; //Calc fuel consumption - depleteInput(tLiquid); //Deplete that amount - fuelRemaining = hatchFluid1.amount; //Record available fuel - this.mProgresstime = 1; - this.mMaxProgresstime = 1; - this.mEfficiencyIncrease = 10; - this.mEUt = mEfficiency < 2000 ? 0 : (int)(baseEUt * ((float)mEfficiency / 10000)); //Output 0 if startup is less than 20% - return true; + if(tFluids.contains(Materials.Oxygen.getGas(1L))) { //Has oxygen? + if(depleteInput(Materials.Oxygen.getGas((8192 / aFuel.mSpecialValue) / 4))) boostEu = true; + } else boostEu = false; + + if(tFluids.contains(Materials.Lubricant.getFluid(1L))) { //Has lubricant? + //Deplete Lubricant. 1000L should = 1 hour of runtime (if baseEU = 2048) + if(mRuntime % 72 == 0 || mRuntime == 0) depleteInput(Materials.Lubricant.getFluid(boostEu ? 4 : 1)); + } else return false; + + fuelConsumption = tLiquid.amount = boostEu ? 8192 / aFuel.mSpecialValue : 2048 / aFuel.mSpecialValue; //Calc fuel consumption + if(depleteInput(tLiquid)) { //Deplete that amount + fuelValue = aFuel.mSpecialValue; + fuelRemaining = hatchFluid1.amount; //Record available fuel + this.mEUt = mEfficiency < 2000 ? 0 : (int) (2048 * ((float) mEfficiency / 10000)); //Output 0 if startup is less than 20% + this.mProgresstime = 1; + this.mMaxProgresstime = 1; + this.mEfficiencyIncrease = 50; + return true; + } } } } } } + this.mEUt = 0; return false; } @@ -187,8 +186,13 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock return 50; } + @Override + public long maxAmperesOut() { + return 4; + } + private boolean addToMachineList(IGregTechTileEntity tTileEntity) { - return ((addTurboToMachineList(tTileEntity, getCasingTextureIndex()) || (addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex())))); + return ((addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex()))); } @Override @@ -212,7 +216,7 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock } public int getMaxEfficiency(ItemStack aStack) { - return 10000; + return boostEu ? 40000 : 10000; } @Override @@ -236,6 +240,7 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock "Diesel Engine", "Current Output: "+mEUt+" EU/t", "Fuel Consumption: "+fuelConsumption+"L/t", + "Fuel Value: "+fuelValue+" EU/mb", "Fuel Remaining: "+fuelRemaining+" Litres", "Current Efficiency: "+(mEfficiency/100)+"%"}; } diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java index 02fb621f..5166ab8f 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java @@ -523,9 +523,6 @@ public class GT_Loader_MetaTileEntities GT_ModHandler.addCraftingRecipe(ItemList.Locker_ZPM.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"T", "M", Character.valueOf('M'), ItemList.Battery_Buffer_2by2_ZPM, Character.valueOf('T'), OreDictNames.craftingChest}); GT_ModHandler.addCraftingRecipe(ItemList.Locker_UV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"T", "M", Character.valueOf('M'), ItemList.Battery_Buffer_2by2_UV, Character.valueOf('T'), OreDictNames.craftingChest}); GT_ModHandler.addCraftingRecipe(ItemList.Locker_MAX.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"T", "M", Character.valueOf('M'), ItemList.Battery_Buffer_2by2_MAX, Character.valueOf('T'), OreDictNames.craftingChest}); - - ItemList.Hatch_Turbo.set(new GT_MetaTileEntity_Hatch_Turbo(700, "hatch.turbo", "Turbo Hatch", 1).getStackForm(1L)); - GT_ModHandler.addCraftingRecipe(ItemList.Hatch_Turbo.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"dwx", "hMc", "fsr", Character.valueOf('M'), ItemList.Hull_LV}); } private static void run2() {