From 259e6db3c913f2fbd2226102db12b7c4abb8f65c Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 19 Aug 2019 20:58:11 +0100 Subject: % Tweaked default Multiblock GUI for those without a slot. (Many will still be broken) $ Fixed weirdly encoded symbol within CONTAINER_Cyclotron.java, which didn't tend to play nice for some users. $ Fixed Cyclotron GUI bug. Closes #473 --- .../xmod/gregtech/api/gui/CONTAINER_Cyclotron.java | 231 ++------------------- .../gregtech/api/gui/CONTAINER_MultiMachine.java | 49 ++++- .../CONTAINER_MultiMachine_NoPlayerInventory.java | 27 +++ .../xmod/gregtech/api/gui/GUI_Cyclotron.java | 44 ++++ .../xmod/gregtech/api/gui/GUI_MultiMachine.java | 139 ++++++++++--- 5 files changed, 250 insertions(+), 240 deletions(-) create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine_NoPlayerInventory.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Cyclotron.java (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/gui') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java index 921871cebe..6d0eb6b14c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java @@ -1,232 +1,37 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_LanguageManager; -import java.util.Iterator; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; +/** + * NEVER INCLUDE THIS FILE IN YOUR MOD!!! + *

+ * The Container I use for all my Basic Machines + */ public class CONTAINER_Cyclotron extends GT_ContainerMetaTile_Machine { - - public int mActive = 0; - public int mMaxProgressTime = 0; - public int mProgressTime = 0; - public long mEnergy = 0; - public int mSteam = 0; - public int mSteamStorage = 0; - public int mStorage = 0; - public int mOutput = 0; - public int mInput = 0; - public int mID = 0; - public int mDisplayErrorCode = 0; - private int oActive = 0; - private int oMaxProgressTime = 0; - private int oProgressTime = 0; - private long oEnergy = 0; - private int oSteam = 0; - private int oSteamStorage = 0; - private int oStorage = 0; - private int oOutput = 0; - private int oInput = 0; - private int oID = 0; - private int oDisplayErrorCode = 0; - private int mTimer = 0; - public CONTAINER_Cyclotron(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - this.mTileEntity = aTileEntity; - if (this.mTileEntity != null && this.mTileEntity.getMetaTileEntity() != null) { - this.addSlots(aInventoryPlayer); - if (this.doesBindPlayerInventory()) { - this.bindPlayerInventory(aInventoryPlayer); - } - - this.detectAndSendChanges(); - } else { - aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; - } + public CONTAINER_Cyclotron(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - } - - public CONTAINER_Cyclotron(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, - boolean doesBindInventory) { super(aInventoryPlayer, aTileEntity); - this.mTileEntity = aTileEntity; - if (this.mTileEntity != null && this.mTileEntity.getMetaTileEntity() != null) { - this.addSlots(aInventoryPlayer); - if (this.doesBindPlayerInventory() && doesBindInventory) { - this.bindPlayerInventory(aInventoryPlayer); - } - - this.detectAndSendChanges(); - } else { - aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; - } - } - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (!this.mTileEntity.isClientSide() && this.mTileEntity.getMetaTileEntity() != null) { - this.mStorage = (int) Math.min(2147483647L, this.mTileEntity.getEUCapacity()); - this.mEnergy = this.mTileEntity.getStoredEU(); - this.mSteamStorage = (int) Math.min(2147483647L, this.mTileEntity.getSteamCapacity()); - this.mSteam = (int) Math.min(2147483647L, this.mTileEntity.getStoredSteam()); - this.mOutput = (int) Math.min(2147483647L, this.mTileEntity.getOutputVoltage()); - this.mInput = (int) Math.min(2147483647L, this.mTileEntity.getInputVoltage()); - this.mDisplayErrorCode = this.mTileEntity.getErrorDisplayID(); - this.mProgressTime = this.mTileEntity.getProgress(); - this.mMaxProgressTime = this.mTileEntity.getMaxProgress(); - this.mActive = this.mTileEntity.isActive() ? 1 : 0; - ++this.mTimer; - Iterator var2 = this.crafters.iterator(); - - while (true) { - ICrafting var1; - do { - if (!var2.hasNext()) { - this.oID = this.mID; - this.oSteam = this.mSteam; - this.oInput = this.mInput; - this.oActive = this.mActive; - this.oOutput = this.mOutput; - this.oEnergy = this.mEnergy; - this.oStorage = this.mStorage; - this.oSteamStorage = this.mSteamStorage; - this.oProgressTime = this.mProgressTime; - this.oMaxProgressTime = this.mMaxProgressTime; - this.oDisplayErrorCode = this.mDisplayErrorCode; - return; - } - - var1 = (ICrafting) var2.next(); - if (this.mTimer % 500 == 10 || this.oEnergy != this.mEnergy) { - - int uEnergy = (int) Math.min(2147483647L, this.mTileEntity.getStoredEU()); - - var1.sendProgressBarUpdate(this, 0, uEnergy & '￿'); - var1.sendProgressBarUpdate(this, 1, uEnergy >>> 16); - } - - if (this.mTimer % 500 == 10 || this.oStorage != this.mStorage) { - var1.sendProgressBarUpdate(this, 2, this.mStorage & '￿'); - var1.sendProgressBarUpdate(this, 3, this.mStorage >>> 16); - } - - if (this.mTimer % 500 == 10 || this.oOutput != this.mOutput) { - var1.sendProgressBarUpdate(this, 4, this.mOutput); - } - - if (this.mTimer % 500 == 10 || this.oInput != this.mInput) { - var1.sendProgressBarUpdate(this, 5, this.mInput); - } - - if (this.mTimer % 500 == 10 || this.oDisplayErrorCode != this.mDisplayErrorCode) { - var1.sendProgressBarUpdate(this, 6, this.mDisplayErrorCode); - } - - if (this.mTimer % 500 == 10 || this.oProgressTime != this.mProgressTime) { - var1.sendProgressBarUpdate(this, 11, this.mProgressTime & '￿'); - var1.sendProgressBarUpdate(this, 12, this.mProgressTime >>> 16); - } - - if (this.mTimer % 500 == 10 || this.oMaxProgressTime != this.mMaxProgressTime) { - var1.sendProgressBarUpdate(this, 13, this.mMaxProgressTime & '￿'); - var1.sendProgressBarUpdate(this, 14, this.mMaxProgressTime >>> 16); - } - - if (this.mTimer % 500 == 10 || this.oID != this.mID) { - var1.sendProgressBarUpdate(this, 15, this.mID); - } - - if (this.mTimer % 500 == 10 || this.oActive != this.mActive) { - var1.sendProgressBarUpdate(this, 16, this.mActive); - } - - if (this.mTimer % 500 == 10 || this.oSteam != this.mSteam) { - var1.sendProgressBarUpdate(this, 17, this.mSteam & '￿'); - var1.sendProgressBarUpdate(this, 18, this.mSteam >>> 16); - } - } while (this.mTimer % 500 != 10 && this.oSteamStorage == this.mSteamStorage); - - var1.sendProgressBarUpdate(this, 19, this.mSteamStorage & '￿'); - var1.sendProgressBarUpdate(this, 20, this.mSteamStorage >>> 16); - } - } + public CONTAINER_Cyclotron(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); } - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 0 : - this.mEnergy = this.mEnergy & -65536 | par2; - break; - case 1 : - this.mEnergy = this.mEnergy & '￿' | par2 << 16; - break; - case 2 : - this.mStorage = this.mStorage & -65536 | par2; - break; - case 3 : - this.mStorage = this.mStorage & '￿' | par2 << 16; - break; - case 4 : - this.mOutput = par2; - break; - case 5 : - this.mInput = par2; - break; - case 6 : - this.mDisplayErrorCode = par2; - case 7 : - case 8 : - case 9 : - case 10 : - default : - break; - case 11 : - this.mProgressTime = this.mProgressTime & -65536 | par2; - break; - case 12 : - this.mProgressTime = this.mProgressTime & '￿' | par2 << 16; - break; - case 13 : - this.mMaxProgressTime = this.mMaxProgressTime & -65536 | par2; - break; - case 14 : - this.mMaxProgressTime = this.mMaxProgressTime & '￿' | par2 << 16; - break; - case 15 : - this.mID = par2; - break; - case 16 : - this.mActive = par2; - break; - case 17 : - this.mSteam = this.mSteam & -65536 | par2; - break; - case 18 : - this.mSteam = this.mSteam & '￿' | par2 << 16; - break; - case 19 : - this.mSteamStorage = this.mSteamStorage & -65536 | par2; - break; - case 20 : - this.mSteamStorage = this.mSteamStorage & '￿' | par2 << 16; - } - + @Override + public void addSlots(final InventoryPlayer aInventoryPlayer) { + //this.addSlotToContainer(new Slot(this.mTileEntity, 1, 154, 42)); } - public boolean canInteractWith(EntityPlayer player) { - return this.mTileEntity.isUseableByPlayer(player); + @Override + public int getSlotCount() { + return 0; } - public String trans(String aKey, String aEnglish) { - return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false); + @Override + public int getShiftClickSlotCount() { + return 0; } -} \ No newline at end of file +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java index bdf19454ce..5fccb51e54 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java @@ -1,9 +1,15 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import net.minecraft.entity.player.InventoryPlayer; +import java.lang.reflect.Field; +import java.util.List; import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -11,6 +17,11 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; * The Container I use for all my Basic Machines */ public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine { + + public String[] mTileDescription; + private String[] oTileDescription; + + public CONTAINER_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); } @@ -18,6 +29,42 @@ public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine { public CONTAINER_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { super(aInventoryPlayer, aTileEntity, bindInventory); } + + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (this.mTileEntity.isClientSide() || this.mTileEntity.getMetaTileEntity() == null) { + return; + } + + try { + this.mTileDescription = this.mTileEntity.getInfoData(); + + Field bTimer = ReflectionUtils.getField(getClass(), "mTimer"); + Field bCrafters = ReflectionUtils.getField(getClass(), "crafters"); + int time = bTimer.getInt(this); + List crafters = (List) bCrafters.get(this); + AutoMap aCrafting = new AutoMap(); + if (crafters != null && !crafters.isEmpty()) { + for (Object o : crafters) { + aCrafting.put((ICrafting) o); + } + } + + for (final ICrafting var3 : aCrafting) { + if (time % 500 == 10 || this.oTileDescription != this.mTileDescription) { + var3.sendProgressBarUpdate((Container)this, 64, 0); + } + } + + this.oTileDescription = this.mTileDescription; + } + catch (Throwable t) { + + } + } + } /*@Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine_NoPlayerInventory.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine_NoPlayerInventory.java new file mode 100644 index 0000000000..2d63a13d60 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine_NoPlayerInventory.java @@ -0,0 +1,27 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; + +public class CONTAINER_MultiMachine_NoPlayerInventory extends CONTAINER_MultiMachine { + + public CONTAINER_MultiMachine_NoPlayerInventory(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public CONTAINER_MultiMachine_NoPlayerInventory(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } + + public boolean doesBindPlayerInventory() { + return false; + } + + @Override + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { + return null; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Cyclotron.java new file mode 100644 index 0000000000..0be44fa616 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Cyclotron.java @@ -0,0 +1,44 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.gui.GT_Container_MultiMachine; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; + +public class GUI_Cyclotron extends GT_GUIContainerMetaTile_Machine +{ + public final String mNEI; + public final String mName; + + public GUI_Cyclotron(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aNEI) { + super(new GT_Container_MultiMachine(aInventoryPlayer, aTileEntity, false), "gregtech:textures/gui/multimachines/" + "FusionComputer.png"); + this.mName = aName; + this.mNEI = aNEI; + } + + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + this.fontRendererObj.drawString(this.mName, 8, -10, 16448255); + if (this.mContainer != null) { + if ((((GT_Container_MultiMachine)this.mContainer).mDisplayErrorCode & 0x40) != 0x0) { + this.fontRendererObj.drawString("Incomplete Structure.", 10, 8, 16448255); + } + if (((GT_Container_MultiMachine)this.mContainer).mDisplayErrorCode == 0) { + if (((GT_Container_MultiMachine)this.mContainer).mActive == 0) { + this.fontRendererObj.drawString("Hit with Soft Hammer to (re-)start the Machine if it doesn't start.", -70, 170, 16448255); + } + else { + this.fontRendererObj.drawString("Running perfectly.", 10, 170, 16448255); + } + } + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java index 425fe6d01f..8293d5b9f3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java @@ -1,12 +1,23 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import net.minecraft.entity.player.InventoryPlayer; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import gregtech.api.enums.Materials; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - +import gregtech.common.items.GT_MetaGenerated_Tool_01; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -20,37 +31,113 @@ public class GUI_MultiMachine extends GT_GUIContainerMetaTile_Machine { String mName = ""; public GUI_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aTextureFile) { - super(new CONTAINER_MultiMachine(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + super(new CONTAINER_MultiMachine_NoPlayerInventory(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); this.mName = aName; } @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.fontRendererObj.drawString(this.mName, 10, 8, 16448255); - + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + fontRendererObj.drawString(this.mName+"!", 6, 7, 16448255); if (this.mContainer != null) { - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 1) != 0) { - this.fontRendererObj.drawString("Pipe is loose.", 10, 16, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 2) != 0) { - this.fontRendererObj.drawString("Screws are missing.", 10, 24, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 4) != 0) { - this.fontRendererObj.drawString("Something is stuck.", 10, 32, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 8) != 0) { - this.fontRendererObj.drawString("Platings are dented.", 10, 40, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 16) != 0) { - this.fontRendererObj.drawString("Circuitry burned out.", 10, 48, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 32) != 0) { - this.fontRendererObj.drawString("That doesn't belong there.", 10, 56, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 64) != 0) { - this.fontRendererObj.drawString("Incomplete Structure.", 10, 64, 16448255); + + boolean aWrench = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 1) != 0; + boolean aScrewdriver = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 2) != 0; + boolean aMallet = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 4) != 0; + boolean aHammer = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 8) != 0; + boolean aSoldering = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 16) != 0; + boolean aCrowbar = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 32) != 0; + + + + //net.minecraft.client.gui.inventory.GuiContainer.drawItemStack(ItemStack, int, int, String) + Method aDrawItemStack = ReflectionUtils.getMethod(GuiContainer.class, "drawItemStack", new Class[] {ItemStack.class, int.class, int.class, String.class}); + if (aDrawItemStack != null) { + + try { + + if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 64) != 0) { + this.fontRendererObj.drawString("Incomplete Structure.", 10, 16, 16448255); // Move down 8px + } + else { + Field aStringData = ReflectionUtils.getField(this.mContainer.getClass(), "oTileDescription"); + if (aStringData != null) { + String[] aData = (String[]) aStringData.get(this.mContainer); + int aIndex = 0; + this.fontRendererObj.drawString(""+aStringData.getType().getSimpleName(), 6, 16+(aIndex++*8), 16448255); // Move down 8px + if (aData != null && aData.length > 0) { + for (String s : aData) { + this.fontRendererObj.drawString(s, 6, 16+(aIndex++*8), 16448255); // Move down 8px + } + } + else { + this.fontRendererObj.drawString("Unable to get Info Data from Tile Entity | "+(aData != null), 6, 16+(aIndex++*8), 16448255); // Move down 8px + } + } + else { + this.fontRendererObj.drawString("Unable to get Info Data from Tile Entity | Bad", 6, 16, 16448255); // Move down 8px + + + } + + } + + + + + + + + //Migrate to static block + + Materials GOOD = Materials.Uranium; + Materials BAD = Materials.Plutonium; + + ItemStack aWrenchStack = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.WRENCH, 1, (aWrench ? BAD : GOOD), Materials.Tungsten, null); + ItemStack aCrowbarStack = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.CROWBAR, 1, (aCrowbar ? BAD : GOOD), Materials.Tungsten, null); + ItemStack aHammerStack = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.HARDHAMMER, 1, (aHammer ? BAD : GOOD), Materials.Tungsten, null); + ItemStack aMalletStack = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SOFTHAMMER, 1, (aMallet ? BAD : GOOD), Materials.Tungsten, null); + ItemStack aScrewdriverStack = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SCREWDRIVER, 1, (aScrewdriver ? BAD : GOOD), Materials.Tungsten, null); + ItemStack aSolderingStack = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, 1, (aSoldering ? BAD : GOOD), Materials.Tungsten, null); + + ItemStack[] aToolStacks2 = new ItemStack[] { + aWrenchStack, + aCrowbarStack, + aHammerStack, + aMalletStack, + aScrewdriverStack, + aSolderingStack + }; + + int aIndex = 0; + for (aIndex = 0; aIndex < 6; aIndex++) { + + int x = 156; + int y = 112 - (18*3) + (aIndex * 18); + aDrawItemStack.invoke(this, new Object[] { + aToolStacks2[aIndex] != null ? aToolStacks2[aIndex] : ItemUtils.getErrorStack(1, "Bad Times"), + x, + y, + ""+(aIndex == 2 ? "H" : aIndex == 3 ? "M" : "") // Stacksize Overlay + }); + this.fontRendererObj.drawString("", 10, 64, 16448255); + } + + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); + } } + + + + + + + + //ItemStack aWrenchStack = ItemUtils.getSimpleStack(GregTech_API.sWrenchList., i) + + + if (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode == 0) { if (((CONTAINER_MultiMachine) this.mContainer).mActive == 0) { this.fontRendererObj.drawString("Hit with Soft Hammer", 10, 16, 16448255); -- cgit From 5f455188ce11c975ced96d8364624af540dd276b Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sat, 24 Aug 2019 16:34:38 +0100 Subject: + Added some more generic language strings. - Removed maintenance requirement from Cyclotron. % More work on new Multiblock GUIs. $ Potentially fixed #507. --- src/Java/gtPlusPlus/core/util/math/MathUtils.java | 65 ++++ .../gregtech/api/gui/CONTAINER_MultiMachine.java | 269 +++++++++++++--- .../xmod/gregtech/api/gui/GUI_MultiMachine.java | 338 +++++++++++++++------ .../gregtech/api/gui/GUI_MultiMachine_Default.java | 68 +++++ .../base/GregtechMeta_MultiBlockBase.java | 106 +++++-- .../advanced/GregtechMetaTileEntity_Adv_EBF.java | 30 +- .../GregtechMetaTileEntity_Cyclotron.java | 16 +- src/resources/assets/gregtech/lang/en_US.lang | 6 +- src/resources/assets/gregtech/lang/zh_CN.lang | 2 +- 9 files changed, 713 insertions(+), 187 deletions(-) create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine_Default.java (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/gui') diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index bda722b47e..a9f7b901ef 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -692,6 +692,39 @@ public class MathUtils { public static int balance(int aInput, int aMin, int aMax) { return Math.max(Math.min(aInput, aMax), aMin); } + + /** + * Balances a number within a range. + * @param aInput - The number to balance + * @param aMin - The minimum bounds + * @param aMax - The maximum bounds + * @return - A Number which will be between the bounds, or a boundary value. + */ + public static Number balance(Number aInput, Number aMin, Number aMax) { + return max(min(aInput, aMax), aMin); + } + + /** + * Balances a number within a range. + * @param aInput - The number to balance + * @param aMin - The minimum bounds + * @param aMax - The maximum bounds + * @return - An Integer which will be between the bounds, or a boundary value. + */ + public static int balanceInt(Number aInput, Number aMin, Number aMax) { + return MathUtils.safeCast_LongToInt((long) balance(max(min(aInput, aMax), aMin), Integer.MIN_VALUE, Integer.MAX_VALUE)); + } + + /** + * Balances a number within a range. + * @param aInput - The number to balance + * @param aMin - The minimum bounds + * @param aMax - The maximum bounds + * @return - A Long which will be between the bounds, or a boundary value. + */ + public static long balanceLong(Number aInput, Number aMin, Number aMax) { + return (long) balance(max(min(aInput, aMax), aMin), Long.MIN_VALUE, Long.MAX_VALUE); + } public static int getValueWithinRange(int i, int aMin, int aMax) { int aAmount = Math.max(Math.min(i, aMax), aMin); @@ -703,5 +736,37 @@ public class MathUtils { int aRemainder = (int) (aLong - (aIntMaxInLong * Integer.MAX_VALUE)); return new Pair(aIntMaxInLong, aRemainder); } + + + + + /** + * Returns the smaller of two {@code Number}s. That is, + * the result the argument closer to the value of + * {@link Long#MIN_VALUE}. If the arguments have the same + * value, the result is that same value. + * + * @param a an argument. + * @param b another argument. + * @return the smaller of {@code a} and {@code b}. + */ + public static Number min(Number a, Number b) { + return (a.longValue() <= b.longValue()) ? a : b; + } + + /** + * Returns the greater of two {@code Number}s. That is, the + * result is the argument closer to the value of + * {@link Long#MAX_VALUE}. If the arguments have the same value, + * the result is that same value. + * + * @param a an argument. + * @param b another argument. + * @return the larger of {@code a} and {@code b}. + */ + public static Number max(Number a, Number b) { + return (a.longValue() >= b.longValue()) ? a : b; + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java index 5fccb51e54..d3e22875ae 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java @@ -1,12 +1,19 @@ package gtPlusPlus.xmod.gregtech.api.gui; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.api.objects.data.AutoMap; +import gregtech.api.util.GT_Recipe; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; @@ -20,6 +27,9 @@ public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine { public String[] mTileDescription; private String[] oTileDescription; + + private GregtechMeta_MultiBlockBase mMCTEI; + private boolean mControllerSet = false; public CONTAINER_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { @@ -29,56 +39,245 @@ public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine { public CONTAINER_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { super(aInventoryPlayer, aTileEntity, bindInventory); } + + public static void setControllerInstance(CONTAINER_MultiMachine aContainer, IGregTechTileEntity aTile) { + if (aTile == null) { + return; + } + final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return; + } + if (aMetaTileEntity instanceof GregtechMeta_MultiBlockBase) { + aContainer.mMCTEI = (GregtechMeta_MultiBlockBase) aMetaTileEntity; + } + } + + public int aTotalTickTime = 0; + public int aMaxParallel = 0; + public int aPollutionTick = 0; + public int aMaxInputVoltage = 0; + public int aInputTier = 0; + public int aOutputTier = 0; + public int aRecipeDuration = 0; + public int aRecipeEU = 0; + public int aRecipeSpecial = 0; + public int aPollutionReduction = 0; + public int aStoredEnergy = 0; + public int aMaxEnergy = 0; + public int aEfficiency = 0; + private int oTotalTickTime = 0; + private int oMaxParallel = 0; + private int oPollutionTick = 0; + private int oMaxInputVoltage = 0; + private int oInputTier = 0; + private int oOutputTier = 0; + private int oRecipeDuration = 0; + private int oRecipeEU = 0; + private int oRecipeSpecial = 0; + private int oPollutionReduction = 0; + private int oStoredEnergy = 0; + private int oMaxEnergy = 0; + private int oEfficiency = 0; + + private static Field timer; + //private static Field crafters; @Override - public void detectAndSendChanges() { + public final void detectAndSendChanges() { super.detectAndSendChanges(); if (this.mTileEntity.isClientSide() || this.mTileEntity.getMetaTileEntity() == null) { return; } - - try { - this.mTileDescription = this.mTileEntity.getInfoData(); - - Field bTimer = ReflectionUtils.getField(getClass(), "mTimer"); - Field bCrafters = ReflectionUtils.getField(getClass(), "crafters"); - int time = bTimer.getInt(this); - List crafters = (List) bCrafters.get(this); - AutoMap aCrafting = new AutoMap(); - if (crafters != null && !crafters.isEmpty()) { + if (!mControllerSet) { + setControllerInstance(this, this.mTileEntity); + } + mControllerSet = (mMCTEI != null); + if (timer == null) { + timer = ReflectionUtils.getField(getClass(), "mTimer"); + } + if (crafters == null) { + //crafters = ReflectionUtils.getField(getClass(), "crafters"); + } + if (timer != null && crafters != null && mControllerSet) { + Logger.INFO("Trying to update clientside GUI data"); + try { + Logger.INFO("0"); + int aTimer = (int) ReflectionUtils.getFieldValue(timer, this); + + //List crafters1List = (List) crafters1; + List crafters2 = new ArrayList(); + Logger.INFO("1"); for (Object o : crafters) { - aCrafting.put((ICrafting) o); + if (o instanceof ICrafting) { + crafters2.add((ICrafting) o); + } } - } + Logger.INFO("2"); + if (!crafters2.isEmpty()) { + Logger.INFO("3"); + handleInitialFieldSetting(); - for (final ICrafting var3 : aCrafting) { - if (time % 500 == 10 || this.oTileDescription != this.mTileDescription) { - var3.sendProgressBarUpdate((Container)this, 64, 0); + try { + Logger.INFO("4"); + for (final ICrafting var3 : crafters2) { + handleCraftingEvent(aTimer, var3); + } + Logger.INFO("5"); + handleInternalFieldSetting(); + Logger.INFO("6"); + } catch (Throwable t) { + + } } + } catch (Throwable t) { + t.printStackTrace(); } + } + else { + Logger.INFO("Failed."); + } + } + + public void handleInitialFieldSetting() { + this.aTotalTickTime = MathUtils.balance((int) mMCTEI.getTotalRuntimeInTicks(), Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aMaxParallel = mMCTEI.getMaxParallelRecipes(); + this.aPollutionTick = mMCTEI.getPollutionPerTick(null); + this.aMaxInputVoltage = MathUtils.balance((int) mMCTEI.getMaxInputVoltage(), Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aInputTier = MathUtils.balance((int) mMCTEI.getInputTier(), Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aOutputTier = MathUtils.balance((int) mMCTEI.getOutputTier(), Integer.MIN_VALUE, Integer.MAX_VALUE); + if (mMCTEI.mLastRecipe != null) { + GT_Recipe aRecipe = mMCTEI.mLastRecipe; + this.aRecipeDuration = MathUtils.balance(aRecipe.mDuration, Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aRecipeEU = MathUtils.balance(aRecipe.mEUt, Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aRecipeSpecial = MathUtils.balance(aRecipe.mSpecialValue, Integer.MIN_VALUE, Integer.MAX_VALUE); + } + this.aPollutionReduction = mMCTEI.getPollutionReductionForAllMufflers(); + + this.aStoredEnergy = MathUtils.balance((int) mMCTEI.getStoredEnergyInAllEnergyHatches(), Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aMaxEnergy = MathUtils.balance((int) mMCTEI.getMaxEnergyStorageOfAllEnergyHatches(), Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aEfficiency = MathUtils.balance(mMCTEI.mEfficiency, Integer.MIN_VALUE, Integer.MAX_VALUE); + } - this.oTileDescription = this.mTileDescription; + public void handleCraftingEvent(int aTimer, ICrafting aCrafter) { + int aID = 750; + if (aTimer % 500 == 10 || this.oTotalTickTime != this.aTotalTickTime) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aTotalTickTime); + } + if (aTimer % 500 == 10 || this.oMaxParallel != this.aMaxParallel) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aMaxParallel); + } + if (aTimer % 500 == 10 || this.oPollutionTick != this.aPollutionTick) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aPollutionTick); + } + if (aTimer % 500 == 10 || this.oMaxInputVoltage != this.aMaxInputVoltage) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aMaxInputVoltage); + } + if (aTimer % 500 == 10 || this.oInputTier != this.aInputTier) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aInputTier); + } + if (aTimer % 500 == 10 || this.oOutputTier != this.aOutputTier) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aOutputTier); + } + if (aTimer % 500 == 10 || this.oRecipeDuration != this.aRecipeDuration) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aRecipeDuration); } - catch (Throwable t) { + if (aTimer % 500 == 10 || this.oRecipeEU != this.aRecipeEU) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aRecipeEU); + } + if (aTimer % 500 == 10 || this.oRecipeSpecial != this.aRecipeSpecial) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aRecipeSpecial); + } + if (aTimer % 500 == 10 || this.oPollutionReduction != this.aPollutionReduction) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aPollutionReduction); + } + if (aTimer % 500 == 10 || this.oStoredEnergy != this.aStoredEnergy) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aStoredEnergy); + } + if (aTimer % 500 == 10 || this.oMaxEnergy != this.aMaxEnergy) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aMaxEnergy); + } + if (aTimer % 500 == 10 || this.oEfficiency != this.aEfficiency) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aEfficiency); + } + } + + public void handleInternalFieldSetting() { + this.oTotalTickTime = this.aTotalTickTime; + this.oMaxParallel = this.aMaxParallel; + this.oPollutionTick = this.aPollutionTick; + this.oMaxInputVoltage = this.aMaxInputVoltage; + this.oInputTier = this.aInputTier; + this.oOutputTier = this.aOutputTier; + this.oRecipeDuration = this.aRecipeDuration; + this.oRecipeEU = this.aRecipeEU; + this.oRecipeSpecial = this.aRecipeSpecial; + this.oPollutionReduction = this.aPollutionReduction; + this.oStoredEnergy = this.aStoredEnergy; + this.oMaxEnergy = this.aMaxEnergy; + this.oEfficiency = this.aEfficiency; + } + @SideOnly(Side.CLIENT) + @Override + public void updateProgressBar(final int par1, final int par2) { + super.updateProgressBar(par1, par2); + int shiftedSwitch = par1 - 750; + switch (shiftedSwitch) { + case 0: { + this.aTotalTickTime = par2; + break; + } + case 1: { + this.aMaxParallel = par2; + break; + } + case 2: { + this.aPollutionTick = par2; + break; + } + case 3: { + this.aMaxInputVoltage = par2; + break; + } + case 4: { + this.aInputTier = par2; + break; + } + case 5: { + this.aOutputTier = par2; + break; + } + case 6: { + this.aRecipeDuration = par2; + break; + } + case 7: { + this.aRecipeEU = par2; + break; + } + case 8: { + this.aRecipeSpecial = par2; + break; + } + case 9: { + this.aPollutionReduction = par2; + break; + } + case 10: { + this.aStoredEnergy = par2; + break; + } + case 11: { + this.aMaxEnergy = par2; + break; + } + case 12: { + this.aEfficiency = par2; + break; + } } } } - -/*@Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mTileEntity, 1, 152, 5)); - } - - @Override - public int getSlotCount() { - return 1; - } - - @Override - public int getShiftClickSlotCount() { - return 0; - } -}*/ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java index 8293d5b9f3..c78e7789b8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java @@ -1,23 +1,26 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -28,128 +31,261 @@ import net.minecraft.util.ResourceLocation; */ public class GUI_MultiMachine extends GT_GUIContainerMetaTile_Machine { - String mName = ""; + private final static Materials GOOD; + private final static Materials BAD; + private final String mName; + + private final static ConcurrentHashMap mToolStacks = new ConcurrentHashMap(); + + //net.minecraft.client.gui.inventory.GuiContainer.drawItemStack(ItemStack, int, int, String) + private final static Method mDrawItemStack; + + static { + GOOD = Materials.Uranium; + BAD = Materials.Plutonium; + + //net.minecraft.client.gui.inventory.GuiContainer.drawItemStack(ItemStack, int, int, String) + mDrawItemStack = ReflectionUtils.getMethod(GuiContainer.class, "drawItemStack", new Class[] {ItemStack.class, int.class, int.class, String.class}); + } public GUI_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aTextureFile) { super(new CONTAINER_MultiMachine_NoPlayerInventory(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - this.mName = aName; + this.mName = aName != null ? aName : ""; } @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - fontRendererObj.drawString(this.mName+"!", 6, 7, 16448255); + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { if (this.mContainer != null) { + drawGuiInfoTextLayer(par1, par2); + drawGuiRepairStatusLayer(par1, par2); + } + } - boolean aWrench = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 1) != 0; - boolean aScrewdriver = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 2) != 0; - boolean aMallet = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 4) != 0; - boolean aHammer = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 8) != 0; - boolean aSoldering = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 16) != 0; - boolean aCrowbar = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 32) != 0; - - - - //net.minecraft.client.gui.inventory.GuiContainer.drawItemStack(ItemStack, int, int, String) - Method aDrawItemStack = ReflectionUtils.getMethod(GuiContainer.class, "drawItemStack", new Class[] {ItemStack.class, int.class, int.class, String.class}); - if (aDrawItemStack != null) { - - try { - - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 64) != 0) { - this.fontRendererObj.drawString("Incomplete Structure.", 10, 16, 16448255); // Move down 8px - } - else { - Field aStringData = ReflectionUtils.getField(this.mContainer.getClass(), "oTileDescription"); - if (aStringData != null) { - String[] aData = (String[]) aStringData.get(this.mContainer); - int aIndex = 0; - this.fontRendererObj.drawString(""+aStringData.getType().getSimpleName(), 6, 16+(aIndex++*8), 16448255); // Move down 8px - if (aData != null && aData.length > 0) { - for (String s : aData) { - this.fontRendererObj.drawString(s, 6, 16+(aIndex++*8), 16448255); // Move down 8px - } - } - else { - this.fontRendererObj.drawString("Unable to get Info Data from Tile Entity | "+(aData != null), 6, 16+(aIndex++*8), 16448255); // Move down 8px - } - } - else { - this.fontRendererObj.drawString("Unable to get Info Data from Tile Entity | Bad", 6, 16, 16448255); // Move down 8px - - - } - - } - - - - - - - - //Migrate to static block - - Materials GOOD = Materials.Uranium; - Materials BAD = Materials.Plutonium; - - ItemStack aWrenchStack = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.WRENCH, 1, (aWrench ? BAD : GOOD), Materials.Tungsten, null); - ItemStack aCrowbarStack = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.CROWBAR, 1, (aCrowbar ? BAD : GOOD), Materials.Tungsten, null); - ItemStack aHammerStack = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.HARDHAMMER, 1, (aHammer ? BAD : GOOD), Materials.Tungsten, null); - ItemStack aMalletStack = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SOFTHAMMER, 1, (aMallet ? BAD : GOOD), Materials.Tungsten, null); - ItemStack aScrewdriverStack = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SCREWDRIVER, 1, (aScrewdriver ? BAD : GOOD), Materials.Tungsten, null); - ItemStack aSolderingStack = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, 1, (aSoldering ? BAD : GOOD), Materials.Tungsten, null); - - ItemStack[] aToolStacks2 = new ItemStack[] { - aWrenchStack, - aCrowbarStack, - aHammerStack, - aMalletStack, - aScrewdriverStack, - aSolderingStack - }; - - int aIndex = 0; - for (aIndex = 0; aIndex < 6; aIndex++) { - - int x = 156; - int y = 112 - (18*3) + (aIndex * 18); - aDrawItemStack.invoke(this, new Object[] { - aToolStacks2[aIndex] != null ? aToolStacks2[aIndex] : ItemUtils.getErrorStack(1, "Bad Times"), - x, - y, - ""+(aIndex == 2 ? "H" : aIndex == 3 ? "M" : "") // Stacksize Overlay - }); - this.fontRendererObj.drawString("", 10, 64, 16448255); - } - - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - } + + protected void drawGuiInfoTextLayer(final float par1, final int par2) { + + if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 64) != 0) { + this.fontRendererObj.drawString(mName, 6, 7, 16448255); // Move down 8px + this.fontRendererObj.drawString("Incomplete Structure.", 6, 15, 16448255); // Move down 8px + } + else { + int aTotalTickTime = ((CONTAINER_MultiMachine) this.mContainer).aTotalTickTime; + int aMaxParallel = ((CONTAINER_MultiMachine) this.mContainer).aMaxParallel; + int aPollutionTick = ((CONTAINER_MultiMachine) this.mContainer).aPollutionTick; + int aMaxInputVoltage = ((CONTAINER_MultiMachine) this.mContainer).aMaxInputVoltage; + int aInputTier = ((CONTAINER_MultiMachine) this.mContainer).aInputTier; + int aOutputTier = ((CONTAINER_MultiMachine) this.mContainer).aOutputTier; + int aRecipeDuration = ((CONTAINER_MultiMachine) this.mContainer).aRecipeDuration; + int aRecipeEU = ((CONTAINER_MultiMachine) this.mContainer).aRecipeEU; + int aRecipeSpecial = ((CONTAINER_MultiMachine) this.mContainer).aRecipeSpecial; + int aEfficiency = ((CONTAINER_MultiMachine) this.mContainer).aEfficiency; + + int aPollutionReduction = ((CONTAINER_MultiMachine) this.mContainer).aPollutionReduction; + + + long aStoredEnergy = ((CONTAINER_MultiMachine) this.mContainer).aStoredEnergy; + long aMaxEnergy = ((CONTAINER_MultiMachine) this.mContainer).aMaxEnergy; + + /* + * Logic Block + */ + + long seconds = (aTotalTickTime/20); + int weeks = (int) (TimeUnit.SECONDS.toDays(seconds) / 7); + int days = (int) (TimeUnit.SECONDS.toDays(seconds) - 7 * weeks); + long hours = TimeUnit.SECONDS.toHours(seconds) - TimeUnit.DAYS.toHours(days) - TimeUnit.DAYS.toHours(7*weeks); + long minutes = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60); + long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60); + + ArrayList mInfo = new ArrayList(); + + String EU = StatCollector.translateToLocal("GTPP.info.eu"); + + //GTPP.machines.tier + + mInfo.add(mName); + + if (aInputTier > 0) { + mInfo.add(StatCollector.translateToLocal("GTPP.machines.input")+" "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+ EnumChatFormatting.GREEN +GT_Values.VOLTAGE_NAMES[aInputTier]); + } + if (aOutputTier > 0) { + mInfo.add(StatCollector.translateToLocal("GTPP.machines.output")+" "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+ EnumChatFormatting.GREEN +GT_Values.VOLTAGE_NAMES[aOutputTier]); + } + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.progress")+": "+ + EnumChatFormatting.GREEN + Integer.toString(((CONTAINER_MultiMachine) this.mContainer).mProgressTime/20) + EnumChatFormatting.RESET +" s / "+ + EnumChatFormatting.YELLOW + Integer.toString(((CONTAINER_MultiMachine) this.mContainer).mMaxProgressTime/20) + EnumChatFormatting.RESET +" s"); + + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+": "+ + EnumChatFormatting.GREEN + Long.toString(aStoredEnergy) + EnumChatFormatting.RESET +" "+EU+" / "+ + EnumChatFormatting.YELLOW + Long.toString(aMaxEnergy) + EnumChatFormatting.RESET +" "+EU+""); + + if (aRecipeEU != 0 && aRecipeDuration > 0) { + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage")+": "+ + EnumChatFormatting.RED + Integer.toString(-aRecipeEU) + EnumChatFormatting.RESET + " "+EU+"/t"); + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.duration")+": "+ + EnumChatFormatting.RED + Integer.toString(aRecipeDuration) + EnumChatFormatting.RESET + " ticks"); + if (aRecipeSpecial > 0) { + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.specialvalue")+": "+ + EnumChatFormatting.RED + Integer.toString(aRecipeEU) + EnumChatFormatting.RESET + ""); + } + } + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei")+": "+ + EnumChatFormatting.YELLOW+Long.toString(aMaxInputVoltage)+EnumChatFormatting.RESET+ " "+EU+"/t"+EnumChatFormatting.RESET); + + mInfo.add(StatCollector.translateToLocal(StatCollector.translateToLocal("GTPP.machines.tier")+": "+ + EnumChatFormatting.YELLOW+GT_Values.VN[GT_Utility.getTier(aMaxInputVoltage)]+ EnumChatFormatting.RESET)); + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.efficiency")+": "+ EnumChatFormatting.YELLOW+Float.toString(aEfficiency / 100.0F)+EnumChatFormatting.RESET + " %"); + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollution")+": "+ EnumChatFormatting.RED + (aPollutionTick*20)+ EnumChatFormatting.RESET+"/sec"); + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced")+": "+ EnumChatFormatting.GREEN + aPollutionReduction + EnumChatFormatting.RESET+" %"); + + mInfo.add(StatCollector.translateToLocal("GTPP.CC.parallel")+": "+EnumChatFormatting.GREEN+(aMaxParallel)+EnumChatFormatting.RESET); + + mInfo.add("Total Time Since Built: "); + mInfo.add("" + EnumChatFormatting.DARK_GREEN + Integer.toString(weeks)+EnumChatFormatting.RESET+" Weeks,"); + mInfo.add("" + EnumChatFormatting.DARK_GREEN+ Integer.toString(days) +EnumChatFormatting.RESET+ " Days,"); + mInfo.add("" + EnumChatFormatting.DARK_GREEN+ Long.toString(hours) +EnumChatFormatting.RESET+ " Hours,"); + mInfo.add("" + EnumChatFormatting.DARK_GREEN+ Long.toString(minutes) +EnumChatFormatting.RESET+ " Minutes,"); + mInfo.add("" + EnumChatFormatting.DARK_GREEN+ Long.toString(second) +EnumChatFormatting.RESET+ " Seconds"); + + + + // Machine Name + //fontRendererObj.drawString(this.mName, 6, 7, 16448255); + + for (int i=0;i 10) { + mStartUpCheck = 10; + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java index d3f6fdb491..97ee87e4a2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java @@ -408,23 +408,25 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase } - private volatile int mGraceTimer = 100; + private volatile int mGraceTimer = 2; - @SuppressWarnings("unused") @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (this.mMaxProgresstime > 0 && this.mProgresstime != 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) { - if (aTick % 10 == 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) { - if (!this.depleteInput(FluidUtils.getFluidStack("pyrotheum", 5))) { - this.causeMaintenanceIssue(); - this.stopMachine(); - } - if (false) { // To be replaced with a config option or something - this.explodeMultiblock(); - } - } + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + //Try dry Pyrotheum after all other logic + if (this.mStartUpCheck < 0) { + if (this.mMaxProgresstime > 0 && this.mProgresstime != 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) { + if (aTick % 10 == 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) { + if (!this.depleteInput(FluidUtils.getFluidStack("pyrotheum", 5))) { + if (mGraceTimer-- == 0) { + this.causeMaintenanceIssue(); + this.stopMachine(); + } + } + } + } } - super.onPostTick(aBaseMetaTileEntity, aTick); + } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java index 91620eece5..ed6c913e6b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java @@ -6,7 +6,6 @@ import gregtech.GT_Mod; import gregtech.api.enums.Dyes; import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_Container_MultiMachine; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -22,14 +21,11 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT; -import gregtech.common.gui.GT_GUIContainer_FusionReactor; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.chemistry.IonParticles; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_Cyclotron; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_Cyclotron; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; @@ -173,12 +169,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas return false; } } - mWrench = true; - mScrewdriver = true; - mSoftHammer = true; - mHardHammer = true; - mSolderingTool = true; - mCrowbar = true; + this.fixAllMaintenanceIssue(); log("Built Cyclotron."); turnCasingActive(true); return true; @@ -320,7 +311,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas /*if (CORE.DEVENV) { return this.checkRecipeGeneric(); }*/ - + this.fixAllMaintenanceIssue(); //log("Recipe Check."); ArrayList tItemList = getStoredInputs(); @@ -411,6 +402,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas //Time Counter this.mTotalRunTime++; + this.fixAllMaintenanceIssue(); onRunningTick(null); @@ -502,7 +494,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas stopMachine(); } } - doRandomMaintenanceDamage(); + //doRandomMaintenanceDamage(); aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); diff --git a/src/resources/assets/gregtech/lang/en_US.lang b/src/resources/assets/gregtech/lang/en_US.lang index c388f9785e..9989bffcf0 100644 --- a/src/resources/assets/gregtech/lang/en_US.lang +++ b/src/resources/assets/gregtech/lang/en_US.lang @@ -4,15 +4,19 @@ GTPP.EBF.heat=Heat capacity GTPP.machines.tier=Tier +GTPP.machines.input=Input +GTPP.machines.output=Output GTPP.multiblock.pollutionreduced=Pollution reduced to GTPP.multiblock.pollution=Pollution GTPP.multiblock.energy=Stored Energy -GTPP.multiblock.Progress=Progress +GTPP.multiblock.progress=Progress GTPP.multiblock.efficiency=Efficiency GTPP.multiblock.problems=Problems GTPP.multiblock.mei=Max Energy Income GTPP.multiblock.usage=Probably uses +GTPP.multiblock.specialvalue=Special Value +GTPP.multiblock.duration=Duration diff --git a/src/resources/assets/gregtech/lang/zh_CN.lang b/src/resources/assets/gregtech/lang/zh_CN.lang index 750961610a..df43ca8590 100644 --- a/src/resources/assets/gregtech/lang/zh_CN.lang +++ b/src/resources/assets/gregtech/lang/zh_CN.lang @@ -8,7 +8,7 @@ GTPP.machines.tier=等级 GTPP.multiblock.pollutionreduced=减少污染至 GTPP.multiblock.pollution=污染 GTPP.multiblock.energy=能量存储 -GTPP.multiblock.Progress=进程 +GTPP.multiblock.progress=进程 GTPP.multiblock.efficiency=效率 GTPP.multiblock.problems=为每桶 GTPP.multiblock.mei=最大能量输入 -- cgit From 68e266e0a227aaf90294d2a8ffd5081dc3bb640e Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 24 Oct 2019 00:58:51 +0100 Subject: + Added Chemical Plant. + Added more Bio Recipes. $ Fixed Strontium Hydroxide generating before it's components. $ Fixed existing Bio Recipes not working. --- src/Java/gregtech/api/util/Recipe_GT.java | 18 + .../gtPlusPlus/core/handler/COMPAT_HANDLER.java | 1 + src/Java/gtPlusPlus/core/item/ModItems.java | 8 +- .../core/item/chemistry/AgriculturalChem.java | 183 ++++- .../gtPlusPlus/core/material/MISC_MATERIALS.java | 36 +- .../gtPlusPlus/core/recipe/RECIPES_GREGTECH.java | 10 +- .../core/slots/SlotChemicalPlantInput.java | 45 ++ .../gtPlusPlus/core/slots/SlotNoInputLogging.java | 25 + .../gtPlusPlus/core/util/minecraft/FluidUtils.java | 6 +- src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java | 456 ++++++++++++ src/Java/gtPlusPlus/nei/NEI_GT_Config.java | 7 +- .../gtPlusPlus/plugin/agrichem/BioRecipes.java | 817 ++++++++++++++++++--- .../gtPlusPlus/plugin/agrichem/Core_Agrichem.java | 134 +--- .../plugin/agrichem/block/AgrichemFluids.java | 16 + .../xmod/forestry/bees/custom/GTPP_Bees.java | 1 - .../xmod/gregtech/api/enums/GregtechItemList.java | 6 +- .../gui/fluidreactor/Container_FluidReactor.java | 182 +++++ .../api/gui/fluidreactor/GUI_FluidReactor.java | 122 +++ .../interfaces/internal/IGregtech_RecipeAdder.java | 7 + .../common/blocks/textures/TexturesGtBlock.java | 9 +- .../GregtechMetaTileEntity_ChemicalReactor.java | 706 ++++++++++++++++++ .../gregtech/loaders/RecipeGen_FluidCanning.java | 63 +- .../xmod/gregtech/loaders/RecipeGen_Fluids.java | 20 +- .../xmod/gregtech/loaders/RecipeGen_Recycling.java | 2 +- .../xmod/gregtech/recipes/GregtechRecipeAdder.java | 48 ++ .../gregtech/GregtechFluidReactor.java | 24 + .../xmod/growthcraft/fishtrap/FishTrapHandler.java | 4 +- .../recipe/TF_Gregtech_Recipes.java | 6 +- .../TileEntities/FluidReactor/OVERLAY_FRONT.png | Bin 0 -> 313 bytes .../FluidReactor/OVERLAY_FRONT_ACTIVE.png | Bin 0 -> 704 bytes .../FluidReactor/OVERLAY_FRONT_ACTIVE.png.mcmeta | 6 + .../TileEntities/FluidReactor/OVERLAY_SIDE.png | Bin 0 -> 333 bytes .../FluidReactor/OVERLAY_SIDE_ACTIVE.png | Bin 0 -> 1049 bytes .../FluidReactor/OVERLAY_SIDE_ACTIVE.png.mcmeta | 6 + .../TileEntities/FluidReactor/OVERLAY_TOP.png | Bin 0 -> 228 bytes .../FluidReactor/OVERLAY_TOP_ACTIVE.png | Bin 0 -> 224 bytes .../assets/miscutils/textures/gui/FluidReactor.png | Bin 0 -> 3587 bytes .../textures/items/bioscience/BioCircuit.png | Bin 0 -> 432 bytes .../textures/items/bioscience/MetaItem1/8.png | Bin 624 -> 654 bytes 39 files changed, 2640 insertions(+), 334 deletions(-) create mode 100644 src/Java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java create mode 100644 src/Java/gtPlusPlus/core/slots/SlotNoInputLogging.java create mode 100644 src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT.png create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE.png create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE.png.mcmeta create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE.png create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE.png create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE.png.mcmeta create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_TOP.png create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_TOP_ACTIVE.png create mode 100644 src/resources/assets/miscutils/textures/gui/FluidReactor.png create mode 100644 src/resources/assets/miscutils/textures/items/bioscience/BioCircuit.png (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/gui') diff --git a/src/Java/gregtech/api/util/Recipe_GT.java b/src/Java/gregtech/api/util/Recipe_GT.java index 1e37c9be13..af7fe38f38 100644 --- a/src/Java/gregtech/api/util/Recipe_GT.java +++ b/src/Java/gregtech/api/util/Recipe_GT.java @@ -18,6 +18,7 @@ import gtPlusPlus.api.interfaces.IComparableRecipe; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.NoConflictGTRecipeMap; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.nei.GT_NEI_MultiBlockHandler; @@ -260,6 +261,23 @@ public class Recipe_GT extends GT_Recipe implements IComparableRecipe{ //Basic Washer Map public static final GT_Recipe_Map sSimpleWasherRecipes = new GT_Recipe_Map(new HashSet(3), "gt.recipe.simplewasher", "Simple Dust Washer", null, RES_PATH_GUI + "basicmachines/PotionBrewer", 1, 1, 0, 0, 1, E, 1, E, true, true); + + public static final Gregtech_Recipe_Map sFluidChemicalReactorRecipes = new Gregtech_Recipe_Map( + new HashSet(100), + "gt.recipe.fluidchemicaleactor", + "Chemical Plant", + null, + CORE.MODID+":textures/gui/FluidReactor", + 0, + 0, + 0, + 2, + 1, + "Tier: ", + 1, + E, + true, + false); //RTG Fuel Map diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index fd30457b46..0b1078366a 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -135,6 +135,7 @@ public class COMPAT_HANDLER { GregtechSolarTower.run(); GregtechLargeTurbinesAndHeatExchanger.run(); GregtechPowerBreakers.run(); + GregtechFluidReactor.run(); //New Horizons Content NewHorizonsAccelerator.run(); diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 96fe5694cc..8bfcfe2d70 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -1055,10 +1055,10 @@ public final class ModItems { GT_OreDictUnificator.registerOre("platePhasedIron", ItemUtils.getSimpleStack(itemPlatePulsatingIron)); GT_OreDictUnificator.registerOre("blockVibrantAlloy", ItemUtils.getItemStackOfAmountFromOreDict("blockPhasedGold", 1)); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getPlate(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(144), 16, 4*9); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getIngot(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(144), 16, 4*9); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getNugget(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(16), 16, 4); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getBlock(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(1294), 16, 4*9*9); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getPlate(1), MaterialEIO.REDSTONE_ALLOY.getFluid(144), 16, 4*9); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getIngot(1), MaterialEIO.REDSTONE_ALLOY.getFluid(144), 16, 4*9); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getNugget(1), MaterialEIO.REDSTONE_ALLOY.getFluid(16), 16, 4); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getBlock(1), MaterialEIO.REDSTONE_ALLOY.getFluid(1294), 16, 4*9*9); } else { diff --git a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java index fd0d044c05..324a3aa9ee 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java @@ -2,6 +2,7 @@ package gtPlusPlus.core.item.chemistry; import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.List; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -15,6 +16,11 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.plugin.agrichem.BioRecipes; +import gtPlusPlus.plugin.agrichem.item.algae.ItemAgrichemBase; +import gtPlusPlus.plugin.agrichem.item.algae.ItemAlgaeBase; +import gtPlusPlus.plugin.agrichem.item.algae.ItemBioChip; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -71,6 +77,60 @@ public class AgriculturalChem extends ItemPackage { // Fertilizer + + public static Item mAlgae; + public static Item mBioCircuit; + public static Item mAgrichemItem1; + + /* + * 0 - Algae Biomass + * 1 - Green Algae Biomass + * 2 - Brown Algae Biomass + * 3 - Golden-Brown Algae Biomass + * 4 - Red Algae Biomass + * 5 - Cellulose Fiber + * 6 - Golden-Brown Cellulose Fiber + * 7 - Red Cellulose Fiber + * 8 - Compost + * 9 - Wood Pellet + * 10 - Wood Brick + * 11 - Cellulose Pulp + * 12 - Raw Bio Resin + * 13 - Catalyst Carrier + * 14 - Green Metal Catalyst + * 15 - Alginic Acid + * 16 - Alumina + * 17 - Aluminium Pellet + * 18 - Sodium Aluminate + * 19 - Sodium Hydroxide // Exists in Newer GT + * 20 - Sodium Carbonate + * 21 - Lithium Chloride + */ + + public static ItemStack mAlgaeBiosmass; + public static ItemStack mGreenAlgaeBiosmass; + public static ItemStack mBrownAlgaeBiosmass; + public static ItemStack mGoldenBrownAlgaeBiosmass; + public static ItemStack mRedAlgaeBiosmass; + public static ItemStack mCelluloseFiber; + public static ItemStack mGoldenBrownCelluloseFiber; + public static ItemStack mRedCelluloseFiber; + public static ItemStack mCompost; + public static ItemStack mWoodPellet; + public static ItemStack mWoodBrick; + public static ItemStack mCellulosePulp; + public static ItemStack mRawBioResin; + public static ItemStack mCatalystCarrier; + public static ItemStack mGreenCatalyst; + public static ItemStack mAlginicAcid; + public static ItemStack mAlumina; + public static ItemStack mAluminiumPellet; + public static ItemStack mSodiumAluminate; + public static ItemStack mSodiumHydroxide; + public static ItemStack mSodiumCarbonate; + public static ItemStack mLithiumChloride; + + @Override public void items() { // Nitrogen, Ammonium Nitrate, Phosphates, Calcium, Copper, Carbon @@ -82,7 +142,91 @@ public class AgriculturalChem extends ItemPackage { "Ca5(PO4)3(OH)", Utils.rgbtoHexValue(240, 240, 240))[0]; // Dirt Dust :) - dustDirt = ItemUtils.generateSpecialUseDusts("Dirt", "Dried Earth", Utils.rgbtoHexValue(65, 50, 15))[0]; + dustDirt = ItemUtils.generateSpecialUseDusts("Dirt", "Dried Earth", Utils.rgbtoHexValue(65, 50, 15))[0]; + + mAlgae = new ItemAlgaeBase(); + mAgrichemItem1 = new ItemAgrichemBase(); + mBioCircuit = new ItemBioChip(); + GregtechItemList.Circuit_BioRecipeSelector.set(mBioCircuit); + + + + mAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 0, 1); + mGreenAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 1, 1); + mBrownAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 2, 1); + mGoldenBrownAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 3, 1); + mRedAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 4, 1); + mCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 5, 1); + mGoldenBrownCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 6, 1); + mRedCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 7, 1); + mCompost = ItemUtils.simpleMetaStack(mAgrichemItem1, 8, 1); + mWoodPellet = ItemUtils.simpleMetaStack(mAgrichemItem1, 9, 1); + mWoodBrick = ItemUtils.simpleMetaStack(mAgrichemItem1, 10, 1); + mCellulosePulp = ItemUtils.simpleMetaStack(mAgrichemItem1, 11, 1); + mRawBioResin = ItemUtils.simpleMetaStack(mAgrichemItem1, 12, 1); + mCatalystCarrier = ItemUtils.simpleMetaStack(mAgrichemItem1, 13, 1); + mGreenCatalyst = ItemUtils.simpleMetaStack(mAgrichemItem1, 14, 1); + mAlginicAcid = ItemUtils.simpleMetaStack(mAgrichemItem1, 15, 1); + mAlumina = ItemUtils.simpleMetaStack(mAgrichemItem1, 16, 1); + mAluminiumPellet = ItemUtils.simpleMetaStack(mAgrichemItem1, 17, 1); + mSodiumAluminate = ItemUtils.simpleMetaStack(mAgrichemItem1, 18, 1); + + /** + * If It exists, don't add a new one. + */ + if (OreDictionary.doesOreNameExist("dustSodiumHydroxide_GT5U") || OreDictionary.doesOreNameExist("dustSodiumHydroxide")) { + List aTest = OreDictionary.getOres("dustSodiumHydroxide", false); + ItemStack aTestStack; + if (aTest.isEmpty()) { + aTest = OreDictionary.getOres("dustSodiumHydroxide_GT5U", false); + if (aTest.isEmpty()) { + aTestStack = ItemUtils.simpleMetaStack(mAgrichemItem1, 19, 1); + } + else { + aTestStack = aTest.get(0); + } + } + else { + aTestStack = aTest.get(0); + } + mSodiumHydroxide = aTestStack; + } + else { + mSodiumHydroxide = ItemUtils.simpleMetaStack(mAgrichemItem1, 19, 1); + } + mSodiumCarbonate = ItemUtils.simpleMetaStack(mAgrichemItem1, 20, 1); + mLithiumChloride = ItemUtils.simpleMetaStack(mAgrichemItem1, 21, 1); + + ItemUtils.addItemToOreDictionary(mGreenAlgaeBiosmass, "biomassGreenAlgae"); + ItemUtils.addItemToOreDictionary(mBrownAlgaeBiosmass, "biomassBrownAlgae"); + ItemUtils.addItemToOreDictionary(mGoldenBrownAlgaeBiosmass, "biomassGoldenBrownAlgae"); + ItemUtils.addItemToOreDictionary(mRedAlgaeBiosmass, "biomassRedAlgae"); + + ItemUtils.addItemToOreDictionary(mCelluloseFiber, "fiberCellulose"); + ItemUtils.addItemToOreDictionary(mGoldenBrownCelluloseFiber, "fiberCellulose"); + ItemUtils.addItemToOreDictionary(mGoldenBrownCelluloseFiber, "fiberGoldenBrownCellulose"); + ItemUtils.addItemToOreDictionary(mRedCelluloseFiber, "fiberCellulose"); + ItemUtils.addItemToOreDictionary(mRedCelluloseFiber, "fiberRedCellulose"); + + ItemUtils.addItemToOreDictionary(mWoodPellet, "pelletWood"); + ItemUtils.addItemToOreDictionary(mWoodBrick, "brickWood"); + ItemUtils.addItemToOreDictionary(mCellulosePulp, "pulpCellulose"); + + ItemUtils.addItemToOreDictionary(mCatalystCarrier, "catalystEmpty"); + ItemUtils.addItemToOreDictionary(mGreenCatalyst, "catalystAluminiumSilver"); + ItemUtils.addItemToOreDictionary(mAlginicAcid, "dustAlginicAcid"); + ItemUtils.addItemToOreDictionary(mAlumina, "dustAlumina"); + ItemUtils.addItemToOreDictionary(mAluminiumPellet, "pelletAluminium"); + + ItemUtils.addItemToOreDictionary(mSodiumAluminate, "dustSodiumAluminate"); + if (mSodiumHydroxide.getItem() instanceof ItemAgrichemBase) { + ItemUtils.addItemToOreDictionary(mSodiumHydroxide, "dustSodiumHydroxide"); + } + ItemUtils.addItemToOreDictionary(mSodiumCarbonate, "dustSodiumCarbonate"); + ItemUtils.addItemToOreDictionary(mLithiumChloride, "dustLithiumChloride"); + + + } @Override @@ -156,20 +300,20 @@ public class AgriculturalChem extends ItemPackage { } - private static AutoMap mMeats = new AutoMap(); - private static AutoMap mFish = new AutoMap(); - private static AutoMap mFruits = new AutoMap(); - private static AutoMap mVege = new AutoMap(); - private static AutoMap mNuts = new AutoMap(); - private static AutoMap mSeeds = new AutoMap(); - private static AutoMap mPeat = new AutoMap(); - private static AutoMap mBones = new AutoMap(); - private static AutoMap mBoneMeal = new AutoMap(); - - private static AutoMap mList_Master_Meats = new AutoMap(); - private static AutoMap mList_Master_FruitVege = new AutoMap(); - private static AutoMap mList_Master_Bones = new AutoMap(); - private static AutoMap mList_Master_Seeds = new AutoMap(); + public final static AutoMap mMeats = new AutoMap(); + public final static AutoMap mFish = new AutoMap(); + public final static AutoMap mFruits = new AutoMap(); + public final static AutoMap mVege = new AutoMap(); + public final static AutoMap mNuts = new AutoMap(); + public final static AutoMap mSeeds = new AutoMap(); + private final static AutoMap mPeat = new AutoMap(); + private final static AutoMap mBones = new AutoMap(); + private final static AutoMap mBoneMeal = new AutoMap(); + + public final static AutoMap mList_Master_Meats = new AutoMap(); + public final static AutoMap mList_Master_FruitVege = new AutoMap(); + public final static AutoMap mList_Master_Seeds = new AutoMap(); + private final static AutoMap mList_Master_Bones = new AutoMap(); private static void processAllOreDict() { processOreDict("listAllmeatraw", mMeats); @@ -323,6 +467,10 @@ public class AgriculturalChem extends ItemPackage { } } } + + public static ItemStack aFertForestry; + public static ItemStack aFertIC2; + private static void addMiscRecipes() { @@ -342,6 +490,7 @@ public class AgriculturalChem extends ItemPackage { Field aFertField = ReflectionUtils.getField(aItemRegInstance.getClass(), "fertilizerCompound"); Object aItemInstance = aFertField.get(aItemRegInstance); if (aItemInstance instanceof Item) { + aFertForestry = ItemUtils.getSimpleStack((Item) aItemInstance); Item aForestryFert = (Item) aItemInstance; CORE.RA.addDehydratorRecipe( new ItemStack[] { CI.getNumberedCircuit(11), ItemUtils.getSimpleStack(aDustOrganicFert, 4) }, null, @@ -359,6 +508,7 @@ public class AgriculturalChem extends ItemPackage { * IC2 Support */ if (LoadedMods.IndustrialCraft2) { + aFertIC2 = ItemUtils.getItemStackFromFQRN("IC2:itemFertilizer", 1); CORE.RA.addDehydratorRecipe( new ItemStack[] { CI.getNumberedCircuit(12), ItemUtils.getSimpleStack(aDustOrganicFert, 4) }, null, null, new ItemStack[] { ItemUtils.getItemStackFromFQRN("IC2:itemFertilizer", 3), aManureByprod, @@ -414,6 +564,9 @@ public class AgriculturalChem extends ItemPackage { addAdvancedOrganiseFertRecipes(); addMiscRecipes(); + + BioRecipes.init(); + return true; } } diff --git a/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java b/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java index b38451bba3..8dad69f70a 100644 --- a/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java +++ b/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java @@ -38,24 +38,6 @@ public final class MISC_MATERIALS { new MaterialStack(ELEMENT.getInstance().OXYGEN, 1) }); - public static final Material STRONTIUM_HYDROXIDE = new Material( - "Strontium Hydroxide", - MaterialState.SOLID, - TextureSet.SET_METALLIC, - null, - -1, - -1, - -1, - -1, - false, - "Sr(OH)2", - 0, - false, - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().STRONTIUM, 1), - new MaterialStack(MISC_MATERIALS.HYDROXIDE, 2) - }); - public static final Material SELENIUM_DIOXIDE = new Material( "Selenium Dioxide", MaterialState.PURE_LIQUID, //State @@ -303,6 +285,24 @@ public final class MISC_MATERIALS { new MaterialStack(SODIUM_CHLORIDE, 2), }); + public static final Material STRONTIUM_HYDROXIDE = new Material( + "Strontium Hydroxide", + MaterialState.SOLID, + TextureSet.SET_METALLIC, + null, + -1, + -1, + -1, + -1, + false, + "Sr(OH)2", + 0, + false, + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().STRONTIUM, 1), + new MaterialStack(MISC_MATERIALS.HYDROXIDE, 2) + }); + } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index f237eb9f37..3f631e0bca 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -1588,18 +1588,18 @@ public class RECIPES_GREGTECH { private static void fluidExtractorRecipes() { //FLiBe fuel - CORE.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustLi2BeF4", 1), null, + CORE.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustLi2BeF4", 1), FluidUtils.getFluidStack("li2bef4", 144), 100, 500); //LFTR Fuel 1 - CORE.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ZrF4U235.getDust(1), null, + CORE.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ZrF4U235.getDust(1), NUCLIDE.LiFBeF2ZrF4U235.getFluid(144), 250, 1000); - CORE.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ZrF4UF4.getDust(1), null, + CORE.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ZrF4UF4.getDust(1), NUCLIDE.LiFBeF2ZrF4UF4.getFluid(144), 150, 2000); - CORE.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ThF4UF4.getDust(1), null, + CORE.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ThF4UF4.getDust(1), NUCLIDE.LiFBeF2ThF4UF4.getFluid(144), 200, 1500); //ZIRCONIUM_TETRAFLUORIDE - CORE.RA.addFluidExtractionRecipe(FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.getDust(1), null, + CORE.RA.addFluidExtractionRecipe(FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.getDust(1), FluidUtils.getFluidStack(ModItems.fluidZrF4, 144), 200, 512+256); diff --git a/src/Java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java b/src/Java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java new file mode 100644 index 0000000000..6cd13dc209 --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java @@ -0,0 +1,45 @@ +package gtPlusPlus.core.slots; + +import gregtech.api.util.Recipe_GT; +import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; + +public class SlotChemicalPlantInput extends Slot { + + public SlotChemicalPlantInput(final IInventory inventory, final int index, final int x, final int y) { + super(inventory, index, x, y); + } + + @Override + public boolean isItemValid(final ItemStack itemstack) { + return isItemValidForChemicalPlantSlot(itemstack); + } + + public static boolean isItemValidForChemicalPlantSlot(ItemStack aStack) { + boolean validItem = Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.containsInput(aStack); + if (!validItem) { + for (Recipe_GT f : Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList) { + if (f.mFluidInputs.length > 0) { + for (FluidStack g : f.mFluidInputs) { + if (g != null) { + if (FluidContainerRegistry.containsFluid(aStack, g)) { + return true; + } + } + } + } + } + } + return validItem; + } + + @Override + public int getSlotStackLimit() { + return 64; + } + +} diff --git a/src/Java/gtPlusPlus/core/slots/SlotNoInputLogging.java b/src/Java/gtPlusPlus/core/slots/SlotNoInputLogging.java new file mode 100644 index 0000000000..42bc7ce346 --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotNoInputLogging.java @@ -0,0 +1,25 @@ +package gtPlusPlus.core.slots; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + +public class SlotNoInputLogging extends SlotNoInput { + + private final int aSlotIndex; + + public SlotNoInputLogging(final IInventory inventory, final int index, final int x, final int y) { + super(inventory, index, x, y); + aSlotIndex = index; + } + + @Override + public boolean isItemValid(final ItemStack itemstack) { + if (ItemUtils.checkForInvalidItems(itemstack)) { + Logger.INFO("Tried Inserting "+ItemUtils.getItemName(itemstack)+" into slot "+aSlotIndex); + } + return false; + } + +} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java index 8902947c0d..d7b6bc0a30 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java @@ -463,8 +463,7 @@ public class FluidUtils { if (dustStack != null){ CORE.RA.addFluidExtractionRecipe( - dustStack, //Input - null, //Input 2 + dustStack, //Input 2 FluidUtils.getFluidStack(gtFluid, amountPerItem), //Fluid Output 1*20, //Duration 16 //Eu Tick @@ -472,8 +471,7 @@ public class FluidUtils { } if (dustStack2 != null){ CORE.RA.addFluidExtractionRecipe( - dustStack2, //Input - null, //Input 2 + dustStack2, //Input 2 FluidUtils.getFluidStack(gtFluid, amountPerItem), //Fluid Output 1*20, //Duration 16 //Eu Tick diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java new file mode 100644 index 0000000000..5c5d1169aa --- /dev/null +++ b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java @@ -0,0 +1,456 @@ +package gtPlusPlus.nei; + +import java.awt.Point; +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.common.event.FMLInterModComms; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.gui.GT_GUIContainer_BasicMachine; +import gregtech.api.objects.ItemData; +import gregtech.api.util.*; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; +import gtPlusPlus.core.lib.CORE; +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.guihook.IContainerInputHandler; +import codechicken.nei.guihook.IContainerTooltipHandler; +import codechicken.nei.recipe.*; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; + +public class GT_NEI_FluidReactor +extends TemplateRecipeHandler { + public static final int sOffsetX = 5; + public static final int sOffsetY = 11; + + static { + GuiContainerManager.addInputHandler(new GT_RectHandler()); + GuiContainerManager.addTooltipHandler(new GT_RectHandler()); + } + + protected final Gregtech_Recipe_Map mRecipeMap; + + public GT_NEI_FluidReactor(final Gregtech_Recipe_Map sfluidchemicalreactorrecipes) { + this.mRecipeMap = sfluidchemicalreactorrecipes; + this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getOverlayIdentifier(), new Object[0])); + if (!NEI_GT_Config.sIsAdded) { + FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getOverlayIdentifier()); + GuiCraftingRecipe.craftinghandlers.add(this); + GuiUsageRecipe.usagehandlers.add(this); + } + } + + public static void drawText(final int aX, final int aY, final String aString, final int aColor) { + Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); + } + + @Override + public TemplateRecipeHandler newInstance() { + return new GT_NEI_FluidReactor(this.mRecipeMap); + } + + @Override + public void loadCraftingRecipes(final String outputId, final Object... results) { + if (outputId.equals(this.getOverlayIdentifier())) { + for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + if (!tRecipe.mHidden) { + this.arecipes.add(new CachedDefaultRecipe(tRecipe)); + } + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(final ItemStack aResult) { + final ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); + + final ArrayList tResults = new ArrayList(); + tResults.add(aResult); + tResults.add(GT_OreDictUnificator.get(true, aResult)); + if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + for (final OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); + } + } + final FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); + if (tFluid != null) { + tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); + for (final FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (tData.fluid.isFluidEqual(tFluid)) { + tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer})); + } + } + } + for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + if (!tRecipe.mHidden) { + final CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); + for (final ItemStack tStack : tResults) { + if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { + this.arecipes.add(tNEIRecipe); + break; + } + } + } + } + } + + @Override + public void loadUsageRecipes(final ItemStack aInput) { + final ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); + + final ArrayList tInputs = new ArrayList(); + tInputs.add(aInput); + tInputs.add(GT_OreDictUnificator.get(false, aInput)); + if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + for (final OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); + } + } + final FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); + if (tFluid != null) { + tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); + for (final FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (tData.fluid.isFluidEqual(tFluid)) { + tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer})); + } + } + } + for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + if (!tRecipe.mHidden) { + final CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); + for (final ItemStack tStack : tInputs) { + if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { + this.arecipes.add(tNEIRecipe); + break; + } + } + } + } + } + + @Override + public String getOverlayIdentifier() { + return this.mRecipeMap.mNEIName; + } + + @Override + public void drawBackground(final int recipe) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); + } + + @Override + public int recipiesPerPage() { + return 1; + } + + @Override + public String getRecipeName() { + return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); + } + + @Override + public String getGuiTexture() { + return CORE.MODID+":textures/gui/FluidReactor.png"; + } + + @Override + public List handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List currenttip, final int aRecipeIndex) { + final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); + if ((tObject instanceof CachedDefaultRecipe)) { + final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; + for (final PositionedStack tStack : tRecipe.mOutputs) { + if (aStack == tStack.item) { + if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { + break; + } + currenttip.add("Chance: " + (((FixedPositionedStack) tStack).mChance / 100) + "." + ((((FixedPositionedStack) tStack).mChance % 100) < 10 ? "0" + (((FixedPositionedStack) tStack).mChance % 100) : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%"); + break; + } + } + for (final PositionedStack tStack : tRecipe.mInputs) { + if (aStack == tStack.item) { + if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || + (tStack.item.stackSize != 0)) { + break; + } + currenttip.add("Does not get consumed in the process"); + break; + } + } + } + return currenttip; + } + + @Override + public void drawExtras(final int aRecipeIndex) { + final int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; + final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + if (tEUt != 0) { + drawText(10, 73, "Total: " + (tDuration * tEUt) + " EU", -16777216); + drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); + if (this.mRecipeMap.mShowVoltageAmperageInNEI) { + drawText(10, 93, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU", -16777216); + drawText(10, 103, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); + } else { + drawText(10, 93, "Voltage: unspecified", -16777216); + drawText(10, 103, "Amperage: unspecified", -16777216); + } + } + if (tDuration > 0) { + drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); + } + if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { + drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); + } + } + + public static class GT_RectHandler + implements IContainerInputHandler, IContainerTooltipHandler { + @Override + public boolean mouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { + if (this.canHandle(gui)) { + if (button == 0) { + return this.transferRect(gui, false); + } + if (button == 1) { + return this.transferRect(gui, true); + } + } + return false; + } + + @Override + public boolean lastKeyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { + return false; + } + + public boolean canHandle(final GuiContainer gui) { + return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) /*|| ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))*/); + } + + @Override + public List handleTooltip(final GuiContainer gui, final int mousex, final int mousey, final List currenttip) { + if ((this.canHandle(gui)) && (currenttip.isEmpty())) { + if ((gui instanceof GT_GUIContainer_BasicMachine) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + currenttip.add("Recipes"); + } /*else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + currenttip.add("Recipes"); + }*/ + + } + return currenttip; + } + + private boolean transferRect(final GuiContainer gui, final boolean usage) { + if (gui instanceof GT_GUIContainer_BasicMachine) { + return (this.canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0])); + } /*else if (gui instanceof GT_GUIContainer_FusionReactor) { + return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0])); + }*/ + return false; + } + + @Override + public List handleItemDisplayName(final GuiContainer gui, final ItemStack itemstack, final List currenttip) { + return currenttip; + } + + @Override + public List handleItemTooltip(final GuiContainer gui, final ItemStack itemstack, final int mousex, final int mousey, final List currenttip) { + return currenttip; + } + + @Override + public boolean keyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { + return false; + } + + @Override + public void onKeyTyped(final GuiContainer gui, final char keyChar, final int keyID) { + } + + @Override + public void onMouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { + } + + @Override + public void onMouseUp(final GuiContainer gui, final int mousex, final int mousey, final int button) { + } + + @Override + public boolean mouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { + return false; + } + + @Override + public void onMouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { + } + + @Override + public void onMouseDragged(final GuiContainer gui, final int mousex, final int mousey, final int button, final long heldTime) { + } + } + + public class FixedPositionedStack + extends PositionedStack { + public final int mChance; + public boolean permutated = false; + + public FixedPositionedStack(final Object object, final int x, final int y) { + this(object, x, y, 0); + } + + public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) { + super(object, x, y, true); + this.mChance = aChance; + } + + @Override + public void generatePermutations() { + if (this.permutated) { + return; + } + final ArrayList tDisplayStacks = new ArrayList(); + for (final ItemStack tStack : this.items) { + if (GT_Utility.isStackValid(tStack)) { + if (tStack.getItemDamage() == 32767) { + final List permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); + if (!permutations.isEmpty()) { + ItemStack stack; + for (final Iterator i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) { + stack = i$.next(); + } + } else { + final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); + base.stackTagCompound = tStack.stackTagCompound; + tDisplayStacks.add(base); + } + } else { + tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack})); + } + } + } + this.items = (tDisplayStacks.toArray(new ItemStack[0])); + if (this.items.length == 0) { + this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; + } + this.permutated = true; + this.setPermutationToRender(0); + } + } + + public class CachedDefaultRecipe + extends TemplateRecipeHandler.CachedRecipe { + public final GT_Recipe mRecipe; + public final List mOutputs = new ArrayList(); + public final List mInputs = new ArrayList(); + + public CachedDefaultRecipe(final GT_Recipe aRecipe) { + super(); + this.mRecipe = aRecipe; + + int tStartIndex = 0; + + // Four Input Slots + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 3, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 21, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 39, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 57, -4)); + } + tStartIndex++; + + + if (aRecipe.mSpecialItems != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); + } + tStartIndex = 0; + + //Four Output Slots + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + + + //New fluid display behaviour when 3 fluid inputs are detected. (Basically a mix of the code below for outputs an the code above for 9 input slots.) + if (aRecipe.mFluidInputs.length >= 1) { + if ((aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 3, 31)); + } + if ((aRecipe.mFluidInputs.length > 1) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 21, 31)); + } + if ((aRecipe.mFluidInputs.length > 2) && (aRecipe.mFluidInputs[2] != null) && (aRecipe.mFluidInputs[2].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[2], true), 39, 31)); + } + if ((aRecipe.mFluidInputs.length > 3) && (aRecipe.mFluidInputs[3] != null) && (aRecipe.mFluidInputs[3].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[3], true), 57, 31)); + } + } + + if (aRecipe.mFluidOutputs.length > 0) { + if ((aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 138, 5)); + } + if ((aRecipe.mFluidOutputs.length > 1) && (aRecipe.mFluidOutputs[1] != null) && (aRecipe.mFluidOutputs[1].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 138, 23)); + } + } + } + + @Override + public List getIngredients() { + return this.getCycledIngredients(GT_NEI_FluidReactor.this.cycleticks / 10, this.mInputs); + } + + @Override + public PositionedStack getResult() { + return null; + } + + @Override + public List getOtherStacks() { + return this.mOutputs; + } + } +} diff --git a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java index ab949bd517..ad03040059 100644 --- a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java @@ -18,10 +18,13 @@ implements IConfigureNEI { } } for (final Gregtech_Recipe_Map tMap : gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map.sMappings) { - if (tMap.mNEIAllowed) { - new GT_NEI_MultiBlockHandler(tMap); + if (tMap.mNEIAllowed) { + if (!tMap.mUnlocalizedName.equals(Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mUnlocalizedName)) { + new GT_NEI_MultiBlockHandler(tMap); + } } } + new GT_NEI_FluidReactor(Gregtech_Recipe_Map.sFluidChemicalReactorRecipes); sIsAdded = true; API.registerRecipeHandler(new DecayableRecipeHandler()); API.registerUsageHandler(new DecayableRecipeHandler()); diff --git a/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java b/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java index b6e4ce8881..a80ae58b65 100644 --- a/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java +++ b/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java @@ -1,24 +1,39 @@ package gtPlusPlus.plugin.agrichem; +import static gtPlusPlus.core.lib.CORE.GTNH; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_ModHandler.RecipeBits; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.item.chemistry.AgriculturalChem; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.MISC_MATERIALS; +import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.plugin.agrichem.block.AgrichemFluids; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.railcraft.utils.RailcraftUtils; +import ic2.core.Ic2Items; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; public class BioRecipes { @@ -51,6 +66,8 @@ public class BioRecipes { private static Fluid mBenzene; private static Fluid mEthylbenzene; private static Fluid mStyrene; + private static Fluid mButanol; + private static Fluid mAcetone; private static final ItemStack getGreenAlgaeRecipeChip() { @@ -67,17 +84,17 @@ public class BioRecipes { } private static final ItemStack getBioChip(int aID) { - return ItemUtils.simpleMetaStack(Core_Agrichem.mBioCircuit, aID, 0); + return ItemUtils.simpleMetaStack(AgriculturalChem.mBioCircuit, aID, 0); } public static void init() { - Core_Agrichem.mInstance.log("Setting Variables"); + Logger.INFO("[Bio] Setting Variables"); initRecipeVars(); - Core_Agrichem.mInstance.log("Generating Biochip Recipes"); + Logger.INFO("[Bio] Generating Biochip Recipes"); recipeBioChip(); - Core_Agrichem.mInstance.log("Generating Recipes"); + Logger.INFO("[Bio] Generating Recipes"); recipeAlgaeBiomass(); - Core_Agrichem.mInstance.log("Finished with recipes"); + Logger.INFO("[Bio] Finished with recipes"); } private static final void initRecipeVars() { @@ -101,7 +118,7 @@ public class BioRecipes { mEthylbenzene = FluidUtils.getFluidStack("fluid.ethylbenzene", 1).getFluid(); mStyrene = FluidUtils.getFluidStack("styrene", 1).getFluid(); mMethanol = FluidUtils.getFluidStack("methanol", 1).getFluid(); - mLiquidPlastic = FluidUtils.getFluidStack("plastic", 1).getFluid(); + mLiquidPlastic = FluidUtils.getWildcardFluidStack("plastic", 1).getFluid(); mCarbonDioxide = MISC_MATERIALS.CARBON_DIOXIDE.getFluid(1).getFluid(); mCarbonMonoxide = MISC_MATERIALS.CARBON_MONOXIDE.getFluid(1).getFluid(); mChlorine = FluidUtils.getFluidStack("chlorine", 1).getFluid(); @@ -110,10 +127,9 @@ public class BioRecipes { mPropionicAcid = AgrichemFluids.mPropionicAcid; mUrea = AgrichemFluids.mUrea; mLiquidResin = AgrichemFluids.mLiquidResin; - mFermentationBase = AgrichemFluids.mFermentationBase; - - - + mFermentationBase = AgrichemFluids.mFermentationBase; + mButanol = AgrichemFluids.mButanol; + mAcetone = AgrichemFluids.mAcetone; } private static void recipeAlgaeBiomass() { @@ -153,22 +169,32 @@ public class BioRecipes { recipeMethane(); recipeBenzene(); recipeStyrene(); + + registerFuels(); } + private static void registerFuels() { + // Gas Fuels + //GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalGas", 1), null, 96, 1); + + //Combustion Fuels + GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellButanol", 1), null, 250, 0); + + } private static void recipeGreenAlgae() { // Compost GT_ModHandler.addPulverisationRecipe( - ItemUtils.getSimpleStack(Core_Agrichem.mGreenAlgaeBiosmass, 10), - ItemUtils.getSimpleStack(Core_Agrichem.mCompost, 1)); + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 10), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); // Turn into Cellulose CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { getGreenAlgaeRecipeChip(), - ItemUtils.getSimpleStack(Core_Agrichem.mGreenAlgaeBiosmass, 30) + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 30) }, GT_Values.NF, - ItemUtils.getSimpleStack(Core_Agrichem.mCelluloseFiber, 5), - 20 * 30, + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 5), + 30 * 30, 16); @@ -177,23 +203,23 @@ public class BioRecipes { private static void recipeBrownAlgae() { // Compost GT_ModHandler.addPulverisationRecipe( - ItemUtils.getSimpleStack(Core_Agrichem.mBrownAlgaeBiosmass, 10), - ItemUtils.getSimpleStack(Core_Agrichem.mCompost, 1)); + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 10), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); // Alginic acid GT_Values.RA.addExtractorRecipe( - ItemUtils.getSimpleStack(Core_Agrichem.mBrownAlgaeBiosmass, 10), - ItemUtils.getSimpleStack(Core_Agrichem.mAlginicAcid, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 10), + ItemUtils.getSimpleStack(AgriculturalChem.mAlginicAcid, 1), 20 * 15, 30); // Lithium Chloride GT_Values.RA.addBlastRecipe( getBrownAlgaeRecipeChip(), - ItemUtils.getSimpleStack(Core_Agrichem.mBrownAlgaeBiosmass, 20), + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 20), GT_Values.NF, GT_Values.NF, - ItemUtils.getSimpleStack(Core_Agrichem.mLithiumChloride, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mLithiumChloride, 1), GT_Values.NI, 120, 120, @@ -202,10 +228,10 @@ public class BioRecipes { // Sodium Carbonate CORE.RA.addChemicalRecipe( getBrownAlgaeRecipeChip(), - ItemUtils.getSimpleStack(Core_Agrichem.mBrownAlgaeBiosmass, 20), + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 20), FluidUtils.getDistilledWater(2000), GT_Values.NF, - ItemUtils.getSimpleStack(Core_Agrichem.mSodiumCarbonate, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 1), 20 * 30, 30); @@ -214,63 +240,63 @@ public class BioRecipes { private static void recipeGoldenBrownAlgae() { // Compost GT_ModHandler.addPulverisationRecipe( - ItemUtils.getSimpleStack(Core_Agrichem.mGoldenBrownAlgaeBiosmass, 10), - ItemUtils.getSimpleStack(Core_Agrichem.mCompost, 1)); + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, 10), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); // Turn into Cellulose CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { getGoldenBrownAlgaeRecipeChip(), - ItemUtils.getSimpleStack(Core_Agrichem.mGoldenBrownAlgaeBiosmass, 30) + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, 30) }, GT_Values.NF, - ItemUtils.getSimpleStack(Core_Agrichem.mGoldenBrownCelluloseFiber, 5), - 20 * 30, - 64); + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 5), + 30 * 30, + 120); } private static void recipeRedAlgae() { // Compost GT_ModHandler.addPulverisationRecipe( - ItemUtils.getSimpleStack(Core_Agrichem.mRedAlgaeBiosmass, 10), - ItemUtils.getSimpleStack(Core_Agrichem.mCompost, 1)); + ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, 10), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); // Turn into Cellulose CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { getRedAlgaeRecipeChip(), - ItemUtils.getSimpleStack(Core_Agrichem.mRedAlgaeBiosmass, 30) + ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, 30) }, GT_Values.NF, - ItemUtils.getSimpleStack(Core_Agrichem.mRedCelluloseFiber, 5), - 20 * 30, - 256); + ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 5), + 30 * 30, + 240); } private static void recipeCelluloseFibre() { CORE.RA.addChemicalRecipe( - ItemUtils.getSimpleStack(Core_Agrichem.mCelluloseFiber, 20), - ItemUtils.getSimpleStack(Core_Agrichem.mAlginicAcid, 2), + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 20), + ItemUtils.getSimpleStack(AgriculturalChem.mAlginicAcid, 2), GT_Values.NF, GT_Values.NF, - ItemUtils.getSimpleStack(Core_Agrichem.mCellulosePulp, 10), - 30 * 20, + ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 10), + 45 * 20, 16); // Craft into Wood Pellets CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { getBioChip(2), - ItemUtils.getSimpleStack(Core_Agrichem.mCelluloseFiber, 12) + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 12) }, GT_Values.NF, - ItemUtils.getSimpleStack(Core_Agrichem.mWoodPellet, 2), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 2), 20 * 30, 30); // Methanol Extraction GT_Values.RA.addFluidExtractionRecipe( - ItemUtils.getSimpleStack(Core_Agrichem.mCelluloseFiber, 12), + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 12), GT_Values.NI, FluidUtils.getFluidStack(mMethanol, 50), 10000, @@ -279,8 +305,8 @@ public class BioRecipes { // Compost GT_ModHandler.addPulverisationRecipe( - ItemUtils.getSimpleStack(Core_Agrichem.mCelluloseFiber, 5), - ItemUtils.getSimpleStack(Core_Agrichem.mCompost, 1)); + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 5), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); } @@ -288,30 +314,29 @@ public class BioRecipes { private static void recipeWoodPellets() { // Shapeless Recipe RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { - ItemUtils.getSimpleStack(Core_Agrichem.mWoodPellet, 1), - ItemUtils.getSimpleStack(Core_Agrichem.mWoodPellet, 1), - ItemUtils.getSimpleStack(Core_Agrichem.mWoodPellet, 1), - ItemUtils.getSimpleStack(Core_Agrichem.mWoodPellet, 1), - ItemUtils.getSimpleStack(Core_Agrichem.mWoodPellet, 1), - ItemUtils.getSimpleStack(Core_Agrichem.mWoodPellet, 1), - ItemUtils.getSimpleStack(Core_Agrichem.mWoodPellet, 1), - ItemUtils.getSimpleStack(Core_Agrichem.mWoodPellet, 1) - }, ItemUtils.getSimpleStack(Core_Agrichem.mWoodBrick, 2)); + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1) + }, ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 2)); // Assembly Recipe CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { getBioChip(2), - ItemUtils.getSimpleStack(Core_Agrichem.mWoodPellet, 8) + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 8) }, GT_Values.NF, - ItemUtils.getSimpleStack(Core_Agrichem.mWoodBrick, 2), - 20, + ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 2), + 20 * 5, 8); // CO2 CORE.RA.addFluidExtractionRecipe( - GT_Values.NI, - ItemUtils.getSimpleStack(Core_Agrichem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), FluidUtils.getFluidStack(mCarbonDioxide, 70), 10*20, 30); @@ -320,7 +345,7 @@ public class BioRecipes { // Add Charcoal Recipe if (LoadedMods.Railcraft) { RailcraftUtils.addCokeOvenRecipe( - ItemUtils.getSimpleStack(Core_Agrichem.mWoodPellet, 2), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 2), true, true, ItemUtils.getItemStackOfAmountFromOreDict("gemCharcoal", 3), @@ -328,7 +353,7 @@ public class BioRecipes { 1200); } CORE.RA.addCokeOvenRecipe( - ItemUtils.getSimpleStack(Core_Agrichem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 2), getBioChip(3), null, GT_Values.NF, @@ -347,8 +372,8 @@ public class BioRecipes { ItemUtils.getOrePrefixStack(OrePrefixes.dust, Materials.Wood, 50) }, GT_Values.NF, - ItemUtils.getSimpleStack(Core_Agrichem.mWoodBrick, 1), - 100, + ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 1), + 100 * 20, 16); } @@ -357,64 +382,352 @@ public class BioRecipes { // Assembly Recipe CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { getBioChip(2), - ItemUtils.getSimpleStack(Core_Agrichem.mCellulosePulp, 4) + ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 4) }, GT_Values.NF, ItemUtils.getSimpleStack(Items.paper, 1), - 50, + 60 * 20, 16); } private static void recipeCatalystCarrier() { - + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getBioChip(20), + ItemUtils.getItemStackOfAmountFromOreDict("plateSteel", GTNH ? 8 : 4), + ItemUtils.getItemStackOfAmountFromOreDict("wireFineCopper", GTNH ? 4 : 2), + ItemUtils.getItemStackOfAmountFromOreDict("screwTin", GTNH ? 6 : 3) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 1), + 300 * 20, + 16); } private static void recipeAluminiumSilverCatalyst() { - + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getBioChip(20), + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 4), + ItemUtils.getItemStackOfAmountFromOreDict("dustSilver", 4) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 10), + 600 * 20, + 30); } private static void recipeAceticAcid() { + /* GT_Values.RA.addMixerRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 10), + var2, + var3, var4, + var5, // Fluid in + var6, // Fluid out + var7, // Item Out + var8, // Time + var9); // Eu + */ + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mMethanol, 700), + FluidUtils.getFluidStack(BioRecipes.mCarbonMonoxide, 300), + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 2000), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mAceticAcid, 250), + }, + 120 * 20, + 60, + 1); + + CORE.RA.addDehydratorRecipe( + CI.emptyCells(1), + FluidUtils.getFluidStack(mFermentationBase, 4000), + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1), + ItemUtils.getItemStackOfAmountFromOreDict("cellAceticAcid", 1) + }, + 60 * 20, + 16); + + } private static void recipeFermentationBase() { + AutoMap aFruitVege = AgriculturalChem.mList_Master_FruitVege; + AutoMap aSeeds = AgriculturalChem.mList_Master_Seeds; + ArrayList aMap = OreDictionary.getOres("cropSugarbeet"); + for (ItemStack a : aFruitVege) { + if (aMap.contains(a)) { + continue; + } + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(2), + ItemUtils.getSimpleStack(a, 10) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 200), + }, + 60 * 20, + 30, + 1); + } + for (ItemStack a : aSeeds) { + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(3), + ItemUtils.getSimpleStack(a, 20) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 50), + }, + 60 * 20, + 30, + 1); + } + + // Sugar Cane + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(4), + ItemUtils.getSimpleStack(Items.reeds, 16) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 75), + }, + 60 * 20, + 30, + 1); + + // Sugar Beet + if (OreDictionary.doesOreNameExist("cropSugarbeet")) { + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(4), + ItemUtils.getItemStackOfAmountFromOreDict("cropSugarbeet", 8) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 75), + }, + 60 * 20, + 30, + 1); + } + + // Produce Acetone, Butanol and Ethanol + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(5), + ItemUtils.getItemStackOfAmountFromOreDict("cellFermentationBase", 48), + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 16), + ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 16), + }, + new FluidStack[] { + + }, + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellButanol", 6), + ItemUtils.getItemStackOfAmountFromOreDict("cellAcetone", 3), + ItemUtils.getItemStackOfAmountFromOreDict("cellEthanol", 1), + CI.emptyCells(38) + }, + new FluidStack[] { + + }, + 900 * 20, + 240, + 2); + } private static void recipePropionicAcid() { - + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mEthylene, 500), + FluidUtils.getFluidStack(BioRecipes.mCarbonMonoxide, 500), + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 2000), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mPropionicAcid, 250), + }, + 20 * 20, + 60, + 1); } private static void recipeEthanol() { + GT_Values.RA.addDistilleryRecipe( + BioRecipes.getBioChip(2), + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 1000), + FluidUtils.getFluidStack(BioRecipes.mEthanol, 100), + null, + 20 * 20, + 60, + false); + } private static void recipeGoldenBrownCelluloseFiber() { - + CORE.RA.addFluidExtractionRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 20), + FluidUtils.getFluidStack(BioRecipes.mAmmonia, 50), + 20 * 30, + 120); } private static void recipeRedCelluloseFiber() { - + GT_Values.RA.addExtractorRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 20), + ItemUtils.getSimpleStack(ModItems.dustCalciumCarbonate, 5), + 20 * 30, + 240); } private static void recipeSodiumHydroxide() { - + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(4) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mSalineWater, 1000), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumHydroxide, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mChlorine, 400), + FluidUtils.getFluidStack(BioRecipes.mHydrogen, 600), + }, + 300 * 20, + 120, + 2); + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(5), + ItemUtils.getItemStackOfAmountFromOreDict("dustSodium", 5) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 5000), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumHydroxide, 5) + }, + new FluidStack[] { + + }, + 60 * 20, + 60, + 2); } private static void recipeSodiumCarbonate() { + if (OreDictionary.doesOreNameExist("fuelCoke")) { + + GT_Values.RA.addBlastRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 4), + ItemUtils.getItemStackOfAmountFromOreDict("fuelCoke", 4), + GT_Values.NF, + GT_Values.NF, + ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 24), + null, + 20 * 120, + 120, + 1600); + + } + + GT_Values.RA.addBlastRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mAlumina, 24), + ItemUtils.getItemStackOfAmountFromOreDict("dustCoal", 4), + GT_Values.NF, + GT_Values.NF, + ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 24), + null, + 20 * 120, + 120, + 1600); + } private static void recipeAluminiumPellet() { - + GT_Values.RA.addAutoclaveRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 3), + null, + ItemUtils.getSimpleStack(AgriculturalChem.mAluminiumPellet, 4), + 10000, + 120 * 20, + 16); } private static void recipeAlumina() { - + GT_Values.RA.addBlastRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumAluminate, 24), + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumHydroxide, 3), + FluidUtils.getFluidStack(mCarbonDioxide, 6000), + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mAlumina, 24), + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 2), + 20 * 120, + 120, + 1200); } private static void recipeAluminium() { - + GT_Values.RA.addBlastRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mAlumina, 24), + ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", 4), + GT_Values.NF, + GT_Values.NF, + ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 24), + null, + 20 * 120, + 120, + 1600); } private static void recipeCalciumCarbonate() { @@ -427,97 +740,389 @@ public class BioRecipes { private static void recipeAlginicAcid() { + // Turn into Cellulose Pulp + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getBioChip(7), + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 20), + ItemUtils.getSimpleStack(AgriculturalChem.mAlginicAcid, 5) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 20), + 90 * 20, + 16); } private static void recipeSulfuricAcid() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(7), + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 10), + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 30) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 2000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mSulfuricAcid, 5), + }, + 60 * 20, + 60, + 2); + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(7), + ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 5), + ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, 30) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 2000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mSulfuricAcid, 15), + }, + 60 * 20, + 60, + 2); + } private static void recipeUrea() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(9), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mAmmonia, 600), + FluidUtils.getFluidStack(BioRecipes.mCarbonDioxide, 400), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mUrea, 400), + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 600), + }, + 120 * 20, + 30, + 1); + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(9), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mUrea, 200), + FluidUtils.getFluidStack(BioRecipes.mFormaldehyde, 200), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mLiquidResin, 200) + }, + 120 * 20, + 30, + 1); } private static void recipeRawBioResin() { + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(3), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 10), + ItemUtils.getSimpleStack(Blocks.dirt, 20) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mRawBioResin, 1), + }, + new FluidStack[] { + + }, + 60 * 20, + 30, + 1); } private static void recipeLiquidResin() { + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(3), + ItemUtils.getSimpleStack(AgriculturalChem.mRawBioResin, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mEthanol, 200), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mLiquidResin, 50), + }, + 60 * 20, + 30, + 1); + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(3), + ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 8) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mLiquidResin, 144), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(Ic2Items.resin, 1) + }, + new FluidStack[] { + + }, + 120 * 20, + 30, + 1); + + } private static void recipeCompost() { + ItemStack aFert; + if (LoadedMods.Forestry) { + aFert = ItemUtils.getSimpleStack(AgriculturalChem.aFertForestry, 2); + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(11), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 16) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mUrea, 500), + }, + new ItemStack[] { + aFert + }, + new FluidStack[] { + + }, + 120 * 20, + 60, + 2); + } + aFert = ItemUtils.getSimpleStack(AgriculturalChem.aFertIC2, 2); + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(12), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 16) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mUrea, 500), + }, + new ItemStack[] { + aFert + }, + new FluidStack[] { + + }, + 120 * 20, + 60, + 2); + } private static void recipeMethane() { - + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(12), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 20) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 2000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mMethane, 10), + }, + 20 * 20, + 30, + 1); + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(13), + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 64), + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 48), + ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 32) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mMethane, 2000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mLiquidPlastic, (144/4)), + }, + 120 * 20, + 240, + 2); } private static void recipeBenzene() { + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(19), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 1), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mMethane, 1000), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 1), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mBenzene, 500), + }, + 8 * 20, + 120, + 2); } private static void recipeStyrene() { - + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(20), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 1), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mEthylbenzene, 100), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 1), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mStyrene, 25), + }, + 16 * 20, + 480, + 3); } private static void recipeBioChip() { - GT_ModHandler.addShapelessCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 0L, new Object[0]), - RecipeBits.NOT_REMOVABLE, new Object[]{OrePrefixes.circuit.get(Materials.Primitive)}); - - - long bits = RecipeBits.BUFFERED | RecipeBits.NOT_REMOVABLE; - - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 1L, new Object[0]), bits, + GT_ModHandler.addShapelessCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 0L), 0, new Object[]{OrePrefixes.circuit.get(Materials.Primitive)}); + + long bits = 0; + + + + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 1L, new Object[0]), bits, new Object[]{"d ", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 2L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 2L, new Object[0]), bits, new Object[]{" d ", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 3L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 3L, new Object[0]), bits, new Object[]{" d", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 4L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 4L, new Object[0]), bits, new Object[]{" ", " Pd", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 5L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 5L, new Object[0]), bits, new Object[]{" ", " P ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 6L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 6L, new Object[0]), bits, new Object[]{" ", " P ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 7L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 7L, new Object[0]), bits, new Object[]{" ", " P ", "d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 8L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 8L, new Object[0]), bits, new Object[]{" ", "dP ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 9L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 9L, new Object[0]), bits, new Object[]{"P d", " ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 10L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 10L, new Object[0]), bits, new Object[]{"P ", " d", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 11L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 11L, new Object[0]), bits, new Object[]{"P ", " ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 12L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 12L, new Object[0]), bits, new Object[]{"P ", " ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 13L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 13L, new Object[0]), bits, new Object[]{" P", " ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 14L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 14L, new Object[0]), bits, new Object[]{" P", " ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 15L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 15L, new Object[0]), bits, new Object[]{" P", " ", "d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 16L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 16L, new Object[0]), bits, new Object[]{" P", "d ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 17L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 17L, new Object[0]), bits, new Object[]{" ", " ", "d P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 18L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 18L, new Object[0]), bits, new Object[]{" ", "d ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 19L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 19L, new Object[0]), bits, new Object[]{"d ", " ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 20L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 20L, new Object[0]), bits, new Object[]{" d ", " ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 21L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 21L, new Object[0]), bits, new Object[]{"d ", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 22L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 22L, new Object[0]), bits, new Object[]{" d ", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 23L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 23L, new Object[0]), bits, new Object[]{" d", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 24L, new Object[0]), bits, + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 24L, new Object[0]), bits, new Object[]{" ", " d", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); } + public static boolean addCraftingRecipe(ItemStack aResult, long aBitMask, Object[] aRecipe) { + Method mAddRecipe = ReflectionUtils.getMethod(GT_ModHandler.class, "addCraftingRecipe", new Class[] { + ItemStack.class, Enchantment[].class, int[].class, + boolean.class, boolean.class, boolean.class, boolean.class, + boolean.class, boolean.class, boolean.class, boolean.class, + boolean.class, boolean.class, boolean.class, boolean.class, + boolean.class, Object[].class}); + boolean didInvoke = false; + if (mAddRecipe != null) { + try { + didInvoke = (boolean) mAddRecipe.invoke(null, aResult, + new Enchantment[] {}, + new int[] {}, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + aRecipe); + } + catch (IllegalAccessException | IllegalArgumentException + | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return didInvoke; + + + } + } diff --git a/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java b/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java index bb467699a7..4cf31e9335 100644 --- a/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java +++ b/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java @@ -19,58 +19,6 @@ public class Core_Agrichem implements IPlugin { final static Core_Agrichem mInstance; - public static Item mAlgae; - public static Item mBioCircuit; - public static Item mAgrichemItem1; - - /* - * 0 - Algae Biomass - * 1 - Green Algae Biomass - * 2 - Brown Algae Biomass - * 3 - Golden-Brown Algae Biomass - * 4 - Red Algae Biomass - * 5 - Cellulose Fiber - * 6 - Golden-Brown Cellulose Fiber - * 7 - Red Cellulose Fiber - * 8 - Compost - * 9 - Wood Pellet - * 10 - Wood Brick - * 11 - Cellulose Pulp - * 12 - Raw Bio Resin - * 13 - Catalyst Carrier - * 14 - Green Metal Catalyst - * 15 - Alginic Acid - * 16 - Alumina - * 17 - Aluminium Pellet - * 18 - Sodium Aluminate - * 19 - Sodium Hydroxide // Exists in Newer GT - * 20 - Sodium Carbonate - * 21 - Lithium Chloride - */ - - public static ItemStack mAlgaeBiosmass; - public static ItemStack mGreenAlgaeBiosmass; - public static ItemStack mBrownAlgaeBiosmass; - public static ItemStack mGoldenBrownAlgaeBiosmass; - public static ItemStack mRedAlgaeBiosmass; - public static ItemStack mCelluloseFiber; - public static ItemStack mGoldenBrownCelluloseFiber; - public static ItemStack mRedCelluloseFiber; - public static ItemStack mCompost; - public static ItemStack mWoodPellet; - public static ItemStack mWoodBrick; - public static ItemStack mCellulosePulp; - public static ItemStack mRawBioResin; - public static ItemStack mCatalystCarrier; - public static ItemStack mGreenCatalyst; - public static ItemStack mAlginicAcid; - public static ItemStack mAlumina; - public static ItemStack mAluminiumPellet; - public static ItemStack mSodiumAluminate; - public static ItemStack mSodiumHydroxide; - public static ItemStack mSodiumCarbonate; - public static ItemStack mLithiumChloride; - static { mInstance = new Core_Agrichem(); @@ -84,98 +32,18 @@ public class Core_Agrichem implements IPlugin { FluidLoader.generate(); AgrichemFluids.init(); mInstance.log("Generating Items"); - mAlgae = new ItemAlgaeBase(); - mAgrichemItem1 = new ItemAgrichemBase(); - mBioCircuit = new ItemBioChip(); - mInstance.log("Setting Bio Circuit"); - GregtechItemList.Circuit_BioRecipeSelector.set(mBioCircuit); return true; } @Override public boolean init() { - mInstance.log("Setting Items"); - mAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 0, 1); - mGreenAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 1, 1); - mBrownAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 2, 1); - mGoldenBrownAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 3, 1); - mRedAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 4, 1); - mCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 5, 1); - mGoldenBrownCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 6, 1); - mRedCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 7, 1); - mCompost = ItemUtils.simpleMetaStack(mAgrichemItem1, 8, 1); - mWoodPellet = ItemUtils.simpleMetaStack(mAgrichemItem1, 9, 1); - mWoodBrick = ItemUtils.simpleMetaStack(mAgrichemItem1, 10, 1); - mCellulosePulp = ItemUtils.simpleMetaStack(mAgrichemItem1, 11, 1); - mRawBioResin = ItemUtils.simpleMetaStack(mAgrichemItem1, 12, 1); - mCatalystCarrier = ItemUtils.simpleMetaStack(mAgrichemItem1, 13, 1); - mGreenCatalyst = ItemUtils.simpleMetaStack(mAgrichemItem1, 14, 1); - mAlginicAcid = ItemUtils.simpleMetaStack(mAgrichemItem1, 15, 1); - mAlumina = ItemUtils.simpleMetaStack(mAgrichemItem1, 16, 1); - mAluminiumPellet = ItemUtils.simpleMetaStack(mAgrichemItem1, 17, 1); - mSodiumAluminate = ItemUtils.simpleMetaStack(mAgrichemItem1, 18, 1); - - /** - * If It exists, don't add a new one. - */ - if (OreDictionary.doesOreNameExist("dustSodiumHydroxide_GT5U") || OreDictionary.doesOreNameExist("dustSodiumHydroxide")) { - List aTest = OreDictionary.getOres("dustSodiumHydroxide", false); - ItemStack aTestStack; - if (aTest.isEmpty()) { - aTest = OreDictionary.getOres("dustSodiumHydroxide_GT5U", false); - if (aTest.isEmpty()) { - aTestStack = ItemUtils.simpleMetaStack(mAgrichemItem1, 19, 1); - } - else { - aTestStack = aTest.get(0); - } - } - else { - aTestStack = aTest.get(0); - } - mSodiumHydroxide = aTestStack; - } - else { - mSodiumHydroxide = ItemUtils.simpleMetaStack(mAgrichemItem1, 19, 1); - } - mSodiumCarbonate = ItemUtils.simpleMetaStack(mAgrichemItem1, 20, 1); - mLithiumChloride = ItemUtils.simpleMetaStack(mAgrichemItem1, 21, 1); - - mInstance.log("OreDicting Items"); - ItemUtils.addItemToOreDictionary(mGreenAlgaeBiosmass, "biomassGreenAlgae"); - ItemUtils.addItemToOreDictionary(mBrownAlgaeBiosmass, "biomassBrownAlgae"); - ItemUtils.addItemToOreDictionary(mGoldenBrownAlgaeBiosmass, "biomassGoldenBrownAlgae"); - ItemUtils.addItemToOreDictionary(mRedAlgaeBiosmass, "biomassRedAlgae"); - - ItemUtils.addItemToOreDictionary(mCelluloseFiber, "fiberCellulose"); - ItemUtils.addItemToOreDictionary(mGoldenBrownCelluloseFiber, "fiberCellulose"); - ItemUtils.addItemToOreDictionary(mGoldenBrownCelluloseFiber, "fiberGoldenBrownCellulose"); - ItemUtils.addItemToOreDictionary(mRedCelluloseFiber, "fiberCellulose"); - ItemUtils.addItemToOreDictionary(mRedCelluloseFiber, "fiberRedCellulose"); - - ItemUtils.addItemToOreDictionary(mWoodPellet, "pelletWood"); - ItemUtils.addItemToOreDictionary(mWoodBrick, "brickWood"); - ItemUtils.addItemToOreDictionary(mCellulosePulp, "pulpCellulose"); - - ItemUtils.addItemToOreDictionary(mCatalystCarrier, "catalystEmpty"); - ItemUtils.addItemToOreDictionary(mGreenCatalyst, "catalystAluminiumSilver"); - ItemUtils.addItemToOreDictionary(mAlginicAcid, "dustAlginicAcid"); - ItemUtils.addItemToOreDictionary(mAlumina, "dustAlumina"); - ItemUtils.addItemToOreDictionary(mAluminiumPellet, "pelletAluminium"); - - ItemUtils.addItemToOreDictionary(mSodiumAluminate, "dustSodiumAluminate"); - if (mSodiumHydroxide.getItem() instanceof ItemAgrichemBase) { - ItemUtils.addItemToOreDictionary(mSodiumHydroxide, "dustSodiumHydroxide"); - } - ItemUtils.addItemToOreDictionary(mSodiumCarbonate, "dustSodiumCarbonate"); - ItemUtils.addItemToOreDictionary(mLithiumChloride, "dustLithiumChloride"); + mInstance.log("Setting Items"); return true; } @Override public boolean postInit() { mInstance.log("Generating Recipes"); - BioRecipes.init(); return true; } diff --git a/src/Java/gtPlusPlus/plugin/agrichem/block/AgrichemFluids.java b/src/Java/gtPlusPlus/plugin/agrichem/block/AgrichemFluids.java index 1f686cf810..099645131a 100644 --- a/src/Java/gtPlusPlus/plugin/agrichem/block/AgrichemFluids.java +++ b/src/Java/gtPlusPlus/plugin/agrichem/block/AgrichemFluids.java @@ -32,6 +32,9 @@ public class AgrichemFluids { public static Fluid mFermentationBase; public static Fluid mUrea; public static Fluid mLiquidResin; + public static Fluid mAcetone; + public static Fluid mButanol; + public static void init() { @@ -65,6 +68,19 @@ public class AgrichemFluids { else { mLiquidResin = FluidRegistry.getFluid("liquidresin"); } + + if (!FluidRegistry.isFluidRegistered("acetone")) { + mAcetone = FluidUtils.generateFluidNoPrefix("acetone", "Acetone", 200, new short[] { 59, 58, 56, 100 }, true); + } + else { + mAcetone = FluidRegistry.getFluid("acetone"); + } + if (!FluidRegistry.isFluidRegistered("butanol")) { + mButanol = FluidUtils.generateFluidNoPrefix("butanol", "Butanol", 200, new short[] { 159, 58, 56, 100 }, true); + } + else { + mButanol = FluidRegistry.getFluid("butanol"); + } } diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java b/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java index 7d45899911..49b8da0d1b 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java @@ -109,7 +109,6 @@ public class GTPP_Bees { private void addExtractorRecipe(ItemStack input, FluidStack output){ CORE.RA.addFluidExtractionRecipe( input, - null, output, 30, 8); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 7a83392c07..588c04d7e5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -478,6 +478,10 @@ public enum GregtechItemList implements GregtechItemContainer { Machine_ZPM_Component_Maker, Machine_UV_Component_Maker, + // Fluid Reactor + FluidReactor_LV, FluidReactor_HV, + FluidReactor_IV, FluidReactor_ZPM, + //Breakers BreakerBox_ULV, BreakerBox_LV, BreakerBox_MV, BreakerBox_HV, BreakerBox_EV, BreakerBox_IV, @@ -601,7 +605,7 @@ public enum GregtechItemList implements GregtechItemContainer { FakeMachineCasingPlate_MV, FakeMachineCasingPlate_HV, FakeMachineCasingPlate_EV, FakeMachineCasingPlate_IV, FakeMachineCasingPlate_LuV, FakeMachineCasingPlate_ZPM, - FakeMachineCasingPlate_UV, FakeMachineCasingPlate_MAX, + FakeMachineCasingPlate_UV, FakeMachineCasingPlate_MAX, //---------------------------------------------------------------------------- diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java new file mode 100644 index 0000000000..0c64644166 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java @@ -0,0 +1,182 @@ +package gtPlusPlus.xmod.gregtech.api.gui.fluidreactor; + +import java.util.Iterator; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_Container_BasicMachine; +import gregtech.api.gui.GT_Slot_Render; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.slots.SlotChemicalPlantInput; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntity_ChemicalReactor; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.item.ItemStack; + +public class Container_FluidReactor extends GT_Container_BasicMachine { + + public boolean mFluidTransfer_1 = false; + public boolean mFluidTransfer_2 = false; + public boolean oFluidTransfer_1 = false; + public boolean oFluidTransfer_2 = false; + + public Container_FluidReactor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + + // Gui Buttons + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, 0, 8, 63)); // Fluid 1 + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, 1, 44, 63)); + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, 2, 26, 63)); // Fluid 2 + + int tStartIndex = 3; + // Input Slots + this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 8, 7)); + this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 26, 7)); + this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 44, 7)); + this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 62, 7)); + + // Output Slots + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 107, 16)); + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 125, 16)); + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 107, 34)); + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 125, 34)); + + // Cell Collector Slot + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 116, 63)); + + + // Inputs Fluids + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 8, 42)); + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 26, 42)); + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 44, 42)); + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 62, 42)); + + // Output Fluids + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 143, 16)); + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 143, 34)); + + + + + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex == 0 || aSlotIndex == 2) { + if (this.mTileEntity != null && this.mTileEntity.isServerSide()) { + try { + final IMetaTileEntity aMetaTileEntity = this.mTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return null; + } + if (aMetaTileEntity instanceof GregtechMetaTileEntity_ChemicalReactor) { + //Set Tile + if (aSlotIndex == 0) { + ((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_1 = !((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_1; + } + else if (aSlotIndex == 2) { + ((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_2 = !((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_2; + } + return null; + } + } + catch (Throwable t) { + t.printStackTrace(); + } + } + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (this.mTileEntity != null && this.mTileEntity.isServerSide()) { + try { + Iterator var2 = this.crafters.iterator(); + final IMetaTileEntity aMetaTileEntity = this.mTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + Logger.INFO("bad"); + return; + } + if (aMetaTileEntity instanceof GregtechMetaTileEntity_ChemicalReactor) { + //Read from Tile + this.mFluidTransfer_1 = ((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_1; + this.mFluidTransfer_2 = ((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_2; + int mTimer; + mTimer = (int) ReflectionUtils.getField(this.getClass(), "mTimer").get(this); + while (true) { + ICrafting var1; + do { + if (!var2.hasNext()) { + this.oFluidTransfer_1 = this.mFluidTransfer_1; + this.oFluidTransfer_2 = this.mFluidTransfer_2; + return; + } + var1 = (ICrafting) var2.next(); + if (mTimer % 500 == 10 || this.oFluidTransfer_1 != this.mFluidTransfer_1) { + var1.sendProgressBarUpdate(this, -50, this.mFluidTransfer_1 ? 1 : 0); + } + if (mTimer % 500 == 10 || this.oFluidTransfer_2 != this.mFluidTransfer_2) { + var1.sendProgressBarUpdate(this, -51, this.mFluidTransfer_2 ? 1 : 0); + } + } while (mTimer % 500 != 10); + } + } + else { + Logger.INFO("bad cast"); + } + } + catch (IllegalArgumentException | IllegalAccessException e) { + e.printStackTrace(); + } + } + + } + + public void addCraftingToCrafters(ICrafting par1ICrafting) { + super.addCraftingToCrafters(par1ICrafting); + } + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + if (par1 > 0) { + super.updateProgressBar(par1, par2); + } + else { + switch (par1) { + case -50 : + this.mFluidTransfer_1 = par2 != 0; + break; + case -51 : + this.mFluidTransfer_2 = par2 != 0; + break; + default : + break; + } + } + } + + public int getSlotStartIndex() { + return 3; + } + + public int getShiftClickStartIndex() { + return 3; + } + + public int getSlotCount() { + return this.getShiftClickSlotCount() + 5 + 2; + } + + public int getShiftClickSlotCount() { + return 4; + } +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java new file mode 100644 index 0000000000..1be79b40cc --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java @@ -0,0 +1,122 @@ +package gtPlusPlus.xmod.gregtech.api.gui.fluidreactor; + +import gregtech.api.gui.GT_Container_BasicMachine; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.lib.CORE; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.entity.player.InventoryPlayer; + +public class GUI_FluidReactor extends GT_GUIContainerMetaTile_Machine { + public final String mName; + public final String mNEI; + public final byte mProgressBarDirection; + public final byte mProgressBarAmount; + + public GUI_FluidReactor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, + String aTextureFile, String aNEI) { + this(aInventoryPlayer, aTileEntity, aName, aTextureFile, aNEI, (byte) 0, (byte) 1); + } + + public GUI_FluidReactor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, + String aTextureFile, String aNEI, byte aProgressBarDirection, byte aProgressBarAmount) { + super(new Container_FluidReactor(aInventoryPlayer, aTileEntity), CORE.MODID+":textures/gui/FluidReactor.png"); + this.mProgressBarDirection = aProgressBarDirection; + this.mProgressBarAmount = (byte) Math.max(1, aProgressBarAmount); + this.mName = aName; + this.mNEI = aNEI; + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + this.fontRendererObj.drawString(this.mName, 82, 5, 4210752); + this.drawTooltip(par1, par2); + } + + private void drawTooltip(int x2, int y2) { + int xStart = (this.width - this.xSize) / 2; + int yStart = (this.height - this.ySize) / 2; + int x = x2 - xStart; + int y = y2 - yStart + 5; + List list = new ArrayList(); + if (y >= 67 && y <= 84) { + if (x >= 7 && x <= 24) { + list.add("Fluid 1 Auto-Output"); + } + if (x >= 25 && x <= 42) { + list.add("Fluid 2 Auto-Output"); + } + if (x >= 43 && x <= 61) { + list.add("Item Auto-Output"); + } + } + + if (!list.isEmpty()) { + this.drawHoveringText(list, x, y, this.fontRendererObj); + } + + } + + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (this.width - this.xSize) / 2; + int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + if (this.mContainer != null) { + if (((Container_FluidReactor) this.mContainer).mFluidTransfer_1) { + this.drawTexturedModalRect(x + 7, y + 62, 176, 18, 18, 18); + } + if (((Container_FluidReactor) this.mContainer).mFluidTransfer_2) { + this.drawTexturedModalRect(x + 25, y + 62, 194, 18, 18, 18); + } + if (((GT_Container_BasicMachine) this.mContainer).mItemTransfer) { + this.drawTexturedModalRect(x + 43, y + 62, 176, 36, 18, 18); + } + + if (((GT_Container_BasicMachine) this.mContainer).mStuttering) { + this.drawTexturedModalRect(x + 79, y + 44, 176, 54, 18, 18); + } + + if (this.mContainer.mMaxProgressTime > 0) { + int tSize = this.mProgressBarDirection < 2 ? 20 : 18; + int tProgress = Math + .max(1, Math + .min(tSize * this.mProgressBarAmount, + (this.mContainer.mProgressTime > 0 ? 1 : 0) + this.mContainer.mProgressTime + * tSize * this.mProgressBarAmount / this.mContainer.mMaxProgressTime)) + % (tSize + 1); + switch (this.mProgressBarDirection) { + case 0 : + this.drawTexturedModalRect(x + 82, y + 24, 176, 0, tProgress, 18); + break; + case 1 : + this.drawTexturedModalRect(x + 82 + 20 - tProgress, y + 24, 196 - tProgress, 0, tProgress, 18); + break; + case 2 : + this.drawTexturedModalRect(x + 82, y + 24, 176, 0, 20, tProgress); + break; + case 3 : + this.drawTexturedModalRect(x + 82, y + 24 + 18 - tProgress, 176, 18 - tProgress, 20, tProgress); + break; + case 4 : + tProgress = 20 - tProgress; + this.drawTexturedModalRect(x + 82, y + 24, 176, 0, tProgress, 18); + break; + case 5 : + tProgress = 20 - tProgress; + this.drawTexturedModalRect(x + 82 + 20 - tProgress, y + 24, 196 - tProgress, 0, tProgress, 18); + break; + case 6 : + tProgress = 18 - tProgress; + this.drawTexturedModalRect(x + 82, y + 24, 176, 0, 20, tProgress); + break; + case 7 : + tProgress = 18 - tProgress; + this.drawTexturedModalRect(x + 82, y + 24 + 18 - tProgress, 176, 18 - tProgress, 20, tProgress); + } + } + } + + } +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index 2726b140ca..ceb2685b7f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -216,6 +216,8 @@ public interface IGregtech_RecipeAdder { public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aDust, ItemStack aOutput); + public boolean addFluidExtractionRecipe(ItemStack input, FluidStack output, int aTime, int aEu); + public boolean addFluidExtractionRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidOut, int aTime, int aEu); public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn); @@ -269,4 +271,9 @@ public interface IGregtech_RecipeAdder { public boolean addUvLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu); public boolean addIrLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu); + public boolean addFluidReactorRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier); + + public boolean addBlastRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aHeat); + + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index 09f3f2d1f5..6cac1fddea 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -350,8 +350,13 @@ public class TexturesGtBlock { private static final CustomIcon Internal_Overlay_Machine_Controller_Advanced_Active = new CustomIcon("iconsets/OVERLAY_FRONT_ADVANCED_MULTIBLOCK_ANIMATED_ACTIVE"); public static final CustomIcon Overlay_Machine_Controller_Advanced_Active = Internal_Overlay_Machine_Controller_Advanced_Active; - - + //Fluid Reactor Overlays + public static final CustomIcon Overlay_FluidReactor_Front = new CustomIcon("TileEntities/FluidReactor/OVERLAY_FRONT"); + public static final CustomIcon Overlay_FluidReactor_Side = new CustomIcon("TileEntities/FluidReactor/OVERLAY_SIDE"); + public static final CustomIcon Overlay_FluidReactor_Top = new CustomIcon("TileEntities/FluidReactor/OVERLAY_TOP"); + public static final CustomIcon Overlay_FluidReactor_Front_Active = new CustomIcon("TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE"); + public static final CustomIcon Overlay_FluidReactor_Side_Active = new CustomIcon("TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE"); + public static final CustomIcon Overlay_FluidReactor_Top_Active = new CustomIcon("TileEntities/FluidReactor/OVERLAY_TOP_ACTIVE"); //Crafting Overlays private static final CustomIcon Internal_Overlay_Crafting_Bronze = new CustomIcon("TileEntities/bronze_top_crafting"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java new file mode 100644 index 0000000000..288b48ebb5 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java @@ -0,0 +1,706 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; + +import static gregtech.api.enums.GT_Values.E; + +import java.util.HashSet; +import java.util.List; + +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.objects.XSTR; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.Recipe_GT; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.slots.SlotChemicalPlantInput; +import gtPlusPlus.xmod.gregtech.api.gui.fluidreactor.Container_FluidReactor; +import gtPlusPlus.xmod.gregtech.api.gui.fluidreactor.GUI_FluidReactor; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidHandler; + +public class GregtechMetaTileEntity_ChemicalReactor extends GT_MetaTileEntity_BasicMachine { + + public boolean mFluidTransfer_1 = false; + public boolean mFluidTransfer_2 = false; + + public FluidStack[] mInputFluids = new FluidStack[4]; + public FluidStack[] mOutputFluids = new FluidStack[2]; + + private static final GT_Recipe_Map mFluidChemicalReactorRecipes = new GT_Recipe_Map( + new HashSet(100), + "gt.recipe.fluidchemicaleactor", + "Chemical Plant", + null, + CORE.MODID+":textures/gui/FluidReactor", + 0, + 0, + 0, + 2, + 1, + "Tier: ", + 1, + E, + true, + false); + + public GregtechMetaTileEntity_ChemicalReactor(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 1, + "For mixing fluids", 4, 4, "ChemicalReactor.png", "", + new ITexture[]{ + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Side_Active), + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Side), + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Front_Active), + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Front), + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top_Active), + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top), + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top_Active), + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top) + } + ); + } + + public GregtechMetaTileEntity_ChemicalReactor(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); + } + + /*public GregtechMetaTileEntity_BasicWasher(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); + }*/ + + @Override + public String[] getDescription() { + return new String[]{this.mDescription, "Because why not?", }; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + try { + GregtechMetaTileEntity_ChemicalReactor y = new GregtechMetaTileEntity_ChemicalReactor(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName); + return y; + } + catch(Throwable t) { + t.printStackTrace(); + } + return null; + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + try { + Container_FluidReactor y = new Container_FluidReactor(aPlayerInventory, aBaseMetaTileEntity); + return y; + } + catch(Throwable t) { + t.printStackTrace(); + } + return null; + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_FluidReactor(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), + this.mGUIName, + GT_Utility.isStringValid(this.mNEIName) + ? this.mNEIName + : (this.getRecipeList() != null ? this.getRecipeList().mUnlocalizedName : "")); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeList() { + if (mFluidChemicalReactorRecipes.mRecipeList.isEmpty()) { + for (Recipe_GT i :Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList) { + mFluidChemicalReactorRecipes.add(i); + } + } + return mFluidChemicalReactorRecipes; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (getRecipeList().containsInput(aStack)); + } + + @Override + public boolean isFluidInputAllowed(FluidStack aFluid) { + return (super.isFluidInputAllowed(aFluid)); + } + + @Override + public int getCapacity() { + return 8000 * Math.max(1, this.mTier); + } + + @Override + public int getInputSlot() { + return 3; + } + + @Override + public boolean isLiquidInput(byte aSide) { + return aSide > 1; + } + + @Override + public boolean isLiquidOutput(byte aSide) { + return aSide < 2; + } + + @Override + public int getOutputSlot() { + return super.getOutputSlot(); + } + + @Override + public int getStackDisplaySlot() { + return super.getStackDisplaySlot(); + } + + @Override + public boolean doesEmptyContainers() { + return true; + } + + @Override + public boolean canTankBeFilled() { + return super.canTankBeFilled(); + } + + @Override + public boolean canTankBeEmptied() { + return super.canTankBeEmptied(); + } + + @Override + public FluidStack getDisplayedFluid() { + return super.getDisplayedFluid(); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setBoolean("mFluidTransfer_1", mFluidTransfer_1); + aNBT.setBoolean("mFluidTransfer_2", mFluidTransfer_2); + for (int i=0;i<4;i++) { + if (this.mInputFluids[i] != null) { + aNBT.setTag("mInputFluid"+i, this.mInputFluids[i].writeToNBT(new NBTTagCompound())); + } + } + for (int i=0;i<2;i++) { + if (this.mOutputFluids[i] != null) { + aNBT.setTag("mOutputFluid"+i, this.mOutputFluids[i].writeToNBT(new NBTTagCompound())); + } + } + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mFluidTransfer_1 = aNBT.getBoolean("mFluidTransfer_1"); + mFluidTransfer_2 = aNBT.getBoolean("mFluidTransfer_2"); + for (int i=0;i<4;i++) { + if (this.mInputFluids[i] == null) { + this.mInputFluids[i] = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mInputFluid"+i)); + } + } + for (int i=0;i<2;i++) { + if (this.mOutputFluids[i] == null) { + this.mOutputFluids[i] = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mOutputFluid"+i)); + } + } + } + + /* + * Custom Fluid Handling - TODO + */ + + public FluidStack getFillableStack() { + return this.mFluid; + } + + public FluidStack setFillableStack(FluidStack aFluid) { + this.mFluid = aFluid; + return this.mFluid; + } + + public FluidStack getDrainableStack() { + return this.mFluid; + } + + public FluidStack setDrainableStack(FluidStack aFluid) { + this.mFluid = aFluid; + return this.mFluid; + } + + + + + + + + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + + // Re-implement basic machine logic from the ground up. + + if (aBaseMetaTileEntity.isServerSide()) { + this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L; + this.mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3L; + this.doDisplayThings(); + boolean tSucceeded = false; + int i; + if (this.mMaxProgresstime > 0 && (this.mProgresstime >= 0 || aBaseMetaTileEntity.isAllowedToWork())) { + aBaseMetaTileEntity.setActive(true); + if (this.mProgresstime >= 0 && !this.drainEnergyForProcess((long) this.mEUt)) { + if (!this.mStuttering) { + this.stutterProcess(); + if (this.canHaveInsufficientEnergy()) { + this.mProgresstime = -100; + } + + this.mStuttering = true; + } + } else { + if (++this.mProgresstime >= this.mMaxProgresstime) { + for (i = 0; i < this.mOutputItems.length; ++i) { + for (i = 0; i < this.mOutputItems.length && !aBaseMetaTileEntity.addStackToSlot( + this.getOutputSlot() + (i + i) % this.mOutputItems.length, + this.mOutputItems[i]); ++i) { + ; + } + } + + if (this.mOutputFluid != null) { + if (this.getDrainableStack() == null) { + this.setDrainableStack(this.mOutputFluid.copy()); + } else if (this.mOutputFluid.isFluidEqual(this.getDrainableStack())) { + FluidStack var10000 = this.getDrainableStack(); + var10000.amount += this.mOutputFluid.amount; + } + } + + for (i = 0; i < this.mOutputItems.length; ++i) { + this.mOutputItems[i] = null; + } + + this.mOutputFluid = null; + this.mEUt = 0; + this.mProgresstime = 0; + this.mMaxProgresstime = 0; + this.mStuttering = false; + tSucceeded = true; + this.endProcess(); + } + + if (this.mProgresstime > 5) { + this.mStuttering = false; + } + + XSTR aXSTR = new XSTR(); + if (GT_Mod.gregtechproxy.mAprilFool && aXSTR.nextInt(5000) == 0) { + GT_Utility.sendSoundToPlayers(aBaseMetaTileEntity.getWorld(), + (String) GregTech_API.sSoundList.get(5), 10.0F, -1.0F, aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()); + } + } + } else { + aBaseMetaTileEntity.setActive(false); + } + + boolean tRemovedOutputFluid = false; + if (this.doesAutoOutputFluids() && this.getDrainableStack() != null + && aBaseMetaTileEntity.getFrontFacing() != this.mMainFacing && (tSucceeded || aTick % 20L == 0L)) { + IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); + if (tTank != null) { + FluidStack tDrained = this.drain(1000, false); + if (tDrained != null) { + int tFilledAmount = tTank.fill( + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false); + if (tFilledAmount > 0) { + tTank.fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), + this.drain(tFilledAmount, true), true); + } + } + } + + if (this.getDrainableStack() == null) { + tRemovedOutputFluid = true; + } + } + + int j; + if (this.doesAutoOutput() && !this.isOutputEmpty() + && aBaseMetaTileEntity.getFrontFacing() != this.mMainFacing + && (tSucceeded || this.mOutputBlocked % 300 == 1 || aBaseMetaTileEntity.hasInventoryBeenModified() + || aTick % 600L == 0L)) { + TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing()); + j = 0; + + for (byte tCosts = 1; j < this.mOutputItems.length && tCosts > 0 + && aBaseMetaTileEntity.isUniversalEnergyStored(128L); ++j) { + tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2, + aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), (List) null, + false, (byte) 64, (byte) 1, (byte) 64, (byte) 1); + if (tCosts > 0) { + aBaseMetaTileEntity.decreaseStoredEnergyUnits((long) tCosts, true); + } + } + } + + if (this.mOutputBlocked != 0) { + if (this.isOutputEmpty()) { + this.mOutputBlocked = 0; + } else { + ++this.mOutputBlocked; + } + } + + if (this.allowToCheckRecipe()) { + if (this.mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() + && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() + || aTick % 600L == 0L || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) + && this.hasEnoughEnergyToCheckRecipe()) { + if (this.checkRecipe() == 2) { + if (this.mInventory[3] != null && this.mInventory[3].stackSize <= 0) { + this.mInventory[3] = null; + } + + i = this.getInputSlot(); + + for (j = i + this.mInputSlotCount; i < j; ++i) { + if (this.mInventory[i] != null && this.mInventory[i].stackSize <= 0) { + this.mInventory[i] = null; + } + } + + for (i = 0; i < this.mOutputItems.length; ++i) { + this.mOutputItems[i] = GT_Utility.copy(new Object[]{this.mOutputItems[i]}); + if (this.mOutputItems[i] != null && this.mOutputItems[i].stackSize > 64) { + this.mOutputItems[i].stackSize = 64; + } + + this.mOutputItems[i] = GT_OreDictUnificator.get(true, this.mOutputItems[i]); + } + + if (this.mFluid != null && this.mFluid.amount <= 0) { + this.mFluid = null; + } + + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + if (GT_Utility.isDebugItem(this.mInventory[this.dechargerSlotStartIndex()])) { + this.mEUt = this.mMaxProgresstime = 1; + } + + this.startProcess(); + } else { + this.mMaxProgresstime = 0; + + for (i = 0; i < this.mOutputItems.length; ++i) { + this.mOutputItems[i] = null; + } + + this.mOutputFluid = null; + } + } + } else if (!this.mStuttering) { + this.stutterProcess(); + this.mStuttering = true; + } + } + + + + } + + @Override + protected void doDisplayThings() { + // TODO Auto-generated method stub + super.doDisplayThings(); + } + + @Override + protected ItemStack getSpecialSlot() { + // TODO Auto-generated method stub + return super.getSpecialSlot(); + } + + @Override + protected ItemStack getOutputAt(int aIndex) { + // TODO Auto-generated method stub + return super.getOutputAt(aIndex); + } + + @Override + protected ItemStack[] getAllOutputs() { + // TODO Auto-generated method stub + return super.getAllOutputs(); + } + + @Override + protected ItemStack getInputAt(int aIndex) { + // TODO Auto-generated method stub + return super.getInputAt(aIndex); + } + + @Override + protected ItemStack[] getAllInputs() { + // TODO Auto-generated method stub + return super.getAllInputs(); + } + + @Override + protected boolean displaysInputFluid() { + return true; + } + + @Override + protected boolean displaysOutputFluid() { + return true; + } + + @Override + public boolean doesAutoOutput() { + return super.doesAutoOutput(); + } + + @Override + public boolean doesAutoOutputFluids() { + return this.mFluidTransfer_1 && this.mFluidTransfer_2; + } + + @Override + public void startProcess() { + super.startProcess(); + } + + @Override + public void endProcess() { + super.endProcess(); + } + + @Override + public String[] getInfoData() { + return super.getInfoData(); + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPullStack(aBaseMetaTileEntity, aIndex, aSide, aStack); + } + + @Override + public int checkRecipe() { + return super.checkRecipe(); + } + + @Override + public int checkRecipe(boolean skipOC) { + return super.checkRecipe(skipOC); + } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPreTick(aBaseMetaTileEntity, aTick); + + /* if (aBaseMetaTileEntity != null) { + if (!aBaseMetaTileEntity.getWorld().isRemote) { + itemslots : for (int i=3;i<7;i++) { + ItemStack aStack = aBaseMetaTileEntity.getStackInSlot(i); + if (aStack != null) { + if (FluidContainerRegistry.isContainer(aStack)) { + if (this.isItemValidForSlot(i, aStack)) { + // Add Fluid + FluidStack aContainerFluid = FluidContainerRegistry.getFluidForFilledItem(aStack); + if (aContainerFluid != null) { + fluidslots : for (FluidStack u : mInputFluids) { + if (u != null && u.isFluidEqual(aContainerFluid)) { + if (u.amount <= (this.getCapacity() - aContainerFluid.amount)) { + + // Matching, not full, let's fill, then continue + u.amount += aContainerFluid.amount; + + // Update stack size + if (aStack.stackSize > 1) { + aStack.stackSize--; + } + else { + aStack = null; + } + + // Add Output container + // TODO + + continue itemslots; + } + else { + // Too full + break fluidslots; + } + } + else { + if (u == null ) { + + // Empty, let's fill, then continue + u = aContainerFluid.copy(); + + // Update stack size + if (aStack.stackSize > 1) { + aStack.stackSize--; + } + else { + aStack = null; + } + + // Add Output container + // TODO + + continue itemslots; + + } + else { + // Not empty, doesn't match, check next slot. + continue fluidslots; + } + } + } + + + + } + // Eat Input + + // Add Container to Output + } + } + } + } + } + }*/ + + } + + @Override + public FluidStack getFluid() { + return super.getFluid(); + } + + @Override + public int getFluidAmount() { + return super.getFluidAmount(); + } + + @Override + public int fill(FluidStack aFluid, boolean doFill) { + return super.fill(aFluid, doFill); + } + + @Override + public FluidStack drain(int maxDrain, boolean doDrain) { + return super.drain(maxDrain, doDrain); + } + + @Override + protected void onEmptyingContainerWhenEmpty() { + super.onEmptyingContainerWhenEmpty(); + } + + @Override + public void setItemNBT(NBTTagCompound aNBT) { + super.setItemNBT(aNBT); + } + + @Override + public boolean isItemValidForSlot(int aIndex, ItemStack aStack) { + if (aIndex >= 3 && aIndex <= 6) { + return SlotChemicalPlantInput.isItemValidForChemicalPlantSlot(aStack); + } + return false; + } + + @Override + public int[] getAccessibleSlotsFromSide(int aSide) { + return super.getAccessibleSlotsFromSide(aSide); + } + + @Override + public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { + if (aIndex >= 3 && aIndex <= 6) { + return super.canInsertItem(aIndex, aStack, aSide); + } + return false; + } + + @Override + public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { + if (aIndex >= 7 && aIndex <= 11) { + return super.canExtractItem(aIndex, aStack, aSide); + } + return false; + } + + @Override + public boolean canFill(ForgeDirection aSide, Fluid aFluid) { + // TODO Auto-generated method stub + return super.canFill(aSide, aFluid); + } + + @Override + public boolean canDrain(ForgeDirection aSide, Fluid aFluid) { + // TODO Auto-generated method stub + return super.canDrain(aSide, aFluid); + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { + // TODO Auto-generated method stub + return super.getTankInfo(aSide); + } + + @Override + public int fill_default( + ForgeDirection aSide, FluidStack aFluid, boolean doFill + ) { + // TODO Auto-generated method stub + return super.fill_default(aSide, aFluid, doFill); + } + + @Override + public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { + // TODO Auto-generated method stub + return super.fill(aSide, aFluid, doFill); + } + + @Override + public FluidStack drain( + ForgeDirection aSide, FluidStack aFluid, boolean doDrain + ) { + // TODO Auto-generated method stub + return super.drain(aSide, aFluid, doDrain); + } + + @Override + public FluidStack drain( + ForgeDirection aSide, int maxDrain, boolean doDrain + ) { + // TODO Auto-generated method stub + return super.drain(aSide, maxDrain, doDrain); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java index ce4a6c629a..fbf61598d3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java @@ -31,7 +31,7 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { return isValid; } public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluid) { - this(aExtracting, aEmpty, aFull, aFluid, null, null, null); + this(aExtracting, aEmpty, aFull, aFluid, GT_Values.NF, null, null); } public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluidIn, FluidStack aFluidOut) { @@ -39,7 +39,7 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { } public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluid, Integer aDuration, Integer aEUt) { - this(aExtracting, aEmpty, aFull, aFluid, null, aDuration, aEUt); + this(aExtracting, aEmpty, aFull, aFluid, GT_Values.NF, aDuration, aEUt); } // Alternative Constructor @@ -68,7 +68,7 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { if (aExtracting) { aInput = aFull; aOutput = aEmpty; - aFluidInput = null; + aFluidInput = GT_Values.NF; aFluidOutput = aFluidIn; } else { @@ -93,23 +93,34 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { 0); - // Not Valid - if ((aExtracting && (aInput == null || aOutput == null ||(aFluidInput == null && aFluidOutput == null))) || (!aExtracting && (aInput == null || aOutput == null || (aFluidInput == null && aFluidOutput == null)))) { - isValid = false; - disableOptional = aExtracting; - recipe = null; + // Check Valid + boolean aTempValidityCheck = false; + if (aExtracting) { + if (aInput != null && aFluidOutput != null) { + aTempValidityCheck = true; + } } else { + if (aInput != null && aOutput != null && (aFluidInput != null || aFluidOutput != null)) { + aTempValidityCheck = true; + } + } + + + if (aTempValidityCheck) { // Valid Recipe recipe = aRecipe; mRecipeGenMap.add(this); disableOptional = aExtracting; - isValid = true; + isValid = true; + } + else { + isValid = false; + disableOptional = aExtracting; + aRecipe.mEnabled = false; + aRecipe.mHidden = true; + recipe = null; } - - - - } @Override @@ -129,25 +140,23 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { } private final boolean addFluidExtractionRecipe(GT_Recipe aRecipe) { - if (aRecipe != null) { - if ((aRecipe.mDuration = GregTech_API.sRecipeFile.get("fluidextractor", aRecipe.mInputs[0], aRecipe.mDuration)) <= 0) { - return false; - } else { - GT_Recipe_Map.sFluidExtractionRecipes.addRecipe(aRecipe); - return true; - } + if (aRecipe != null) { + int aCount1 = GT_Recipe_Map.sFluidExtractionRecipes.mRecipeList.size(); + int aCount2 = aCount1; + GT_Recipe_Map.sFluidExtractionRecipes.addRecipe(aRecipe); + aCount1 = GT_Recipe_Map.sFluidExtractionRecipes.mRecipeList.size(); + return aCount1 > aCount2; } return false; } private final boolean addFluidCannerRecipe(GT_Recipe recipe2) { - if (recipe2 != null) { - if ((recipe2.mDuration = GregTech_API.sRecipeFile.get("fluidcanner", recipe2.mOutputs[0], recipe2.mDuration)) <= 0) { - return false; - } else { - GT_Recipe_Map.sFluidCannerRecipes.addRecipe(recipe2); - return true; - } + if (recipe2 != null) { + int aCount1 = GT_Recipe_Map.sFluidCannerRecipes.mRecipeList.size(); + int aCount2 = aCount1; + GT_Recipe_Map.sFluidCannerRecipes.addRecipe(recipe2); + aCount1 = GT_Recipe_Map.sFluidCannerRecipes.mRecipeList.size(); + return aCount1 > aCount2; } return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java index 799c6cd63b..2b4e52abb9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java @@ -48,8 +48,8 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Ingot if (ItemUtils.checkForInvalidItems(material.getIngot(1))) - if (CORE.RA.addFluidExtractionRecipe(material.getIngot(1), // Input - null, // Input 2 + if (CORE.RA.addFluidExtractionRecipe( + material.getIngot(1), // Input material.getFluid(144), // Fluid Output 1 * 20, // Duration material.vVoltageMultiplier // Eu Tick @@ -63,8 +63,8 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Plate if (ItemUtils.checkForInvalidItems(material.getPlate(1))) - if (CORE.RA.addFluidExtractionRecipe(material.getPlate(1), // Input - null, // Input 2 + if (CORE.RA.addFluidExtractionRecipe( + material.getPlate(1), // Input material.getFluid(144), // Fluid Output 1 * 20, // Duration material.vVoltageMultiplier // Eu Tick @@ -78,8 +78,8 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Double Plate if (ItemUtils.checkForInvalidItems(material.getPlateDouble(1))) - if (CORE.RA.addFluidExtractionRecipe(material.getPlateDouble(1), // Input - null, // Input 2 + if (CORE.RA.addFluidExtractionRecipe( + material.getPlateDouble(1), // Input material.getFluid(288), // Fluid Output 1 * 20, // Duration material.vVoltageMultiplier // Eu Tick @@ -93,8 +93,8 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Nugget if (ItemUtils.checkForInvalidItems(material.getNugget(1))) - if (CORE.RA.addFluidExtractionRecipe(material.getNugget(1), // Input - null, // Input 2 + if (CORE.RA.addFluidExtractionRecipe( + material.getNugget(1), // Input material.getFluid(16), // Fluid Output 16, // Duration material.vVoltageMultiplier // Eu Tick @@ -108,8 +108,8 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Block if (ItemUtils.checkForInvalidItems(material.getBlock(1))) - if (CORE.RA.addFluidExtractionRecipe(material.getBlock(1), // Input - null, // Input 2 + if (CORE.RA.addFluidExtractionRecipe( + material.getBlock(1), // Input material.getFluid(144 * 9), // Fluid Output 288, // Duration material.vVoltageMultiplier // Eu Tick diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java index 58db8a473f..84188a44aa 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java @@ -137,7 +137,7 @@ public class RecipeGen_Recycling implements Runnable { //Fluid Extractor if (ItemUtils.checkForInvalidItems(tempStack)) { // mValidItems[mSlotIndex++] = tempStack; - if ((mDust != null) && CORE.RA.addFluidExtractionRecipe(tempStack, null, material.getFluid(mFluidAmount), 30, material.vVoltageMultiplier)) { + if ((mDust != null) && CORE.RA.addFluidExtractionRecipe(tempStack, material.getFluid(mFluidAmount), 30, material.vVoltageMultiplier)) { Logger.WARNING("Fluid Recycle Recipe: " + material.getLocalizedName() + " - Success - Recycle " + tempStack.getDisplayName() + " and obtain " + mFluidAmount+"mb of "+material.getFluid(1).getLocalizedName()+"."); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index fa6f2ad790..d43adb2be3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -989,6 +989,11 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } } + @Override + public boolean addFluidExtractionRecipe(ItemStack input, FluidStack output, int aTime, int aEu) { + return MaterialGenerator.addFluidExtractionRecipe(GT_Values.NI, input, output, aTime, aEu); + } + @Override public boolean addFluidExtractionRecipe(ItemStack input, ItemStack input2, FluidStack output, int aTime, int aEu) { return MaterialGenerator.addFluidExtractionRecipe(input, input2, output, aTime, aEu); @@ -1157,6 +1162,49 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } + @Override + public boolean addFluidReactorRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier) { + + Recipe_GT aSpecialRecipe = new Recipe_GT( + false, + aInputs, + aOutputs, + null, + new int[] {}, + aInputFluids, + aFluidOutputs, + time, + (int) eu, + aTier); + + int aSize = Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList.size(); + int aSize2 = aSize; + Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.add(aSpecialRecipe); + aSize = Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList.size(); + return aSize > aSize2; + } + + @Override + public boolean addBlastRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aHeat) { + Recipe_GT aSpecialRecipe = new Recipe_GT( + false, + aInputs, + aOutputs, + null, + new int[] {}, + aInputFluids, + aFluidOutputs, + time, + (int) eu, + aHeat); + + int aSize = GT_Recipe.GT_Recipe_Map.sBlastRecipes.mRecipeList.size(); + int aSize2 = aSize; + GT_Recipe.GT_Recipe_Map.sBlastRecipes.add(aSpecialRecipe); + aSize = GT_Recipe.GT_Recipe_Map.sBlastRecipes.mRecipeList.size(); + return aSize > aSize2; + + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java new file mode 100644 index 0000000000..bd0edd9002 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java @@ -0,0 +1,24 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntity_ChemicalReactor; + +public class GregtechFluidReactor { + + public static void run() { + + GregtechItemList.FluidReactor_LV + .set(new GregtechMetaTileEntity_ChemicalReactor(31021, "chemicalplant.01.tier.01", "Chemical Plant I", 1) + .getStackForm(1L)); + GregtechItemList.FluidReactor_HV + .set(new GregtechMetaTileEntity_ChemicalReactor(31022, "chemicalplant.01.tier.02", "Chemical Plant II", 3) + .getStackForm(1L)); + GregtechItemList.FluidReactor_IV + .set(new GregtechMetaTileEntity_ChemicalReactor(31023, "chemicalplant.01.tier.03", "Chemical Plant III", 5) + .getStackForm(1L)); + GregtechItemList.FluidReactor_ZPM + .set(new GregtechMetaTileEntity_ChemicalReactor(31024, "chemicalplant.01.tier.04", "Chemical Plant IV", 7) + .getStackForm(1L)); + + } +} diff --git a/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java b/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java index 6933987593..686910b9aa 100644 --- a/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java +++ b/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java @@ -221,10 +221,10 @@ public class FishTrapHandler { private static void addGregtechFluidRecipe(final ItemStack input){ if (LoadedMods.Gregtech){ if (CORE.GTNH) { - CORE.RA.addFluidExtractionRecipe(input, null, FluidUtils.getFluidStack("fishoil", 50), 16, 4); + CORE.RA.addFluidExtractionRecipe(input, FluidUtils.getFluidStack("fishoil", 50), 16, 4); } else { - CORE.RA.addFluidExtractionRecipe(input, null, FluidUtils.getFluidStack("fishoil", 4), 16, 4); //4eu/t total eu used = 64 so time = 64/4 + CORE.RA.addFluidExtractionRecipe(input, FluidUtils.getFluidStack("fishoil", 4), 16, 4); //4eu/t total eu used = 64 so time = 64/4 } } } diff --git a/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java b/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java index 56e577fb7d..3de15ce6be 100644 --- a/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java +++ b/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java @@ -34,7 +34,7 @@ public class TF_Gregtech_Recipes { //Gelid Cryotheum Logger.INFO("Adding Recipes for Gelid Cryotheum"); - CORE.RA.addFluidExtractionRecipe(dust_Cryotheum, GT_Values.NI, getFluidStack("cryotheum", 250), 200, 240); + CORE.RA.addFluidExtractionRecipe(dust_Cryotheum, getFluidStack("cryotheum", 250), 200, 240); GT_Values.RA.addChemicalBathRecipe((GT_OreDictUnificator.get(OrePrefixes.ore, Materials.Cinnabar, 1L)), getFluidStack("cryotheum", 144), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cinnabar, 3L), GT_Values.NI, GT_Values.NI, null, 400, 30); //Blizz Powder @@ -48,10 +48,10 @@ public class TF_Gregtech_Recipes { //Blazing Pyrotheum Logger.INFO("Adding Recipes for Blazing Pyrotheum"); - CORE.RA.addFluidExtractionRecipe(dust_Pyrotheum, GT_Values.NI, getFluidStack("pyrotheum", 250), 200, 240); + CORE.RA.addFluidExtractionRecipe(dust_Pyrotheum, getFluidStack("pyrotheum", 250), 200, 240); //Ender Fluid - CORE.RA.addFluidExtractionRecipe(ItemUtils.getSimpleStack(Items.ender_pearl), GT_Values.NI, getFluidStack("ender", 250), 100, 30); + CORE.RA.addFluidExtractionRecipe(ItemUtils.getSimpleStack(Items.ender_pearl), getFluidStack("ender", 250), 100, 30); ItemStack dustCoal = ItemUtils.getItemStackOfAmountFromOreDict("dustCoal", 1); diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT.png new file mode 100644 index 0000000000..e92b9c9ff8 Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE.png new file mode 100644 index 0000000000..8a47157d2b Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE.png.mcmeta new file mode 100644 index 0000000000..1367b80758 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation":{ + "frametime":2, + "frames": [0, 0, 1, 1, 2, 2, 3, 3, 3, 2, 2, 1, 1, 0] + } +} \ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE.png new file mode 100644 index 0000000000..b926eb1ef2 Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE.png new file mode 100644 index 0000000000..ae63da7746 Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE.png.mcmeta new file mode 100644 index 0000000000..8447c98f9a --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation":{ + "frametime":2, + "frames": [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0] + } +} \ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_TOP.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_TOP.png new file mode 100644 index 0000000000..e9b20bd486 Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_TOP.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_TOP_ACTIVE.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_TOP_ACTIVE.png new file mode 100644 index 0000000000..25ea33ce3a Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_TOP_ACTIVE.png differ diff --git a/src/resources/assets/miscutils/textures/gui/FluidReactor.png b/src/resources/assets/miscutils/textures/gui/FluidReactor.png new file mode 100644 index 0000000000..b8e88bd461 Binary files /dev/null and b/src/resources/assets/miscutils/textures/gui/FluidReactor.png differ diff --git a/src/resources/assets/miscutils/textures/items/bioscience/BioCircuit.png b/src/resources/assets/miscutils/textures/items/bioscience/BioCircuit.png new file mode 100644 index 0000000000..c2736be76c Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/bioscience/BioCircuit.png differ diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/8.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/8.png index c16e0a1278..c8c6299d7b 100644 Binary files a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/8.png and b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/8.png differ -- cgit From 9ba6d563d1b69bc8aa88d48754c273dae77aa713 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 24 Oct 2019 05:07:27 +0100 Subject: % Tried to adjust the name of IC2 Hot Water. $ Fixed OreDicting ore Sodium Hydroxide if GT dusts are detected. $ Fixed bad oredict look-up for RP1 cell. $ Rewrote how GT++ Materials look for existing fluids and cells during generation, hopefully this didn't break any existing cells or fluids. (Please investigate log after loading a world) --- .../core/item/base/BaseItemComponent.java | 2 +- .../core/item/chemistry/AgriculturalChem.java | 31 +- .../core/item/chemistry/RocketFuels.java | 6 +- src/Java/gtPlusPlus/core/material/Material.java | 129 +++---- .../gtPlusPlus/core/slots/SlotNoInputLogging.java | 13 +- .../util/minecraft/gregtech/PollutionUtils.java | 13 +- .../gtPlusPlus/plugin/agrichem/BioRecipes.java | 68 +++- src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java | 2 + .../gui/fluidreactor/Container_FluidReactor.java | 2 + .../xmod/gregtech/common/Meta_GT_Proxy.java | 379 ++++++++++++--------- .../GregtechMetaTileEntity_ChemicalReactor.java | 3 - src/resources/assets/miscutils/lang/en_US.lang | 11 +- 12 files changed, 382 insertions(+), 277 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/gui') diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index c8b6253753..9b732e38e1 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -169,7 +169,7 @@ public class BaseItemComponent extends Item{ if (this.componentMaterial == null){ if (this.materialName != null){ - list.add(Utils.sanitizeStringKeepBrackets(materialName)); + //list.add(Utils.sanitizeStringKeepBrackets(materialName)); } } diff --git a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java index 324a3aa9ee..55f4dfa0be 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java @@ -219,12 +219,19 @@ public class AgriculturalChem extends ItemPackage { ItemUtils.addItemToOreDictionary(mAluminiumPellet, "pelletAluminium"); ItemUtils.addItemToOreDictionary(mSodiumAluminate, "dustSodiumAluminate"); - if (mSodiumHydroxide.getItem() instanceof ItemAgrichemBase) { - ItemUtils.addItemToOreDictionary(mSodiumHydroxide, "dustSodiumHydroxide"); - } + ItemUtils.addItemToOreDictionary(mSodiumHydroxide, "dustSodiumHydroxide"); ItemUtils.addItemToOreDictionary(mSodiumCarbonate, "dustSodiumCarbonate"); ItemUtils.addItemToOreDictionary(mLithiumChloride, "dustLithiumChloride"); + //Handle GT NaOH dusts + List NaOHSmall = OreDictionary.getOres("dustSmallSodiumHydroxide_GT5U", false); + if (!NaOHSmall.isEmpty()) { + ItemUtils.addItemToOreDictionary(NaOHSmall.get(0), "dustSmallSodiumHydroxide"); + } + List NaOHTiny = OreDictionary.getOres("dustTinySodiumHydroxide_GT5U", false); + if (!NaOHTiny.isEmpty()) { + ItemUtils.addItemToOreDictionary(NaOHTiny.get(0), "dustTinySodiumHydroxide"); + } } @@ -300,19 +307,19 @@ public class AgriculturalChem extends ItemPackage { } - public final static AutoMap mMeats = new AutoMap(); - public final static AutoMap mFish = new AutoMap(); - public final static AutoMap mFruits = new AutoMap(); - public final static AutoMap mVege = new AutoMap(); - public final static AutoMap mNuts = new AutoMap(); - public final static AutoMap mSeeds = new AutoMap(); + private final static AutoMap mMeats = new AutoMap(); + private final static AutoMap mFish = new AutoMap(); + private final static AutoMap mFruits = new AutoMap(); + private final static AutoMap mVege = new AutoMap(); + private final static AutoMap mNuts = new AutoMap(); + private final static AutoMap mSeeds = new AutoMap(); private final static AutoMap mPeat = new AutoMap(); private final static AutoMap mBones = new AutoMap(); private final static AutoMap mBoneMeal = new AutoMap(); - public final static AutoMap mList_Master_Meats = new AutoMap(); - public final static AutoMap mList_Master_FruitVege = new AutoMap(); - public final static AutoMap mList_Master_Seeds = new AutoMap(); + private final static AutoMap mList_Master_Meats = new AutoMap(); + private final static AutoMap mList_Master_FruitVege = new AutoMap(); + private final static AutoMap mList_Master_Seeds = new AutoMap(); private final static AutoMap mList_Master_Bones = new AutoMap(); private static void processAllOreDict() { diff --git a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java index c02e767dcd..0bea7dfc31 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java @@ -292,7 +292,7 @@ public class RocketFuels extends ItemPackage { GT_Values.RA.addCentrifugeRecipe( CI.getNumberedCircuit(23), - ItemUtils.getItemStackOfAmountFromOreDict("cellRP1Fuel", 1), + ItemUtils.getItemStackOfAmountFromOreDict("cellRP1", 1), FluidUtils.getFluidStack(Liquid_Oxygen, 4000), FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 200), CI.emptyCells(1), @@ -679,7 +679,7 @@ public class RocketFuels extends ItemPackage { CoalTar.Coal_Oil = Kerosene; //RP! Focket Fuel - RP1 = FluidUtils.generateFluidNonMolten("RP1Fuel", "RP-1 Rocket Fuel", 500, new short[]{210, 50, 50, 100}, null, null); + RP1 = FluidUtils.generateFluidNonMolten("RP1Fuel", "RP-1", 500, new short[]{210, 50, 50, 100}, null, null); //Create Nitrogen Tetroxide Nitrogen_Tetroxide = FluidUtils.generateFluidNonMolten("NitrogenTetroxide", "Nitrogen Tetroxide", -11, new short[]{170, 170, 0, 100}, null, null); @@ -753,7 +753,7 @@ public class RocketFuels extends ItemPackage { Formaldehyde = FluidUtils.generateFluidNonMolten("Formaldehyde", "Formaldehyde", -92, new short[]{150, 75, 150, 100}, null, null); Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide = FluidUtils.generateFluidNonMolten("RocketFuelMixA", "H8N4C2O4 Rocket Fuel", -185, new short[]{50, 220, 50, 100}, null, null); - RP1_Plus_Liquid_Oxygen = FluidUtils.generateFluidNonMolten("RocketFuelMixB", "Rp-1 Fuel Mixture", -250, new short[]{250, 50, 50, 100}, null, null); + RP1_Plus_Liquid_Oxygen = FluidUtils.generateFluidNonMolten("RocketFuelMixB", "Rp-1 Rocket Fuel", -250, new short[]{250, 50, 50, 100}, null, null); Monomethylhydrazine_Plus_Nitric_Acid = FluidUtils.generateFluidNonMolten("RocketFuelMixC", "CN3H7O3 Rocket Fuel", -300, new short[]{125, 75, 180, 100}, null, null); Dense_Hydrazine_Mix = FluidUtils.generateFluidNonMolten("RocketFuelMixD", "Dense Hydrazine Fuel Mixture", -250, new short[]{175, 80, 120, 100}, null, null); diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index d95b17e75c..b5922dde53 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -1094,96 +1094,41 @@ public class Material { if (this.materialState == MaterialState.ORE){ return null; } + + Fluid aGTBaseFluid = null; - final Materials isValid = Materials.get(this.getLocalizedName()); - //Logger.MATERIALS("Is "+this.getLocalizedName()+" a Gregtech material? "+(isValid != null && isValid != Materials._NULL)+" | Found "+isValid.mDefaultLocalName); - if (isValid != Materials._NULL){ - for (Materials m : invalidMaterials.values()){ - if (isValid == m){ - Logger.MATERIALS("Trying to generate a fluid for blacklisted material: "+m.mDefaultLocalName); - FluidStack a1 = m.getFluid(1); - FluidStack a2 = m.getGas(1); - FluidStack a3 = m.getMolten(1); - FluidStack a4 = m.getSolid(1); - FluidStack a5 = m.getPlasma(1); - if (a1 != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. Fluid."); - return a1.getFluid(); - } - if (a2 != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. Gas."); - return a2.getFluid(); - } - if (a3 != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. Molten."); - return a3.getFluid(); - } - if (a4 != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. Solid."); - return a4.getFluid(); - } - if (a5 != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. Plasma."); - return a5.getFluid(); - } - Logger.MATERIALS("Using null."); - return null; - } - } - } + // Clean up Internal Fluid Generation + final Materials n1 = MaterialUtils.getMaterial(this.getLocalizedName(), Utils.sanitizeString(this.getLocalizedName())); + final Materials n2 = MaterialUtils.getMaterial(this.getUnlocalizedName(), Utils.sanitizeString(this.getUnlocalizedName())); - if (this.materialState == MaterialState.SOLID){ - if (isValid.mFluid != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. mFluid."); - return isValid.mFluid; - } - else if (isValid.mStandardMoltenFluid != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. mStandardMoltenFluid."); - return isValid.mStandardMoltenFluid; - } - } - else if (this.materialState == MaterialState.GAS){ - if (isValid.mGas != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. mGas."); - return isValid.mGas; - } - } - else if (this.materialState == MaterialState.LIQUID || this.materialState == MaterialState.PURE_LIQUID){ - if (isValid.mFluid != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. mFluid."); - return isValid.mFluid; - } - else if (isValid.mGas != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. mGas."); - return isValid.mGas; - } - else if (isValid.mStandardMoltenFluid != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. mStandardMoltenFluid."); - return isValid.mStandardMoltenFluid; - } - } - - FluidStack aTest1 = FluidUtils.getFluidStack("molten."+Utils.sanitizeString(this.getLocalizedName()), 1); - FluidStack aTest2 = FluidUtils.getFluidStack("fluid."+Utils.sanitizeString(this.getLocalizedName()), 1); - FluidStack aTest3 = FluidUtils.getFluidStack(Utils.sanitizeString(this.getLocalizedName()), 1); + FluidStack f1 = FluidUtils.getWildcardFluidStack(n1, 1); + FluidStack f2 = FluidUtils.getWildcardFluidStack(n2, 1); + FluidStack f3 = FluidUtils.getWildcardFluidStack(Utils.sanitizeString(this.getUnlocalizedName(), new char[] {'-', '_'}), 1); + FluidStack f4 = FluidUtils.getWildcardFluidStack(Utils.sanitizeString(this.getLocalizedName(), new char[] {'-', '_'}), 1); - if (aTest1 != null) { - Logger.MATERIALS("Found FluidRegistry entry for "+"molten."+Utils.sanitizeString(this.getLocalizedName())); - return aTest1.getFluid(); + if (f1 != null) { + aGTBaseFluid = f1.getFluid(); } - if (aTest2 != null) { - Logger.MATERIALS("Found FluidRegistry entry for "+"fluid."+Utils.sanitizeString(this.getLocalizedName())); - return aTest2.getFluid(); + else if (f2 != null) { + aGTBaseFluid = f2.getFluid(); } - if (aTest3 != null) { - Logger.MATERIALS("Found FluidRegistry entry for "+Utils.sanitizeString(this.getLocalizedName())); - return aTest3.getFluid(); + else if (f3 != null) { + aGTBaseFluid = f3.getFluid(); } + else if (f4 != null) { + aGTBaseFluid = f4.getFluid(); + } + ItemStack aFullCell = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1); + ItemStack aFullCell2 = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getLocalizedName(), 1); + ItemStack aFullCell3 = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+Utils.sanitizeString(this.getUnlocalizedName(), new char[] {'-', '_'}), 1); + ItemStack aFullCell4 = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+Utils.sanitizeString(this.getLocalizedName(), new char[] {'-', '_'}), 1); + Logger.MATERIALS("Generating our own fluid."); - //Generate a Cell if we need to - if (aFullCell == null){ + //Generate a Cell if we need to, but first validate all four searches are invalid + + if (!ItemUtils.checkForInvalidItems(new ItemStack[] {aFullCell, aFullCell2, aFullCell3, aFullCell4})){ if (this.vGenerateCells){ Item g = new BaseItemCell(this); aFullCell = ItemUtils.getSimpleStack(g); @@ -1193,7 +1138,29 @@ public class Material { Logger.MATERIALS("Did not generate a cell for "+this.getUnlocalizedName()); } } + else { + // One cell we searched for was valid, let's register it. + if (aFullCell != null) { + this.registerComponentForMaterial(ComponentTypes.CELL, aFullCell); + } + else if (aFullCell2 != null) { + this.registerComponentForMaterial(ComponentTypes.CELL, aFullCell2); + } + else if (aFullCell3 != null) { + this.registerComponentForMaterial(ComponentTypes.CELL, aFullCell3); + } + else if (aFullCell4 != null) { + this.registerComponentForMaterial(ComponentTypes.CELL, aFullCell4); + } + } + // We found a GT fluid, let's use it. + // Good chance we registered the cell from this material too. + if (aGTBaseFluid != null) { + return aGTBaseFluid; + } + + // This fluid does not exist at all, time to generate it. if (this.materialState == MaterialState.SOLID){ return FluidUtils.addGTFluid( this.getUnlocalizedName(), diff --git a/src/Java/gtPlusPlus/core/slots/SlotNoInputLogging.java b/src/Java/gtPlusPlus/core/slots/SlotNoInputLogging.java index 42bc7ce346..762714ac94 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotNoInputLogging.java +++ b/src/Java/gtPlusPlus/core/slots/SlotNoInputLogging.java @@ -2,6 +2,7 @@ package gtPlusPlus.core.slots; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.block.Block; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -12,13 +13,23 @@ public class SlotNoInputLogging extends SlotNoInput { public SlotNoInputLogging(final IInventory inventory, final int index, final int x, final int y) { super(inventory, index, x, y); aSlotIndex = index; + Logger.INFO("Slot "+index+" is doing logging"); } @Override public boolean isItemValid(final ItemStack itemstack) { if (ItemUtils.checkForInvalidItems(itemstack)) { Logger.INFO("Tried Inserting "+ItemUtils.getItemName(itemstack)+" into slot "+aSlotIndex); - } + Block b = Block.getBlockFromItem(itemstack.getItem()); + Logger.INFO(""+itemstack.getUnlocalizedName()); + if (b != null) { + Logger.INFO(""+b.getLocalizedName()); + Logger.INFO(""+b.getUnlocalizedName()); + } + } + else { + Logger.INFO("Bad Itemstack"); + } return false; } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java index a0a684d3c6..b3372e8bde 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java @@ -15,6 +15,7 @@ import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.common.GT_Proxy; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.item.base.cell.BaseItemCell; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.MISC_MATERIALS; import gtPlusPlus.core.material.MaterialGenerator; @@ -239,11 +240,16 @@ public class PollutionUtils { if (CD != null) { Logger.INFO("[PollutionCompat] Found carbon dioxide fluid, registering it."); PollutionUtils.mPollutionFluidStacks.put(CD); + MISC_MATERIALS.CARBON_DIOXIDE.registerComponentForMaterial(CD); ItemStack cellCD = ItemUtils.getItemStackOfAmountFromOreDict("cellCarbonDioxide", 1); if (ItemUtils.checkForInvalidItems(cellCD)) { Logger.INFO("[PollutionCompat] Found carbon dioxide cell, registering component."); MISC_MATERIALS.CARBON_DIOXIDE.registerComponentForMaterial(OrePrefixes.cell, cellCD); } + else { + Logger.INFO("[PollutionCompat] Did not find carbon dioxide cell, registering new component."); + new BaseItemCell(MISC_MATERIALS.CARBON_DIOXIDE); + } } else { MaterialGenerator.generate(MISC_MATERIALS.CARBON_DIOXIDE, false, false); @@ -252,11 +258,16 @@ public class PollutionUtils { if (CM != null) { Logger.INFO("[PollutionCompat] Found carbon monoxide fluid, registering it."); PollutionUtils.mPollutionFluidStacks.put(CM); + MISC_MATERIALS.CARBON_MONOXIDE.registerComponentForMaterial(CM); ItemStack cellCD = ItemUtils.getItemStackOfAmountFromOreDict("cellCarbonMonoxide", 1); if (ItemUtils.checkForInvalidItems(cellCD)) { - Logger.INFO("[PollutionCompat] Found carbon dioxide cell, registering component."); + Logger.INFO("[PollutionCompat] Found carbon monoxide cell, registering component."); MISC_MATERIALS.CARBON_MONOXIDE.registerComponentForMaterial(OrePrefixes.cell, cellCD); } + else { + Logger.INFO("[PollutionCompat] Did not find carbon monoxide cell, registering new component."); + new BaseItemCell(MISC_MATERIALS.CARBON_MONOXIDE); + } } else { MaterialGenerator.generate(MISC_MATERIALS.CARBON_MONOXIDE, false, false); diff --git a/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java b/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java index 9512651417..477bdb2ff5 100644 --- a/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java +++ b/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java @@ -5,10 +5,12 @@ import static gtPlusPlus.core.lib.CORE.GTNH; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.HashSet; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; +import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; @@ -487,10 +489,64 @@ public class BioRecipes { } - + + + + public final static HashSet mFruits = new HashSet(); + public final static HashSet mVege = new HashSet(); + public final static HashSet mNuts = new HashSet(); + public final static HashSet mSeeds = new HashSet(); + + public final static AutoMap mList_Master_FruitVege = new AutoMap(); + public final static AutoMap mList_Master_Seeds = new AutoMap(); + + private static void processFermentationOreDict() { + processOreDictEntry("listAllfruit", mFruits); + processOreDictEntry("listAllFruit", mFruits); + processOreDictEntry("listAllveggie", mVege); + processOreDictEntry("listAllVeggie", mVege); + processOreDictEntry("listAllnut", mNuts); + processOreDictEntry("listAllNut", mNuts); + processOreDictEntry("listAllseed", mSeeds); + processOreDictEntry("listAllSeed", mSeeds); + + if (!mFruits.isEmpty()) { + for (GT_ItemStack g : mFruits) { + mList_Master_FruitVege.put(g.toStack()); + } + } + if (!mVege.isEmpty()) { + for (GT_ItemStack g : mVege) { + mList_Master_FruitVege.put(g.toStack()); + } + } + if (!mNuts.isEmpty()) { + for (GT_ItemStack g : mNuts) { + mList_Master_FruitVege.put(g.toStack()); + } + } + if (!mSeeds.isEmpty()) { + for (GT_ItemStack g : mSeeds) { + mList_Master_Seeds.put(g.toStack()); + } + } + } + + // Make Fermentation + private static void processOreDictEntry(String aOreName, HashSet mfruits2) { + ArrayList aTemp = OreDictionary.getOres(aOreName); + if (!aTemp.isEmpty()) { + for (ItemStack stack : aTemp) { + mfruits2.add(new GT_ItemStack(stack)); + } + } + } + + private static void recipeFermentationBase() { - AutoMap aFruitVege = AgriculturalChem.mList_Master_FruitVege; - AutoMap aSeeds = AgriculturalChem.mList_Master_Seeds; + processFermentationOreDict(); + AutoMap aFruitVege = mList_Master_FruitVege; + AutoMap aSeeds = mList_Master_Seeds; ArrayList aMap = OreDictionary.getOres("cropSugarbeet"); for (ItemStack a : aFruitVege) { if (aMap.contains(a)) { @@ -780,7 +836,7 @@ public class BioRecipes { private static void recipeAluminiumPellet() { GT_Values.RA.addAutoclaveRecipe( ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 3), - null, + FluidUtils.getFluidStack(BioRecipes.mAir, 1000), ItemUtils.getSimpleStack(AgriculturalChem.mAluminiumPellet, 4), 10000, 120 * 20, @@ -856,7 +912,7 @@ public class BioRecipes { private static void recipeAlginicAcid() { - // Turn into Cellulose Pulp + /*// Turn into Cellulose Pulp CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { getBioChip(7), ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 20), @@ -865,7 +921,7 @@ public class BioRecipes { GT_Values.NF, ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 20), 90 * 20, - 16); + 16);*/ } private static void recipeSulfuricAcid() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index f85d432b0c..42354e49e1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -36,6 +36,7 @@ import gtPlusPlus.everglades.gen.gt.WorldGen_GT; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config; import gtPlusPlus.xmod.gregtech.api.world.GTPP_Worldgen; +import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.fluid.GregtechFluidHandler; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; @@ -134,6 +135,7 @@ public class HANDLER_GT { } RecipesToRemove.go(); convertPyroToCokeOven(); + Meta_GT_Proxy.fixIC2FluidNames(); } private static void convertPyroToCokeOven() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java index 0c64644166..cdca065e60 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java @@ -11,6 +11,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.slots.SlotChemicalPlantInput; import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.core.slots.SlotNoInputLogging; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntity_ChemicalReactor; import net.minecraft.entity.player.EntityPlayer; @@ -93,6 +94,7 @@ public class Container_FluidReactor extends GT_Container_BasicMachine { } } } + //Logger.INFO("Clicked slot "+aSlotIndex); return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index 2d7151bf45..d507b3c814 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -13,10 +13,12 @@ import java.util.Timer; import java.util.TimerTask; import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; @@ -33,11 +35,15 @@ import gtPlusPlus.core.handler.AchievementHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity; import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.BaseCustomPower_MTE; import gtPlusPlus.xmod.gregtech.common.covers.CoverManager; +import ic2.core.init.BlocksItems; +import ic2.core.init.InternalName; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -45,6 +51,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; public class Meta_GT_Proxy { @@ -52,74 +60,111 @@ public class Meta_GT_Proxy { static { Logger.INFO("GT_PROXY - initialized."); } - + public static List GT_BlockIconload = new ArrayList<>(); public static List GT_ItemIconload = new ArrayList<>(); - + public static AutoMap GT_ValidHeatingCoilMetas = new AutoMap(); private static Class sBaseMetaTileEntityClass; private static Class sBaseMetaTileEntityClass2; - + public static AchievementHandler mAssemblyAchievements; - + public static final Map mCustomGregtechMetaTooltips = new LinkedHashMap(); - + @SideOnly(Side.CLIENT) public static IIconRegister sBlockIcons, sItemIcons; public Meta_GT_Proxy() { - + } - + public static Block sBlockMachines; - + public static void preInit() { - + //New GT++ Block, yay! (Progress) //sBlockMachines = new GTPP_Block_Machines(); - - GT_Log.out.println("GT++ Mod: Register TileEntities."); - BaseMetaTileEntity tBaseMetaTileEntity = constructBaseMetaTileEntity(); - BaseMetaTileEntity tBaseMetaTileEntity2 = constructBaseMetaTileEntityCustomPower(); - - GT_Log.out.println("GT++ Mod: Testing BaseMetaTileEntity."); - if (tBaseMetaTileEntity == null || tBaseMetaTileEntity2 == null) { - GT_Log.out.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); - throw new RuntimeException(""); - } - - //Gotta set it here so that we don't try call gregtech too early. - //Must set on the correct side - - if (ReflectionUtils.doesFieldExist(GT_Proxy.class, "gt6Pipe")) { - StaticFields59.mGT6StylePipes = (boolean) StaticFields59.getFieldFromGregtechProxy("gt6Pipe"); - } - else { - StaticFields59.mGT6StylePipes = false; - } - - GT_Log.out.println("GT++ Mod: Registering the BaseMetaTileEntity."); - GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP"); - GameRegistry.registerTileEntity(tBaseMetaTileEntity2.getClass(), "BaseMetaTileEntity_GTPP2"); - CoverManager.generateCustomCovers(); + fixIC2FluidNames(); + + GT_Log.out.println("GT++ Mod: Register TileEntities."); + BaseMetaTileEntity tBaseMetaTileEntity = constructBaseMetaTileEntity(); + BaseMetaTileEntity tBaseMetaTileEntity2 = constructBaseMetaTileEntityCustomPower(); + + GT_Log.out.println("GT++ Mod: Testing BaseMetaTileEntity."); + if (tBaseMetaTileEntity == null || tBaseMetaTileEntity2 == null) { + GT_Log.out.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); + throw new RuntimeException(""); + } + + //Gotta set it here so that we don't try call gregtech too early. + //Must set on the correct side + + if (ReflectionUtils.doesFieldExist(GT_Proxy.class, "gt6Pipe")) { + StaticFields59.mGT6StylePipes = (boolean) StaticFields59.getFieldFromGregtechProxy("gt6Pipe"); + } + else { + StaticFields59.mGT6StylePipes = false; + } + + GT_Log.out.println("GT++ Mod: Registering the BaseMetaTileEntity."); + GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP"); + GameRegistry.registerTileEntity(tBaseMetaTileEntity2.getClass(), "BaseMetaTileEntity_GTPP2"); + CoverManager.generateCustomCovers(); } - + public static void init() { scheduleCoverMapCleaner(); setValidHeatingCoilMetas(); + PollutionUtils.setPollutionFluids(); + fixIC2FluidNames(); } - + public static void postInit() { - mAssemblyAchievements = new AchievementHandler(); + mAssemblyAchievements = new AchievementHandler(); + fixIC2FluidNames(); } - + + @SuppressWarnings("deprecation") + public static void fixIC2FluidNames() { + //Fix IC2 Hot Water name + try { + String aNewHeatedWaterName = "Heated Water"; + Logger.INFO("Renaming [IC2 Hotspring Water] --> ["+aNewHeatedWaterName+"].");LanguageRegistry.instance().addStringLocalization("fluidHotWater", "Heated Water"); + LanguageRegistry.instance().addStringLocalization("fluidHotWater", aNewHeatedWaterName); + LanguageRegistry.instance().addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization("fluidHotWater", aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName); + + Block b = BlocksItems.getFluidBlock(InternalName.fluidHotWater); + if (b != null) { + LanguageRegistry.addName(ItemUtils.getSimpleStack(b), aNewHeatedWaterName); + LanguageRegistry.instance().addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName); + } + Fluid f = BlocksItems.getFluid(InternalName.fluidHotWater); + if (f != null) { + LanguageRegistry.instance().addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName); + int aDam = FluidRegistry.getFluidID(f); + ItemStack s = ItemList.Display_Fluid.getWithDamage(1, aDam); + if (s != null) { + LanguageRegistry.addName(s, aNewHeatedWaterName); + } + } + } + catch (Throwable t) { + + } + } + public static boolean generatePlasmaRecipesForAdvVacFreezer() { - + AutoMap aFreezerMapRebaked = new AutoMap(); AutoMap aRemovedRecipes = new AutoMap(); - + //Find recipes containing Plasma and map them for (Recipe_GT y : Recipe_GT.Gregtech_Recipe_Map.sAdvFreezerRecipes.mRecipeList) { if (y.mFluidInputs.length > 0) { @@ -132,20 +177,20 @@ public class Meta_GT_Proxy { aFreezerMapRebaked.put(y); } } - + AutoMap aNewRecipes = new AutoMap(); int aAtomicMass = 0; int aAtomicTier = 0; - + final FluidStack NULL_PLASMA = Materials._NULL.getPlasma(1); - + for (String s : ELEMENT.NAMES) { - + aAtomicMass++; aAtomicTier = (aAtomicMass/30)+1; FluidStack aMoltenFluid = null; FluidStack aPlasma = null; - + //Try Get Material via Gregtech Materials aGregMaterial = MaterialUtils.getMaterial(s); if (aGregMaterial != null) { @@ -161,7 +206,7 @@ public class Meta_GT_Proxy { } aPlasma = aGregMaterial.getPlasma(100); } - + //Just wildcard values if (aMoltenFluid == null || aPlasma == null) { if (aMoltenFluid == null) { @@ -171,7 +216,7 @@ public class Meta_GT_Proxy { aPlasma = FluidUtils.getFluidStack("plasma."+s.toLowerCase(), 1); } } - + //Skip this material if (aMoltenFluid == null || aPlasma == null || aPlasma.isFluidEqual(NULL_PLASMA)) { Logger.INFO("Could not generate Advanced Vacuum Freezer recipe. Cooling "+s+" plasma. Molten Form Exists? "+(aMoltenFluid != null)+" | Plasma Exists? "+(aPlasma != null)); @@ -186,49 +231,49 @@ public class Meta_GT_Proxy { null, new int[] {10000}, new FluidStack[] { - aPlasma, - FluidUtils.getFluidStack("cryotheum", aTotalTickTime) - }, + aPlasma, + FluidUtils.getFluidStack("cryotheum", aTotalTickTime) + }, new FluidStack[] { - aMoltenFluid - }, + aMoltenFluid + }, aTotalTickTime, (int) GT_Values.V[4+aAtomicTier], aAtomicMass); - + //Add it to the map if it's valid if (aTempRecipe != null) { aNewRecipes.put(aTempRecipe); } } - + } - + //Add the new recipes to the map we will rebake over the original for (Recipe_GT w : aNewRecipes) { aFreezerMapRebaked.put(w); } - + //Best not touch the original map if we don't have a valid map to override it with. if (aFreezerMapRebaked.size() > 0) { - + int aOriginalCount = Recipe_GT.Gregtech_Recipe_Map.sAdvFreezerRecipes.mRecipeList.size(); - + //Empty the original map Recipe_GT.Gregtech_Recipe_Map.sAdvFreezerRecipes.mRecipeList.clear(); - + //Rebake the real map for (Recipe_GT w : aFreezerMapRebaked) { Recipe_GT.Gregtech_Recipe_Map.sAdvFreezerRecipes.mRecipeList.add(w); } - + return Recipe_GT.Gregtech_Recipe_Map.sAdvFreezerRecipes.mRecipeList.size() >= aOriginalCount; } - + return false; } - + public static TileEntity constructCustomGregtechMetaTileEntityByMeta(int aMeta) { if (aMeta == 12) { return Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower(); @@ -237,7 +282,7 @@ public class Meta_GT_Proxy { return Meta_GT_Proxy.constructBaseMetaTileEntity(); } } - + public static BaseCustomTileEntity constructBaseMetaTileEntity() { if (sBaseMetaTileEntityClass == null) { try { @@ -264,7 +309,7 @@ public class Meta_GT_Proxy { } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | SecurityException e) { GT_Log.err - .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); + .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); e.printStackTrace(GT_Log.err); throw new RuntimeException(e); } @@ -299,20 +344,20 @@ public class Meta_GT_Proxy { } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | SecurityException e) { GT_Log.err - .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); + .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); e.printStackTrace(GT_Log.err); throw new RuntimeException(e); } } } - - - - - - - - + + + + + + + + public static void setValidHeatingCoilMetas() { for (int i = 0; i <= 6; i++ ) { GT_ValidHeatingCoilMetas.put(i); @@ -336,20 +381,20 @@ public class Meta_GT_Proxy { return false; } } - + public static void scheduleCoverMapCleaner(){ - TimerTask repeatedTask = new TimerTask() { - public void run() { - cleanupOverFlowCoverCache(); - } - }; - Timer timer = new Timer("CoverCleanupManager"); - long delay = 120000L; - long period = 300000L; - timer.scheduleAtFixedRate(repeatedTask, delay, period); + TimerTask repeatedTask = new TimerTask() { + public void run() { + cleanupOverFlowCoverCache(); + } + }; + Timer timer = new Timer("CoverCleanupManager"); + long delay = 120000L; + long period = 300000L; + timer.scheduleAtFixedRate(repeatedTask, delay, period); } - + public static int cleanupOverFlowCoverCache() { ObjMap cache = mOverflowCache; int aRemoved = 0; @@ -376,8 +421,8 @@ public class Meta_GT_Proxy { } return aRemoved; } - - + + static GT_Proxy[] mProxies = new GT_Proxy[2]; /** @@ -386,47 +431,47 @@ public class Meta_GT_Proxy { public static Object getFieldFromGregtechProxy(boolean client, String fieldName) { return StaticFields59.getFieldFromGregtechProxy(fieldName); } - + public static void setCustomGregtechTooltip(String aNbtTagName, FormattedTooltipString aData) { mCustomGregtechMetaTooltips.put(aNbtTagName, aData); } - - public static void conStructGtTileBlockTooltip(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean par4) { - try { - int tDamage = aStack.getItemDamage(); - if ((tDamage <= 0) || (tDamage >= GregTech_API.METATILEENTITIES.length)) { - return; - } - - if (GregTech_API.METATILEENTITIES[tDamage] != null) { - IGregTechTileEntity tTileEntity = GregTech_API.METATILEENTITIES[tDamage].getBaseMetaTileEntity(); - if (tTileEntity.getDescription() != null) { - int i = 0; - for (String tDescription : tTileEntity.getDescription()) { - if (GT_Utility.isStringValid(tDescription)) { - if(tDescription.contains("%%%")){ - String[] tString = tDescription.split("%%%"); - if(tString.length>=2){ - StringBuffer tBuffer = new StringBuffer(); - Object tRep[] = new String[tString.length / 2]; - for (int j = 0; j < tString.length; j++) - if (j % 2 == 0) tBuffer.append(tString[j]); - else {tBuffer.append(" %s"); tRep[j / 2] = tString[j];} - aList.add(String.format(GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tBuffer.toString(), !GregTech_API.sPostloadFinished), tRep)); - } - }else{String tTranslated = GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tDescription, !GregTech_API.sPostloadFinished ); - aList.add(tTranslated.equals("") ? tDescription : tTranslated);} - }else i++; - } - } - + + public static void conStructGtTileBlockTooltip(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean par4) { + try { + int tDamage = aStack.getItemDamage(); + if ((tDamage <= 0) || (tDamage >= GregTech_API.METATILEENTITIES.length)) { + return; + } + + if (GregTech_API.METATILEENTITIES[tDamage] != null) { + IGregTechTileEntity tTileEntity = GregTech_API.METATILEENTITIES[tDamage].getBaseMetaTileEntity(); + if (tTileEntity.getDescription() != null) { + int i = 0; + for (String tDescription : tTileEntity.getDescription()) { + if (GT_Utility.isStringValid(tDescription)) { + if(tDescription.contains("%%%")){ + String[] tString = tDescription.split("%%%"); + if(tString.length>=2){ + StringBuffer tBuffer = new StringBuffer(); + Object tRep[] = new String[tString.length / 2]; + for (int j = 0; j < tString.length; j++) + if (j % 2 == 0) tBuffer.append(tString[j]); + else {tBuffer.append(" %s"); tRep[j / 2] = tString[j];} + aList.add(String.format(GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tBuffer.toString(), !GregTech_API.sPostloadFinished), tRep)); + } + }else{String tTranslated = GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tDescription, !GregTech_API.sPostloadFinished ); + aList.add(tTranslated.equals("") ? tDescription : tTranslated);} + }else i++; + } + } + if (tTileEntity.getEUCapacity() > 0L) { final long tVoltage = tTileEntity.getInputVoltage(); byte tTier = (byte) ((byte) Math.max(1, GT_Utility.getTier(tVoltage))); - + //Custom handling if (tDamage < 30500 && tDamage >= 30400) { int aOffset = tDamage - 30400; @@ -439,13 +484,13 @@ public class Meta_GT_Proxy { aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Breaker_Loss", "Breaker Loss: "+EnumChatFormatting.RED+""+(GT_Values.V[Math.max(tTier-1, 0)]/10)+EnumChatFormatting.GRAY+" EU/t", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); } - + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Special_Power_1", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); //aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_2", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); //aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_3", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); } - - + + if (tTileEntity.getInputVoltage() > 0L) { String inA = "0"; if (tTileEntity.getInputAmperage() >= 1L) { @@ -473,20 +518,20 @@ public class Meta_GT_Proxy { + EnumChatFormatting.GRAY + outA; aList.add(a1); } - + if (tTileEntity.getOutputVoltage() > 0L) { aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Lossess_EU", "Transmission Loss: "+EnumChatFormatting.DARK_BLUE+""+(tDamage < 30500 && tDamage >= 30400 ? 0 : 1), !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); } - + if (tTileEntity.getEUCapacity() > 0) { aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE2", "Internal Capacity: ", !GregTech_API.sPostloadFinished) + EnumChatFormatting.BLUE + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY + " EU"); } } - - /*if (tTileEntity.getEUCapacity() > 0L) { + + /*if (tTileEntity.getEUCapacity() > 0L) { if (tTileEntity.getInputVoltage() > 0L) { aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getInputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getInputVoltage())] + ")" + EnumChatFormatting.GRAY); } @@ -498,42 +543,42 @@ public class Meta_GT_Proxy { } aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.BLUE + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY); }*/ - - } - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - if (aNBT.getBoolean("mMuffler")) { - aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_MUFFLER", "has Muffler Upgrade", !GregTech_API.sPostloadFinished )); - } - if (aNBT.getBoolean("mSteamConverter")) { - aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMCONVERTER", "has Steam Upgrade", !GregTech_API.sPostloadFinished )); - } - int tAmount = 0; - if ((tAmount = aNBT.getByte("mSteamTanks")) > 0) { - aList.add(tAmount + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS", "Steam Tank Upgrades", !GregTech_API.sPostloadFinished )); - } - - FluidStack afluid = net.minecraftforge.fluids.FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); - if (afluid != null) { - int tFluidAmount = afluid.amount; - if (tFluidAmount > 0) { - aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_FLUIDTANK", "Tank Fluid: "+tFluidAmount+"L "+afluid.getLocalizedName()+"", !GregTech_API.sPostloadFinished )); - } - } - - } - - //Add Custom Here - - //Add Custom Tooltips - for (String s : mCustomGregtechMetaTooltips.keySet()) { - if (aNBT.hasKey(s)) { - String aTip = mCustomGregtechMetaTooltips.get(s).getTooltip(aNBT.getString(s)); - aList.add(aTip); - } - } - - //Add GT++ Stuff + + } + NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + if (aNBT.getBoolean("mMuffler")) { + aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_MUFFLER", "has Muffler Upgrade", !GregTech_API.sPostloadFinished )); + } + if (aNBT.getBoolean("mSteamConverter")) { + aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMCONVERTER", "has Steam Upgrade", !GregTech_API.sPostloadFinished )); + } + int tAmount = 0; + if ((tAmount = aNBT.getByte("mSteamTanks")) > 0) { + aList.add(tAmount + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS", "Steam Tank Upgrades", !GregTech_API.sPostloadFinished )); + } + + FluidStack afluid = net.minecraftforge.fluids.FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); + if (afluid != null) { + int tFluidAmount = afluid.amount; + if (tFluidAmount > 0) { + aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_FLUIDTANK", "Tank Fluid: "+tFluidAmount+"L "+afluid.getLocalizedName()+"", !GregTech_API.sPostloadFinished )); + } + } + + } + + //Add Custom Here + + //Add Custom Tooltips + for (String s : mCustomGregtechMetaTooltips.keySet()) { + if (aNBT.hasKey(s)) { + String aTip = mCustomGregtechMetaTooltips.get(s).getTooltip(aNBT.getString(s)); + aList.add(aTip); + } + } + + //Add GT++ Stuff if (tDamage >= 30400 && tDamage < 30500) { aList.add(EnumChatFormatting.UNDERLINE+"Special GT++ Machine"); @@ -541,11 +586,11 @@ public class Meta_GT_Proxy { if ((tDamage >= 750 && tDamage < 1000) || (tDamage >= 30000 && tDamage < 31000)) { aList.add(CORE.GT_Tooltip); } - - - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } - } + + + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + } + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java index 288b48ebb5..ed312b704d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java @@ -18,7 +18,6 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.slots.SlotChemicalPlantInput; import gtPlusPlus.xmod.gregtech.api.gui.fluidreactor.Container_FluidReactor; @@ -30,7 +29,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; @@ -257,7 +255,6 @@ public class GregtechMetaTileEntity_ChemicalReactor extends GT_MetaTileEntity_Ba @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - // Re-implement basic machine logic from the ground up. if (aBaseMetaTileEntity.isServerSide()) { diff --git a/src/resources/assets/miscutils/lang/en_US.lang b/src/resources/assets/miscutils/lang/en_US.lang index cbba0cc3d8..394680edd8 100644 --- a/src/resources/assets/miscutils/lang/en_US.lang +++ b/src/resources/assets/miscutils/lang/en_US.lang @@ -3045,7 +3045,6 @@ item.ureamix.name=Cell of Urea Mix item.liquidresin.name=Cell of Liquid Resin item.propionicacid.name=Propionic Acid Cell item.aceticacid.name=Acetic Acid Cell - item.BasicAgrichemItem.0.name=Algae Biomass item.BasicAgrichemItem.1.name=Green Algae Biomass item.BasicAgrichemItem.2.name=Brown Algae Biomass @@ -3067,4 +3066,12 @@ item.BasicAgrichemItem.17.name=Aluminium Pellet item.BasicAgrichemItem.18.name=Sodium Aluminate item.BasicAgrichemItem.19.name=Sodium Hydroxide item.BasicAgrichemItem.20.name=Sodium Carbonate -item.BasicAgrichemItem.21.name=Lithium Chloride \ No newline at end of file +item.BasicAgrichemItem.21.name=Lithium Chloride + +//Added 24/10/19 +item.butanol.name=Butanol Cell + +//Try Fix IC2 Garbage vv +fluidHotWater=Heated Water +fluidHotWater.name=Heated Water +//Try Fix IC2 Garbage ^^ \ No newline at end of file -- cgit From f3a698a3af1826ef6f5ac719d31334b930e0005e Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 24 Nov 2019 16:14:12 +0000 Subject: + Added Concurrent Set objects to the API. + Added Flexible Pair objects to the API. + Added logging to ICO formation code. % Adjusted position of GUI elements in NEI for Chemical Plant recipes. % Adjusted the recipe for the Lava Filter. % Adjusted which fluids are returned when requesting tiered fluids from CI. This will inevitably adjust many recipes as a result. % Adjusted handling of the creative energy buffer. % Adjusted Achievement handler for Dev Mode. % Adjusted Tank Capacity on my Chemical Plants. $ Fixed Output buffer checks on multiblocks, Closes #574. $ Fixed LuV Super Bus recipes, Closes #575. (ULV super bus recipe is still broken for the time being) $ Attempted once more to fix Hot Water localization. --- src/Java/gtPlusPlus/api/objects/data/AutoMap.java | 14 + .../api/objects/data/ConcurrentHashSet.java | 18 + .../gtPlusPlus/api/objects/data/ConcurrentSet.java | 53 +++ .../gtPlusPlus/api/objects/data/FlexiblePair.java | 39 ++ .../handler/StopAnnoyingFuckingAchievements.java | 13 +- .../gtPlusPlus/core/recipe/RECIPES_Machines.java | 77 +++- src/Java/gtPlusPlus/core/recipe/common/CI.java | 16 +- .../gtPlusPlus/core/util/minecraft/ItemUtils.java | 9 + .../gtPlusPlus/core/util/minecraft/LangUtils.java | 51 +++ src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java | 22 +- .../gregtech/api/gui/CONTAINER_MultiMachine.java | 16 +- .../base/GregtechMeta_MultiBlockBase.java | 464 ++++++++++++++++----- .../xmod/gregtech/common/Meta_GT_Proxy.java | 101 +++-- .../creative/GregtechMetaCreativeEnergyBuffer.java | 74 ++-- .../GregtechMetaTileEntity_ChemicalReactor.java | 6 +- .../GregtechMetaTileEntity_IndustrialCokeOven.java | 26 +- 16 files changed, 789 insertions(+), 210 deletions(-) create mode 100644 src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java create mode 100644 src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java create mode 100644 src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java create mode 100644 src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/gui') diff --git a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java index 9e7f702200..02517097cf 100644 --- a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java +++ b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java @@ -70,6 +70,20 @@ public class AutoMap implements Iterable, Cloneable, Serializable, Collect } } } + + /** + * Generates an AutoMap from a Array. + * @param aArray - Data to be inserted into the AutoMap. + */ + public AutoMap(V[] aArray) { + mInternalMap = new LinkedHashMap(); + mInternalNameMap = new LinkedHashMap(); + if (aArray != null && aArray.length > 0) { + for (V obj : aArray) { + add(obj); + } + } + } @Override public Iterator iterator() { diff --git a/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java b/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java new file mode 100644 index 0000000000..991908e402 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java @@ -0,0 +1,18 @@ +package gtPlusPlus.api.objects.data; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +public class ConcurrentHashSet extends ConcurrentSet { + + private static final long serialVersionUID = -1293478938482781728L; + + public ConcurrentHashSet() { + this(new ConcurrentHashMap()); + } + + public ConcurrentHashSet(ConcurrentMap defaultMapType) { + super(defaultMapType); + } + +} diff --git a/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java b/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java new file mode 100644 index 0000000000..1d3ffc1c01 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java @@ -0,0 +1,53 @@ +package gtPlusPlus.api.objects.data; + +import java.io.Serializable; +import java.util.AbstractSet; +import java.util.Iterator; +import java.util.concurrent.ConcurrentMap; + +public abstract class ConcurrentSet extends AbstractSet implements Serializable { + + private static final long serialVersionUID = -6761513279741915432L; + + private final ConcurrentMap mInternalMap; + + private int mInternalID = 0; + + /** + * Creates a new instance which wraps the specified {@code map}. + */ + public ConcurrentSet(ConcurrentMap aMap) { + mInternalMap = aMap; + } + + @Override + public int size() { + return mInternalMap.size(); + } + + @Override + public boolean contains(Object o) { + return mInternalMap.containsKey(o); + } + + @Override + public boolean add(E o) { + return mInternalMap.putIfAbsent(mInternalID++, o) == null; + } + + @Override + public boolean remove(Object o) { + return mInternalMap.remove(o) != null; + } + + @Override + public void clear() { + this.mInternalID = 0; + mInternalMap.clear(); + } + + @Override + public Iterator iterator() { + return mInternalMap.values().iterator(); + } +} diff --git a/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java b/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java new file mode 100644 index 0000000000..64f57b4e5a --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java @@ -0,0 +1,39 @@ +package gtPlusPlus.api.objects.data; + +import java.io.Serializable; + +import com.google.common.base.Objects; + +public class FlexiblePair implements Serializable { + + /** + * SVUID + */ + private static final long serialVersionUID = 1250550491092812443L; + private final K key; + private V value; + + public FlexiblePair(final K key, final V value){ + this.key = key; + this.value = value; + } + + final public K getKey(){ + return this.key; + } + + final public V getValue(){ + return this.value; + } + + final public void setValue(V aObj) { + value = aObj; + } + + @Override + public int hashCode() { + Integer aCode = Objects.hashCode(getKey(), getValue()); + return aCode != null ? aCode : super.hashCode(); + } + +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java b/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java index b10e67aeaf..8853acd4b7 100644 --- a/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java +++ b/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java @@ -1,8 +1,8 @@ package gtPlusPlus.core.handler; +import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; +import net.minecraft.client.Minecraft; import net.minecraft.stats.AchievementList; import net.minecraftforge.event.entity.player.AchievementEvent; @@ -12,12 +12,15 @@ public class StopAnnoyingFuckingAchievements { * Stops me getting fireworks every fucking time I open my inventory upon first loading a dev client. * @param event */ - @SubscribeEvent + @SubscribeEvent(priority=EventPriority.HIGHEST) public void FUCK_OFF(AchievementEvent event) { if (event.achievement.equals(AchievementList.openInventory)) { - if (MathUtils.randInt(0, 10) >= 9) - PlayerUtils.messagePlayer(event.entityPlayer, "Bang! Nah, Just joking, there's no fireworks. :)"); event.setCanceled(true); + if (Minecraft.getMinecraft() != null) { + if (Minecraft.getMinecraft().gameSettings != null) { + Minecraft.getMinecraft().gameSettings.showInventoryAchievementHint = false; + } + } } } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index bc1c7fc398..c0a4a998e8 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -1063,7 +1063,20 @@ public class RECIPES_Machines { RECIPE_ThermalBoilerCasing); //Lava Filter Recipe - GT_Values.RA.addAssemblerRecipe(ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemPartCarbonMesh", "RawCarbonMesh", 0, 16), CI.getNumberedCircuit(18), ItemUtils.getSimpleStack(ModItems.itemLavaFilter), 80*20, 16); + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + CI.getNumberedCircuit(18), + ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", GTNH ? 64 : 32), + ItemUtils.getItemStackOfAmountFromOreDict("wireFineSteel", GTNH ? 64 : 32), + ItemUtils.getItemStackOfAmountFromOreDict("ringTumbaga", GTNH ? 32 : 16), + ItemUtils.getItemStackOfAmountFromOreDict("foilCopper", GTNH ? 8 : 4), + ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemPartCarbonMesh", "RawCarbonMesh", 0, 64), + + }, + CI.getTieredFluid(3, 144), + ItemUtils.getSimpleStack(ModItems.itemLavaFilter, GTNH ? 8 : 16), + 1600, + 240 + ); } if (CORE.ConfigSwitches.enableMultiblock_LiquidFluorideThoriumReactor){ @@ -2201,10 +2214,10 @@ public class RECIPES_Machines { ItemList.Hatch_Input_Bus_ZPM.get(1), ItemList.Hatch_Input_Bus_UV.get(1), ItemList.Hatch_Input_Bus_MAX.get(1), - GregtechItemList.Hatch_SuperBus_Input_ULV.get(1), GregtechItemList.Hatch_SuperBus_Input_LV.get(1), GregtechItemList.Hatch_SuperBus_Input_MV.get(1), GregtechItemList.Hatch_SuperBus_Input_HV.get(1), + GregtechItemList.Hatch_SuperBus_Input_EV.get(1), }; ItemStack[] mOutputHatch = new ItemStack[] { @@ -2214,20 +2227,66 @@ public class RECIPES_Machines { ItemList.Hatch_Output_Bus_ZPM.get(1), ItemList.Hatch_Output_Bus_UV.get(1), ItemList.Hatch_Output_Bus_MAX.get(1), - GregtechItemList.Hatch_SuperBus_Output_ULV.get(1), GregtechItemList.Hatch_SuperBus_Output_LV.get(1), GregtechItemList.Hatch_SuperBus_Output_MV.get(1), GregtechItemList.Hatch_SuperBus_Output_HV.get(1), + GregtechItemList.Hatch_SuperBus_Output_EV.get(1), }; + // Special Case recipes for ULV buses + { + + int i = 0; + ItemStack[] aInputs1 = new ItemStack[] { + CI.getNumberedCircuit(17), + mInputHatch[i], + CI.getElectricMotor(i, GTNH ? 8 : 2), + CI.getConveyor(i, GTNH ? 10 : 5), + CI.getBolt(i, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) + }; + Logger.INFO("[FIND] "+ItemUtils.getArrayStackNames(aInputs1)); + ItemStack[] aOutputs1 = new ItemStack[] { + CI.getNumberedCircuit(18), + mOutputHatch[i], + CI.getElectricPiston(i, GTNH ? 8 : 2), + CI.getConveyor(i, GTNH ? 10 : 5), + CI.getGear(i, GTNH ? 6 : 3), + CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) + }; + Logger.INFO("[FIND] "+ItemUtils.getArrayStackNames(aOutputs1)); + + FluidStack a1 = CI.getAlternativeTieredFluid(i, 144 * 8); + FluidStack a2 = CI.getTertiaryTieredFluid(i, 144 * 8); + + + Logger.INFO("[FIND] Input Bus Fluid: "+ItemUtils.getFluidName(a1)); + Logger.INFO("[FIND] Output Bus Fluid: "+ItemUtils.getFluidName(a2)); + + + CORE.RA.addSixSlotAssemblingRecipe(aInputs1, + a1, + mSuperBusesInput[i].get(1), + 20 * 30 * 2 * i, + (int) GT_Values.V[i]); + + CORE.RA.addSixSlotAssemblingRecipe(aOutputs1, + a2, + mSuperBusesOutput[i].get(1), + 20 * 30 * 2 * i, + (int) GT_Values.V[i]); + + + } + //Input Buses - for (int i = 0; i < 10; i++) { + for (int i = 1; i < 10; i++) { CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.getNumberedCircuit(16), + CI.getNumberedCircuit(17), mInputHatch[i], CI.getElectricMotor(i, GTNH ? 8 : 2), CI.getConveyor(i, GTNH ? 10 : 5), - CI.getGear(i, GTNH ? 6 : 3), + CI.getBolt(i, GTNH ? 32 : 16), CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) }, CI.getAlternativeTieredFluid(i, 144 * 8), @@ -2235,7 +2294,7 @@ public class RECIPES_Machines { (int) GT_Values.V[i]); } //Output Buses - for (int i = 0; i < 10; i++) { + for (int i = 1; i < 10; i++) { CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { CI.getNumberedCircuit(18), mOutputHatch[i], @@ -2259,7 +2318,7 @@ public class RECIPES_Machines { CI.craftingToolWrench, CI.machineCasing_ULV, CI.craftingToolScrewdriver, ItemUtils.getSimpleStack(Blocks.hopper), "circuitPrimitive", ItemUtils.getSimpleStack(Blocks.hopper), ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 0, 1)); - + ItemStack[] aRobinators = new ItemStack[] { ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 0, 1), ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 1, 1), @@ -2283,7 +2342,7 @@ public class RECIPES_Machines { CI.getTieredComponent(OrePrefixes.plate, aTier, 4 * aCostMultiplier), CI.getTieredComponent(OrePrefixes.circuit, i, 2 * aCostMultiplier), }; - + CORE.RA.addSixSlotAssemblingRecipe( aInputs, CI.getAlternativeTieredFluid(aTier, (144 * 2 * i)), //Input Fluid diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index 63477cda19..968a96135e 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -634,12 +634,22 @@ public class CI { } public static FluidStack getTieredFluid(int aTier, int aAmount, int aType) { - ItemStack aCell = getTieredComponent(OrePrefixes.liquid, aTier, 1); + // Weird Legacy handling + /*ItemStack aCell = getTieredComponent(OrePrefixes.liquid, aTier, 1); FluidStack a = GT_Utility.getFluidForFilledItem(aCell, true); if (a == null) { a = aMaster[aType][aTier].getFluid(aAmount); - } - a.amount = aAmount; + }*/ + + // Modern Handling + FluidStack a = aMaster[aType][aTier].getFluid(aAmount); + if (a == null) { + ItemStack aCell = getTieredComponent(OrePrefixes.liquid, aTier, 1); + if (aCell != null) { + a = GT_Utility.getFluidForFilledItem(aCell, true); + a.amount = aAmount; + } + } return a; } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 88fdda555c..cb490203df 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -47,6 +47,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; @@ -1083,6 +1084,14 @@ public class ItemUtils { } + + public static String getFluidName(FluidStack aFluid) { + return aFluid != null ? aFluid.getFluid().getLocalizedName(aFluid) : "NULL"; + } + + public static String getFluidName(Fluid aFluid) { + return aFluid != null ? aFluid.getLocalizedName() : "NULL"; + } public static String getItemName(ItemStack aStack) { if (aStack == null) { diff --git a/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java new file mode 100644 index 0000000000..1de4209bf9 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java @@ -0,0 +1,51 @@ +package gtPlusPlus.core.util.minecraft; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import cpw.mods.fml.common.registry.LanguageRegistry; +import gtPlusPlus.core.util.reflect.ReflectionUtils; + +public class LangUtils { + + + public static boolean rewriteEntryForLanguageRegistry(String aKey, String aNewValue){ + return rewriteEntryForLanguageRegistry("en_US", aKey, aNewValue); + } + + @SuppressWarnings("unchecked") + public static boolean rewriteEntryForLanguageRegistry(String aLang, String aKey, String aNewValue){ + LanguageRegistry aInstance = LanguageRegistry.instance(); + Field aModLanguageData = ReflectionUtils.getField(LanguageRegistry.class, "modLanguageData"); + if (aModLanguageData != null){ + Map aProps = new HashMap(); + Object aInstanceProps; + try { + aInstanceProps = aModLanguageData.get(aInstance); + if (aInstanceProps != null){ + aProps = (Map) aInstanceProps; + Properties aLangProps = aProps.get(aLang); + if (aLangProps != null){ + if (aLangProps.containsKey(aKey)) { + aLangProps.remove(aKey); + aLangProps.put(aKey, aNewValue); + } + else { + aLangProps.put(aKey, aNewValue); + } + aProps.remove(aLang); + aProps.put(aLang, aLangProps); + ReflectionUtils.setField(aInstance, aModLanguageData, aProps); + } + } + } + catch (IllegalArgumentException | IllegalAccessException e) { + + } + } + return false; + } + +} diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java index 5c5d1169aa..e4279cf489 100644 --- a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java +++ b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java @@ -65,7 +65,7 @@ extends TemplateRecipeHandler { @Override public void loadCraftingRecipes(final String outputId, final Object... results) { - if (outputId.equals(this.getOverlayIdentifier())) { + if (outputId.equals(this.mRecipeMap.mNEIName)) { for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { if (!tRecipe.mHidden) { this.arecipes.add(new CachedDefaultRecipe(tRecipe)); @@ -146,7 +146,8 @@ extends TemplateRecipeHandler { @Override public String getOverlayIdentifier() { - return this.mRecipeMap.mNEIName; + //return this.mRecipeMap.mNEIName; + return "Penis"; } @Override @@ -163,7 +164,8 @@ extends TemplateRecipeHandler { @Override public String getRecipeName() { - return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); + //return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); + return " Chem Plant"; } @Override @@ -201,24 +203,24 @@ extends TemplateRecipeHandler { @Override public void drawExtras(final int aRecipeIndex) { - final int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; + final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; if (tEUt != 0) { - drawText(10, 73, "Total: " + (tDuration * tEUt) + " EU", -16777216); - drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); + drawText(10, 73, "Total: " + (long) (tDuration * tEUt) + " EU", -16777216); + //drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); if (this.mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 93, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU", -16777216); - drawText(10, 103, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); + drawText(10, 83, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU/t", -16777216); + drawText(10, 93, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); } else { drawText(10, 93, "Voltage: unspecified", -16777216); drawText(10, 103, "Amperage: unspecified", -16777216); } } if (tDuration > 0) { - drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); + drawText(10, 103, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); } if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { - drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); + drawText(10, 113, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java index d3e22875ae..88b9661c95 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java @@ -101,32 +101,32 @@ public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine { //crafters = ReflectionUtils.getField(getClass(), "crafters"); } if (timer != null && crafters != null && mControllerSet) { - Logger.INFO("Trying to update clientside GUI data"); + //Logger.INFO("Trying to update clientside GUI data"); try { - Logger.INFO("0"); + //Logger.INFO("0"); int aTimer = (int) ReflectionUtils.getFieldValue(timer, this); //List crafters1List = (List) crafters1; List crafters2 = new ArrayList(); - Logger.INFO("1"); + //Logger.INFO("1"); for (Object o : crafters) { if (o instanceof ICrafting) { crafters2.add((ICrafting) o); } } - Logger.INFO("2"); + //Logger.INFO("2"); if (!crafters2.isEmpty()) { - Logger.INFO("3"); + //Logger.INFO("3"); handleInitialFieldSetting(); try { - Logger.INFO("4"); + //Logger.INFO("4"); for (final ICrafting var3 : crafters2) { handleCraftingEvent(aTimer, var3); } - Logger.INFO("5"); + //Logger.INFO("5"); handleInternalFieldSetting(); - Logger.INFO("6"); + //Logger.INFO("6"); } catch (Throwable t) { } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 68b81182fc..2e50d12aca 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -42,6 +42,11 @@ import gtPlusPlus.GTplusplus; import gtPlusPlus.GTplusplus.INIT_PHASE; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.data.ConcurrentHashSet; +import gtPlusPlus.api.objects.data.ConcurrentSet; +import gtPlusPlus.api.objects.data.FlexiblePair; +import gtPlusPlus.api.objects.data.Pair; +import gtPlusPlus.api.objects.data.Triplet; import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; @@ -49,6 +54,7 @@ import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.asm.AsmConfig; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine_NoPlayerInventory; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; @@ -59,6 +65,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEn import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery; import gtPlusPlus.xmod.gregtech.api.objects.MultiblockRequirements; + import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -92,12 +99,12 @@ GT_MetaTileEntity_MultiBlockBase { else { aLogger = ReflectionUtils.getMethod(Logger.class, "MACHINE_INFO", String.class); } - + try { calculatePollutionReduction = GT_MetaTileEntity_Hatch_Muffler.class.getDeclaredMethod("calculatePollutionReduction", int.class); } catch (NoSuchMethodException | SecurityException e) {} - - + + //gregtech.api.util.GT_Recipe.GT_Recipe_Map.findRecipe(IHasWorldObjectAndCoords, GT_Recipe, boolean, long, FluidStack[], ItemStack, ItemStack...) } @@ -135,7 +142,7 @@ GT_MetaTileEntity_MultiBlockBase { } public abstract boolean hasSlotInGUI(); - + public long getTotalRuntimeInTicks() { return this.mTotalRunTime; } @@ -276,7 +283,7 @@ GT_MetaTileEntity_MultiBlockBase { } - + public int getPollutionReductionForAllMufflers() { int mPollutionReduction=0; for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { @@ -286,7 +293,7 @@ GT_MetaTileEntity_MultiBlockBase { } return mPollutionReduction; } - + public long getStoredEnergyInAllEnergyHatches() { long storedEnergy=0; for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { @@ -296,7 +303,7 @@ GT_MetaTileEntity_MultiBlockBase { } return storedEnergy; } - + public long getMaxEnergyStorageOfAllEnergyHatches() { long maxEnergy=0; for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { @@ -408,7 +415,7 @@ GT_MetaTileEntity_MultiBlockBase { String[] aToolTip = new String[(a2 + a3)]; aToolTip = ArrayUtils.addAll(aToolTip, x); aToolTip = ArrayUtils.addAll(aToolTip, z); - + if (aCachedToolTip == null || aCachedToolTip.length <= 0) { aCachedToolTip = aToolTip; } @@ -465,66 +472,300 @@ GT_MetaTileEntity_MultiBlockBase { public String getSound() { return ""; } public boolean canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes) { - if (aRecipe.mOutputs.length > 16) { - // Gendustry custom comb with a billion centrifuge outputs? Do it anyway. - return true; - } - // Count slots available in output buses - ArrayList tBusStacks = new ArrayList<>(); + Logger.INFO("Determining if we have space to buffer outputs."); + + // Null recipe or a recipe with lots of outputs? + // E.G. Gendustry custom comb with a billion centrifuge outputs? + // Do it anyway. + if (aRecipe == null || aRecipe.mOutputs.length > 16) { + return aRecipe == null ? false : true; + } - int tEmptySlots = 0; - for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) { - if (!isValidMetaTileEntity(tBus)) { - continue; + // Do we even need to check for item outputs? + boolean aDoesOutputItems = aRecipe.mOutputs.length > 0; + // Do we even need to check for fluid outputs? + boolean aDoesOutputFluids = aRecipe.mFluidOutputs.length > 0; + + + + /* ======================================== + * Item Management + * ======================================== + */ + + if (aDoesOutputItems) { + Logger.INFO("We have items to output."); + + // How many slots are free across all the output buses? + int aInputBusSlotsFree = 0; + + /* + * Create Variables for Item Output + */ + + AutoMap> aItemMap = new AutoMap>(); + AutoMap aOutputs = new AutoMap(aRecipe.mOutputs); + + for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) { + if (!isValidMetaTileEntity(tBus)) { + continue; + } + final IInventory tBusInv = tBus.getBaseMetaTileEntity(); + for (int i = 0; i < tBusInv.getSizeInventory(); i++) { + if (tBus.getStackInSlot(i) == null) { + aInputBusSlotsFree++; + } + else { + ItemStack aT = tBus.getStackInSlot(i); + int aSize = aT.stackSize; + aT = aT.copy(); + aT.stackSize = 0; + aItemMap.put(new FlexiblePair(aT, aSize)); + } + } } - final IInventory tBusInv = tBus.getBaseMetaTileEntity(); - for (int i = 0; i < tBusInv.getSizeInventory(); i++) { - if (tBus.getStackInSlot(i) == null) { - tEmptySlots++; + + // Count the slots we need, later we can check if any are able to merge with existing stacks + int aRecipeSlotsRequired = 0; + + // A map to hold the items we will be 'inputting' into the output buses. These itemstacks are actually the recipe outputs. + ConcurrentSet> aInputMap = new ConcurrentHashSet>(); + + // Iterate over the outputs, calculating require stack spacing they will require. + for (int i=0;i 64) { + int aSlotsNeedsForThisStack = (int) Math.ceil((double) ((float) aStackSize / 64f)); + // Sould round up and add as many stacks as required nicely. + aRecipeSlotsRequired += aSlotsNeedsForThisStack; + for (int o=0;o 64 ? 64 : aStackSize; + aY = aY.copy(); + aY.stackSize = 0; + aInputMap.add(new FlexiblePair(aY, aStackToRemove)); + } + } + else { + // Only requires one slot + aRecipeSlotsRequired++; + aY = aY.copy(); + aY.stackSize = 0; + aInputMap.add(new FlexiblePair(aY, aStackSize)); + } + } + } + + // We have items to add to the output buses. See if any are not full stacks and see if we can make them full. + if (aInputMap.size() > 0) { + // Iterate over the current stored items in the Output busses, if any match and are not full, we can try account for merging. + busItems: for (FlexiblePair y : aItemMap) { + // Iterate over the 'inputs', we can safely remove these as we go. + outputItems: for (FlexiblePair u : aInputMap) { + // Create local vars for readability. + ItemStack aOutputBusStack = y.getKey(); + ItemStack aOutputStack = u.getKey(); + // Stacks match, including NBT. + if (GT_Utility.areStacksEqual(aOutputBusStack, aOutputStack, false)) { + // Stack Matches, but it's full, continue. + if (aOutputBusStack.stackSize >= 64) { + // This stack is full, no point checking it. + continue busItems; + } + else { + // We can merge these two stacks without any hassle. + if ((aOutputBusStack.stackSize + aOutputStack.stackSize) <= 64) { + // Update the stack size in the bus storage map. + y.setValue(aOutputBusStack.stackSize + aOutputStack.stackSize); + // Remove the 'input' stack from the recipe outputs, so we don't try count it again. + aInputMap.remove(u); + continue outputItems; + } + // Stack merging is too much, so we fill this stack, leave the remainder. + else { + int aRemainder = (aOutputBusStack.stackSize + aOutputStack.stackSize) - 64; + // Update the stack size in the bus storage map. + y.setValue(64); + // Create a new object to iterate over later, with the remainder data; + FlexiblePair t = new FlexiblePair(u.getKey(), aRemainder); + // Remove the 'input' stack from the recipe outputs, so we don't try count it again. + aInputMap.remove(u); + // Add the remainder stack. + aInputMap.add(t); + continue outputItems; + } + } + } + else { + continue outputItems; + } + } + } } + + // We have stacks that did not merge, do we have space for them? + if (aInputMap.size() > 0) { + if (aInputMap.size() > aInputBusSlotsFree) { + // We do not have enough free slots in total to accommodate the remaining managed stacks. + Logger.INFO("Failed to find enough space for all item outputs."); + return false; + } + } + + /* + * End Item Management + */ + } - int slotsNeeded = aRecipe.mOutputs.length; - for (final ItemStack tRecipeOutput: aRecipe.mOutputs) { - if (tRecipeOutput == null) continue; - int amount = tRecipeOutput.stackSize * aParallelRecipes; - for (final ItemStack tBusStack : tBusStacks) { - if (GT_Utility.areStacksEqual(tBusStack, tRecipeOutput)) { - if (tBusStack.stackSize + amount <= tBusStack.getMaxStackSize()) { - slotsNeeded--; - break; - } + + + + + /* ======================================== + * Fluid Management + * ======================================== + */ + + + + if (aDoesOutputFluids) { + Logger.INFO("We have Fluids to output."); + // How many slots are free across all the output buses? + int aFluidHatches = 0; + int aEmptyFluidHatches = 0; + int aFullFluidHatches = 0; + // Create Map for Fluid Output + ConcurrentHashSet> aOutputHatches = new ConcurrentHashSet>(); + for (final GT_MetaTileEntity_Hatch_Output tBus : this.mOutputHatches) { + if (!isValidMetaTileEntity(tBus)) { + continue; + } + aFluidHatches++; + // Map the Hatch with the space left for easy checking later. + if (tBus.getFluid() == null) { + aOutputHatches.add(new Triplet(tBus, null, tBus.getCapacity())); + } + else { + int aSpaceLeft = tBus.getCapacity() - tBus.getFluidAmount(); + aOutputHatches.add(new Triplet(tBus, tBus.getFluid(), aSpaceLeft)); } } - } - // Enough open slots? - if (tEmptySlots < slotsNeeded) return false; - - // For each output fluid, make sure an output hatch can accept it. - for (FluidStack tRecipeFluid: aRecipe.mFluidOutputs) { - if (tRecipeFluid == null) continue; - boolean tCanBufferFluid = false; - int tRecipeAmount = tRecipeFluid.amount; - for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { - FluidStack tHatchFluid = tHatch.getFluid(); - if (tHatchFluid == null) { - if(tHatch.getCapacity() > tRecipeAmount) { - tCanBufferFluid = true; - break; - } + // Create a map of all the fluids we would like to output, we can iterate over this and see how many we can merge into existing hatch stacks. + ConcurrentHashSet aOutputFluids = new ConcurrentHashSet(); + // Ugly ass boxing + aOutputFluids.addAll(new AutoMap(aRecipe.mFluidOutputs)); + // Iterate the Hatches, updating their 'stored' data. + aHatchIterator: for (Triplet aHatchData : aOutputHatches) { + // The Hatch Itself + GT_MetaTileEntity_Hatch_Output aHatch = aHatchData.getValue_1(); + // Fluid in the Hatch + FluidStack aHatchStack = aHatchData.getValue_2(); + // Space left in Hatch + int aSpaceLeftInHatch = aHatch.getCapacity() - aHatch.getFluidAmount(); + // Hatch is full, + if (aSpaceLeftInHatch <= 0) { + aFullFluidHatches++; + aOutputHatches.remove(aHatchData); + continue aHatchIterator; } - else if (tHatchFluid.isFluidEqual(tRecipeFluid) && tHatch.getCapacity() - tHatchFluid.amount > tRecipeAmount) { - tCanBufferFluid = true; - break; + // Hatch has space + else { + // Check if any fluids match + aFluidMatch: for (FluidStack aOutputStack : aOutputFluids) { + if (GT_Utility.areFluidsEqual(aHatchStack, aOutputStack)) { + int aFluidToPutIntoHatch = aOutputStack.amount; + // Not Enough space to insert all of the fluid. + // We fill this hatch and add a smaller Fluidstack back to the iterator. + if (aSpaceLeftInHatch < aFluidToPutIntoHatch) { + // Copy existing Hatch Stack + FluidStack aNewHatchStack = aHatchStack.copy(); + aNewHatchStack.amount = 0; + // Copy existing Hatch Stack again + FluidStack aNewOutputStack = aHatchStack.copy(); + aNewOutputStack.amount = 0; + // How much fluid do we have left after we fill the hatch? + int aFluidLeftAfterInsert = aFluidToPutIntoHatch - aSpaceLeftInHatch; + // Set new stacks to appropriate values + aNewHatchStack.amount = aHatch.getCapacity(); + aNewOutputStack.amount = aFluidLeftAfterInsert; + // Remove fluid from output list, merge success + aOutputFluids.remove(aOutputStack); + // Remove hatch from hatch list, data is now invalid. + aOutputHatches.remove(aHatchData); + // Add remaining Fluid to Output list + aOutputFluids.add(aNewOutputStack); + // Re-add hatch to hatch list, with new data. + Triplet aNewHatchData = new Triplet(aHatch, aNewHatchStack, aNewHatchStack.amount); + aOutputHatches.add(aNewHatchData); + continue aHatchIterator; + } + // We can fill this hatch perfectly (rare case), may as well add it directly to the full list. + else if (aSpaceLeftInHatch == aFluidToPutIntoHatch) { + // Copy Old Stack + FluidStack aNewHatchStack = aHatchStack.copy(); + // Add in amount from output stack + aNewHatchStack.amount += aOutputStack.amount; + // Remove fluid from output list, merge success + aOutputFluids.remove(aOutputStack); + // Remove hatch from hatch list, data is now invalid. + aOutputHatches.remove(aHatchData); + // Re-add hatch to hatch list, with new data. + Triplet aNewHatchData = new Triplet(aHatch, aNewHatchStack, aNewHatchStack.amount); + aOutputHatches.add(aNewHatchData); + continue aHatchIterator; + } + // We have more space than we need to merge, so we remove the stack from the output list and update the hatch list. + else { + // Copy Old Stack + FluidStack aNewHatchStack = aHatchStack.copy(); + // Add in amount from output stack + aNewHatchStack.amount += aOutputStack.amount; + // Remove fluid from output list, merge success + aOutputFluids.remove(aOutputStack); + // Remove hatch from hatch list, data is now invalid. + aOutputHatches.remove(aHatchData); + // Re-add hatch to hatch list, with new data. + Triplet aNewHatchData = new Triplet(aHatch, aNewHatchStack, aNewHatchStack.amount); + aOutputHatches.add(aNewHatchData); + // Check next fluid + continue aFluidMatch; + } + + } + else { + continue aFluidMatch; + } + } + } + } + + for (Triplet aFreeHatchCheck : aOutputHatches) { + // Free Hatch + if (aFreeHatchCheck.getValue_2() == null || aFreeHatchCheck.getValue_3() == 0 || aFreeHatchCheck.getValue_1().getFluid() == null) { + aEmptyFluidHatches++; } } - if (!tCanBufferFluid) return false; + + // We have Fluid Stacks we did not merge. Do we have space? + if (aOutputFluids.size() > 0) { + // Not enough space to add fluids. + if (aOutputFluids.size() < aEmptyFluidHatches) { + Logger.INFO("Failed to find enough space for all fluid outputs."); + return false; + } + } + + /* + * End Fluid Management + */ } + return true; } @@ -534,20 +775,17 @@ GT_MetaTileEntity_MultiBlockBase { public static Method aLogger = null; public void log(String s) { - - boolean isDebugLogging = CORE.DEBUG; - boolean reset = false; - - if (reset) { - if (isDebugLogging) { + boolean reset = true; + if (reset || aLogger == null) { + if (!AsmConfig.disableAllLogging) { aLogger = ReflectionUtils.getMethod( Logger.class, "INFO", String.class - ); + ); } else { aLogger = ReflectionUtils.getMethod( Logger.class, "MACHINE_INFO", String.class - ); + ); } } try { @@ -555,6 +793,7 @@ GT_MetaTileEntity_MultiBlockBase { } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); } } @@ -741,21 +980,39 @@ GT_MetaTileEntity_MultiBlockBase { int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { // Based on the Processing Array. A bit overkill, but very flexible. + // Reset outputs and progress stats this.mEUt = 0; this.mMaxProgresstime = 0; this.mOutputItems = new ItemStack[]{}; this.mOutputFluids = new FluidStack[]{}; - + + + + // Get input Voltage long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + + // Get total Amps available to this multiblock + long tAmpsIn = 0; + for (GT_MetaTileEntity_Hatch_Energy aHatch : this.mEnergyHatches) { + tAmpsIn += aHatch.maxAmperesIn(); + } + + // How much voltage can actually go in + long tEffectiveVoltage = tVoltage * tAmpsIn; + + byte tTierInputVoltage = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tEffectiveVoltage)); log("Running checkRecipeGeneric(0)"); + log("Amps: "+tAmpsIn); + log("Input Voltage: "+tVoltage+", Tier: "+tTierInputVoltage); + log("Effective Voltage: "+tEffectiveVoltage+", Effective Tier: "+tTier); GT_Recipe tRecipe = findRecipe( getBaseMetaTileEntity(), mLastRecipe, false, - gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); + gregtech.api.enums.GT_Values.V[tTierInputVoltage], aFluidInputs, aItemInputs); log("Running checkRecipeGeneric(1)"); // Remember last recipe - an optimization for findRecipe() @@ -767,7 +1024,8 @@ GT_MetaTileEntity_MultiBlockBase { } if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { - log("BAD RETURN - 2"); + log("BAD RETURN - 2"); // TODO + Logger.INFO("No Output Space."); return false; } @@ -783,12 +1041,12 @@ GT_MetaTileEntity_MultiBlockBase { log("tVoltage: "+tVoltage); log("tRecipeEUt: "+tRecipeEUt); // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits - for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) { + for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEffectiveVoltage - tRecipeEUt); parallelRecipes++) { if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { log("Broke at "+parallelRecipes+"."); break; } - log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"."); + log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+". Can use "+tEffectiveVoltage); tTotalEUt += tRecipeEUt; } @@ -813,10 +1071,10 @@ GT_MetaTileEntity_MultiBlockBase { // Overclock if (this.mEUt <= 16) { - this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1)); + this.mEUt = (this.mEUt * (1 << tTierInputVoltage - 1) * (1 << tTierInputVoltage - 1)); + this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTierInputVoltage - 1)); } else { - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTierInputVoltage - 1)]) { this.mEUt *= 4; this.mMaxProgresstime /= 2; } @@ -1383,36 +1641,36 @@ GT_MetaTileEntity_MultiBlockBase { public boolean causeMaintenanceIssue() { boolean b = false; switch (this.getBaseMetaTileEntity().getRandomNumber(6)) { - case 0 : { - this.mWrench = false; - b = true; - break; - } - case 1 : { - this.mScrewdriver = false; - b = true; - break; - } - case 2 : { - this.mSoftHammer = false; - b = true; - break; - } - case 3 : { - this.mHardHammer = false; - b = true; - break; - } - case 4 : { - this.mSolderingTool = false; - b = true; - break; - } - case 5 : { - this.mCrowbar = false; - b = true; - break; - } + case 0 : { + this.mWrench = false; + b = true; + break; + } + case 1 : { + this.mScrewdriver = false; + b = true; + break; + } + case 2 : { + this.mSoftHammer = false; + b = true; + break; + } + case 3 : { + this.mHardHammer = false; + b = true; + break; + } + case 4 : { + this.mSolderingTool = false; + b = true; + break; + } + case 5 : { + this.mCrowbar = false; + b = true; + break; + } } return b; } @@ -1849,7 +2107,7 @@ GT_MetaTileEntity_MultiBlockBase { @SuppressWarnings("rawtypes") public boolean isThisHatchMultiDynamo(Object aMetaTileEntity){ - Class mDynamoClass; + Class mDynamoClass; mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); if (mDynamoClass != null){ if (mDynamoClass.isInstance(aMetaTileEntity)){ @@ -1894,7 +2152,7 @@ GT_MetaTileEntity_MultiBlockBase { try { return (int) calculatePollutionReduction.invoke(i, g); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - + } } return 0; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index d507b3c814..aad05f1730 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -36,6 +36,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.LangUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -131,32 +132,84 @@ public class Meta_GT_Proxy { public static void fixIC2FluidNames() { //Fix IC2 Hot Water name try { - String aNewHeatedWaterName = "Heated Water"; - Logger.INFO("Renaming [IC2 Hotspring Water] --> ["+aNewHeatedWaterName+"].");LanguageRegistry.instance().addStringLocalization("fluidHotWater", "Heated Water"); - LanguageRegistry.instance().addStringLocalization("fluidHotWater", aNewHeatedWaterName); - LanguageRegistry.instance().addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName); - GT_LanguageManager.addStringLocalization("fluidHotWater", aNewHeatedWaterName); - GT_LanguageManager.addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName); - - Block b = BlocksItems.getFluidBlock(InternalName.fluidHotWater); - if (b != null) { - LanguageRegistry.addName(ItemUtils.getSimpleStack(b), aNewHeatedWaterName); - LanguageRegistry.instance().addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName); - GT_LanguageManager.addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName); - } - Fluid f = BlocksItems.getFluid(InternalName.fluidHotWater); - if (f != null) { - LanguageRegistry.instance().addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName); - GT_LanguageManager.addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName); - int aDam = FluidRegistry.getFluidID(f); - ItemStack s = ItemList.Display_Fluid.getWithDamage(1, aDam); - if (s != null) { - LanguageRegistry.addName(s, aNewHeatedWaterName); - } - } + String aNewHeatedWaterName = "Heated Water"; + Logger.INFO("Renaming [IC2 Hotspring Water] --> ["+aNewHeatedWaterName+"].");LanguageRegistry.instance().addStringLocalization("fluidHotWater", "Heated Water"); + LanguageRegistry.instance().addStringLocalization("fluidHotWater", aNewHeatedWaterName); + LanguageRegistry.instance().addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization("fluidHotWater", aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName); + + Block b = BlocksItems.getFluidBlock(InternalName.fluidHotWater); + if (b != null) { + LanguageRegistry.addName(ItemUtils.getSimpleStack(b), aNewHeatedWaterName); + LanguageRegistry.instance().addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName); + } + Fluid f = BlocksItems.getFluid(InternalName.fluidHotWater); + if (f != null) { + LanguageRegistry.instance().addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName); + int aDam = FluidRegistry.getFluidID(f); + ItemStack s = ItemList.Display_Fluid.getWithDamage(1, aDam); + if (s != null) { + LanguageRegistry.addName(s, aNewHeatedWaterName); + } + } + + String[] aLangs = new String[] { + "de_DE", + "en_US", + "en_GB", + "en_IC", + "es_AR", + "es_ES", + "es_MX", + "es_UY", + "es_VE", + "fr_CA", + "fr_FR", + "it_IT", + "ko_KR", + "pt_BR", + "pt_PT", + "ru_RU", + "sv_SE", + "tr_TR", + "zh_CN", + "zh_TW", + }; + String[] aLangValues = new String[] { + "Erhitztes Wasser", + "Heated Water", + "Heated Water", + "Heated Water", + "Agua caliente", + "Agua caliente", + "Agua caliente", + "Agua caliente", + "Agua caliente", + "Eau chauffée", + "Eau chauffée", + "Acqua riscaldata", + "온수", + "Água aquecida", + "Água aquecida", + "Вода с подогревом", + "Uppvärmt vatten", + "Isıtılmış Su", + "热水", + "热水", + + }; + for (int i=0;i aBaseMetaTileEntity.getEUCapacity() / 3L; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java index 611cb4da71..b8517533e6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java @@ -55,7 +55,7 @@ extends GregtechMeta_MultiBlockBase { "1x Input Bus", "1x Output Bus", "1x Energy Hatch" - }; + }; } @Override @@ -101,7 +101,7 @@ extends GregtechMeta_MultiBlockBase { public boolean checkRecipe(final ItemStack aStack) { return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 0); } - + @Override public int getMaxParallelRecipes() { return this.mLevel * 12; @@ -118,19 +118,21 @@ extends GregtechMeta_MultiBlockBase { final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; this.mLevel = 0; if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { + Logger.INFO("No air? "+xDir+", 1, "+zDir); return false; } final byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir); switch (tUsedMeta) { - case 2: - this.mLevel = 1; - break; - case 3: - this.mLevel = 2; - break; - default: - return false; + case 2: + this.mLevel = 1; + break; + case 3: + this.mLevel = 2; + break; + default: + Logger.INFO("Bad Heating Coils."); + return false; } for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { @@ -140,7 +142,7 @@ extends GregtechMeta_MultiBlockBase { Logger.INFO("Heating Coils missing."); return false; } - + if (!isValidBlockForStructure(tTileEntity2, TAE.GTPP_INDEX(1), true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j), ModBlocks.blockCasingsMisc, 1)) { Logger.INFO("Casings missing from top layer of coke oven."); return false; @@ -158,7 +160,7 @@ extends GregtechMeta_MultiBlockBase { } } } - } + } return true; } -- cgit From 7fbe8a8aae1cc923ec4a0a9f5b7075d30568d94c Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 24 Nov 2019 19:05:01 +0000 Subject: + Added recipe for Supreme Pizza Gloves. + Added Turbine Housing. + Added recipe for Turbine Housing. + Added auto-output behaviour to Super Bus (O), borrowed from GTNH. Closes #576. % Adjusted Multiblock base checkRecipe function to hopefully now use 2A per energy hatch. (This was done last commit, but was never mentioned) $ Fixed missing Recipe for Cloaking Device. $ Fixed Selenium Exploit. Closes #570. $ Potentially fixed weird cape crash. $ Added additional logging for TT recipe adding. $ Did some work on ToggleSneak stuff in Sneak Manager. Fixes #566. --- src/Java/gtPlusPlus/core/common/BasePlayer.java | 183 ++------------- .../core/handler/events/SneakManager.java | 33 ++- .../core/item/crafting/ItemDummyResearch.java | 4 +- .../core/item/general/ItemSlowBuildingRing.java | 36 +-- .../gtPlusPlus/core/recipe/RECIPES_GREGTECH.java | 256 +++++++++++++++------ .../core/recipe/RECIPES_SeleniumProcessing.java | 18 +- src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java | 11 +- src/Java/gtPlusPlus/core/util/data/ArrayUtils.java | 17 +- .../xmod/gregtech/api/enums/GregtechItemList.java | 3 + .../api/gui/hatches/CONTAINER_1by1_Turbine.java | 4 +- .../GT_MetaTileEntity_Hatch_TurbineProvider.java | 212 +++++++++++++++++ .../GT_MetaTileEntity_SuperBus_Output.java | 2 +- .../base/GregtechMeta_MultiBlockBase.java | 2 +- .../gregtech/common/render/GTPP_CapeRenderer.java | 10 +- .../multi/production/GT4Entity_ThermalBoiler.java | 14 +- .../xmod/gregtech/recipes/GregtechRecipeAdder.java | 13 +- .../gregtech/GregtechCustomHatches.java | 14 ++ 17 files changed, 542 insertions(+), 290 deletions(-) create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/gui') diff --git a/src/Java/gtPlusPlus/core/common/BasePlayer.java b/src/Java/gtPlusPlus/core/common/BasePlayer.java index d60925102a..4686f34207 100644 --- a/src/Java/gtPlusPlus/core/common/BasePlayer.java +++ b/src/Java/gtPlusPlus/core/common/BasePlayer.java @@ -1,19 +1,14 @@ package gtPlusPlus.core.common; -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.entity.EntityClientPlayerMP; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.network.play.client.C0BPacketEntityAction; -import net.minecraft.potion.Potion; -import net.minecraft.util.MovementInputFromOptions; -import net.minecraft.util.ResourceLocation; - import api.player.client.ClientPlayerAPI; import api.player.client.ClientPlayerBase; import gtPlusPlus.core.handler.events.CustomMovementHandler; import gtPlusPlus.core.handler.events.SneakManager; +import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.util.MovementInputFromOptions; public class BasePlayer extends ClientPlayerBase { @@ -30,8 +25,17 @@ public class BasePlayer extends ClientPlayerBase * EntityPlayerSP.onLivingUpdate() - Adapted to PlayerAPI */ @Override - public void onLivingUpdate() - { + public void onLivingUpdate() { + + super.onLivingUpdate(); + EntityPlayer aPlayer = this.player; + if (aPlayer != null) { + SneakManager aSneak = SneakManager.get(aPlayer); + if (!aSneak.isWearingRing()) { + return; + } + } + if(this.player.sprintingTicksLeft > 0) { --this.player.sprintingTicksLeft; @@ -57,54 +61,9 @@ public class BasePlayer extends ClientPlayerBase } else { - this.player.prevTimeInPortal = this.player.timeInPortal; - if(this.playerAPI.getInPortalField()) - { - if(this.mc.currentScreen != null) - { - this.mc.displayGuiScreen((GuiScreen)null); - } - - if(this.player.timeInPortal == 0.0F) - { - this.mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("portal.trigger"), (this.player.getRNG().nextFloat() * 0.4F) + 0.8F)); - } - - this.player.timeInPortal += 0.0125F; - - if(this.player.timeInPortal >= 1.0F) - { - this.player.timeInPortal = 1.0F; - } - - this.playerAPI.setInPortalField(false); - } - else if(this.player.isPotionActive(Potion.confusion) && (this.player.getActivePotionEffect(Potion.confusion).getDuration() > 60)) - { - this.player.timeInPortal += 0.006666667F; - if(this.player.timeInPortal > 1.0F) - { - this.player.timeInPortal = 1.0F; - } - } - else - { - if(this.player.timeInPortal > 0.0F) - { - this.player.timeInPortal -= 0.05F; - } - - if(this.player.timeInPortal < 0.0F) - { - this.player.timeInPortal = 0.0F; - } - } - if(this.player.timeUntilPortal > 0) - { - --this.player.timeUntilPortal; - } + final boolean isJumping = this.player.movementInput.jump; @@ -112,23 +71,6 @@ public class BasePlayer extends ClientPlayerBase final boolean isMovingForward = this.player.movementInput.moveForward >= minSpeed; this.customMovementInput.update(this.mc, (MovementInputFromOptions)this.player.movementInput, this.player); - if(this.player.isUsingItem() && !this.player.isRiding()) - { - this.player.movementInput.moveStrafe *= 0.2F; - this.player.movementInput.moveForward *= 0.2F; - this.playerAPI.setSprintToggleTimerField(0); - } - - if(this.player.movementInput.sneak && (this.player.ySize < 0.2F)) - { - this.player.ySize = 0.2F; - } - - this.playerAPI.localPushOutOfBlocks(this.player.posX - (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ + (this.player.width * 0.35D)); - this.playerAPI.localPushOutOfBlocks(this.player.posX - (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ - (this.player.width * 0.35D)); - this.playerAPI.localPushOutOfBlocks(this.player.posX + (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ - (this.player.width * 0.35D)); - this.playerAPI.localPushOutOfBlocks(this.player.posX + (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ + (this.player.width * 0.35D)); - final boolean enoughHunger = (this.player.getFoodStats().getFoodLevel() > 6.0F) || this.player.capabilities.isFlying; /* * Begin ToggleSneak Changes - ToggleSprint @@ -151,7 +93,7 @@ public class BasePlayer extends ClientPlayerBase if(isSprintDisabled) { //Utils.LOG_INFO("Sprint pressed"); - if(aSneak.optionDoubleTap && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) + if(aSneak.optionDoubleTap && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) { if((this.playerAPI.getSprintToggleTimerField() <= 0) && !this.settings.keyBindSprint.getIsKeyPressed()) { @@ -170,7 +112,7 @@ public class BasePlayer extends ClientPlayerBase } } - if(!this.player.isSprinting() && (this.player.movementInput.moveForward >= minSpeed) && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && this.settings.keyBindSprint.getIsKeyPressed()) + if(!this.player.isSprinting() && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && this.settings.keyBindSprint.getIsKeyPressed()) { if (aSneak.Sprinting()){ this.player.setSprinting(true); @@ -192,7 +134,7 @@ public class BasePlayer extends ClientPlayerBase // 5/6/14 - onGround check removed to match vanilla's 'start sprint while jumping' behavior. //if(this.player.onGround && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && !this.customMovementInput.sprintHeldAndReleased) - if(enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && !this.customMovementInput.sprintHeldAndReleased) + if(!this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && !this.customMovementInput.sprintHeldAndReleased) { if((canDoubleTap && !this.player.isSprinting()) || !canDoubleTap) { @@ -204,7 +146,7 @@ public class BasePlayer extends ClientPlayerBase } } - if(canDoubleTap && !state && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) + if(canDoubleTap && !state && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) { if(this.playerAPI.getSprintToggleTimerField() == 0) { @@ -223,7 +165,7 @@ public class BasePlayer extends ClientPlayerBase // If sprinting, break the sprint in appropriate circumstances: // Player stops moving forward, runs into something, or gets too hungry - if(this.player.isSprinting() && ((this.player.movementInput.moveForward < minSpeed) || this.player.isCollidedHorizontally || !enoughHunger)) + if(this.player.isSprinting() && ((this.player.movementInput.moveForward < minSpeed) || this.player.isCollidedHorizontally)) { this.player.setSprinting(false); @@ -265,87 +207,6 @@ public class BasePlayer extends ClientPlayerBase // this.handledDebugPress = false; // } - // - // Fly Speed Boosting - Added 5/7/2014 - // - if(this.player.capabilities.getFlySpeed() != 0.05F) - { - this.player.capabilities.setFlySpeed(0.05F); - } - - - if(this.player.capabilities.allowFlying && !isJumping && this.player.movementInput.jump) - { - if(this.playerAPI.getFlyToggleTimerField() == 0) - { - this.playerAPI.setFlyToggleTimerField(7); - } - else - { - this.player.capabilities.isFlying = !this.player.capabilities.isFlying; - this.player.sendPlayerAbilities(); - this.playerAPI.setFlyToggleTimerField(0); - } - } - - if(this.player.capabilities.isFlying) - { - if(this.player.movementInput.sneak) - { - this.player.motionY -= 0.15D; - } - if(this.player.movementInput.jump) - { - this.player.motionY += 0.15D; - } - } - - if(this.player.isRidingHorse()) - { - if(this.playerAPI.getHorseJumpPowerCounterField() < 0) - { - this.playerAPI.setHorseJumpPowerCounterField(this.playerAPI.getHorseJumpPowerCounterField() + 1); - if(this.playerAPI.getHorseJumpPowerCounterField() == 0) - { - this.playerAPI.setHorseJumpPowerField(0.0F); - } - } - - if(isJumping && !this.player.movementInput.jump) - { - this.playerAPI.setHorseJumpPowerCounterField(this.playerAPI.getHorseJumpPowerCounterField() - 10); - this.playerAPI.setHorseJumpPowerCounterField(-10); - ((EntityClientPlayerMP)this.player).sendQueue.addToSendQueue(new C0BPacketEntityAction(this.player, 6, (int)(this.player.getHorseJumpPower() * 100.0F))); - } - else if(!isJumping && this.player.movementInput.jump) - { - this.playerAPI.setHorseJumpPowerCounterField(0); - this.playerAPI.setHorseJumpPowerField(0.0F); - } - else if(isJumping) - { - this.playerAPI.setHorseJumpPowerCounterField(this.playerAPI.getHorseJumpPowerCounterField() + 1); - if(this.playerAPI.getHorseJumpPowerCounterField() < 10) - { - this.playerAPI.setHorseJumpPowerField(this.playerAPI.getHorseJumpPowerCounterField() * 0.1F); - } - else - { - this.playerAPI.setHorseJumpPowerField(0.8F + ((2.0F / (this.playerAPI.getHorseJumpPowerCounterField() - 9)) * 0.1F)); - } - } - } - else - { - this.playerAPI.setHorseJumpPowerField(0.0F); - } - - this.playerAPI.superOnLivingUpdate(); - if(this.player.onGround && this.player.capabilities.isFlying) - { - this.player.capabilities.isFlying = false; - this.player.sendPlayerAbilities(); - } } } } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/events/SneakManager.java b/src/Java/gtPlusPlus/core/handler/events/SneakManager.java index 2b067be477..3e51c6488a 100644 --- a/src/Java/gtPlusPlus/core/handler/events/SneakManager.java +++ b/src/Java/gtPlusPlus/core/handler/events/SneakManager.java @@ -37,10 +37,11 @@ public class SneakManager { public boolean canSprint = true; public boolean isSneaking = true; public boolean optionDoubleTap = true; - public boolean wasSprintDisabled = false; + public boolean wasSprintDisabled = false; + public boolean mIsWearingRing = false; - private static State Sprinting = State.ON; - private static State Crouching = State.OFF; + private State Sprinting = State.ON; + private State Crouching = State.OFF; public SneakManager(EntityPlayer aPlayer) { owner = aPlayer; @@ -78,22 +79,38 @@ public class SneakManager { return State.ON; } - public State setCrouchingStateON(){ + private State setCrouchingStateON(){ return Crouching = State.ON; } - public State setCrouchingStateOFF(){ + private State setCrouchingStateOFF(){ return Crouching = State.OFF; } - public State setSprintingStateON(){ + private State setSprintingStateON(){ return Sprinting = State.ON; } - public State setSprintingStateOFF(){ + private State setSprintingStateOFF(){ return Sprinting = State.OFF; } - + + public void putRingOn() { + mIsWearingRing = true; + setSprintingStateOFF(); + setCrouchingStateON(); + } + + public void takeRingOff() { + mIsWearingRing = false; + setSprintingStateON(); + setCrouchingStateOFF(); + } + + public boolean isWearingRing() { + return mIsWearingRing; + } + public static enum State { ON(true), OFF(false); diff --git a/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java b/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java index 1c28f99ff8..3f8e31d8d2 100644 --- a/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java +++ b/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java @@ -26,7 +26,9 @@ public class ItemDummyResearch extends ItemGenericToken { RESEARCH_4_BASIC_PHYSICS("Basic Physics", "Fundamental laws of motion"), RESEARCH_5_ADV_PHYSICS("Advanced Physics", "Advanced knowledge!"), RESEARCH_6_BASIC_METALLURGY("Basic Metallurgy", "Information about material smelting"), - RESEARCH_7_ADV_METALLURGY("Advanced Metallurgy", "Advanced Material Sciences!"); + RESEARCH_7_ADV_METALLURGY("Advanced Metallurgy", "Advanced Material Sciences!"), + RESEARCH_8_TURBINE_AUTOMATION("Turbine Automation", "You really don't want to share this with anyone!"), + RESEARCH_9_CLOAKING("Cloaking Technologies", "Sneaking around like a mouse"); diff --git a/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java b/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java index c151a16f09..fa008bf1a3 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java @@ -2,10 +2,15 @@ package gtPlusPlus.core.item.general; import java.util.List; +import baubles.api.BaubleType; +import baubles.api.IBauble; import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.client.Minecraft; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.handler.events.CustomMovementHandler; +import gtPlusPlus.core.handler.events.SneakManager; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -14,14 +19,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import baubles.api.BaubleType; -import baubles.api.IBauble; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.handler.events.CustomMovementHandler; -import gtPlusPlus.core.handler.events.SneakManager; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; - @Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) public class ItemSlowBuildingRing extends Item implements IBauble{ @@ -84,7 +81,17 @@ public class ItemSlowBuildingRing extends Item implements IBauble{ @Override //TODO public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { - doEffect(arg1); + try { + EntityPlayer aPlayer; + if (arg1 instanceof EntityPlayer) { + aPlayer = (EntityPlayer) arg1; + SneakManager s = SneakManager.get(aPlayer); + s.putRingOn(); + } + } + catch (Throwable t) { + t.printStackTrace(); + } } @Override //TODO @@ -94,8 +101,7 @@ public class ItemSlowBuildingRing extends Item implements IBauble{ if (arg1 instanceof EntityPlayer) { aPlayer = (EntityPlayer) arg1; SneakManager s = SneakManager.get(aPlayer); - s.setSprintingStateON(); - s.setCrouchingStateOFF(); + s.takeRingOff(); } } catch (Throwable t) { @@ -122,9 +128,7 @@ public class ItemSlowBuildingRing extends Item implements IBauble{ } if (aPlayer.isSprinting()) { aPlayer.setSprinting(false); - } - s.setSprintingStateOFF(); - s.setCrouchingStateON(); + } } } } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index 3f631e0bca..ea7f5e4ef7 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -276,6 +276,35 @@ public class RECIPES_GREGTECH { 20 * 60 * 1 * (GTNH ? 2 : 1), (int) GT_Values.V[5]); + // Turbine Automation Port + CORE.RA.addAssemblylineRecipe( + ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_8_TURBINE_AUTOMATION, 1), + 20 * 60 * 60 * 24, + new ItemStack[] { + CI.getTieredMachineHull(8, 4), + CI.getConveyor(8, GTNH ? 24 : 12), + CI.getElectricMotor(7, GTNH ? 32 : 16), + CI.getElectricPiston(7, GTNH ? 16 : 4), + CI.getEnergyCore(6, GTNH ? 8 : 2), + CI.getPlate(8, GTNH ? 24 : 12), + CI.getTieredComponent(OrePrefixes.screw, 8, GTNH ? 48 : 24), + CI.getTieredComponent(OrePrefixes.bolt, 7, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.rod, 6, GTNH ? 12 : 6), + CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 20 : 10), + CI.getTieredComponent(OrePrefixes.rotor, 6, GTNH ? 16 : 8), + }, + new FluidStack[] { + CI.getTieredFluid(8, 144 * 32), + CI.getAlternativeTieredFluid(7, 144 * 16), + CI.getTertiaryTieredFluid(7, 144 * 16), + ALLOY.BABBIT_ALLOY.getFluid(128 * 144), + ALLOY.ZERON_100.getFluid(144 * 64) + + }, + GregtechItemList.Hatch_Input_TurbineHousing.get(4), + 20 * 60 * 60 * (GTNH ? 2 : 1), + (int) GT_Values.V[8]); + /* * Contianment casings @@ -360,88 +389,116 @@ public class RECIPES_GREGTECH { } - //Nano Healer - CORE.RA.addAssemblylineRecipe( - ItemUtils.simpleMetaStack(Items.golden_apple, 1, 1), - 20 * 60 * 10, - new ItemStack[] { - ItemUtils.getSimpleStack(aGemCasings[2], GTNH ? 4 : 2), - CI.getTieredComponent(OrePrefixes.plate, 8, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 4), - CI.getTieredComponent(OrePrefixes.cableGt02, 7, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.gearGt, 6, GTNH ? 6 : 3), - CI.getTieredComponent(OrePrefixes.screw, 7, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.bolt, 5, GTNH ? 24 : 12), - CI.getTieredComponent(OrePrefixes.frameGt, 4, GTNH ? 12 : 6), - aCoilWire[3] - }, - new FluidStack[] { - CI.getTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), - CI.getTertiaryTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), - CI.getAlternativeTieredFluid(6, 144 * 18 * (GTNH ? 16 : 8)), - CI.getAlternativeTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), - - }, - ItemUtils.getItemStackFromFQRN("miscutils:personalHealingDevice", 1), - 20 * 60 * 30 * (GTNH ? 2 : 1), - (int) GT_Values.V[7]); - - - - //Charge Pack LuV-UV - - ItemStack[] aChargeResearch = new ItemStack[] { - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore7", 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_1, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_2, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_3, 1), - }; - - ItemStack[] aChargeOutputs = new ItemStack[] { - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_1, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_2, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_3, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_4, 1), - }; + if (LoadedMods.Baubles) { + //Nano Healer + CORE.RA.addAssemblylineRecipe( + ItemUtils.simpleMetaStack(Items.golden_apple, 1, 1), + 20 * 60 * 10, + new ItemStack[] { + ItemUtils.getSimpleStack(aGemCasings[2], GTNH ? 4 : 2), + CI.getTieredComponent(OrePrefixes.plate, 8, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 4), + CI.getTieredComponent(OrePrefixes.cableGt02, 7, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.gearGt, 6, GTNH ? 6 : 3), + CI.getTieredComponent(OrePrefixes.screw, 7, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.bolt, 5, GTNH ? 24 : 12), + CI.getTieredComponent(OrePrefixes.frameGt, 4, GTNH ? 12 : 6), + aCoilWire[3] + }, + new FluidStack[] { + CI.getTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), + CI.getTertiaryTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), + CI.getAlternativeTieredFluid(6, 144 * 18 * (GTNH ? 16 : 8)), + CI.getAlternativeTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), - ItemStack[] aBufferCoreInputs = new ItemStack[] { - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore7", GTNH ? 8 : 4), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore8", GTNH ? 8 : 4), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore9", GTNH ? 8 : 4), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore10", GTNH ? 8 : 4), - }; + }, + ItemUtils.getItemStackFromFQRN("miscutils:personalHealingDevice", 1), + 20 * 60 * 30 * (GTNH ? 2 : 1), + (int) GT_Values.V[7]); + + + + //Charge Pack LuV-UV + + ItemStack[] aChargeResearch = new ItemStack[] { + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore7", 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_1, 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_2, 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_3, 1), + }; + + ItemStack[] aChargeOutputs = new ItemStack[] { + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_1, 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_2, 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_3, 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_4, 1), + }; + + ItemStack[] aBufferCoreInputs = new ItemStack[] { + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore7", GTNH ? 8 : 4), + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore8", GTNH ? 8 : 4), + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore9", GTNH ? 8 : 4), + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore10", GTNH ? 8 : 4), + }; + + int aCurrSlot = 0; + for (int h = 6; h < 10; h++) { + CORE.RA.addAssemblylineRecipe( + aChargeResearch[aCurrSlot], + 20 * 60 * 10 * (aCurrSlot + 1), + new ItemStack[] { + ItemUtils.getSimpleStack( + aGemBatteries[aCurrSlot], GTNH ? 4 : 2), + aBufferCoreInputs[aCurrSlot], + aCoilWire[aCurrSlot], + CI.getTieredComponent(OrePrefixes.plate, h, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.plate, h-1, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, h, GTNH ? 16 : 4), + CI.getTieredComponent(OrePrefixes.circuit, h-1, GTNH ? 32 : 8), + CI.getTieredComponent(OrePrefixes.cableGt12, h-1, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.screw, h, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.bolt, h-2, GTNH ? 32 : 16), + CI.getElectricMotor(h, GTNH ? 8 : 4), + CI.getFieldGenerator(h-1, 2), + CI.getRobotArm(h-2, GTNH ? 4 : 2), + }, + new FluidStack[] { + CI.getTieredFluid(h, 144 * 18 * (GTNH ? 8 : 4)), + CI.getTertiaryTieredFluid(h-1, 144 * 18 * (GTNH ? 8 : 4)), + CI.getAlternativeTieredFluid(h-1, 144 * 18 * (GTNH ? 8 : 4)), + CI.getAlternativeTieredFluid(h-2, 144 * 18 * (GTNH ? 8 : 4)), + }, + aChargeOutputs[aCurrSlot], + 20 * 60 * 30 * (GTNH ? 2 : 1) * (aCurrSlot+1), + (int) GT_Values.V[h]); + aCurrSlot++; + } - int aCurrSlot = 0; - for (int h = 6; h < 10; h++) { + //Cloaking device CORE.RA.addAssemblylineRecipe( - aChargeResearch[aCurrSlot], - 20 * 60 * 10 * (aCurrSlot + 1), + ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_9_CLOAKING, 1), + 20 * 60 * 10, new ItemStack[] { - ItemUtils.getSimpleStack( - aGemBatteries[aCurrSlot], GTNH ? 4 : 2), - aBufferCoreInputs[aCurrSlot], - aCoilWire[aCurrSlot], - CI.getTieredComponent(OrePrefixes.plate, h, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.plate, h-1, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.circuit, h, GTNH ? 16 : 4), - CI.getTieredComponent(OrePrefixes.circuit, h-1, GTNH ? 32 : 8), - CI.getTieredComponent(OrePrefixes.cableGt12, h-1, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.screw, h, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.bolt, h-2, GTNH ? 32 : 16), - CI.getElectricMotor(h, GTNH ? 8 : 4), - CI.getFieldGenerator(h-1, 2), - CI.getRobotArm(h-2, GTNH ? 4 : 2), + ItemUtils.getSimpleStack(aGemCasings[3], GTNH ? 4 : 2), + CI.getTieredComponent(OrePrefixes.plate, 8, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 4), + CI.getTieredComponent(OrePrefixes.cableGt04, 8, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.gearGt, 7, GTNH ? 6 : 3), + CI.getTieredComponent(OrePrefixes.screw, 8, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.bolt, 7, GTNH ? 24 : 12), + CI.getTieredComponent(OrePrefixes.frameGt, 5, GTNH ? 12 : 6), + aCoilWire[3] }, new FluidStack[] { - CI.getTieredFluid(h, 144 * 18 * (GTNH ? 8 : 4)), - CI.getTertiaryTieredFluid(h-1, 144 * 18 * (GTNH ? 8 : 4)), - CI.getAlternativeTieredFluid(h-1, 144 * 18 * (GTNH ? 8 : 4)), - CI.getAlternativeTieredFluid(h-2, 144 * 18 * (GTNH ? 8 : 4)), + CI.getTieredFluid(8, 144 * 18 * (GTNH ? 16 : 8)), + CI.getTertiaryTieredFluid(8, 144 * 18 * (GTNH ? 16 : 8)), + CI.getAlternativeTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), + CI.getAlternativeTieredFluid(8, 144 * 18 * (GTNH ? 16 : 8)), + }, - aChargeOutputs[aCurrSlot], - 20 * 60 * 30 * (GTNH ? 2 : 1) * (aCurrSlot+1), - (int) GT_Values.V[h]); - aCurrSlot++; + ItemUtils.getItemStackFromFQRN("miscutils:personalCloakingDevice", 1), + 20 * 60 * 30 * (GTNH ? 2 : 1), + (int) GT_Values.V[8]); } @@ -1491,6 +1548,53 @@ public class RECIPES_GREGTECH { GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Invar, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Invar, 4L), GregtechItemList.Fluid_Cell_144L.get(1L, new Object[0]), 75, 32); } } + + + if (LoadedMods.Baubles) { + + + + // Turbine Housing Research Page + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + ItemUtils.getGregtechCircuit(17), + ItemUtils.getItemStackOfAmountFromOreDict("plateRefinedTrinium", GTNH ? 64 : 32), + CI.getSensor(6, GTNH ? 6 : 3), + CI.getBolt(7, GTNH ? 64 : 32), + ItemUtils.getItemStackOfAmountFromOreDict("wireFinePlatinum", GTNH ? 64 : 32), + ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(7), GTNH ? 12 : 6) + }, + CI.getAlternativeTieredFluid(7, 144 * 32), + ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_8_TURBINE_AUTOMATION, 1), + 20 * 60 * 5, + (int) GT_Values.V[6]); + + // Cloaking Device Research Page + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + ItemUtils.getGregtechCircuit(17), + ItemUtils.getSimpleStack(ModItems.itemCircuitLFTR, 4), + CI.getFieldGenerator(6, GTNH ? 16 : 8), + ItemUtils.getItemStackOfAmountFromOreDict("wireFinePalladium", GTNH ? 32 : 16), + ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(6), GTNH ? 12 : 6) + }, + CI.getAlternativeTieredFluid(7, 144 * 32), + ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_9_CLOAKING, 1), + 20 * 60 * 10, + (int) GT_Values.V[7]); + + + // Supreme Pizza Gloves + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + ItemUtils.getGregtechCircuit(17), + ItemUtils.getSimpleStack(ModItems.itemRope, 16), + ItemUtils.getItemStackOfAmountFromOreDict("gearGtSmallWroughtIron", GTNH ? 8 : 4), + ItemUtils.getItemStackOfAmountFromOreDict("wireFineTin", GTNH ? 32 : 16), + ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(1), GTNH ? 2 : 1) + }, + FluidUtils.getFluidStack("molten.rubber", 2000), + ItemUtils.getSimpleStack(ModItems.itemPersonalFireProofDevice), + 20 * 60 * 5, + 30); + } @@ -1641,7 +1745,7 @@ public class RECIPES_GREGTECH { } private static void centrifugeRecipes() { - + //Try use all woods found, fix/add methane extraction. ArrayList aLogData = OreDictionary.getOres("logWood"); ArrayList aRubberLogs = OreDictionary.getOres("logRubber"); diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java index 73c7279bb8..902806e026 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java @@ -86,15 +86,15 @@ public class RECIPES_SeleniumProcessing { public static void processCopperRecipes() { - //Copper + //Copper CORE.RA.addDehydratorRecipe( new ItemStack[]{ - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Copper, 1), // Item Input + ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Copper, 1), // Item Input }, FluidUtils.getHotWater(1000), // Fluid MISC_MATERIALS.SELENIUM_DIOXIDE.getFluid(20), // Fluid new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Copper, 1), + ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Copper, 1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), @@ -121,12 +121,12 @@ public class RECIPES_SeleniumProcessing { //Tetra CORE.RA.addDehydratorRecipe( new ItemStack[]{ - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Tetrahedrite, 1), // Item Input + ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Tetrahedrite, 1), // Item Input }, FluidUtils.getHotWater(1000), // Fluid MISC_MATERIALS.SELENIUM_DIOXIDE.getFluid(10), // Fluid new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Tetrahedrite, 1), + ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Tetrahedrite, 1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), @@ -153,12 +153,12 @@ public class RECIPES_SeleniumProcessing { //Chalco CORE.RA.addDehydratorRecipe( new ItemStack[]{ - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Chalcopyrite, 1), // Item Input + ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Chalcopyrite, 1), // Item Input }, FluidUtils.getHotWater(1000), // Fluid MISC_MATERIALS.SELENIUM_DIOXIDE.getFluid(10), // Fluid new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Chalcopyrite, 1), + ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Chalcopyrite, 1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), @@ -185,12 +185,12 @@ public class RECIPES_SeleniumProcessing { //Malachite CORE.RA.addDehydratorRecipe( new ItemStack[]{ - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Malachite, 1), // Item Input + ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Malachite, 1), // Item Input }, FluidUtils.getHotWater(1000), // Fluid MISC_MATERIALS.SELENIUM_DIOXIDE.getFluid(10), // Fluid new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Malachite, 1), + ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Malachite, 1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java index 10cefdf0c4..2cc6d7b41a 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java @@ -154,16 +154,7 @@ public class RECIPES_Tools { CobbleStone, sandHammer, CobbleStone, CobbleStone, CobbleStone, CobbleStone, RECIPE_Sand); - - if (LoadedMods.Baubles){ - //Cloaking Device - RecipeUtils.recipeBuilder( - plateDoubleNiChrome, plateIridiumAlloy, plateDoubleNiChrome, - plateIridiumAlloy, batteryUltimate, plateIridiumAlloy, - plateDoubleNiChrome, plateIridiumAlloy, plateDoubleNiChrome, - personalCloakingDevice); - - } + //Sand to Sandstone RecipeUtils.recipeBuilder( Sand, Sand, Sand, diff --git a/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java b/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java index cca58467ef..3e96220995 100644 --- a/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java +++ b/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java @@ -1,10 +1,15 @@ package gtPlusPlus.core.util.data; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; -import net.minecraft.item.ItemStack; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; +import net.minecraft.item.ItemStack; public class ArrayUtils { @@ -75,5 +80,13 @@ public class ArrayUtils { } } + public static String toString(Object[] aArray, String string) { + return org.apache.commons.lang3.ArrayUtils.toString(aArray, string); + } + + public static String toString(Object[] aArray) { + return org.apache.commons.lang3.ArrayUtils.toString(aArray); + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 588c04d7e5..3ea2851a85 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -343,6 +343,9 @@ public enum GregtechItemList implements GregtechItemContainer { //XL Turbine Rotor Hatch Hatch_Turbine_Rotor, + //Standard Turbine Rotor Hatch + Hatch_Input_TurbineHousing, + //Control Core Hatch_Control_Core, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java index d4d2fcacd7..e6203823b6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java @@ -36,11 +36,11 @@ public class CONTAINER_1by1_Turbine extends GT_Container_1by1 { } @Override public boolean isItemValid(final ItemStack itemstack) { - /*if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) { + if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) { if (itemstack.getItemDamage() >= 170 && itemstack.getItemDamage() <= 176) { return true; } - }*/ + } return false; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java new file mode 100644 index 0000000000..d9e2692b09 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java @@ -0,0 +1,212 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; +import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_1by1_Turbine; +import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_1by1_Turbine; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; + +public class GT_MetaTileEntity_Hatch_TurbineProvider extends GT_MetaTileEntity_Hatch_InputBus { + + public GT_MetaTileEntity_Hatch_TurbineProvider(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public GT_MetaTileEntity_Hatch_TurbineProvider(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + public GT_MetaTileEntity_Hatch_TurbineProvider(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_TurbineProvider(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); + } + + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new CONTAINER_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity); + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity, "Turbine Housing"); + } + + @Override + public String[] getDescription() { + return new String[]{ + "An automation port for Large Turbines", "Will attempt once per 1200 ticks to fill the turbine slot of it's parent turbine", "You may adjust this with a screwdriver", "Hold shift to adjust in finer amounts", "Hold control to adjust direction", "Left Click with Screwdriver to reset", "This module assumes the entire turbine is in the same Chunk"}; + } + + + private GT_MetaTileEntity_LargeTurbine mParent = null; + + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + super.onPostTick(aBaseMetaTileEntity, aTimer); + if (aTimer % mRefreshTime == 0 && this.getBaseMetaTileEntity().isServerSide()) { + tryRefillTurbine(); + } + } + + private final void tryFindParentTurbine() { + Logger.INFO("This turbine housing has no parent, searching world."); + IGregTechTileEntity T = this.getBaseMetaTileEntity(); + World W = T.getWorld(); + Chunk C = W.getChunkFromBlockCoords(T.getXCoord(), T.getZCoord()); + for (Object o : C.chunkTileEntityMap.values()) { + if (o instanceof IGregTechTileEntity) { + IGregTechTileEntity G = (IGregTechTileEntity) o; + final IMetaTileEntity aMetaTileEntity = G.getMetaTileEntity(); + if (aMetaTileEntity == null) { + continue; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine) { + GT_MetaTileEntity_LargeTurbine aTurb = (GT_MetaTileEntity_LargeTurbine) aMetaTileEntity; + for (GT_MetaTileEntity_Hatch_InputBus ee : aTurb.mInputBusses) { + if (ee.equals(this)) { + mParent = aTurb; + Logger.INFO("Found a Parent to attach to this housing."); + return; + } + } + } + } + } + } + + private final void tryRefillTurbine() { + if (mParent == null) { + tryFindParentTurbine(); + } + if (mParent != null && mParent.mInventory[1] == null) { + for (ItemStack aStack : this.mInventory) { + if (isItemStackTurbine(aStack)) { + setGUIItemStack(aStack); + } + } + } + } + + protected boolean setGUIItemStack(ItemStack aNewGuiSlotContents) { + boolean result = false; + if (mParent.mInventory[1] == null) { + mParent.mInventory[1] = aNewGuiSlotContents != null ? aNewGuiSlotContents.copy() : null; + mParent.depleteInput(aNewGuiSlotContents); + mParent.updateSlots(); + this.updateSlots(); + result = true; + } + return result; + } + + public boolean isItemStackTurbine(ItemStack aStack) { + if (aStack.getItem() instanceof GT_MetaGenerated_Tool) { + if (aStack.getItemDamage() >= 170 && aStack.getItemDamage() <= 176) { + return true; + } + } + return false; + } + + public boolean isItemStackScrewdriver(ItemStack aStack) { + if (aStack.getItem() instanceof GT_MetaGenerated_Tool) { + if (aStack.getItemDamage() == 22 || aStack.getItemDamage() == 150) { + return true; + } + } + return false; + } + + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return isItemStackTurbine(aStack); + } + + private int mRefreshTime = 1200; + private boolean mDescending = true; + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("mRefreshTime", mRefreshTime); + aNBT.setBoolean("mDescending", mDescending); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mRefreshTime = aNBT.getInteger("mRefreshTime"); + mDescending = aNBT.getBoolean("mDescending"); + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (aPlayer != null) { + if (KeyboardUtils.isCtrlKeyDown()) { + mDescending = Utils.invertBoolean(mDescending); + PlayerUtils.messagePlayer(aPlayer, "Direction: "+(mDescending ? "DOWN" : "UP")); + } + else { + int aAmount = 0; + if (KeyboardUtils.isShiftKeyDown()) { + aAmount = 10; + } + else { + aAmount = 100; + } + if (mDescending) { + mRefreshTime -= aAmount; + if (mRefreshTime < 0) { + mRefreshTime = 1200; + } + } + else { + mRefreshTime += aAmount; + if (mRefreshTime > 1200) { + mRefreshTime = 0; + } + } + PlayerUtils.messagePlayer(aPlayer, "Set check time to be every "+mRefreshTime+" ticks."); + } + } + } + + @Override + public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + boolean aDidScrewdriver = false; + if (aPlayer != null) { + if (aPlayer.getHeldItem() != null) { + if (isItemStackScrewdriver(aPlayer.getHeldItem())) { + aDidScrewdriver = true; + mRefreshTime = 1200; + PlayerUtils.messagePlayer(aPlayer, "Reset check time to "+mRefreshTime+" ticks."); + } + } + } + if (!aDidScrewdriver) { + super.onLeftclick(aBaseMetaTileEntity, aPlayer); + } + } + + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java index 3afa3312b1..cca5a39de3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java @@ -58,7 +58,7 @@ public class GT_MetaTileEntity_SuperBus_Output extends GT_MetaTileEntity_Hatch_O if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { this.fillStacksIntoFirstSlots(); } - + super.onPostTick(aBaseMetaTileEntity, aTimer); } public void updateSlots() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 2e50d12aca..e5d7f58dc6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -1573,7 +1573,7 @@ GT_MetaTileEntity_MultiBlockBase { boolean result = false; if (this.mInventory[1] == null) { this.mInventory[1] = aNewGuiSlotContents != null ? aNewGuiSlotContents.copy() : null; - aNewGuiSlotContents = null; + this.depleteInput(aNewGuiSlotContents); this.updateSlots(); result = true; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java index 763a4a129d..6201a782de 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java @@ -63,7 +63,6 @@ public class GTPP_CapeRenderer extends RenderPlayer { private final ArrayList mData; public GTPP_CapeRenderer() { - setRenderManager(RenderManager.instance); downloadCapeList(); ArrayList aTemp = new ArrayList(); try { @@ -76,10 +75,19 @@ public class GTPP_CapeRenderer extends RenderPlayer { } private static boolean hasResourceChecked = false; + private static boolean hasSetRenderer = false; private boolean hasCape = false; private ResourceLocation tResource = null; public synchronized void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) { + if (this.renderManager == null) { + hasSetRenderer = false; + } + if (!hasSetRenderer) { + if (RenderManager.instance != null) { + setRenderManager(RenderManager.instance); + } + } AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer; if (!ConfigSwitches.enableCustomCapes) { aEvent.setCanceled(true); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java index c55fe10829..6e7039f8ca 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java @@ -292,7 +292,19 @@ extends GregtechMeta_MultiBlockBase @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()){ - //Utils.LOG_INFO("tick: "+aTick); + // Reload Lava Filter + if (this.getGUIItemStack() == null) { + if (this.mInputBusses.size() > 0) { + for (GT_MetaTileEntity_Hatch_InputBus aBus : this.mInputBusses) { + for (ItemStack aStack : aBus.mInventory) { + if (aStack.getItem() instanceof ItemLavaFilter) { + this.setGUIItemStack(aStack); + } + } + } + } + } + if (this.mEUt > 0){ if (aTick % 600L == 0L){ damageFilter(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index d43adb2be3..cd853dfb0d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -706,6 +706,17 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { if (ttTest != null) { T = ttTest; } + else { + Method[] aDump = TTRecipeAdder.getDeclaredMethods(); + for (Method m : aDump) { + if (m != null) { + Logger.INFO("Found "+m.getName()+" | "+m.getModifiers()+" | "+ArrayUtils.toString(m.getParameters(), "EMPTY")+""); + if (m.getName().toLowerCase().equals("addresearchableassemblylinerecipe")){ + Logger.INFO("Types: "+ArrayUtils.toString(m.getParameterTypes())); + } + } + } + } } } else { @@ -787,7 +798,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { Logger.INFO("Failed to generate TecTech recipe for "+ItemUtils.getItemName(aResearchItem)+", please report this to Alkalus."); } catch (Throwable t) { - + t.printStackTrace(); } } return (boolean) mAssemblyLine.invoke(GT_Values.RA, aResearchItem, aResearchTime, aInputs, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java index 45a23fb184..9f67363302 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java @@ -11,6 +11,7 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler_Adv; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_TurbineProvider; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Input; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Output; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GT_MetaTileEntity_Hatch_CustomFluidBase; @@ -62,6 +63,19 @@ public class GregtechCustomHatches { "Naquadah Reactor Input hatch" // Local name ).getStackForm(1L)); + + GregtechItemList.Hatch_Input_TurbineHousing.set(new GT_MetaTileEntity_Hatch_TurbineProvider(31025, // ID + "hatch.turbine.input.tier.00", // unlocal name + "Turbine Housing", // Local name + 8 + ).getStackForm(1L)); + + + + + + + } private static void run2() { -- cgit