From 2859490274895866f864e66ba7ac18882b0dfb53 Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Tue, 24 May 2016 14:59:49 +1000 Subject: +Industrial Press +New Coke Oven GUI +Changed casings internally. +3 Coke Oven Recipes. --- .../handler/registration/RECIPES_GREGTECH.java | 25 +- .../gregtech/api/enums/GregtechItemList.java | 5 +- .../gregtech/api/gui/CONTAINER_MultiMachine.java | 35 ++ .../gregtech/api/gui/GUI_MultiMachine.java | 63 ++++ .../miscutil/gregtech/api/init/InitGregtech.java | 2 + .../machines/GregtechIndustrialCentrifuge.java | 4 +- .../machines/GregtechIndustrialPlatePress.java | 27 ++ .../implementations/GregtechMetaEnergyBuffer.java | 9 +- .../api/objects/GregtechRenderedTexture.java | 24 +- .../gregtech/common/GregtechRecipeAdder.java | 71 ++-- .../common/blocks/GregtechMetaCasingBlocks.java | 34 +- .../GregtechMetaLargeIndustrialCentrifuge.java | 391 --------------------- ...GregtechMetaTileEntityIndustrialCentrifuge.java | 391 +++++++++++++++++++++ .../GregtechMetaTileEntityIndustrialCokeOven.java | 11 +- ...GregtechMetaTileEntityIndustrialPlatePress.java | 143 ++++++++ .../assets/miscutils/textures/gui/CokeOven.png | Bin 0 -> 199683 bytes 16 files changed, 761 insertions(+), 474 deletions(-) create mode 100644 src/Java/miscutil/gregtech/api/gui/CONTAINER_MultiMachine.java create mode 100644 src/Java/miscutil/gregtech/api/gui/GUI_MultiMachine.java create mode 100644 src/Java/miscutil/gregtech/api/init/machines/GregtechIndustrialPlatePress.java delete mode 100644 src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaLargeIndustrialCentrifuge.java create mode 100644 src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCentrifuge.java create mode 100644 src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java create mode 100644 src/resources/assets/miscutils/textures/gui/CokeOven.png (limited to 'src') diff --git a/src/Java/miscutil/core/handler/registration/RECIPES_GREGTECH.java b/src/Java/miscutil/core/handler/registration/RECIPES_GREGTECH.java index b1b6312956..f433632163 100644 --- a/src/Java/miscutil/core/handler/registration/RECIPES_GREGTECH.java +++ b/src/Java/miscutil/core/handler/registration/RECIPES_GREGTECH.java @@ -17,9 +17,9 @@ public class RECIPES_GREGTECH { private static void execute(){ cokeOvenRecipes(); assemblerRecipes(); - + } - + private static void cokeOvenRecipes(){ Utils.LOG_INFO("Loading Recipes for Industrial Coking Oven."); @@ -29,45 +29,46 @@ public class RECIPES_GREGTECH { //With Sulfuric Acid CORE.RA.addCokeOvenRecipe( GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 2L), //Input 1 - GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 2L), //Input 2 + GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 1L), //Input 2 Materials.SulfuricAcid.getFluid(20L), //Fluid Input Materials.Creosote.getFluid(175L), //Fluid Output GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 2L), //Item Output 800, //Time in ticks 30); //EU - + }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + try { //Coal -> Coke Recipe //With Sulfuric Acid CORE.RA.addCokeOvenRecipe( GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 2L), //Input 1 - GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 2L), //Input 2 + GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 1L), //Input 2 Materials.SulfuricAcid.getFluid(80L), //Fluid Input Materials.Creosote.getFluid(250L), //Fluid Output UtilsItems.getItemStack("Railcraft:fuel.coke", 2), //Item Output 600, //Time in ticks 120); //EU }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} - + try { //GT Logs to Charcoal Recipe //Without Sulfuric Acid CORE.RA.addCokeOvenRecipe( GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 2L), //Input 1 - GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 2L), //Input 2 - null, //Fluid Input + GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 1L), //Input 2 + Materials.Water.getFluid(160L), //Fluid Input Materials.Creosote.getFluid(145L), //Fluid Output GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 2L), //Item Output 1200, //Time in ticks 30); //EU }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} - + try { //Coal -> Coke Recipe //Without Sulfuric Acid CORE.RA.addCokeOvenRecipe( GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 2L), //Input 1 - GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 2L), //Input 2 + GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 1L), //Input 2 null, //Fluid Input Materials.Creosote.getFluid(200L), //Fluid Output UtilsItems.getItemStack("Railcraft:fuel.coke", 2), //Item Output @@ -75,10 +76,10 @@ public class RECIPES_GREGTECH { 120); //EU }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} } - + private static void assemblerRecipes(){ //GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Titanium, 6L), ItemList.Casing_Turbine.get(1L, new Object[0]), ItemList.Casing_Turbine2.get(1L, new Object[0]), 50, 16); //GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 6L), ItemList.Casing_Turbine.get(1L, new Object[0]), ItemList.Casing_Turbine3.get(1L, new Object[0]), 50, 16); - + } } \ No newline at end of file diff --git a/src/Java/miscutil/gregtech/api/enums/GregtechItemList.java b/src/Java/miscutil/gregtech/api/enums/GregtechItemList.java index 79ebcd3576..9a2d8c23df 100644 --- a/src/Java/miscutil/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/miscutil/gregtech/api/enums/GregtechItemList.java @@ -52,7 +52,10 @@ public enum GregtechItemList implements GregtechItemContainer { Industrial_Centrifuge, Casing_Centrifuge1, //Coke Oven - Industrial_CokeOven, Casing_CokeOven, Casing_CokeOven_Coil1, Casing_CokeOven_Coil2; + Industrial_CokeOven, Casing_CokeOven, Casing_CokeOven_Coil1, Casing_CokeOven_Coil2, + + //Bending Maching // Plate Press // Press + Industrial_PlatePress; public static final GregtechItemList[] DYE_ONLY_ITEMS = { diff --git a/src/Java/miscutil/gregtech/api/gui/CONTAINER_MultiMachine.java b/src/Java/miscutil/gregtech/api/gui/CONTAINER_MultiMachine.java new file mode 100644 index 0000000000..417dae03f8 --- /dev/null +++ b/src/Java/miscutil/gregtech/api/gui/CONTAINER_MultiMachine.java @@ -0,0 +1,35 @@ +package miscutil.gregtech.api.gui; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; + +/** + * NEVER INCLUDE THIS FILE IN YOUR MOD!!! + *

+ * The Container I use for all my Basic Machines + */ +public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine { + public CONTAINER_MultiMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public CONTAINER_MultiMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } + + /*@Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 1, 152, 5)); + } + + @Override + public int getSlotCount() { + return 1; + } + + @Override + public int getShiftClickSlotCount() { + return 1; + }*/ +} diff --git a/src/Java/miscutil/gregtech/api/gui/GUI_MultiMachine.java b/src/Java/miscutil/gregtech/api/gui/GUI_MultiMachine.java new file mode 100644 index 0000000000..c56690ed76 --- /dev/null +++ b/src/Java/miscutil/gregtech/api/gui/GUI_MultiMachine.java @@ -0,0 +1,63 @@ +package miscutil.gregtech.api.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import miscutil.core.lib.CORE; +import net.minecraft.entity.player.InventoryPlayer; + +/** + * NEVER INCLUDE THIS FILE IN YOUR MOD!!! + *

+ * The GUI-Container I use for all my Basic Machines + *

+ * As the NEI-RecipeTransferRect Handler can't handle one GUI-Class for all GUIs I needed to produce some dummy-classes which extend this class + */ +public class GUI_MultiMachine extends GT_GUIContainerMetaTile_Machine { + + String mName = ""; + + public GUI_MultiMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { + super(new CONTAINER_MultiMachine(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + mName = aName; + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + fontRendererObj.drawString(mName, 10, 8, 16448255); + + if (mContainer != null) { + if ((((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode & 1) != 0) + fontRendererObj.drawString("Pipe is loose.", 10, 16, 16448255); + if ((((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode & 2) != 0) + fontRendererObj.drawString("Screws are missing.", 10, 24, 16448255); + if ((((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode & 4) != 0) + fontRendererObj.drawString("Something is stuck.", 10, 32, 16448255); + if ((((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode & 8) != 0) + fontRendererObj.drawString("Platings are dented.", 10, 40, 16448255); + if ((((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode & 16) != 0) + fontRendererObj.drawString("Circuitry burned out.", 10, 48, 16448255); + if ((((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode & 32) != 0) + fontRendererObj.drawString("That doesn't belong there.", 10, 56, 16448255); + if ((((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode & 64) != 0) + fontRendererObj.drawString("Incomplete Structure.", 10, 64, 16448255); + + if (((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode == 0) { + if (((CONTAINER_MultiMachine) mContainer).mActive == 0) { + fontRendererObj.drawString("Hit with Soft Hammer", 10, 16, 16448255); + fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255); + fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255); + } else { + fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255); + } + } + } + } + + @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/Java/miscutil/gregtech/api/init/InitGregtech.java b/src/Java/miscutil/gregtech/api/init/InitGregtech.java index a1f1f1eb41..c610107d04 100644 --- a/src/Java/miscutil/gregtech/api/init/InitGregtech.java +++ b/src/Java/miscutil/gregtech/api/init/InitGregtech.java @@ -5,6 +5,7 @@ import miscutil.gregtech.api.init.machines.GregtechConduits; import miscutil.gregtech.api.init.machines.GregtechEnergyBuffer; import miscutil.gregtech.api.init.machines.GregtechIndustrialCentrifuge; import miscutil.gregtech.api.init.machines.GregtechIndustrialCokeOven; +import miscutil.gregtech.api.init.machines.GregtechIndustrialPlatePress; import miscutil.gregtech.api.init.machines.GregtechSafeBlock; import miscutil.gregtech.api.init.machines.GregtechSteamCondenser; @@ -18,6 +19,7 @@ public class InitGregtech { GregtechSafeBlock.run(); GregtechIndustrialCentrifuge.run(); GregtechIndustrialCokeOven.run(); + GregtechIndustrialPlatePress.run(); } } diff --git a/src/Java/miscutil/gregtech/api/init/machines/GregtechIndustrialCentrifuge.java b/src/Java/miscutil/gregtech/api/init/machines/GregtechIndustrialCentrifuge.java index a653bbce93..4bad285fd5 100644 --- a/src/Java/miscutil/gregtech/api/init/machines/GregtechIndustrialCentrifuge.java +++ b/src/Java/miscutil/gregtech/api/init/machines/GregtechIndustrialCentrifuge.java @@ -2,7 +2,7 @@ package miscutil.gregtech.api.init.machines; import miscutil.core.util.Utils; import miscutil.gregtech.api.enums.GregtechItemList; -import miscutil.gregtech.common.machines.multi.GregtechMetaLargeIndustrialCentrifuge; +import miscutil.gregtech.common.machines.multi.GregtechMetaTileEntityIndustrialCentrifuge; public class GregtechIndustrialCentrifuge { @@ -21,7 +21,7 @@ public class GregtechIndustrialCentrifuge private static void run1() { //Industrial Centrifuge Multiblock - GregtechItemList.Industrial_Centrifuge.set(new GregtechMetaLargeIndustrialCentrifuge(790, "industrialcentrifuge.controller.tier.single", "Industrial Centrifuge").getStackForm(1L)); + GregtechItemList.Industrial_Centrifuge.set(new GregtechMetaTileEntityIndustrialCentrifuge(790, "industrialcentrifuge.controller.tier.single", "Industrial Centrifuge").getStackForm(1L)); } } diff --git a/src/Java/miscutil/gregtech/api/init/machines/GregtechIndustrialPlatePress.java b/src/Java/miscutil/gregtech/api/init/machines/GregtechIndustrialPlatePress.java new file mode 100644 index 0000000000..78f05b157c --- /dev/null +++ b/src/Java/miscutil/gregtech/api/init/machines/GregtechIndustrialPlatePress.java @@ -0,0 +1,27 @@ +package miscutil.gregtech.api.init.machines; + +import miscutil.core.util.Utils; +import miscutil.gregtech.api.enums.GregtechItemList; +import miscutil.gregtech.common.machines.multi.GregtechMetaTileEntityIndustrialPlatePress; + +public class GregtechIndustrialPlatePress +{ + + + + public static void run() + { + if (miscutil.core.lib.LoadedMods.Gregtech){ + Utils.LOG_INFO("MiscUtils: Gregtech5u Content | Registering Industrial Press Multiblock."); + run1(); + } + + } + + private static void run1() + { + //Industrial Centrifuge Multiblock + GregtechItemList.Industrial_PlatePress.set(new GregtechMetaTileEntityIndustrialPlatePress(792, "industrialbender.controller.tier.single", "Industrial Material Press").getStackForm(1L)); + + } +} \ No newline at end of file diff --git a/src/Java/miscutil/gregtech/api/metatileentity/implementations/GregtechMetaEnergyBuffer.java b/src/Java/miscutil/gregtech/api/metatileentity/implementations/GregtechMetaEnergyBuffer.java index 26a88067b7..a7db28154d 100644 --- a/src/Java/miscutil/gregtech/api/metatileentity/implementations/GregtechMetaEnergyBuffer.java +++ b/src/Java/miscutil/gregtech/api/metatileentity/implementations/GregtechMetaEnergyBuffer.java @@ -18,7 +18,6 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import ic2.api.item.IElectricItem; -import miscutil.core.handler.GuiHandler; import miscutil.core.util.Utils; import miscutil.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity; import net.minecraft.entity.player.EntityPlayer; @@ -169,15 +168,15 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { } private void showEnergy(World worldIn, EntityPlayer playerIn){ - Utils.LOG_WARNING("Begin Show Energy"); + //Utils.LOG_WARNING("Begin Show Energy"); final double c = ((double) getProgresstime() / maxProgresstime()) * 100; - Utils.LOG_WARNING(""+c); + //Utils.LOG_WARNING(""+c); final double roundOff = Math.round(c * 100.0) / 100.0; Utils.messagePlayer(playerIn, "Energy: " + getProgresstime() + " EU at "+V[mTier]+"v ("+roundOff+"%)"); - Utils.LOG_WARNING("Making new instance of Guihandler"); + /*Utils.LOG_WARNING("Making new instance of Guihandler"); GuiHandler block = new GuiHandler(); Utils.LOG_WARNING("Guihandler.toString(): "+block.toString()); - block.getClientGuiElement(1, playerIn, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ); + block.getClientGuiElement(1, playerIn, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);*/ } diff --git a/src/Java/miscutil/gregtech/api/objects/GregtechRenderedTexture.java b/src/Java/miscutil/gregtech/api/objects/GregtechRenderedTexture.java index 88ef8f5fff..5c87109ef0 100644 --- a/src/Java/miscutil/gregtech/api/objects/GregtechRenderedTexture.java +++ b/src/Java/miscutil/gregtech/api/objects/GregtechRenderedTexture.java @@ -118,34 +118,34 @@ public class GregtechRenderedTexture implements ITexture, IColorModulationContai aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); } } catch (NullPointerException e){ - Utils.LOG_INFO("renderZPos failed."); + Utils.LOG_WARNING("renderZPos failed."); } } @Override public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { try { - Utils.LOG_INFO("renderZNeg Method();."); - Utils.LOG_INFO("Setting RGBA of instance."); + Utils.LOG_WARNING("renderZNeg Method();."); + Utils.LOG_WARNING("Setting RGBA of instance."); Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); - Utils.LOG_INFO("Is mIconContainer null? "+mIconContainer.toString()); - Utils.LOG_INFO("mIconContainer.getIcon.getIconName(): "+mIconContainer.getIcon().getIconName()); - Utils.LOG_INFO("mIconContainer.getTextureFile().getResourceDomain()"+mIconContainer.getTextureFile().getResourceDomain()); - Utils.LOG_INFO("mIconContainer.getTextureFile().getResourcePath()"+mIconContainer.getTextureFile().getResourcePath()); + Utils.LOG_WARNING("Is mIconContainer null? "+mIconContainer.toString()); + Utils.LOG_WARNING("mIconContainer.getIcon.getIconName(): "+mIconContainer.getIcon().getIconName()); + Utils.LOG_WARNING("mIconContainer.getTextureFile().getResourceDomain()"+mIconContainer.getTextureFile().getResourceDomain()); + Utils.LOG_WARNING("mIconContainer.getTextureFile().getResourcePath()"+mIconContainer.getTextureFile().getResourcePath()); if (mIconContainer.getOverlayIcon() != null) { Tessellator.instance.setColorRGBA(204, 204, 204, 255); aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); - Utils.LOG_INFO("Is miconContainer.getOverlayIcon null? "+mIconContainer.getOverlayIcon().toString()); - Utils.LOG_INFO("mIconContainer.getIcon.getIconName(): "+mIconContainer.getOverlayIcon().getIconName()); - Utils.LOG_INFO("mIconContainer.getTextureFile().getResourceDomain()"+mIconContainer.getTextureFile().getResourceDomain()); - Utils.LOG_INFO("mIconContainer.getTextureFile().getResourcePath()"+mIconContainer.getTextureFile().getResourcePath()); + Utils.LOG_WARNING("Is miconContainer.getOverlayIcon null? "+mIconContainer.getOverlayIcon().toString()); + Utils.LOG_WARNING("mIconContainer.getIcon.getIconName(): "+mIconContainer.getOverlayIcon().getIconName()); + Utils.LOG_WARNING("mIconContainer.getTextureFile().getResourceDomain()"+mIconContainer.getTextureFile().getResourceDomain()); + Utils.LOG_WARNING("mIconContainer.getTextureFile().getResourcePath()"+mIconContainer.getTextureFile().getResourcePath()); } } catch (NullPointerException e){ e.printStackTrace(); - Utils.LOG_INFO("renderZNeg failed."+e.getMessage()+"|"+e.getClass()+"|"+e.getLocalizedMessage()); + Utils.LOG_WARNING("renderZNeg failed."+e.getMessage()+"|"+e.getClass()+"|"+e.getLocalizedMessage()); Minecraft.getMinecraft().shutdown(); } } diff --git a/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java b/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java index ab6d0ad900..4cc07aafcb 100644 --- a/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java +++ b/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java @@ -54,44 +54,57 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { @Override public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt) { try { - - debug1(); - if (((aInput1 == null) /*&& (aFluidInput == null)*/) || ((aOutput == null) && (aFluidOutput == null))) { - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Something was null, returning false"); - return false; - } + try { + debug1(); + if (((aInput1 == null) /*&& (aFluidInput == null)*/) || ((aOutput == null) || (aFluidOutput == null))) { + Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_INFO("Something was null, returning false"); + return false; + } + } catch (NullPointerException e){e.getStackTrace();} + try { + debug2(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); + if ((aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aOutput, aDuration)) <= 0)) { + Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_INFO("Something was null, returning false"); + return false; + } - debug2(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); - if ((aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aOutput, aDuration)) <= 0)) { - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Something was null, returning false"); - return false; - } + } catch (NullPointerException e){e.getStackTrace();} + try { + debug3(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); + if ((aFluidOutput == null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aFluidOutput.getFluid().getName(), aDuration)) <= 0)) { + Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_INFO("Something was null, returning false"); + return false; + } - debug3(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); - if ((aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aFluidOutput.getFluid().getName(), aDuration)) <= 0)) { - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Something was null, returning false"); - return false; - } + } catch (NullPointerException e){e.getStackTrace();} + try { + debug4(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); + if (aFluidInput == null){ + GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput}, null, null, null, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); + } + else { + GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); + } + debug5(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); - debug4(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); - if (aFluidInput == null){ - GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput}, null, null, null, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); - } - else { - GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); + return true; + + } catch (NullPointerException e){ + return false; } - debug5(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); - - return true; - } catch (NullPointerException e){ + } catch (Throwable e){ Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_INFO("Failed."); + e.getStackTrace(); return false; } } + + + } diff --git a/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocks.java b/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocks.java index ef0cd3c62e..c1b98560ee 100644 --- a/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocks.java +++ b/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocks.java @@ -7,7 +7,7 @@ import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.util.GT_LanguageManager; import gregtech.common.blocks.GT_Material_Casings; import miscutil.gregtech.api.enums.GregtechItemList; -import miscutil.gregtech.common.machines.multi.GregtechMetaLargeIndustrialCentrifuge; +import miscutil.gregtech.common.machines.multi.GregtechMetaTileEntityIndustrialCentrifuge; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; @@ -102,49 +102,49 @@ extends GregtechMetaCasingBlocksAbstract { if ((aSide == 2) || (aSide == 3)) { TileEntity tTileEntity; IMetaTileEntity tMetaTileEntity; - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[0].getIcon(); } return Textures.BlockIcons.TURBINE[0].getIcon(); } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[3].getIcon(); } return Textures.BlockIcons.TURBINE[3].getIcon(); } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[6].getIcon(); } return Textures.BlockIcons.TURBINE[6].getIcon(); } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[1].getIcon(); } return Textures.BlockIcons.TURBINE[1].getIcon(); } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[7].getIcon(); } return Textures.BlockIcons.TURBINE[7].getIcon(); } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[8].getIcon(); } return Textures.BlockIcons.TURBINE[8].getIcon(); } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[5].getIcon(); } return Textures.BlockIcons.TURBINE[5].getIcon(); } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[2].getIcon(); } @@ -153,49 +153,49 @@ extends GregtechMetaCasingBlocksAbstract { } else if ((aSide == 4) || (aSide == 5)) { TileEntity tTileEntity; Object tMetaTileEntity; - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[0].getIcon(); } return Textures.BlockIcons.TURBINE[0].getIcon(); } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[3].getIcon(); } return Textures.BlockIcons.TURBINE[3].getIcon(); } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[6].getIcon(); } return Textures.BlockIcons.TURBINE[6].getIcon(); } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[1].getIcon(); } return Textures.BlockIcons.TURBINE[1].getIcon(); } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[7].getIcon(); } return Textures.BlockIcons.TURBINE[7].getIcon(); } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[8].getIcon(); } return Textures.BlockIcons.TURBINE[8].getIcon(); } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[5].getIcon(); } return Textures.BlockIcons.TURBINE[5].getIcon(); } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaLargeIndustrialCentrifuge))) { + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntityIndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { return Textures.BlockIcons.TURBINE_ACTIVE[2].getIcon(); } diff --git a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaLargeIndustrialCentrifuge.java b/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaLargeIndustrialCentrifuge.java deleted file mode 100644 index d07b306b69..0000000000 --- a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaLargeIndustrialCentrifuge.java +++ /dev/null @@ -1,391 +0,0 @@ -package miscutil.gregtech.common.machines.multi; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import miscutil.core.block.ModBlocks; -import miscutil.core.util.Utils; -import miscutil.gregtech.api.objects.GregtechRenderedTexture; -import net.minecraft.block.Block; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import org.apache.commons.lang3.ArrayUtils; - -public class GregtechMetaLargeIndustrialCentrifuge -extends GT_MetaTileEntity_MultiBlockBase { - private static boolean controller; - - public GregtechMetaLargeIndustrialCentrifuge(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaLargeIndustrialCentrifuge(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaLargeIndustrialCentrifuge(this.mName); - } - - @Override - public String[] getDescription() { - return new String[]{ - "Controller Block for the Industrial Centrifuge", - "Size: 3x3x3 (Hollow)", - "Controller (Front Center)", - "1x Maintenance Hatch (Rear Center)", - "The rest can be placed anywhere except the Front", - "1x Input Hatch", - "1x Output Hatch", - "1x Input Bus", - "1x Output Bus", - "1x [EV] Energy Hatch (Can be higher Tier)", - "Needs a Turbine Item (inside controller GUI)", - "Centrifuge Casings for the rest (16 at least)",}; - } - - /*@Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{GregtechTextures.BlockIcons.GT_CASING_BLOCKS[0], new GT_RenderedTexture(aActive ? Textures.BlockIcons.LARGETURBINE_ACTIVE5 : Textures.BlockIcons.LARGETURBINE5)}; - } - return new ITexture[]{GregtechTextures.BlockIcons.GT_CASING_BLOCKS[0]}; - }*/ - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? new GregtechRenderedTexture(Textures.BlockIcons.LARGETURBINE_ACTIVE5) : new GregtechRenderedTexture(Textures.BlockIcons.LARGETURBINE5) : Textures.BlockIcons.CASING_BLOCKS[57]}; - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "VacuumFreezer.png"); - } - - @Override - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } - - ArrayList tInputList = getStoredInputs(); - GT_Recipe mLastRecipe; - - @Override - public boolean checkRecipe(ItemStack aStack) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - - GT_Recipe.GT_Recipe_Map map = getRecipeMap(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); - } else { - tInputList.remove(i--); - break; - } - } - } - } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - - ArrayList tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); - } else { - tFluidList.remove(i--); - break; - } - } - } - } - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); - if (tInputList.size() > 0 || tFluids.length > 0) { - GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - if (tRecipe != null) { - if (tRecipe.mFluidInputs != null) { - - } - mLastRecipe = tRecipe; - this.mEUt = 0; - this.mOutputItems = null; - this.mOutputFluids = null; - int machines = Math.min(16, mInventory[1].stackSize); - int i = 0; - for (; i < machines; i++) { - if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) { - if (i == 0) { - return false; - } - break; - } - } - this.mMaxProgresstime = tRecipe.mDuration; - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 4; - } - } - this.mEUt *= i; - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; - for (int h = 0; h < tRecipe.mOutputs.length; h++) { - tOut[h] = tRecipe.getOutput(h).copy(); - tOut[h].stackSize = 0; - } - FluidStack tFOut = null; - if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy(); - for (int f = 0; f < tOut.length; f++) { - if (tRecipe.mOutputs[f] != null && tOut[f] != null) { - for (int g = 0; g < i; g++) { - if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) - tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; - } - } - } - if (tFOut != null) { - int tSize = tFOut.amount; - tFOut.amount = tSize * i; - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - List overStacks = new ArrayList(); - for (int f = 0; f < tOut.length; f++) { - if (tOut[f].getMaxStackSize() < tOut[f].stackSize) { - while (tOut[f].getMaxStackSize() < tOut[f].stackSize) { - ItemStack tmp = tOut[f].copy(); - tmp.stackSize = tmp.getMaxStackSize(); - tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize(); - overStacks.add(tmp); - } - } - } - if (overStacks.size() > 0) { - ItemStack[] tmp = new ItemStack[overStacks.size()]; - tmp = overStacks.toArray(tmp); - tOut = ArrayUtils.addAll(tOut, tmp); - } - List tSList = new ArrayList(); - for (ItemStack tS : tOut) { - if (tS.stackSize > 0) tSList.add(tS); - } - tOut = tSList.toArray(new ItemStack[tSList.size()]); - this.mOutputItems = tOut; - this.mOutputFluids = new FluidStack[]{tFOut}; - updateSlots(); - return true; - } - } - return false; - } - - @SuppressWarnings("static-method") - public Block getCasingBlock() { - return ModBlocks.blockCasingsMisc; - } - - @SuppressWarnings("static-method") - public byte getCasingMeta() { - return 0; - } - - @SuppressWarnings("static-method") - public byte getCasingTextureIndex() { - return 0; - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - //Utils.LOG_WARNING("X:"+xDir+" Y:"+yDir+" Z:"+zDir); - if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { - return false; - } - int tAmount = 0; - for (int i = -1; i < 2; i++) { //X-Dir - for (int j = -1; j < 2; j++) { //Z-Dir - for (int h = -1; h < 2; h++) { //Y-Dir - if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { - - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - //Utils.LOG_INFO("X:"+tTileEntity.getXCoord()+" Y:"+tTileEntity.getYCoord()+" Z:"+tTileEntity.getZCoord()); - if ((!addMaintenanceToMachineList(tTileEntity, 57)) && (!addInputToMachineList(tTileEntity, 57)) && (!addOutputToMachineList(tTileEntity, 57)) && (!addEnergyInputToMachineList(tTileEntity, 57))) { - - //Maintenance Hatch - if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { - if (tTileEntity.getXCoord() == aBaseMetaTileEntity.getXCoord() && tTileEntity.getYCoord() == aBaseMetaTileEntity.getYCoord() && tTileEntity.getZCoord() == (aBaseMetaTileEntity.getZCoord()+2)) { - if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { - Utils.LOG_INFO("MAINT HATCH IN CORRECT PLACE"); - this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity()); - ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); - } else { - return false; - } - } - else { - Utils.LOG_INFO("MAINT HATCH IN WRONG PLACE"); - } - } - - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 0) { - return false; - } - tAmount++; - - } - } - } - } - } - return tAmount >= 16; - } - - @SuppressWarnings("static-method") - public boolean ignoreController(Block tTileEntity) { - if (!controller && tTileEntity == GregTech_API.sBlockMachines) { - return true; - } - return false; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public int getAmountOfOutputs() { - return 1; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - private boolean checkStructure(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack){ - - Utils.LOG_INFO("structure checking"); - int x = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int y = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY; - int z = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - Utils.LOG_INFO("X:"+x+" Y:"+y+" Z:"+z); - - //North case - int hatchMaintainence[] = {x, y, z+2}; - int hatchInputBus[] = {x+1, y, z+1}; - int hatchOutputBus[] = {x-1, y, z+1}; - int hatchInput[] = {x+1, y+1, z+1}; - int hatchOutput[] = {x-1, y+1, z+1}; - int hatchEnergy[] = {x, y+1, z+2}; - - //South case - int hatchMaintainence0[] = {x, y, z-2}; - int hatchInputBus0[] = {x-1, y, z-1}; - int hatchOutputBus0[] = {x+1, y, z-1}; - int hatchInput0[] = {x-1, y+1, z-1}; - int hatchOutput0[] = {x+1, y+1, z-1}; - int hatchEnergy0[] = {x, y+1, z-2}; - - - //East case - int hatchMaintainence1[] = {x+2, y, z}; - int hatchInputBus1[] = {x+1, y, z+1}; - int hatchOutputBus1[] = {x+1, y, z-1}; - int hatchInput1[] = {x+1, y+1, z+1}; - int hatchOutput1[] = {x+1, y+1, z-1}; - int hatchEnergy1[] = {x+2, y+1, z}; - - //West case - int hatchMaintainence2[] = {x-2, y, z}; - int hatchInputBus2[] = {x-1, y, z-1}; - int hatchOutputBus2[] = {x-1, y, z+1}; - int hatchInput2[] = {x-1, y+1, z-1}; - int hatchOutput2[] = {x-1, y+1, z+1}; - int hatchEnergy2[] = {x-2, y+1, z}; - - - - /*//Maintenance Hatch - IGregTechTileEntity tTileEntityMaintenanceHatch = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2); - if ((tTileEntityMaintenanceHatch != null) && (tTileEntityMaintenanceHatch.getMetaTileEntity() != null)) { - if ((tTileEntityMaintenanceHatch.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { - this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntityMaintenanceHatch.getMetaTileEntity()); - ((GT_MetaTileEntity_Hatch) tTileEntityMaintenanceHatch.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); - } else { - return false; - } - }*/ - - /*//Energy Hatch - IGregTechTileEntity tTileEntityEnergyHatch = getBaseMetaTileEntity().getIGregTechTileEntity(i, h+1, j+2); - if ((tTileEntityEnergyHatch != null) && (tTileEntityEnergyHatch.getMetaTileEntity() != null)) { - if ((tTileEntityEnergyHatch.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Energy)) { - this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntityEnergyHatch.getMetaTileEntity()); - ((GT_MetaTileEntity_Hatch) tTileEntityEnergyHatch.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); - } else { - return false; - } - }*/ - - - - - return false; - } -} \ No newline at end of file diff --git a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCentrifuge.java b/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCentrifuge.java new file mode 100644 index 0000000000..8bef3fa1d3 --- /dev/null +++ b/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCentrifuge.java @@ -0,0 +1,391 @@ +package miscutil.gregtech.common.machines.multi; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import miscutil.core.block.ModBlocks; +import miscutil.core.util.Utils; +import miscutil.gregtech.api.gui.GUI_MultiMachine; +import miscutil.gregtech.api.objects.GregtechRenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +import org.apache.commons.lang3.ArrayUtils; + +public class GregtechMetaTileEntityIndustrialCentrifuge +extends GT_MetaTileEntity_MultiBlockBase { + private static boolean controller; + + public GregtechMetaTileEntityIndustrialCentrifuge(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntityIndustrialCentrifuge(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityIndustrialCentrifuge(this.mName); + } + + @Override + public String[] getDescription() { + return new String[]{ + "Controller Block for the Industrial Centrifuge", + "Size: 3x3x3 (Hollow)", + "Controller (Front Center)", + "1x Maintenance Hatch (Rear Center)", + "The rest can be placed anywhere except the Front", + "1x Input Hatch", + "1x Output Hatch", + "1x Input Bus", + "1x Output Bus", + "1x [EV] Energy Hatch (Can be higher Tier)", + "Needs a Turbine Item (inside controller GUI)", + "Centrifuge Casings for the rest (16 at least)",}; + } + + /*@Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{GregtechTextures.BlockIcons.GT_CASING_BLOCKS[0], new GT_RenderedTexture(aActive ? Textures.BlockIcons.LARGETURBINE_ACTIVE5 : Textures.BlockIcons.LARGETURBINE5)}; + } + return new ITexture[]{GregtechTextures.BlockIcons.GT_CASING_BLOCKS[0]}; + }*/ + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? new GregtechRenderedTexture(Textures.BlockIcons.LARGETURBINE_ACTIVE5) : new GregtechRenderedTexture(Textures.BlockIcons.LARGETURBINE5) : Textures.BlockIcons.CASING_BLOCKS[57]}; + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "CokeOven.png"); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + ArrayList tInputList = getStoredInputs(); + GT_Recipe mLastRecipe; + + @Override + public boolean checkRecipe(ItemStack aStack) { + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + + GT_Recipe.GT_Recipe_Map map = getRecipeMap(); + for (int i = 0; i < tInputList.size() - 1; i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { + if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + + ArrayList tFluidList = getStoredFluids(); + for (int i = 0; i < tFluidList.size() - 1; i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { + if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; + } + } + } + } + FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); + if (tInputList.size() > 0 || tFluids.length > 0) { + GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if (tRecipe != null) { + if (tRecipe.mFluidInputs != null) { + + } + mLastRecipe = tRecipe; + this.mEUt = 0; + this.mOutputItems = null; + this.mOutputFluids = null; + int machines = Math.min(16, mInventory[1].stackSize); + int i = 0; + for (; i < machines; i++) { + if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) { + if (i == 0) { + return false; + } + break; + } + } + this.mMaxProgresstime = tRecipe.mDuration; + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 4; + } + } + this.mEUt *= i; + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; + for (int h = 0; h < tRecipe.mOutputs.length; h++) { + tOut[h] = tRecipe.getOutput(h).copy(); + tOut[h].stackSize = 0; + } + FluidStack tFOut = null; + if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy(); + for (int f = 0; f < tOut.length; f++) { + if (tRecipe.mOutputs[f] != null && tOut[f] != null) { + for (int g = 0; g < i; g++) { + if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) + tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; + } + } + } + if (tFOut != null) { + int tSize = tFOut.amount; + tFOut.amount = tSize * i; + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + List overStacks = new ArrayList(); + for (int f = 0; f < tOut.length; f++) { + if (tOut[f].getMaxStackSize() < tOut[f].stackSize) { + while (tOut[f].getMaxStackSize() < tOut[f].stackSize) { + ItemStack tmp = tOut[f].copy(); + tmp.stackSize = tmp.getMaxStackSize(); + tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize(); + overStacks.add(tmp); + } + } + } + if (overStacks.size() > 0) { + ItemStack[] tmp = new ItemStack[overStacks.size()]; + tmp = overStacks.toArray(tmp); + tOut = ArrayUtils.addAll(tOut, tmp); + } + List tSList = new ArrayList(); + for (ItemStack tS : tOut) { + if (tS.stackSize > 0) tSList.add(tS); + } + tOut = tSList.toArray(new ItemStack[tSList.size()]); + this.mOutputItems = tOut; + this.mOutputFluids = new FluidStack[]{tFOut}; + updateSlots(); + return true; + } + } + return false; + } + + @SuppressWarnings("static-method") + public Block getCasingBlock() { + return ModBlocks.blockCasingsMisc; + } + + @SuppressWarnings("static-method") + public byte getCasingMeta() { + return 0; + } + + @SuppressWarnings("static-method") + public byte getCasingTextureIndex() { + return 0; + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + //Utils.LOG_WARNING("X:"+xDir+" Y:"+yDir+" Z:"+zDir); + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + return false; + } + int tAmount = 0; + for (int i = -1; i < 2; i++) { //X-Dir + for (int j = -1; j < 2; j++) { //Z-Dir + for (int h = -1; h < 2; h++) { //Y-Dir + if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { + + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + //Utils.LOG_INFO("X:"+tTileEntity.getXCoord()+" Y:"+tTileEntity.getYCoord()+" Z:"+tTileEntity.getZCoord()); + if ((!addMaintenanceToMachineList(tTileEntity, 57)) && (!addInputToMachineList(tTileEntity, 57)) && (!addOutputToMachineList(tTileEntity, 57)) && (!addEnergyInputToMachineList(tTileEntity, 57))) { + + //Maintenance Hatch + if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { + if (tTileEntity.getXCoord() == aBaseMetaTileEntity.getXCoord() && tTileEntity.getYCoord() == aBaseMetaTileEntity.getYCoord() && tTileEntity.getZCoord() == (aBaseMetaTileEntity.getZCoord()+2)) { + if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { + Utils.LOG_INFO("MAINT HATCH IN CORRECT PLACE"); + this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity()); + ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); + } else { + return false; + } + } + else { + Utils.LOG_INFO("MAINT HATCH IN WRONG PLACE"); + } + } + + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 0) { + return false; + } + tAmount++; + + } + } + } + } + } + return tAmount >= 16; + } + + @SuppressWarnings("static-method") + public boolean ignoreController(Block tTileEntity) { + if (!controller && tTileEntity == GregTech_API.sBlockMachines) { + return true; + } + return false; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public int getAmountOfOutputs() { + return 1; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + private boolean checkStructure(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack){ + + Utils.LOG_INFO("structure checking"); + int x = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int y = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY; + int z = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + Utils.LOG_INFO("X:"+x+" Y:"+y+" Z:"+z); + + //North case + int hatchMaintainence[] = {x, y, z+2}; + int hatchInputBus[] = {x+1, y, z+1}; + int hatchOutputBus[] = {x-1, y, z+1}; + int hatchInput[] = {x+1, y+1, z+1}; + int hatchOutput[] = {x-1, y+1, z+1}; + int hatchEnergy[] = {x, y+1, z+2}; + + //South case + int hatchMaintainence0[] = {x, y, z-2}; + int hatchInputBus0[] = {x-1, y, z-1}; + int hatchOutputBus0[] = {x+1, y, z-1}; + int hatchInput0[] = {x-1, y+1, z-1}; + int hatchOutput0[] = {x+1, y+1, z-1}; + int hatchEnergy0[] = {x, y+1, z-2}; + + + //East case + int hatchMaintainence1[] = {x+2, y, z}; + int hatchInputBus1[] = {x+1, y, z+1}; + int hatchOutputBus1[] = {x+1, y, z-1}; + int hatchInput1[] = {x+1, y+1, z+1}; + int hatchOutput1[] = {x+1, y+1, z-1}; + int hatchEnergy1[] = {x+2, y+1, z}; + + //West case + int hatchMaintainence2[] = {x-2, y, z}; + int hatchInputBus2[] = {x-1, y, z-1}; + int hatchOutputBus2[] = {x-1, y, z+1}; + int hatchInput2[] = {x-1, y+1, z-1}; + int hatchOutput2[] = {x-1, y+1, z+1}; + int hatchEnergy2[] = {x-2, y+1, z}; + + + + /*//Maintenance Hatch + IGregTechTileEntity tTileEntityMaintenanceHatch = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2); + if ((tTileEntityMaintenanceHatch != null) && (tTileEntityMaintenanceHatch.getMetaTileEntity() != null)) { + if ((tTileEntityMaintenanceHatch.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { + this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntityMaintenanceHatch.getMetaTileEntity()); + ((GT_MetaTileEntity_Hatch) tTileEntityMaintenanceHatch.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); + } else { + return false; + } + }*/ + + /*//Energy Hatch + IGregTechTileEntity tTileEntityEnergyHatch = getBaseMetaTileEntity().getIGregTechTileEntity(i, h+1, j+2); + if ((tTileEntityEnergyHatch != null) && (tTileEntityEnergyHatch.getMetaTileEntity() != null)) { + if ((tTileEntityEnergyHatch.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Energy)) { + this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntityEnergyHatch.getMetaTileEntity()); + ((GT_MetaTileEntity_Hatch) tTileEntityEnergyHatch.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); + } else { + return false; + } + }*/ + + + + + return false; + } +} \ No newline at end of file diff --git a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java b/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java index 606cac5482..65c58b35db 100644 --- a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java +++ b/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java @@ -1,7 +1,6 @@ package miscutil.gregtech.common.machines.multi; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -14,6 +13,7 @@ import java.util.ArrayList; import java.util.Arrays; import miscutil.core.block.ModBlocks; +import miscutil.gregtech.api.gui.GUI_MultiMachine; import miscutil.gregtech.api.util.GregtechRecipe; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -62,7 +62,7 @@ public class GregtechMetaTileEntityIndustrialCokeOven @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiFurnace.png"); + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "CokeOven.png"); } @Override @@ -115,7 +115,7 @@ public class GregtechMetaTileEntityIndustrialCokeOven if (tInputList.size() > 0) { long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + GT_Recipe tRecipe = GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); if ((tRecipe != null) && (this.mLevel >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; @@ -134,7 +134,8 @@ public class GregtechMetaTileEntityIndustrialCokeOven this.mEUt = (-this.mEUt); } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; updateSlots(); return true; } @@ -170,7 +171,6 @@ public class GregtechMetaTileEntityIndustrialCokeOven public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - //this.mOutputItems = new ItemStack[12 * this.mLevel]; this.mLevel = 0; if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { return false; @@ -188,6 +188,7 @@ public class GregtechMetaTileEntityIndustrialCokeOven default: return false; } + this.mOutputItems = new ItemStack[12 * this.mLevel]; for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { if ((i != 0) || (j != 0)) { diff --git a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java b/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java new file mode 100644 index 0000000000..0084deb2a2 --- /dev/null +++ b/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java @@ -0,0 +1,143 @@ +package miscutil.gregtech.common.machines.multi; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; + +import java.util.ArrayList; + +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; + +public class GregtechMetaTileEntityIndustrialPlatePress + extends GT_MetaTileEntity_MultiBlockBase { + public GregtechMetaTileEntityIndustrialPlatePress(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntityIndustrialPlatePress(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityIndustrialPlatePress(this.mName); + } + + public String[] getDescription() { + return new String[]{"Controller Block for the Vacuum Freezer", "Size: 3x3x3 (Hollow)", "Controller (front centered)", "1x Input (anywhere)", "1x Output (anywhere)", "1x Energy Hatch (anywhere)", "1x Maintenance Hatch (anywhere)", "Frost Proof Casings for the rest (16 at least!)"}; + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[17], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[17]}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "VacuumFreezer.png"); + } + + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GT_Recipe.GT_Recipe_Map.sBenderRecipes; + } + + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + public boolean checkRecipe(ItemStack aStack) { + ArrayList tInputList = getStoredInputs(); + for (ItemStack tInput : tInputList) { + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sVacuumRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); + if (tRecipe != null) { + if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + updateSlots(); + return true; + } + } + } + return false; + } + + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + return false; + } + int tAmount = 0; + for (int i = -2; i < 3; i++) { + for (int j = -1; j < 2; j++) { + for (int h = -1; h < 2; h++) { + if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!addMaintenanceToMachineList(tTileEntity, 17)) && (!addInputToMachineList(tTileEntity, 17)) && (!addOutputToMachineList(tTileEntity, 17)) && (!addEnergyInputToMachineList(tTileEntity, 17))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings2) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 1) { + return false; + } + tAmount++; + } + } + } + } + } + return tAmount >= 16; + } + + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + public int getAmountOfOutputs() { + return 1; + } + + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } +} diff --git a/src/resources/assets/miscutils/textures/gui/CokeOven.png b/src/resources/assets/miscutils/textures/gui/CokeOven.png new file mode 100644 index 0000000000..1ba910c262 Binary files /dev/null and b/src/resources/assets/miscutils/textures/gui/CokeOven.png differ -- cgit