aboutsummaryrefslogtreecommitdiff
path: root/src/main
AgeCommit message (Collapse)Author
2023-06-05Fix fluid registry related bugs (#2057)miozune
2023-06-05Use IVoidable for GT_ParallelHelper (#2053)miozune
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-06-05Lower ingot to nugget craft with saw from 9 to 8 (#2056)Daniel Mendes
2023-06-04fix (#2054)BlueWeabo
2023-06-04Fix void protection not working with MB with custom output hatch field (#2051)miozune
* Fix void protection not working with MB with custom output hatch field * forgot to filter * Add util method for DT-like structure
2023-06-04do optimize explicitly where it matters (#2047)chochem
2023-06-04safe the macguffin (#2050)chochem
2023-06-03fix incorrect GT_RecipeBuilder deep copy (#2048)Glease
* fix incorrect GT_RecipeBuilder deep copy * spotlessApply (#2049) Co-authored-by: GitHub GTNH Actions <> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-06-03Chemical reactor recipe map fix (#2046)chochem
* minor stuff * disable some optimizations
2023-06-03Refactor GT-ERR-01 (#2045)chill
* refactor and reword GT-ERR-01 Add two functions at the bottom: one contains the error message, the other one prints it. This refactor puts the error at the end of the file, so you don't have to scroll through a screen's worth of space when debugging this file. * invert if condition for mRegisteredOres.contains It is questionable to put the case that is considered "wrong" as the first one, and do the most common result as "else". The flipped "if" essentially says "if condition then do the usual, otherwise handle the error."
2023-06-01change processing voltage (#2044)GDCloud
2023-06-01some gtmodhandler improvements (#2043)chochem
* remove terrible naming conflict * ra2 for the alloysmelter+furnace combo
2023-06-01Add durability and charge bar visibility config options (#2041)Caedis
2023-06-01add Grate Machine Casing assembler recipe (#2042)DotJason
2023-05-30remove hourglass (#2039)chochem
2023-05-29Final stretch for GT RA2 conversions (#2038)chochem
* (un)boxing RA2 * fuel ra2 * blast RA2 * primitive blast RA2 * remaining cutter ra2 * fix
2023-05-29add tooltips (#2037)BlueWeabo
2023-05-29Allow muffler hatches to face downward (#2036)miozune
2023-05-29butcher recipe time (#2033)RIONDY 'POPlol333' Adam
* butcher recipe time * spotlessApply (#2034) Co-authored-by: GitHub GTNH Actions <> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-29Allow setting larger threshold of item detector cover for digital chests (#2035)miozune
2023-05-28Delegate blast resistance call to MetaPipeEntity to allow overriding (#2030)Maxim
2023-05-28make enum fields final where possible (#2029)chill
Non-final enum fields make a global mutable state, which should be used only when necessary. Let's make the enum fields final where possible.
2023-05-28make private fields final where possible (#2028)chill
2023-05-28simplify ifs (#2027)chill
2023-05-28Add new mode for void protection & implement it for more multis (#2024)miozune
* Void protection improvements * Rename methods: isXXXButtonEnabled -> supportsXXX * Adjust texture for forbidden * Add MultiBlockFeatureSupportDumpers * Fix oversight in PCBFactory * Revert void protection support for PA * Rename class: ControllerWithButtons -> ControllerWithOptionalFeatures
2023-05-28simplify logic expressions (#2026)chill
2023-05-27Refactor checkExoticAndNormalEnergyHatches (#2025)chill
* add tests to checkExoticAndNormalEnergyHatches Add a parameterized test to GT_MetaTileEntity_MultiBlockBase::checkExoticAndNormalEnergyHatches in order to be sure that the function returns the same results after the change. * refactor checkExoticAndNormalEnergyHatches
2023-05-26Add void protection mode to fluid and ore drillers (#2023)miozune
* Refactor GT_ParallelHelper part 1 * Refactor GT_ParallelHelper part 2 * Move void protection logic to separated class * Clean doc * Fix inverted logic in VoidProtectionHelper * Add void protection mode to fluid and ore drillers
2023-05-26Fix warnings about ModularUI methods that can only be overridden (#2022)chill
* address ModularUI methods that can only be overridden A call of super was safely deleted. A call of draw() is legit, but it's labeled as OverrideOnly in ModularUI, so IntelliJ considers it incorrect to call draw(). This warning was suppressed. On top of that, IntelliJ incorrectly says that this suppression is redundant, so that was addressed too. Fixing the issue without suppressing the warning entails changing the ModularUI mod, which is too much work for one warning. However, if there are many warnings like that, it might be reasonable to change ModularUI. The whitespace change is Spotless, although it did not detect it before the changes to the file. * remove suppression on RedundantSuppression The mark of OverrideOnly suppression as RedundantSuppression could not be reproduced. Therefore the suppression of RedundantSuppression is not needed.
2023-05-26Texture update for a few QFT items (#2021)EmeraldsEmerald
* Delete old texture * Delete old texture (low quality...) * New versions of deleted textures
2023-05-24Adjust overrides to allow opening machine GUI (#2019)Maxim
2023-05-24Fixed mixer recipe map ending up without programmed circuits (#2020)Maxim
2023-05-24Add tooltip for gas proof for fluid pipe (#2018)miozune
2023-05-24list update for recipe in coremod (#2017)TheEpicGamer274
* list update for recipe in coremod * fix * fix
2023-05-23Speedup Recycler recipe lookup (#2016)miozune
2023-05-22Nerf Sunnarium Bee, Add Endstone to Endstone Bee (#2014)Runakai1
* Nerf Sunnarium Bee, Add Endstone to Endstone Bee Previous sunnarium: glowstone 40% sunnarium 20% now: glowstone 30% sunnarium 5% Added 4 End Stone to comb centrifuging of End stone bee * spotlessApply (#2015) Co-authored-by: GitHub GTNH Actions <> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-20Singleblock machine internal fluid tank scaling standardization (#1999)Pxx500
* chemical reactors * Other machines * More machines and chemical reactors pt2 * standard * fix * Update GT_Loader_MetaTileEntities_Recipes.java * expand fluid scaling --------- Co-authored-by: kuba6000 <kuba.123123.6000@gmail.com>
2023-05-20GT Charged Certus Quartz fix (#2013)chochem
* fix charged certus quartz aname * disable dust
2023-05-20Fix typo in SteamPower (#2012)miozune
2023-05-19Debug for recipe collisions (#2008)chochem
* add collision debug * fix npe * try better names * unwrap nested ifs * do it for the other too * follow some code writing suggestions * add more info to panic crash * code polishing
2023-05-19Cable recipe collision fix (#2009)chochem
* fix missing break * switch to modern switch * more code improvements
2023-05-19Yet another round of ra2 conversions (#2006)chochem
* lathe and saplings * toolhead oreproc recipes * fluid solidification * reverse macerating * autoclave combs * implosion compressor * assembler recipes * assembling line * slicer recipes * minor fixes * attempted cell to fluid fix * minor fix 2
2023-05-19More recipe collision fixes (#2010)chochem
* dont add the same recipe 300 times * have custom vac freezer recipes in GT * have custom vac freezer recipes in coremod
2023-05-19Don't allow steel steam machines to do MV recipe (#2007)miozune
2023-05-18check that fluid is not null (#2004)chochem
2023-05-18Don't add cell recipe for Replicator if dust one is already available (#2005)miozune
2023-05-18a few small fixes (#2003)chochem
* fix snow queen bee drop * fix ismodloaded errors
2023-05-17More RA2 conversion for automatic gt recipes (#2000)chochem
* fully convert all wiremill recipes and clean up unnecessary duplicate code * fully convert all polarizer recipes * fully convert all canner recipes * RA2 for oredict plank recipes * RA2 for oredict stoneCobble recipes * convert some assembler recipes to RA2 * fix * fix2 * remove recipes that were never in the game
2023-05-17Various GT fixes (#2002)chochem
* TE items cant be required * remove from itemlist * TE does not exist * this never worked anyway but also unecessary * these are broken. have a working replacement already * give valid id to fix rockbreaker fake recipes * fix texture and text * no NC its fake anyway