diff options
| author | Raven Szewczyk <git@eigenraven.me> | 2023-04-01 20:06:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-01 19:06:12 +0000 |
| commit | b088958c9f6935d356b6c087c8e8106b400aa24f (patch) | |
| tree | be608fac08ba158f1226a4fb9f5b1ed459bac2a9 /src/main/java/gregtech/api/util | |
| parent | e52cd9c3458584e58073df5cd9cde1302994f266 (diff) | |
| download | GT5-Unofficial-b088958c9f6935d356b6c087c8e8106b400aa24f.tar.gz GT5-Unofficial-b088958c9f6935d356b6c087c8e8106b400aa24f.tar.bz2 GT5-Unofficial-b088958c9f6935d356b6c087c8e8106b400aa24f.zip | |
Jabel, Generic injection and mostly automatic code cleanup (#1829)
* 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
Diffstat (limited to 'src/main/java/gregtech/api/util')
21 files changed, 337 insertions, 422 deletions
diff --git a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java index 41b6e0013e..ae480343b2 100644 --- a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java +++ b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java @@ -11,7 +11,6 @@ import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -20,7 +19,7 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; @SideOnly(Side.CLIENT) -public class ColorsMetadataSectionSerializer extends BaseMetadataSectionSerializer implements JsonSerializer { +public class ColorsMetadataSectionSerializer extends BaseMetadataSectionSerializer { public ColorsMetadataSection deserialize(JsonElement metadataColors, Type type, JsonDeserializationContext context) { diff --git a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java index 9f648fa7e0..7dc15f994d 100644 --- a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java +++ b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java @@ -28,15 +28,15 @@ public class GT_AssemblyLineUtils { /** * A cache of Recipes using the Output as Key. */ - private static HashMap<GT_ItemStack, GT_Recipe_AssemblyLine> sRecipeCacheByOutput = new HashMap<GT_ItemStack, GT_Recipe_AssemblyLine>(); + private static HashMap<GT_ItemStack, GT_Recipe_AssemblyLine> sRecipeCacheByOutput = new HashMap<>(); /** * A cache of Recipes using the Recipe Hash String as Key. */ - private static HashMap<String, GT_Recipe_AssemblyLine> sRecipeCacheByRecipeHash = new HashMap<String, GT_Recipe_AssemblyLine>(); + private static HashMap<String, GT_Recipe_AssemblyLine> sRecipeCacheByRecipeHash = new HashMap<>(); /** * Checks the DataStick for deprecated/invalid recipes, updating them as required. - * + * * @param aDataStick - The DataStick to process * @return Is this DataStick now valid with a current recipe? */ @@ -57,7 +57,7 @@ public class GT_AssemblyLineUtils { /** * Finds an Assembly Line recipe from a DataStick. - * + * * @param aDataStick - The DataStick to check. * @return The GT_Recipe_AssemblyLine recipe contained on the DataStick, if any. */ @@ -67,7 +67,7 @@ public class GT_AssemblyLineUtils { /** * Finds an Assembly Line recipe from a DataStick. - * + * * @param aDataStick - The DataStick to check. * @param aReturnBuiltRecipe - Do we return a GT_Recipe_AssemblyLine built from the data on the Data Stick instead * of searching the Recipe Map? @@ -197,7 +197,7 @@ public class GT_AssemblyLineUtils { /** * Finds a GT_Recipe_AssemblyLine based on the expected output ItemStack. - * + * * @param aOutput - The Output of a GT_Recipe_AssemblyLine. * @return First found GT_Recipe_AssemblyLine with matching output. */ @@ -321,7 +321,7 @@ public class GT_AssemblyLineUtils { /** * Get the Output ItemStack from a Data Stick. - * + * * @param aDataStick - The Data Stick to check. * @return Output ItemStack contained on the Data Stick. */ diff --git a/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java b/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java index fa58c1d614..7a1515ec0c 100644 --- a/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java +++ b/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java @@ -16,10 +16,10 @@ import gregtech.api.enums.MaterialsBotania; public class GT_Assemblyline_Server { - public static LinkedHashMap<String, String> lServerNames = new LinkedHashMap<String, String>(); - private static LinkedHashMap<String, String> internal2 = new LinkedHashMap<String, String>(), - internal3 = new LinkedHashMap<String, String>(), internal4 = new LinkedHashMap<String, String>(); - private static HashMap<String, Property> internal = new HashMap<String, Property>(); + public static LinkedHashMap<String, String> lServerNames = new LinkedHashMap<>(); + private static LinkedHashMap<String, String> internal2 = new LinkedHashMap<>(), internal3 = new LinkedHashMap<>(), + internal4 = new LinkedHashMap<>(); + private static HashMap<String, Property> internal = new HashMap<>(); public static void fillMap(FMLPreInitializationEvent aEvent) { @@ -224,71 +224,54 @@ public class GT_Assemblyline_Server { t = t.substring(0, 1); int i = Integer.parseInt(t); switch (i) { - case 1: - mMats = new Materials[] { Materials.Adamantium, Materials.Aluminium, - Materials.Americium, Materials.AnnealedCopper, Materials.Antimony, - Materials.Arsenic, Materials.AstralSilver, Materials.BatteryAlloy, - Materials.Beryllium, Materials.Bismuth, Materials.BismuthBronze, - Materials.BlackBronze, Materials.BlackSteel, Materials.BlueAlloy, - Materials.BlueSteel, Materials.Brass }; - break; - case 2: - mMats = new Materials[] { Materials.Bronze, Materials.Caesium, - Materials.Cerium, Materials.Chrome, Materials.ChromiumDioxide, - Materials.Cobalt, Materials.CobaltBrass, Materials.Copper, - Materials.Cupronickel, Materials.DamascusSteel, Materials.DarkIron, - Materials.DeepIron, Materials.Desh, Materials.Duranium, - Materials.Dysprosium, Materials.Electrum }; - break; - case 3: - mMats = new Materials[] { Materials.ElectrumFlux, Materials.Enderium, - Materials.Erbium, Materials.Europium, Materials.FierySteel, - Materials.Gadolinium, Materials.Gallium, Materials.Holmium, - Materials.HSLA, Materials.Indium, Materials.InfusedGold, - Materials.Invar, Materials.Iridium, Materials.IronMagnetic, - Materials.IronWood, Materials.Kanthal }; - break; - case 4: - mMats = new Materials[] { Materials.Knightmetal, Materials.Lanthanum, - Materials.Lead, Materials.Lutetium, Materials.Magnalium, - Materials.Magnesium, Materials.Manganese, Materials.MeteoricIron, - Materials.MeteoricSteel, Materials.Trinium, Materials.Mithril, - Materials.Molybdenum, Materials.Naquadah, Materials.NaquadahAlloy, - Materials.NaquadahEnriched, Materials.Naquadria }; - break; - case 5: - mMats = new Materials[] { Materials.Neodymium, Materials.NeodymiumMagnetic, - Materials.Neutronium, Materials.Nichrome, Materials.Nickel, - Materials.Niobium, Materials.NiobiumNitride, - Materials.NiobiumTitanium, Materials.Osmiridium, Materials.Osmium, - Materials.Palladium, Materials.PigIron, Materials.Platinum, - Materials.Plutonium, Materials.Plutonium241, - Materials.Praseodymium }; - break; - case 6: - mMats = new Materials[] { Materials.Promethium, Materials.RedAlloy, - Materials.RedSteel, Materials.RoseGold, Materials.Rubidium, - Materials.Samarium, Materials.Scandium, Materials.ShadowIron, - Materials.ShadowSteel, Materials.Silicon, Materials.Silver, - Materials.SolderingAlloy, Materials.StainlessSteel, Materials.Steel, - Materials.SteelMagnetic, Materials.SterlingSilver }; - break; - case 7: - mMats = new Materials[] { Materials.Sunnarium, Materials.Tantalum, - Materials.Tellurium, Materials.Terbium, Materials.Thaumium, - Materials.Thorium, Materials.Thulium, Materials.Tin, - Materials.TinAlloy, Materials.Titanium, Materials.Tritanium, - Materials.Tungsten, Materials.TungstenSteel, Materials.Ultimet, - Materials.Uranium, Materials.Uranium235 }; - break; - case 8: - mMats = new Materials[] { Materials.Vanadium, Materials.VanadiumGallium, - Materials.WroughtIron, Materials.Ytterbium, Materials.Yttrium, - Materials.YttriumBariumCuprate, Materials.Zinc, - Materials.TungstenCarbide, Materials.VanadiumSteel, Materials.HSSG, - Materials.HSSE, Materials.HSSS, Materials.Steeleaf, - Materials.Ichorium, Materials.Firestone }; - break; + case 1 -> mMats = new Materials[] { Materials.Adamantium, Materials.Aluminium, + Materials.Americium, Materials.AnnealedCopper, Materials.Antimony, + Materials.Arsenic, Materials.AstralSilver, Materials.BatteryAlloy, + Materials.Beryllium, Materials.Bismuth, Materials.BismuthBronze, + Materials.BlackBronze, Materials.BlackSteel, Materials.BlueAlloy, + Materials.BlueSteel, Materials.Brass }; + case 2 -> mMats = new Materials[] { Materials.Bronze, Materials.Caesium, + Materials.Cerium, Materials.Chrome, Materials.ChromiumDioxide, + Materials.Cobalt, Materials.CobaltBrass, Materials.Copper, + Materials.Cupronickel, Materials.DamascusSteel, Materials.DarkIron, + Materials.DeepIron, Materials.Desh, Materials.Duranium, + Materials.Dysprosium, Materials.Electrum }; + case 3 -> mMats = new Materials[] { Materials.ElectrumFlux, Materials.Enderium, + Materials.Erbium, Materials.Europium, Materials.FierySteel, + Materials.Gadolinium, Materials.Gallium, Materials.Holmium, + Materials.HSLA, Materials.Indium, Materials.InfusedGold, + Materials.Invar, Materials.Iridium, Materials.IronMagnetic, + Materials.IronWood, Materials.Kanthal }; + case 4 -> mMats = new Materials[] { Materials.Knightmetal, Materials.Lanthanum, + Materials.Lead, Materials.Lutetium, Materials.Magnalium, + Materials.Magnesium, Materials.Manganese, Materials.MeteoricIron, + Materials.MeteoricSteel, Materials.Trinium, Materials.Mithril, + Materials.Molybdenum, Materials.Naquadah, Materials.NaquadahAlloy, + Materials.NaquadahEnriched, Materials.Naquadria }; + case 5 -> mMats = new Materials[] { Materials.Neodymium, + Materials.NeodymiumMagnetic, Materials.Neutronium, Materials.Nichrome, + Materials.Nickel, Materials.Niobium, Materials.NiobiumNitride, + Materials.NiobiumTitanium, Materials.Osmiridium, Materials.Osmium, + Materials.Palladium, Materials.PigIron, Materials.Platinum, + Materials.Plutonium, Materials.Plutonium241, Materials.Praseodymium }; + case 6 -> mMats = new Materials[] { Materials.Promethium, Materials.RedAlloy, + Materials.RedSteel, Materials.RoseGold, Materials.Rubidium, + Materials.Samarium, Materials.Scandium, Materials.ShadowIron, + Materials.ShadowSteel, Materials.Silicon, Materials.Silver, + Materials.SolderingAlloy, Materials.StainlessSteel, Materials.Steel, + Materials.SteelMagnetic, Materials.SterlingSilver }; + case 7 -> mMats = new Materials[] { Materials.Sunnarium, Materials.Tantalum, + Materials.Tellurium, Materials.Terbium, Materials.Thaumium, + Materials.Thorium, Materials.Thulium, Materials.Tin, Materials.TinAlloy, + Materials.Titanium, Materials.Tritanium, Materials.Tungsten, + Materials.TungstenSteel, Materials.Ultimet, Materials.Uranium, + Materials.Uranium235 }; + case 8 -> mMats = new Materials[] { Materials.Vanadium, + Materials.VanadiumGallium, Materials.WroughtIron, Materials.Ytterbium, + Materials.Yttrium, Materials.YttriumBariumCuprate, Materials.Zinc, + Materials.TungstenCarbide, Materials.VanadiumSteel, Materials.HSSG, + Materials.HSSE, Materials.HSSS, Materials.Steeleaf, Materials.Ichorium, + Materials.Firestone }; } t = entry.getKey() .substring( @@ -307,28 +290,22 @@ public class GT_Assemblyline_Server { t = t.substring(0, 1); int i = Integer.parseInt(t); switch (i) { - case 1: - mMats = new Materials[] { Materials.InfusedAir, Materials.Amber, - Materials.Amethyst, Materials.InfusedWater, Materials.BlueTopaz, - Materials.CertusQuartz, Materials.Dilithium, Materials.EnderEye, - Materials.EnderPearl, Materials.FoolsRuby, Materials.Force, - Materials.Forcicium, Materials.Forcillium, Materials.GreenSapphire, - Materials.InfusedFire, Materials.Jasper, MaterialsBotania.ManaDiamond, - MaterialsBotania.BotaniaDragonstone }; - break; - case 2: - mMats = new Materials[] { Materials.Lazurite, Materials.Lignite, - Materials.Monazite, Materials.Niter, Materials.Olivine, Materials.Opal, - Materials.InfusedOrder, Materials.InfusedEntropy, Materials.Phosphorus, - Materials.Quartzite, Materials.GarnetRed, Materials.Ruby, - Materials.Sapphire, Materials.Sodalite, Materials.Tanzanite, - Materials.InfusedEarth }; - break; - case 3: - mMats = new Materials[] { Materials.Topaz, Materials.Vinteum, - Materials.GarnetYellow, Materials.NetherStar, Materials.Charcoal, - Materials.Blaze }; - break; + case 1 -> mMats = new Materials[] { Materials.InfusedAir, Materials.Amber, + Materials.Amethyst, Materials.InfusedWater, Materials.BlueTopaz, + Materials.CertusQuartz, Materials.Dilithium, Materials.EnderEye, + Materials.EnderPearl, Materials.FoolsRuby, Materials.Force, + Materials.Forcicium, Materials.Forcillium, Materials.GreenSapphire, + Materials.InfusedFire, Materials.Jasper, MaterialsBotania.ManaDiamond, + MaterialsBotania.BotaniaDragonstone }; + case 2 -> mMats = new Materials[] { Materials.Lazurite, Materials.Lignite, + Materials.Monazite, Materials.Niter, Materials.Olivine, Materials.Opal, + Materials.InfusedOrder, Materials.InfusedEntropy, Materials.Phosphorus, + Materials.Quartzite, Materials.GarnetRed, Materials.Ruby, + Materials.Sapphire, Materials.Sodalite, Materials.Tanzanite, + Materials.InfusedEarth }; + case 3 -> mMats = new Materials[] { Materials.Topaz, Materials.Vinteum, + Materials.GarnetYellow, Materials.NetherStar, Materials.Charcoal, + Materials.Blaze }; } t = entry.getKey() .substring( diff --git a/src/main/java/gregtech/api/util/GT_BaseCrop.java b/src/main/java/gregtech/api/util/GT_BaseCrop.java index e66866cd8f..a586ad672e 100644 --- a/src/main/java/gregtech/api/util/GT_BaseCrop.java +++ b/src/main/java/gregtech/api/util/GT_BaseCrop.java @@ -3,6 +3,7 @@ package gregtech.api.util; import static gregtech.api.enums.GT_Values.E; import static gregtech.api.enums.ModIDs.IC2CropPlugin; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; @@ -27,11 +28,18 @@ import ic2.api.crops.ICropTile; public class GT_BaseCrop extends CropCard implements ICropCardInfo { - public static ArrayList<GT_BaseCrop> sCropList = new ArrayList<GT_BaseCrop>(); - private String mName = E, mDiscoveredBy = "Gregorius Techneticies", mAttributes[]; - private int mTier = 0, mMaxSize = 0, mAfterHarvestSize = 0, mHarvestSize = 0, mStats[] = new int[5], - mGrowthSpeed = 0; - private ItemStack mDrop = null, mSpecialDrops[] = null; + public static ArrayList<GT_BaseCrop> sCropList = new ArrayList<>(); + private String mName = E; + private String mDiscoveredBy = "Gregorius Techneticies"; + private String[] mAttributes; + private int mTier = 0; + private int mMaxSize = 0; + private int mAfterHarvestSize = 0; + private int mHarvestSize = 0; + private int[] mStats = new int[5]; + private int mGrowthSpeed = 0; + private ItemStack mDrop = null; + private ItemStack[] mSpecialDrops = null; private Materials mBlock = null; private static boolean bIc2NeiLoaded = IC2CropPlugin.isModLoaded(); @@ -123,19 +131,8 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { Class.forName("speiger.src.crops.api.CropPluginAPI") .getField("instance"), this); - } catch (IllegalAccessException ex) { - bIc2NeiLoaded = false; - } catch (IllegalArgumentException ex) { - bIc2NeiLoaded = false; - } catch (java.lang.reflect.InvocationTargetException ex) { - bIc2NeiLoaded = false; - } catch (NoSuchFieldException ex) { - bIc2NeiLoaded = false; - } catch (NoSuchMethodException ex) { - bIc2NeiLoaded = false; - } catch (SecurityException ex) { - bIc2NeiLoaded = false; - } catch (ClassNotFoundException ex) { + } catch (IllegalAccessException | ClassNotFoundException | SecurityException | NoSuchMethodException + | NoSuchFieldException | InvocationTargetException | IllegalArgumentException ex) { bIc2NeiLoaded = false; } } @@ -294,7 +291,7 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { @Override public List<String> getCropInformation() { if (mBlock != null) { - ArrayList<String> result = new ArrayList<String>(1); + ArrayList<String> result = new ArrayList<>(1); result.add( String.format( "Requires %s Ore or Block of %s as soil block to reach full growth.", diff --git a/src/main/java/gregtech/api/util/GT_CLS_Compat.java b/src/main/java/gregtech/api/util/GT_CLS_Compat.java index a7cae35d59..4dff5f65f9 100644 --- a/src/main/java/gregtech/api/util/GT_CLS_Compat.java +++ b/src/main/java/gregtech/api/util/GT_CLS_Compat.java @@ -105,11 +105,11 @@ public class GT_CLS_Compat { if (nextBakingMsgAt < now) { nextBakingMsgAt = now + bakingMsgEvery; GT_Mod.GT_FML_LOGGER.info( - String.format("%s - Baking: %d%%", materialsType, (Integer) (currentStep * 100 / sizeStep))); + String.format("%s - Baking: %d%%", materialsType, currentStep * 100 / sizeStep)); } action.accept(m); currentStep += 1; - } ; + } GT_Mod.GT_FML_LOGGER.info(String.format("%s - Baking: Done", materialsType)); try { progressBarStep.set(progressBar, currentStep); @@ -130,7 +130,7 @@ public class GT_CLS_Compat { mEvents, progressBar, m -> m.mMaterial, - m -> GT_Proxy.registerRecipes(m)); + GT_Proxy::registerRecipes); ProgressManager.pop(progressBar); isRegisteringGTmaterials.set(null, false); } @@ -147,7 +147,7 @@ public class GT_CLS_Compat { replacedVanillaItemsSet, progressBar, m -> m.mDefaultLocalName, - m -> GT_PostLoad.doActualRegistration(m)); + GT_PostLoad::doActualRegistration); } public static void pushToDisplayProgress() throws InvocationTargetException, IllegalAccessException { diff --git a/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java b/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java index 113d8cc420..afbcf6145f 100644 --- a/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java +++ b/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java @@ -189,7 +189,7 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } private void saveRegions(Stream<SuperRegion> stream) { - stream.filter(r -> r.isDirty()) + stream.filter(SuperRegion::isDirty) .map(c -> (Runnable) c::save) .map(r -> CompletableFuture.runAsync(r, IO_WORKERS)) .reduce(CompletableFuture::allOf) @@ -447,12 +447,10 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID World world = Objects.requireNonNull(this.world.get(), "Attempting to load region of another world!"); try (DataInputStream input = new DataInputStream(new FileInputStream(file))) { byte b = input.readByte(); - switch (b) { - case 0: - loadV0(input, world); - break; - default: - GT_Log.err.printf("Unknown ChunkAssociatedData version %d\n", b); + if (b == 0) { + loadV0(input, world); + } else { + GT_Log.err.printf("Unknown ChunkAssociatedData version %d\n", b); } } } diff --git a/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java b/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java index 6c6ac4bc62..c3057f3caa 100644 --- a/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java +++ b/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java @@ -268,7 +268,7 @@ public class GT_HatchElementBuilder<T> { * This will clear the sides set by previous call to this or {@link #allowOnly(ForgeDirection...)} * <p> * Usually mandatory for multis with multiple slices, and otherwise not needed if it contains a single slice only. - * + * * @param facings disallowed direction in ABC coordinate system */ public GT_HatchElementBuilder<T> disallowOnly(ForgeDirection... facings) { @@ -284,7 +284,7 @@ public class GT_HatchElementBuilder<T> { * This will clear the sides set by previous call to this or {@link #disallowOnly(ForgeDirection...)} * <p> * Usually mandatory for multis with multiple slices, and otherwise not needed if it contains a single slice only. - * + * * @param facings allowed direction in ABC coordinate system */ public GT_HatchElementBuilder<T> allowOnly(ForgeDirection... facings) { @@ -376,7 +376,7 @@ public class GT_HatchElementBuilder<T> { } if (mHatchItemFilter == null) { // no item filter -> no placement - return new IStructureElementNoPlacement<T>() { + return new IStructureElementNoPlacement<>() { @Override public boolean check(T t, World world, int x, int y, int z) { @@ -392,7 +392,7 @@ public class GT_HatchElementBuilder<T> { } }; } - return new IStructureElement<T>() { + return new IStructureElement<>() { private String mHint = mHatchItemType == null ? "unspecified GT hatch" : mHatchItemType.get(); diff --git a/src/main/java/gregtech/api/util/GT_Log.java b/src/main/java/gregtech/api/util/GT_Log.java index db7edf7779..2d00c2e061 100644 --- a/src/main/java/gregtech/api/util/GT_Log.java +++ b/src/main/java/gregtech/api/util/GT_Log.java @@ -25,7 +25,7 @@ public class GT_Log { public static class LogBuffer extends PrintStream { - public final List<String> mBufferedOreDictLog = new ArrayList<String>(); + public final List<String> mBufferedOreDictLog = new ArrayList<>(); public LogBuffer() { super(new OutputStream() { diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index ec3f8a2b70..3dff430782 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -706,42 +706,34 @@ public class GT_ModHandler { .contains("ic2.itemPurifiedCrushed")))) continue; switch (aGTRecipeMap.mUnlocalizedName) { - case "gt.recipe.macerator": - case "gt.recipe.extractor": - case "gt.recipe.compressor": - aGTRecipeMap.addRecipe( - true, - new ItemStack[] { GT_Utility.copyAmount( - iRecipeInputRecipeOutputEntry.getKey() - .getAmount(), - tStack) }, - iRecipeInputRecipeOutputEntry.getValue().items.toArray( - new ItemStack[0]), - null, - null, - null, - null, - 300, - 2, - 0); - break; - case "gt.recipe.thermalcentrifuge": - aGTRecipeMap.addRecipe( - true, - new ItemStack[] { GT_Utility.copyAmount( - iRecipeInputRecipeOutputEntry.getKey() - .getAmount(), - tStack) }, - iRecipeInputRecipeOutputEntry.getValue().items.toArray( - new ItemStack[0]), - null, - null, - null, - null, - 500, - 48, - 0); - break; + case "gt.recipe.macerator", "gt.recipe.extractor", "gt.recipe.compressor" -> aGTRecip |
