diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-10-24 00:58:51 +0100 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-10-24 00:58:51 +0100 |
commit | 68e266e0a227aaf90294d2a8ffd5081dc3bb640e (patch) | |
tree | 87322c949165f2a12f4dda7be8b781344371fc49 /src/Java/gtPlusPlus/xmod/gregtech/api | |
parent | 82445f39bb9d1f257d0850a0535f5058aa2e867c (diff) | |
download | GT5-Unofficial-68e266e0a227aaf90294d2a8ffd5081dc3bb640e.tar.gz GT5-Unofficial-68e266e0a227aaf90294d2a8ffd5081dc3bb640e.tar.bz2 GT5-Unofficial-68e266e0a227aaf90294d2a8ffd5081dc3bb640e.zip |
+ Added Chemical Plant.
+ Added more Bio Recipes.
$ Fixed Strontium Hydroxide generating before it's components.
$ Fixed existing Bio Recipes not working.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api')
4 files changed, 316 insertions, 1 deletions
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<String> 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); + + } |