aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/enums/Element.java
AgeCommit message (Collapse)Author
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-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-04-10Update spotless config to 0.2.2Raven Szewczyk
2023-01-30[ci skip] spotlessApply with the new settingsJason Mitchell
2023-01-25EOH materials + Allow materials to pick their processing tier (#1671)Connor-Colenso
* Begin addition of tiered material manipulation * Dwarf matter * Add hardcoded EU tiers for wider usage. * New material images etc * Nugget processing tiers * Move iron nugget to wrought iron smelting to the correct place * Add white dwarf shapes * Add white dwarf shapes * Additional retiering options for EU consumption on material part generation * White dwarf matter complete * Tier neutronium processing at ZPM * Spotless * More adjustments * Renaming files * Add new overlays for magneto material and more name adjustments * Add no recipes subtag * Spotless + name adjustment * Undo isCustom to maintain potential public variable references in addons. * Undo isCustom to maintain potential public variable references in addons. * Fix fluid registry corruption. * Add rotor EU override * Add rotor EU override * Make neutronium mass more reasonable * Add proper time adjustments to rotor (probably an old oversight) * Adjust enums to use VP rather than recalculate * Fix typos on EU usage * spotlessApply (#1672) Co-authored-by: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Co-authored-by: GitHub GTNH Actions <> * Change setProcessingMaterialTierEU to accept long. * Small fix * Add space and time materials * Add new forge hammer support * Update tooltip * Expand laser engraver slots. * spotlessApply (#1673) Co-authored-by: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Co-authored-by: GitHub GTNH Actions <> * Reserve texture page. * Modernise GT circuit usage * Add oversight in assembler frame recipe * Add missing MHDCSM overlay textures * Remove small and tiny MHDCSM dusts * Fix error in ingot texture * Fix NO_RECIPES not applying to frame boxes * Restore missing ingot * Add rod handles for materials * Fix frame box auto generating with NO_RECIPEs tag * recipe * Spotless * Add MOD_ID_GTPP as modid * spotlessApply (#1675) Co-authored-by: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Co-authored-by: GitHub GTNH Actions <> * Remove smelting spacetime from furnace (why does this exist?) * Recipes + new storage blocks for materials * Bedrockium LuV -> EV * SpaceTime UMV -> UIV * TranscendentMetal UIV -> UEV * MagnetoThingy and dward mats UXV -> UMV * update buildscript * yeet magic number that could be * spotlessApply * Make the nanite tier 3, colen request * Up nanite tier * Comment * Change name * Change name Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: adam riondy <adampoplol@gmail.com> Co-authored-by: boubou19 <miisterunknown@gmail.com>
2022-08-27Update buildscript & apply spotless (#1306)Raven Szewczyk
* Update dependencies * Update buildscript, apply spotless
2022-06-24Kevlar (#1018)Martin Robertz
* add first recipes for Kevlar Line * merge conflict * add more materials and recipes for kevlar line * fix butanol naming (cherry picked from commit 808c91e2904314f67085c8cce2d579d6ac711bbb) * fix more Kevlar recipes (cherry picked from commit 3688dda0a8d4cd79edd76072d04a59fe4e8b3ca4) * fix more recipes (cherry picked from commit a527b22bd815629372c8dca98e579628b1128d46) * add more Kevlar stuff * add more materials for Kevlar Line * add more Materials and recipes for Kevlar (cherry picked from commit 448083f5c1789cd78cc1dc049c859c3bec4c2485) * Merge branch 'Kevlar' into dev # Conflicts: # src/main/java/gregtech/api/enums/Materials.java * add second maven from ic2 * overseen * add more kevlar materials and recipes * fix naming * fix metal block 9 was not set * fix materials and names (cherry picked from commit 3119d83ba53f43de6163de3f01edd6081f318cd6) * Fix Acetylen Material (cherry picked from commit d379365de519c503a78f68ce5ab2a3de02ff7852) * fix recipes (cherry picked from commit 2e2033773e1aa92224932fc93aaadaeacb83e8ba) * remove Calcium Hydroxide Formula * add ALF3 * make Nitrochlorobenzene backwards compatible fix a lot of recipes (cherry picked from commit ca2a59db88f036649f6d8ff4b5e5565c9da400c9) * add more Kevlar materials fix recipes remove Nitrobenzene 3 and 4 * remove 2 Buten 1,4 Diol fix recipes (cherry picked from commit 811549dc9f4f73e77752d5faef2b6d7243e6e625) * add spinnert Item, Woven and fiber kevlar add more materials add more recipes * fix derp (cherry picked from commit dc1e24753c39c70ad262f7bc2ce70d839a655942) * fix materials id derp (cherry picked from commit c7ba51ad846ae466054fb5e002fa8c634e3dfcad) * fix recipes (cherry picked from commit f8e6e32acaee563d3683b79980459bc464c6e716) * fix more recipe add Kevlar material add fiber and woven kevlar recipes (cherry picked from commit cc99809ea80f616ffe5c22e0d3f189a7b5cd7bdb) * add Spinneret recipe (cherry picked from commit 4db8497380b39edda8a00964613eae3a72cebbcb) * add Bromine add Liquid Kevlar Texture fix recipe add more Kevlar Materials (cherry picked from commit e2f96cb825f5ededaff3989b7e087b51b57a913c) * Fix recipes (cherry picked from commit e4f8d0d33f81f94124b733cbeb975ca0b4a33da2) * fix recipes (cherry picked from commit 7c6b7cdd0fd0720f58993faeaa81dd95d1b3757c) * Add more Kevlar recipes add more Materials (cherry picked from commit 9c35ca47e917fb2ac082ba5077e65001a7ab074a) * add more Materials (cherry picked from commit 12c598fe8784198c996eda3d5e072b829cf33ab8) * fix Kevlar recipes add more recipes * finish kevlar line (cherry picked from commit 39567610956ac02d3001f68851ddeb7e5d63aed7) * fix a few more recipes (cherry picked from commit e28283321ce1670d6684a47c0fd3fd263da8a6cb) * fix recipe (cherry picked from commit df89c96bc826b321f81c1c3af521469decdcff22) * try to add back single block distillation recipes * stupid me :) (cherry picked from commit 7fc6c375605d85b7cc791aa9818174a1cb2f7f59) * fix distillation recipes (cherry picked from commit e2351c4390b632b9e361a19ba03225c82766e455) * fix more recipes (cherry picked from commit 0fefb881e80659d41308dec85c59a114862aaf40) * remove not working texture (cherry picked from commit f70cdbf7e0138ed6cc867153693db527f04a78f8) * fix more recipes (cherry picked from commit 6c45aa36d4176af8f41e64a8758e31618ac56ab9) * rename chemicals (cherry picked from commit 4aa52352319b72bca6ec27ea65aba42bd293bb39) * fix recipes (cherry picked from commit 0885006add9ce78614a4a45cc8ae1d46a5b466d8) * remove unused Kevlar Materials (cherry picked from commit 69525c04a6505ef06e1f7cc6166aaba808b0ba26) * add more Kevlar changes (cherry picked from commit a16f12fe71fa65ce7706b049b5e94602cb676b37) * change Kevlar line a bit (cherry picked from commit b06cdb634125465e073adf1e09f1821b8794d243) * add Rhodium as compat metal (cherry picked from commit cfde983db03efec6d83367cbd5c13887eef6aa67) * fix texture set (cherry picked from commit 7f2f5508acb3613505522db98eef948c8e269892) * add more Kevlar recipes disable Rhodium GT dummy (cherry picked from commit 9389fe086e9d8a4bef92115a9eef8816fdf51c43) * fix recipes (cherry picked from commit 7dd26f59af45619c3cf2045edfb6c38198358cb0) * fix more recipes (cherry picked from commit b407abebd0ce1d5351b770a729d75fb3fc7a0e87) * fix more recipes (cherry picked from commit f2c24ea7fe4a2dfb9a95129d9a0c4b03b70f34d5) * fix kevlar recipes (cherry picked from commit fb9f937b7f31ab9f3f958a0a53772c82f0d55b64) * add chemical Formular (cherry picked from commit 5116ee58132bb1723c318e8f2c20b52f97da3b9d) * fix recipe (cherry picked from commit ce10e89e059946f7020219f2a79397862272d2ab) * fix circuit (cherry picked from commit 0ee7d4535dab0bb1a20665160f11bdf01efd411d) * fix most of the Kevelar recipes retier them remove potassium Nitrate its still Saltpeter (cherry picked from commit 49e1eec47c4c86044ce748d96dc5a11d1db68877) * add back Potassium Nitrate for compt reasons (cherry picked from commit eee82dc1783d40fe4b68d87ee0da646cc4ea5262) * fix more Kevlar recipes (cherry picked from commit aaaf2969da671cf923f7213f71e9c8eb89091e87) * fix name in Kevlar line (cherry picked from commit e7a883254d2c89f289453cdcd67be5dc1fc1c53a) * Lowered EU cost on Wood Tar - Lowered EU/t on the Wood Tar DT recipe from 256 to 224 EU/t (value suggested by Dream). The old value is just a bit too high for an HV Semifluid Generator to power the DT with the Creosote output, which forced lower tier generators and spam. * Removed DT Recipes and Added Alternatives - Removed circuits in DT recipes for the HV Oil and Benzene processing; - Added IV recipes to obtain the new chemicals for the Kevlar line (the Dimethylbenzene isomer and Naphthenic Acid), without changing the setup of players that were previously processing those for their early-mid game purposes. * Revert "Removed DT Recipes and Added Alternatives" This reverts commit 165ad2e4d196b5966af0fe282658f1bea3d579a9. * Revert "Lowered EU cost on Wood Tar" This reverts commit 420d0d5cd530d3e29164c3a9c384d4187a46495a. * fix Copper oxide use old Material Shift ids add melting Point (cherry picked from commit 488d6598513307bb4221bbb50904a32e5a0bd069) * Update GT_Loader_Item_Block_And_Fluid.java * MAchine REcipe code too large Co-authored-by: Glease <4586901+Glease@users.noreply.github.com> Co-authored-by: Steelux8 <steelux7@gmail.com>
2022-06-19Add Plasma Forge (Endgame multi) (#1076)Connor-Colenso
* 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 <dream-master@gmx.net>
2022-01-30Add compat for EnumHelper to Element#get (#908)Glease
2021-05-08Fix name of americiumPrometheus0000
2020-03-16Refactored Element.javabartimaeusnek
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
2018-11-09Nerf neutronium shaping through smelting->moulding #3820Dream-Master
reducing Mass of neutronium by 100x
2018-02-06[suggestion]Superconductor recipes #2475Dream-Master
https://github.com/GTNewHorizons/NewHorizons/issues/2475 Suggestion: Superconductors #2433 https://github.com/GTNewHorizons/NewHorizons/issues/2433
2018-01-14Update Element.javaLOKKO12
2018-01-14set desh an oriharukon as elements not as isotopesLOKKO12
2018-01-14Added Desh as Titanium and Oriharukon as IsotopesLOKKO12
2018-01-11Update Element.javaLOKKO12
2018-01-11Tritanium should have a uu replication recipe in my opinion #2391Dream-Master
https://github.com/GTNewHorizons/NewHorizons/issues/2391#issuecomment-357016835
2016-06-21experimental branchDream-Master
2016-06-21reverse commitDream-Master
2016-06-21even with Blood asp experimental branchDream-Master
2016-06-21remove allDream-Master
2015-10-21Reformat codeShawn Buckley
2015-10-18Move source directoryShawn Buckley