From 18c7ac051b3e7c392666c63b7b439560ae915c07 Mon Sep 17 00:00:00 2001 From: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Date: Sun, 19 Jun 2022 19:47:52 +0100 Subject: Add Plasma Forge (Endgame multi) (#1076) * Basis of changes. * Fix item stack and fluid vanishing. * Add new plasma forge UI, change tooltip and fix recipe map. * Fix corrupted fluid registry. * Fix fluids in recipes. Items still need adjusting. * Working. * Liquid spacetime and rename multi to D.T.P.S. so it can fit in GUI properly. * Make animation of spacetime fluid slower. * Fix recipe map (again). * Remove screwdriver junk. Clean up code slightly. * More cleaning. * Comments * Add hatch limitations and add some additional information. Also update NEI GUI. * Add proper recipes and change SpaceTime to a fluid not a gas. * Remove depreciated coil check (since I stole the IDs). * Remove depreciated coil check (since I stole the IDs). Add more comments. * Change temp of SpaceTime. * Add catalyst recipes + support for 16:16 fusion recipes. * Add comments. * Scala fix maybe? * Change plasma forge GUI. * Uncap temperature of materials. (Short -> Int) * Add chunkloading support (when multi is active). * Fix NEI merge issues. * fix used ids in kevlar * Add fluid support for laser engraver. * fix sh***t (cherry picked from commit 01851c100c52fd8292028cf6dda2cb136c617afc) * Add new intermediate materials to facilitate crafting. Also fix fusion typo. * Fix heat/fluid quantity display to be formatted correctly. * Change recipes to be more balanced. * Change residue fluid texture. * Restore better naming for multiblock. * Fix recipe typo. * Fix text not wrapping in multi controller. * Give laser engraver internal fluid storage. * Add IMC NEI support. * Update material properties. * Remove old dev comments. * Fix NEI texture. Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Co-authored-by: Martin Robertz --- .../api/gui/GT_GUIContainer_MultiMachine.java | 106 +++++++++++++++++---- 1 file changed, 85 insertions(+), 21 deletions(-) (limited to 'src/main/java/gregtech/api/gui') diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java index a477789d06..f84b8547bc 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java @@ -30,41 +30,105 @@ public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machin @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { - fontRendererObj.drawString(mName, 10, 8, 16448255); + + // If text is drawn iterate down GUI 8 pixels (height of characters). + int line_counter = 7; + int max_chars_per_line = 26; + + if (mName.length() > 26) { + + // Split the machine name into an array, so we can try fit it on one line but if not use more. + String[] split = mName.split(" "); + + int total_line_length = 0; + String current_line = ""; + + int index = 0; + + for (String str : split) { + + total_line_length += str.length(); + + if (total_line_length > max_chars_per_line) { + fontRendererObj.drawString(current_line, 10, line_counter, 16448255); + line_counter += 8; + current_line = ""; + index = 0; + total_line_length = str.length(); + } + + if (index == 0) { + current_line += str; + } else { + current_line += " " + str; + } + index++; + } + fontRendererObj.drawString(current_line, 10, line_counter, 16448255); + line_counter += 8; + } else { + fontRendererObj.drawString(mName, 10, line_counter, 16448255); + line_counter += 8; + } + if (mContainer != null) {//(mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); - if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 1) != 0) - fontRendererObj.drawString(GT_Utility.trans("132", "Pipe is loose."), 10, 16, 16448255); - if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 2) != 0) - fontRendererObj.drawString(GT_Utility.trans("133", "Screws are loose."), 10, 24, 16448255); - if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 4) != 0) - fontRendererObj.drawString(GT_Utility.trans("134", "Something is stuck."), 10, 32, 16448255); - if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 8) != 0) - fontRendererObj.drawString(GT_Utility.trans("135", "Platings are dented."), 10, 40, 16448255); - if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 16) != 0) - fontRendererObj.drawString(GT_Utility.trans("136", "Circuitry burned out."), 10, 48, 16448255); - if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 32) != 0) - fontRendererObj.drawString(GT_Utility.trans("137", "That doesn't belong there."), 10, 56, 16448255); - if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 64) != 0) - fontRendererObj.drawString(GT_Utility.trans("138", "Incomplete Structure."), 10, 64, 16448255); + if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 1) != 0) { + fontRendererObj.drawString(GT_Utility.trans("132", "Pipe is loose."), 10, line_counter, 16448255); + line_counter += 8; + } + + if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 2) != 0) { + fontRendererObj.drawString(GT_Utility.trans("133", "Screws are loose."), 10, line_counter, 16448255); + line_counter += 8; + } + + if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 4) != 0) { + fontRendererObj.drawString(GT_Utility.trans("134", "Something is stuck."), 10, line_counter, 16448255); + line_counter += 8; + } + + if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 8) != 0) { + fontRendererObj.drawString(GT_Utility.trans("135", "Platings are dented."), 10, line_counter, 16448255); + line_counter += 8; + } + + if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 16) != 0) { + fontRendererObj.drawString(GT_Utility.trans("136", "Circuitry burned out."), 10, line_counter, 16448255); + line_counter += 8; + } + + if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 32) != 0) { + fontRendererObj.drawString(GT_Utility.trans("137", "That doesn't belong there."), 10, line_counter, 16448255); + line_counter += 8; + } + + if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 64) != 0) { + fontRendererObj.drawString(GT_Utility.trans("138", "Incomplete Structure."), 10, line_counter, 16448255); + line_counter += 8; + } if (((GT_Container_MultiMachine) mContainer).mDisplayErrorCode == 0) { if (((GT_Container_MultiMachine) mContainer).mActive == 0) { - fontRendererObj.drawString(GT_Utility.trans("139", "Hit with Soft Mallet"), 10, 16, 16448255); - fontRendererObj.drawString(GT_Utility.trans("140", "to (re-)start the Machine"), 10, 24, 16448255); - fontRendererObj.drawString(GT_Utility.trans("141", "if it doesn't start."), 10, 32, 16448255); + fontRendererObj.drawString(GT_Utility.trans("139", "Hit with Soft Mallet"), 10, line_counter, 16448255); + line_counter += 8; + fontRendererObj.drawString(GT_Utility.trans("140", "to (re-)start the Machine"), 10, line_counter, 16448255); + line_counter += 8; + fontRendererObj.drawString(GT_Utility.trans("141", "if it doesn't start."), 10, line_counter, 16448255); + line_counter += 8; } else { - fontRendererObj.drawString(GT_Utility.trans("142", "Running perfectly."), 10, 16, 16448255); + fontRendererObj.drawString(GT_Utility.trans("142", "Running perfectly."), 10, line_counter, 16448255); + line_counter += 8; } if (mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_DrillerBase) { ItemStack tItem = mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); if (tItem == null || !GT_Utility.areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L))) { - fontRendererObj.drawString(GT_Utility.trans("143", "Missing Mining Pipe"), 10, ((GT_Container_MultiMachine) mContainer).mActive == 0 ? 40 : 24, 16448255); + fontRendererObj.drawString(GT_Utility.trans("143", "Missing Mining Pipe"), 10, line_counter, 16448255); } } else if (mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine) { ItemStack tItem = mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); if (tItem == null || !(tItem.getItem() == GT_MetaGenerated_Tool_01.INSTANCE && tItem.getItemDamage() >= 170 && tItem.getItemDamage() <= 177)) { - fontRendererObj.drawString(GT_Utility.trans("144", "Missing Turbine Rotor"), 10, ((GT_Container_MultiMachine) mContainer).mActive == 0 ? 40 : 24, 16448255); + fontRendererObj.drawString(GT_Utility.trans("144", "Missing Turbine Rotor"), 10, line_counter, 16448255); } } } -- cgit