aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/covers
AgeCommit message (Collapse)Author
2023-10-15Fix memory leak of player instances in CoverBehavior (#2333)tth05
* Use weak references to store last player in cover behavior * Remove duplicate lastPlayer field from GT_CoverBehavior
2023-10-09Allows covers to be configured to tick more slowly (#2307)querns
* Right clicking covers with a jackhammer will now make them tick more slowly * Interim commit, switching tasks * Finishes tick rate button in cover UIs * Change tick rate multiplier to a tick rate addition * Missed one number in the multiplier -> addition conversion * Hold Ctrl to adjust tick rate by 5 steps per click, move button closer to corner of cover GUI * Adjust how holding Ctrl computes tick rate change, remove gray formatting option for tick rate formatter * Cover tick rate addition can now be prevented per-cover-behavior, minor code tweaks
2023-09-13Adds Metrics Transmitter Cover and Advanced GT Sensor Card for Information ↵querns
Panels (#2289) * Adds several UI elements to multiblock drills * Adds metrics transmitter cover and associated sensor card * Fixes item icons and item name * Adds tooltips for adv. sensor card and metrics panel, fixes card/overlay icons, adds recipe for metrics cover * Refactor cover tab sync to send much smaller ISerializable payloads * Remove unused variable * Additional master merge cleanup * Adds interface for custom metrics export, adds oil drill support * Adds support for metrics covers retaining attached machine name for tooltip, metrics * * Adds discrete coordinates to Metrics Cover data * Adds machine to advanced sensor card tooltip * Adds cycle time and minimum energy hatch tier to multiblock ore drill tooltips * Moves many tooltip strings to i10n * Remove old GT_DisabledWhileActiveButton.java file that crept in during a messy merge * Spotless * Improve oil and ore drill metrics, more i18n * Addresses PR review concerns, adds more situations for self-destructing sensor cards * Remediates further PR concerns
2023-09-10Deprecate GregTech_API#mAE2 (#2288)miozune
2023-08-23Update the conditionals buttons and tooltips on covers to reflect their ↵Guillaume Mercier
actual effects (#2244) * Update redstone buttons and tooltips to better reflect actual use * Spotless Apply * Update GT_Cover_FluidRegulator.java * Update GT_Cover_FluidRegulator.java * Typo fix, Icon Improved and interactive blocking ui - Fixed a typo in the world machine - Fixed double button situation for conveyor belts. - There was never any issue, the testing methodology gave me invalid results. - Conveyor behaviour is in line with all the other covers affected by this PR/Branch. - Updated icon for the machine state to be a miniature machine controller cover. - Made the block/allow input section more interactive in order to better reflect the actual effect of these buttons. - In import mode, it actually blocks the machine from outputting from that side. * typos I can't write to save myself sometimes * Better text alignment - Better text alignment * fix typos I swear I can't write to save myself. --------- Co-authored-by: Martin Robertz <dream-master@gmx.net>
2023-08-10Fix Digital Tank capacity for Fluid Storage Monitor (#2217)miozune
* Fix Digital Tank capacity for Fluid Storage Monitor * Annotations
2023-07-28Less hostile user interfaces (Buffer/Filter/Input bus) (#2165)Yannick Marcotte-Gourde
* Made Emit Energy button a CycleButtonWidget * Made Emit Redstone button a CycleButtonWidget * Made Invert Redstone button a CycleButtonWidget * Made Stocking Mode button a CycleButtonWidget * Spotless apply * Made Invert Filter button a CycleButtonWidget * public bInvertFilter -> protected invertFilter * Deduplicated filter code * Made Allow NBT button a CycleButtonWidget * Made Ignore NBT button a CycleButtonWidget * public bNBTAllowed -> private allowNbt * public bNBTAllowed -> private ignoreNbt * Grey extended tooltips * Don't hardcode multiline tooltips * Document hidden functionality * Cleaned numeric constants * Fixed string constant declaration * Named constants in filter * Unify filter redstone behavior * Fix cover filter mode being inverted so that the displayed mode is the active one * Less magic numbers * Allow right clicking recipe filter * Display only machine type in recipe filter and cycle through compatible machines * Buffer tooltips show output voltage to clarify their role as passthroughs * Added more info to Emit EU/Redstone buttons * Added Sorting mode button to buffers/filters * Added Sorting mode button and stack limit button to input buses * Don't cycle prefixes when clicking with itemstack * Fixed tooltips to work off of the inventory * Fix RecipeFilter losing filter * Support multiblock machines * Use ModularUi syncers to sync state with client Thanks minecraft7771! * Grey text for recipe filter helper text * AnimatedTooltipHandler -> EnumChatFormatting * Explicited RecipeFilter filter building * Specify color for empty slot tooltip * Don't cache new uses of GT5U.MBTT.MachineType. Also corrected MachineType::description * Removed unused getItemExtraTooltip * Multiple returns in getItemStackMachineRecipeMap
2023-06-05Code cleanup (#2040)chill
* remove redundant suppressions * prettify commented code * improve comments The integer comment contradicted the code, so I deleted it. * delete commented-out code * update bitwise int flip from XOR to the dedicated tilda operator The flip was a 32-bit XOR, which is an int-flip. That XOR was replaced with an equivalent tilda operator. * convert a field to inline This field was used only once, so put it straight to where it is used. * remove fluid fix since no-one uses Forge version 1355 or earlier * unwrap switches where fitting In some places, we suppress IntelliJ's inspection RedundantLabeledSwitchRuleCodeBlock - we don't want to unwrap some of the suggested cases because we want to keep the consistency in a switch statement for the sake of readability. * fuse "collect" into Stream API * fix javadocs * remove unnecessary public modifiers from an interface Members of an interface are public by default. * move common parts outside of if * suppress OverrideOnly warning in a javadoc * remove unused lock * suppress warnings about unchecked casts These warnings require non-trivial fixes that are yet to arrive. For now, let's suppress them to reduce the warning-bloat. * remove outdated comment * remove final modifier from private methods Because they are private, it is hard to accidentally overwrite them. Therefore, the final modifier is redundant in this case. * refactor getIcon The first 'if' doesn't cover only tMeta == 9 && mConnectedMachineTextures, therefore the second if can be unrolled. The last switch is redundant because all tMeta values are covered by switches, but let's keep SOLID_STEEL as a fallback just in case. * explain what the casings are and why block casings are split * suppress switch-to-if suggestion * remove unnecessary null check The null is handled in doGenerateItem() * address redundant local variables * rename variables in onTick * suppress warning about accessing static member via instance * rephrase exception * rephrase javadoc * address field-can-be-final warnings * remove empty methods * enum cannot inherit, so protected is redundant * remove redundant throws * update imports to be not wildcard * remove unnecessary try-catch * update for loop * remove redundant code in order to use the diamond operator * update instanceof to use pattern variables * replace blank lines with <p> in javadocs * fix dangling javadocs * suppress warning about unreachable methods in javadocs * remove redundant operation * add the descriptions of parameters in javadocs Also fix javadocs along the way. * relax returned type in javadoc That was done in order to make the docs reflect the code more often. Otherwise, people may forget to change the returned type again with another change. * make long conversion explicit Integer multiplication can give a wrong result if one of the parts is not explicitly cast to long. Let's cast one of the parts where applicable. * remove unary plus * simplify unary minus * use addAll instead of forEach,add It was suggested by IntelliJ to replace the iteration with a bulk operation to improve performance. * replace .asList with .singletonList for consistency * simplify toArray calls Explanation from IntelliJ: There are two styles to convert a collection to an array: * A pre-sized array, for example, c.toArray(new String[c.size()]) * An empty array, for example, c.toArray(new String[0]) In older Java versions, using a pre-sized array was recommended, as the reflection call necessary to create an array of proper size was quite slow. However, since late updates of OpenJDK 6, this call was intrinsified, making the performance of the empty array version the same, and sometimes even better, compared to the pre-sized version. Also, passing a pre-sized array is dangerous for a concurrent or synchronized collection as a data race is possible between the size and toArray calls. This may result in extra nulls at the end of the array if the collection was concurrently shrunk during the operation. * split StringBuilder append Explanation by IntelliJ: Reports String concatenation used as the argument to appends. Such calls may profitably be turned into chained append calls on the existing StringBuilder saving the cost of an extra StringBuilder allocation. This inspection ignores compile-time evaluated String concatenations, in which case the conversion would only worsen performance. * annotate overriding methods with @Nonnull where needed The method that was overridden has @Nonnull so the method that is overriding should also have @Nonnull. * remove set adding itself to itself * remove null check because findField either works or blows up cpw.mods.fml.relauncher.ReflectionHelper::findField either returns a non-null value or throws a RuntimeException, so no need to check of null. * remove slot comparison with tInventory.length slot max value is 127 when tInventory.length is set to 256, which results in that the condition is always true and unnecessary. * remove aOutput2 null check As GT_Values.NI is null, there is no need to check aOutput2 for null again * suppress the suggestion to delete tMeta < 13 mConnectedMachineTextures can change, so tMeta range is not guaranteed * remove aCoverVariable % 3 < 2 the if above already limits the result of % 3 to "2", so the condition "less than 2" is always false. * unwrap "if" because bonus is unchanged Unwrap if because even if the bonus is a variable, it hasn't been changed for the past 8 years and is unlikely to be changed in the future. * reformat javadoc * improve ignoring an exception Make them either more clear or concise * fixup fix typo * update deprecated calls of newInstance() * remove testing BaseMetaTileEntity GregTech_API.constructBaseMetaTileEntity() checks the creation by itself, logging and throwing a runtime error if failed. * unwrap hatch-fill for do_SolarSalt To reach this branch, do_coolant needs to be false and we need to still be in the function, which means that do_SolarSalt was set to true in the previous top-tier "if". * remove always-false input-bus checks of MTE PlasmaForge size() is non-negative, and the values it is compared to are final and 0. * length and size are non-negative Therefore, there's no need to check their negativity * aOutput is guaranteed to be positive * tThereWasARecipe is always false when reached in its first occurrence * convert an assert into if Only tStack 2 is checked for null because if it isn't null then tStack1 also isn't null based on the "if" above. Also IntelliJ was sure that tStack is not null for some reason. On a side note, assertions work only either with a specified flag or in debug runs. Therefore, it is dangerous to rely on them. * simplify stone-gravel-cobble if tBlock != Blocks.stone because of the if at the start of the method. for the last else-if, tBlock == Blocks.gravel because of the check slightly above the change. * interDimensional is always true because of the first if * convert an example to javadoc * remove always-false statements * replace referential string equality with equals If we compare strings by "==", we compare references to them, which is not what we usually want. I wasn't sure if String Pool works here, so I played it save with equals(). * use Automatic Resource Management for AutoCloseable ByteBufOutputStream * add todo to swap from sleep to event bus * null is checked by instanceof * merge switch branches * add a TODO to use clamp() * new String declaration is redundant * use getOrDefault for a map * replace StringBuilder with concatenation where fitting Using a StringBuilder to concatenate two string will not make the program faster or more understandable, so I swapped it to concatenation. * remove unnecessary continue * flip if * remove redundant returns * unwrap ifs It's checked at the top "if" that aType == IItemRenderer.ItemRenderType.INVENTORY, so all aType.equals(IItemRenderer.ItemRenderType.INVENTORY below are always true. * remove checking all GT VERSIONs except the API one * remove version check from GT_Mod and delete respective VERSION fields Aside from GregTech_API.VERSION, these fields are not used anywhere in the project, so only GregTech_API.VERSION was kept. The idea and the usage check were done by miozune.
2023-05-29Allow setting larger threshold of item detector cover for digital chests (#2035)miozune
2023-05-24Adjust overrides to allow opening machine GUI (#2019)Maxim
2023-05-06Exploring some various ForgeDirection fixes (#1950)Jason Mitchell
* Fix mFacing NPEs * Default facing fixes (#1945) * QuickFixes incomplete facing fixes * fix Neither UP nor DOWN conditions as offsetY == 0 is not valid test * fix neither up nor down again * Still not fixed: use ForgeDirection.flag for clarty killed more ordinal siding. * get ride of offset testing --------- Co-authored-by: Jakub <53441451+kuba6000@users.noreply.github.com> Co-authored-by: Jason Mitchell <mitchej@gmail.com> * bit logic fix * Fix single block machine facings * Predict the machine facing direction clientside before the server packet arrives * Fix isFacingValid logic --------- Co-authored-by: Léa Gris <lea.gris@noiraude.net> Co-authored-by: Jakub <53441451+kuba6000@users.noreply.github.com> Co-authored-by: Martin Robertz <dream-master@gmx.net> Co-authored-by: Raven Szewczyk <git@eigenraven.me>
2023-04-29Revert #1816 and #1825 (#1931)NexusNull
* revert redstone fix * remove strong redstone checkbox from Liquid Meter
2023-04-23Forge direction (#1895)Jason Mitchell
* ForgeDirection Also refactor the clusterfuck that was `getCoordinateScan` Co-authored by: Jason Mitchell <mitchej@gmail.com> * Fix rendering of Frame Boxes Frame boxes needed their own implementation of getTexture with int connexion mask, which is returning an error texture for the MetaTileEntity, because pipes (FrameBox **is** a pipe) do use this method to return different textures based on connexion status. --------- Co-authored-by: Léa Gris <lea.gris@noiraude.net>
2023-04-21Recipes ra2 (#1872)boubou19
* Recipes RA2 fixes * Use \uXXXX for non-ASCII characters * Misc cleanup (#1888) * migrate away from addThermalCentrifugeRecipe * split recipes of GT_Block_Stones_Abstract * migrate away from addForgeHammerRecipe * migrate away from addChemicalBathRecipe * remove "DisableOldChemicalRecipes" and its usage, as it's disabled by default in NH and it increases recipe complexity for nothing * Remove underground biomes ore classes, as it's not present in NH * migrate away from addFluidCannerRecipe * migrate away from addFluidExtractionRecipe * migrate away from addChemicalRecipe * migrate away from addMultiblockChemicalRecipe * deprecate addChemicalRecipeForBasicMachineOnly * migrate away from addCentrifugeRecipe * spotlessApply * fixing wrong merge conflict solving * Add Tengam materials (#1891) * Add Tengam materials * Change new recipes to consume 15/16 Amp * Remove now redundant `break` statements * fix comb chances? * fix centrifuge code not working --------- Co-authored-by: glowredman <35727266+glowredman@users.noreply.github.com> Co-authored-by: Martin Robertz <dream-master@gmx.net>
2023-04-10Update spotless config to 0.2.2Raven Szewczyk
2023-04-02Fix: Basic heat vent works without water (#1832)Léa Gris
Address Mod-pack issue https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/13112
2023-04-01Jabel, Generic injection and mostly automatic code cleanup (#1829)Raven Szewczyk
* Enable Jabel&Generic injection, fix type error caused by this * add missing <> * Infer generic types automatically * Parametrize cast types * Use enhanced for loops * Unnecessary boxing * Unnecessary unboxing * Use Objects.equals * Explicit type can be replaced with `<>` * Collapse identical catch blocks * Add SafeVarargs where applicable * Anonymous type can be replaced with lambda * Use List.sort directly * Lambda can be a method reference * Statement lambda can be an expression lambda * Use string switches * Instanceof pattern matching * Text block can be used * Migrate to enhanced switch * Java style array declarations * Unnecessary toString() * More unnecessary String conversions * Unnecessary modifiers * Unnecessary semicolons * Fix duplicate conditions * Extract common code from if branches * Replace switches with ifs for 1-2 cases * Inner class may be static * Minor performance issues * Replace string appending in loops with string builders * Fix IntelliJ using the wrong empty list method * Use Long.compare * Generic arguments: getSubItems * Generic arguments: getSubBlocks * Raw types warnings * Fix remaining missing generics * Too weak variable type leads to unnecessary cast * Redundant type casts * Redundant array length check * Redundant vararg arrays * Manual min/max implementations * A couple missed inspections * Goodbye explosion power ternary ladder * Apply spotless * Get rid of the other two big ternary ladders * Binary search explosion power * Don't overcomplicate things
2023-04-01update spotless formatting (#1827)boubou19
2023-04-01add option for strong signal (#1825)NexusNull
2023-03-11Add regulator abilities to Steam Valve (#1785)NexusNull
* fix: fix Steam Valve not being configurable * Revert "fix: fix Steam Valve not being configurable" This reverts commit 505d9e273b48315fde154490e116d58fed46ffaf. * feat: add steam regulator * feat: add superheated steam to steam valve
2023-03-10Fix advanced external transmitter cover (#1793)Matej Dipčár
2023-01-30[ci skip] spotlessApply with the new settingsJason Mitchell
2023-01-24Fix array ClassCastExceptions (#1681)Raven Szewczyk
* Fix array classcastexceptions * Remove extra parens
2023-01-20MTE Inventory updates (#1496)Jason Mitchell
* MTE Inventory updates * Separate Input/Output inventory * Use a LinkedHashMap to ensure inventory orders are deterministic * Input/Output work on either Input/Output inventories * MTE Inventory * Add GT_Packet_MultiTileEntity * More dyanmic packet with packetFeatures * Add IMTE_HasModes for MultiBlockPart * Help with MTE Inventory (#1613) * convert inventory to use ItemStackHandler * Update MUI * inventories * move Iteminventory to its own method Co-authored-by: miozune <miozune@gmail.com> * Update MUI * Update MUI * Add IMultiBlockPart * Mte fluid inventory (#1639) * first work on fluid inventory * make gui work with numbers not dividable by 4 * use math.min * add outputfluids saving * actually working * Update MUI Co-authored-by: miozune <miozune@gmail.com> * Ticking Covers! * Parts now register covers with the controller * Controllers now tick covers on parts * Break cover ticking out into `tickCoverAtSide` Fix some inventory methods on MultiBlockController * Filter on tickable covers * Improve GUIs for MTEs (#1650) * working controller GUI * locked inventory selection work * input and output locking of inventories Co-authored-by: miozune <miozune@gmail.com> * spotless * CoverInfo refactor (#1654) * Add `CoverInfo` and deprecate the old fields to hold cover information * Disable MTE registration * Fix NPE - Return EMPTY_INFO for SIDE_UNKNOWN Temporarily add back old NBT saving in case of a revert so covers aren't lost. * Actually save the old NBT data, instead of empty Co-authored-by: BlueWeabo <76872108+BlueWeabo@users.noreply.github.com> Co-authored-by: miozune <miozune@gmail.com>
2022-12-14ensure machine controller incompatible with redstone receiver (#1547)Glease
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com> Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
2022-12-14make covers actually insensitive to redstone if it doesn't need it (#1546)Glease
* make covers actually insensitive to redstone if it doesn't need it Signed-off-by: Glease <4586901+Glease@users.noreply.github.com> * fix machine controller redstone sensitivity Signed-off-by: Glease <4586901+Glease@users.noreply.github.com> Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
2022-11-25Rewrite GUIs with ModularUI (#1381)miozune
* Base work for ModularUI compat * Remove useless interface * Add almost all the widgets * Invert method * Refactor NEI stack placement positions * NEI handlers on ModularUI * Add some more docs * AdvDebugStructureWriter * Fix NEI progressbar not working * PrimitiveBlastFurnace * clean * derp * clean * spotlessApply * Boilers * Buffers * clean * N by N slots containers * Fix boilers not having bucket interaction Put opening UI to individual MetaTEs * Maintenance Hatch * clean * spotlessApply * Add dependency * IndustrialApiary * Adapt to ModularUI change * Base work for covers & fix crash with MP * Fix crash with server * Rewrite base work for covers * Send initial cover data on cover GUI open so that the time of showing incorrect data will be eliminated * Covers part 1 * Rename package: ModularUI -> modularui * Rename class: GT_UIInfo -> GT_UIInfos * Fix build * Covers part2 * Fix missing client check with tile UI & fix title overlap * CoverTabLine * Move cover window creators to inner class * Fix crash with null base TE * Close GUI when tile is broken * Color cover window with tile colorization * Change signature of addUIWidgets * FluidFilter cover, FluidDisplaySlotWidget, BasicTank, BasicGenerator, Output Hatch, MicrowaveEnergyTransmitter, Teleporter, DigitalChest, DigitalTank * Add title tab * Move package: modularui -> modularui/widget * Programmed circuit + IConfigurationCircuitSupport * clean * VolumetricFlask * Remove integrated circuit overlay from recipe input slots * Input Hatch & Quadruple Input Hatch * Multiblock * Deprecate old cover GUI * BasicMachines * Finish BasicMachine & NEI * Expand DTPF NEI to 9 slots * Fix ME input bus on MP * Move AESlotWidget to public class * Move GT_Recipe_Map constructors with mNEIUnificateOutput to setter method * Move SteamTexture.Variant to outer enum * Switch to remote repository * oops * Update MUI * Update MUI * Minor refactor for change amount buttons * Display items and fluids that exceed usual count * blah * use +=, why didn't I do this * Update MUI * Move ModularUI to Base (#1510) * Move ModularUI to Base * Move most of the ModularUI functionality to `BaseTileEntity` (and `CoverableTileEntity`) * `CommonMetaTileEntity` delegates ato the MetaTileEntity * Added several interfaces (with defaults) to indicate if a tile/metatile override/implement certain behaviors. * Moved `IConfigurationCircuitSupport` interface such that it will work with BaseTileEntity or a MetaTileEntity * Address reviews Co-authored-by: miozune <miozune@gmail.com> * Update MUI * Minor changes to NEI * Return :facepalm: * IGetTabIconSet override * Some more changes to NEI * Merge texture getter interfaces to new class GUITextureSet * Remove BBF structure picture as it's auto-buildable now * Make unified title tab style of texture angular * Expose some boiler texture getters for addon * Fix crash with cover GUI on pipe * Lower the number of recipe per page for DTPF & update MUI * Update MUI * Fix crash with middle-clicking slot on circuit selection GUI * Fix circuit selection window not syncing item from base machine * Merge GT_NEI_AssLineHandler into GT_NEI_DefaultHandler * Update MUI * Add in TecTech multi message * Allow changing the way of binding player inventory * Update MUI * Update MUI * Update MUI * Update MUI * Update MUI * Make MUI non-transitive to allow addons to use their own version * Force enable mixin * Format fluid amount tooltip * Add GUITextureSet.STEAM * Add guard against null ModularWindow creation * Add constructors for Muffler Hatch with inventory * Fix output slot on digital chest and tank allowing insertion * Don't log null ModularWindow * Add default implementation for IHasWorldObjectAndCoords#openGUI * Make openGTTileEntityUI accept MultiTE & cleanup Co-authored-by: Jason Mitchell <mitchej@gmail.com>
2022-10-26Fixed annoying cover message bug (#1490)johnch18
* Fixed annoying cover message bug * Spotless
2022-10-13Fix Fluid Detector RS signal (#1464)Charles Gagnon
2022-10-12No more duplicated key II (#1457)iouter
* no more duplicated key II * spotlessApply
2022-10-05Allow Redstone, Energy, and item to pass through Fluid Filter Cover (#1437)miozune
2022-10-01Merge branch 'advanced_redstone_covers'Martin Robertz
# Conflicts: # src/main/java/gregtech/api/util/GT_Utility.java
2022-10-01spotlessMartin Robertz
2022-10-01no-more-duplicate-key (#1424)iouter
2022-09-23Move `hashCoverCoords` to WirelessBaseMatej Dipčár
2022-09-23Add new icon for the analog modeMatej Dipčár
2022-09-23Rename `In`, `Out` to `Internal`, `External`Matej Dipčár
2022-09-23Add Analog Mode to the receiverMatej Dipčár
2022-09-23Add Maintenance Detector CoverMatej Dipčár
2022-09-23Add Fake Item Slot to GUIMatej Dipčár
2022-09-23Implement Wireless Item DetectorMatej Dipčár
2022-09-23Reformat intentMatej Dipčár
2022-09-23Reset signal, only when frequency or UUID changedMatej Dipčár
2022-09-23Fix calculating super chest contentMatej Dipčár
2022-09-23Add new hook `preDataChanged`Matej Dipčár
2022-09-23Abstract `convertRatioToRedstone` properlyMatej Dipčár
2022-09-23Abstract `computeSignalBasedOnItems`Matej Dipčár
2022-09-23Make `GT_GuiShortTextBox` able to map values to different display stringsMatej Dipčár
2022-09-23Make `parseTextBox` and `GT_GuiShortTextBox` more abstractMatej Dipčár
2022-09-23Swap min, maxMatej Dipčár