aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/loaders
diff options
context:
space:
mode:
authorLéa Gris <lea.gris@noiraude.net>2022-08-09 04:41:27 +0200
committerGitHub <noreply@github.com>2022-08-09 03:41:27 +0100
commit18d72ee94c18a8b6e330c255bb6ca650e6220196 (patch)
tree4f482ca6b488c09267b99cb393b2b9733113f41e /src/main/java/gregtech/loaders
parent3d26fefc4089fde7b26f8c95235737a89403e1c9 (diff)
downloadGT5-Unofficial-18d72ee94c18a8b6e330c255bb6ca650e6220196.tar.gz
GT5-Unofficial-18d72ee94c18a8b6e330c255bb6ca650e6220196.tar.bz2
GT5-Unofficial-18d72ee94c18a8b6e330c255bb6ca650e6220196.zip
fix(warnings): remove broad wanings suppression (#1223)
* fix(warnings): remove broad wanings suppression This shell script was applied to remove all instances of `@SuppressWarnings("ALL")`: ```sh grep -lr '@SuppressWarnings([[:space:]]*"ALL"[[:space:]]*)' src/ | xargs -l1 \ sed -n -i.bak '/@SuppressWarnings([[:space:]]*"ALL"[[:space:]]*)/!p' ``` * nuke @SuppressWarnings("all") in GT_NEI_DefaultHandler Case insensitive: ```sh grep -lr '@SuppressWarnings([[:space:]]*"[Aa][Ll][Ll]"[[:space:]]*)' src/ | xargs -l1 \ sed -n -i.bak '/@SuppressWarnings([[:space:]]*"[Aa][Ll][Ll]"[[:space:]]*)/!p' find src -type f -name '*.bak' -delete ``` * fix(warnings): GT_NEI_DefaultHandler * fix(warnings): GT_Mod * fix(warnings): GT_Values * fix(warnings): Materials * fix(warnings): GT_BeeDefinition * fix(warnings): GT_PostLoad * fix(warnings): GT_Worldgenloader * fix(warnings): GT_PreLoad
Diffstat (limited to 'src/main/java/gregtech/loaders')
-rw-r--r--src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java61
-rw-r--r--src/main/java/gregtech/loaders/postload/GT_PostLoad.java50
-rw-r--r--src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java9
-rw-r--r--src/main/java/gregtech/loaders/preload/GT_PreLoad.java31
4 files changed, 72 insertions, 79 deletions
diff --git a/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java b/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java
index 526ede3215..7228c52292 100644
--- a/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java
+++ b/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java
@@ -48,7 +48,6 @@ import static gregtech.api.enums.GT_Values.MOD_ID;
import static gregtech.api.enums.GT_Values.MOD_ID_DC;
import static gregtech.loaders.misc.GT_BeeDefinitionReference.*;
-@SuppressWarnings("ALL")
/**
* Bride Class for Lambdas
*/
@@ -669,9 +668,7 @@ public enum GT_BeeDefinition implements IBeeDefinition {
beeSpecies.setHasEffect();
},
template -> AlleleHelper.instance.set(template, LIFESPAN, Lifespan.NORMAL),
- dis -> {
- IBeeMutationCustom tMutation = dis.registerMutation(REDSTONE, GOLD, 10);
- }
+ dis -> dis.registerMutation(REDSTONE, GOLD, 10)
),
SUNNARIUM(GT_BranchDefinition.RAREMETAL, "Sunnarium", false, new Color(0xFFBC5E), new Color(0xE5CA2A),
beeSpecies -> {
@@ -824,9 +821,7 @@ public enum GT_BeeDefinition implements IBeeDefinition {
beeSpecies.setTemperature(HOT);
},
template -> AlleleHelper.instance.set(template, SPEED, Speed.NORMAL),
- dis -> {
- IBeeMutationCustom tMutation = dis.registerMutation(ASH, PEAT, 15);
- }
+ dis -> dis.registerMutation(ASH, PEAT, 15)
),
//IC2
@@ -1400,9 +1395,7 @@ public enum GT_BeeDefinition implements IBeeDefinition {
AlleleHelper.instance.set(template, FLOWERING, Flowering.SLOW);
AlleleHelper.instance.set(template, NOCTURNAL, true);
},
- dis -> {
- IBeeMutationCustom tMutation = dis.registerMutation(DIAMOND, DIVIDED, 10);
- }
+ dis -> dis.registerMutation(DIAMOND, DIVIDED, 10)
),
SPARKELING(GT_BranchDefinition.THAUMIC, "NetherStar", true, new Color(0x7A007A), new Color(0xFFFFFF),
beeSpecies -> {
@@ -3046,9 +3039,7 @@ public enum GT_BeeDefinition implements IBeeDefinition {
beeSpecies.setHasEffect();
},
template -> AlleleHelper.instance.set(template, LIFESPAN, Lifespan.SHORTEST),
- dis -> {
- IBeeMutationCustom tMutation = dis.registerMutation(INFINITYCATALYST, MYSTERIOUSCRYSTAL, 5);
- }
+ dis -> dis.registerMutation(INFINITYCATALYST, MYSTERIOUSCRYSTAL, 5)
),
//Endgame bees
JAEGERMEISTER(GT_BranchDefinition.ENDGAME, "JaegerMeister", false, new Color(0x05AD18), new Color(0xE7DAC3),
@@ -3106,7 +3097,7 @@ public enum GT_BeeDefinition implements IBeeDefinition {
}
}
- protected static IAlleleBeeEffect getEffect(byte modid, String name) {
+ static IAlleleBeeEffect getEffect(byte modid, String name) {
String s;
switch (modid) {
case EXTRABEES:
@@ -3129,7 +3120,7 @@ public enum GT_BeeDefinition implements IBeeDefinition {
return (IAlleleBeeEffect) AlleleManager.alleleRegistry.getAllele(s);
}
- protected static IAlleleFlowers getFlowers(byte modid, String name) {
+ static IAlleleFlowers getFlowers(byte modid, String name) {
String s;
switch (modid) {
case EXTRABEES:
@@ -3152,7 +3143,7 @@ public enum GT_BeeDefinition implements IBeeDefinition {
return (IAlleleFlowers) AlleleManager.alleleRegistry.getAllele(s);
}
- protected static IAlleleBeeSpecies getSpecies(byte modid, String name) {
+ private static IAlleleBeeSpecies getSpecies(byte modid, String name) {
String s;
switch (modid) {
case EXTRABEES:
@@ -3181,15 +3172,15 @@ public enum GT_BeeDefinition implements IBeeDefinition {
}
- protected final void setSpeciesProperties(GT_AlleleBeeSpecies beeSpecies) {
+ private void setSpeciesProperties(GT_AlleleBeeSpecies beeSpecies) {
this.mSpeciesProperties.accept(beeSpecies);
}
- protected final void setAlleles(IAllele[] template) {
+ private void setAlleles(IAllele[] template) {
this.mAlleles.accept(template);
}
- protected final void registerMutations() {
+ private void registerMutations() {
this.mMutations.accept(this);
}
@@ -3205,40 +3196,40 @@ public enum GT_BeeDefinition implements IBeeDefinition {
BeeManager.beeRoot.registerTemplate(template);
}
- protected final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance) {
+ private IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance) {
return registerMutation(parent1, parent2, chance, 1f);
}
- protected final IBeeMutationCustom registerMutation(GT_BeeDefinition parent1, IAlleleBeeSpecies parent2, int chance) {
+ private IBeeMutationCustom registerMutation(GT_BeeDefinition parent1, IAlleleBeeSpecies parent2, int chance) {
return registerMutation(parent1, parent2, chance, 1f);
}
- protected final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GT_BeeDefinition parent2, int chance) {
+ private IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GT_BeeDefinition parent2, int chance) {
return registerMutation(parent1, parent2, chance, 1f);
}
- protected final IBeeMutationCustom registerMutation(GT_BeeDefinition parent1, GT_BeeDefinition parent2, int chance) {
+ private IBeeMutationCustom registerMutation(GT_BeeDefinition parent1, GT_BeeDefinition parent2, int chance) {
return registerMutation(parent1, parent2, chance, 1f);
}
/**
- * Diese neue Funtion erlaubt Mutationsraten unter 1%. Setze dazu die Mutationsrate als Bruch mit chance / chancedivider
- * This new function allows Mutation percentages under 1%. Set them as a fraction with chance / chancedivider
+ * Diese neue Funtion erlaubt Mutationsraten unter 1%. Setze dazu die Mutationsrate als Bruch mit chance / chanceDivider
+ * This new function allows Mutation percentages under 1%. Set them as a fraction with chance / chanceDivider
*/
- protected final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance, float chancedivider) {
- return new GT_Bee_Mutation(parent1, parent2, this.getTemplate(), chance, chancedivider);
+ private IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance, float chanceDivider) {
+ return new GT_Bee_Mutation(parent1, parent2, this.getTemplate(), chance, chanceDivider);
}
- protected final IBeeMutationCustom registerMutation(GT_BeeDefinition parent1, IAlleleBeeSpecies parent2, int chance, float chancedivider) {
- return registerMutation(parent1.species, parent2, chance, chancedivider);
+ private IBeeMutationCustom registerMutation(GT_BeeDefinition parent1, IAlleleBeeSpecies parent2, int chance, float chanceDivider) {
+ return registerMutation(parent1.species, parent2, chance, chanceDivider);
}
- protected final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GT_BeeDefinition parent2, int chance, float chancedivider) {
- return registerMutation(parent1, parent2.species, chance, chancedivider);
+ private IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GT_BeeDefinition parent2, int chance, float chanceDivider) {
+ return registerMutation(parent1, parent2.species, chance, chanceDivider);
}
- protected final IBeeMutationCustom registerMutation(GT_BeeDefinition parent1, GT_BeeDefinition parent2, int chance, float chancedivider) {
- return registerMutation(parent1.species, parent2, chance, chancedivider);
+ private IBeeMutationCustom registerMutation(GT_BeeDefinition parent1, GT_BeeDefinition parent2, int chance, float chanceDivider) {
+ return registerMutation(parent1.species, parent2, chance, chanceDivider);
}
@Override
@@ -3260,8 +3251,4 @@ public enum GT_BeeDefinition implements IBeeDefinition {
public final ItemStack getMemberStack(EnumBeeType beeType) {
return BeeManager.beeRoot.getMemberStack(getIndividual(), beeType.ordinal());
}
-
- public final IBeeDefinition getRainResist() {
- return new BeeVariation.RainResist(this);
- }
}
diff --git a/src/main/java/gregtech/loaders/postload/GT_PostLoad.java b/src/main/java/gregtech/loaders/postload/GT_PostLoad.java
index 77b0c89ba6..5301a97b1e 100644
--- a/src/main/java/gregtech/loaders/postload/GT_PostLoad.java
+++ b/src/main/java/gregtech/loaders/postload/GT_PostLoad.java
@@ -44,19 +44,22 @@ import java.util.stream.Collectors;
import static gregtech.api.enums.GT_Values.MOD_ID_FR;
-@SuppressWarnings("ALL")
public class GT_PostLoad {
public static void activateOreDictHandler() {
+ @SuppressWarnings("UnstableApiUsage") // Stable enough for this project
Stopwatch stopwatch = Stopwatch.createStarted();
GT_Mod.gregtechproxy.activateOreDictHandler();
+
+ //noinspection UnstableApiUsage// Stable enough for this project
GT_Mod.GT_FML_LOGGER.info("Congratulations, you have been waiting long enough (" + stopwatch.stop() + "). Have a Cake.");
GT_Log.out.println("GT_Mod: List of Lists of Tool Recipes: " + GT_ModHandler.sSingleNonBlockDamagableRecipeList_list.toString());
GT_Log.out.println("GT_Mod: Vanilla Recipe List -> Outputs null or stackSize <=0: " + GT_ModHandler.sVanillaRecipeList_warntOutput.toString());
- GT_Log.out.println("GT_Mod: Single Non Block Damagable Recipe List -> Outputs null or stackSize <=0: " + GT_ModHandler.sSingleNonBlockDamagableRecipeList_warntOutput.toString());
+ GT_Log.out.println("GT_Mod: Single Non Block Damageable Recipe List -> Outputs null or stackSize <=0: " + GT_ModHandler.sSingleNonBlockDamagableRecipeList_warntOutput.toString());
}
public static void removeIc2Recipes(Map<IRecipeInput, RecipeOutput> aMaceratorRecipeList, Map<IRecipeInput, RecipeOutput> aCompressorRecipeList, Map<IRecipeInput, RecipeOutput> aExtractorRecipeList, Map<IRecipeInput, RecipeOutput> aOreWashingRecipeList, Map<IRecipeInput, RecipeOutput> aThermalCentrifugeRecipeList) {
+ @SuppressWarnings("UnstableApiUsage") // Stable enough for this project
Stopwatch stopwatch = Stopwatch.createStarted();
// remove gemIridium exploit
ItemStack iridiumOre = GT_ModHandler.getIC2Item("iridiumOre", 1);
@@ -70,18 +73,19 @@ public class GT_PostLoad {
GT_ModHandler.addIC2RecipesToGT(aExtractorRecipeList, GT_Recipe.GT_Recipe_Map.sExtractorRecipes, true, true, true);
GT_ModHandler.addIC2RecipesToGT(aOreWashingRecipeList, GT_Recipe.GT_Recipe_Map.sOreWasherRecipes, false, true, true);
GT_ModHandler.addIC2RecipesToGT(aThermalCentrifugeRecipeList, GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes, true, true, true);
+ //noinspection UnstableApiUsage// Stable enough for this project
GT_Mod.GT_FML_LOGGER.info("IC2 Removal (" + stopwatch.stop() + "). Have a Cake.");
}
public static void registerFluidCannerRecipes() {
- ItemStack ISdata0 = new ItemStack(Items.potionitem, 1, 0);
- ItemStack ILdata0 = ItemList.Bottle_Empty.get(1L);
+ ItemStack iSData0 = new ItemStack(Items.potionitem, 1, 0);
+ ItemStack iLData0 = ItemList.Bottle_Empty.get(1L);
for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
if ((tData.filledContainer.getItem() == Items.potionitem) && (tData.filledContainer.getItemDamage() == 0)) {
- GT_Recipe.GT_Recipe_Map.sFluidCannerRecipes.addRecipe(true, new ItemStack[]{ILdata0}, new ItemStack[]{ISdata0}, null, new FluidStack[]{Materials.Water.getFluid(250L)}, null, 4, 1, 0);
- GT_Recipe.GT_Recipe_Map.sFluidCannerRecipes.addRecipe(true, new ItemStack[]{ISdata0}, new ItemStack[]{ILdata0}, null, null, null, 4, 1, 0);
+ GT_Recipe.GT_Recipe_Map.sFluidCannerRecipes.addRecipe(true, new ItemStack[]{iLData0}, new ItemStack[]{iSData0}, null, new FluidStack[]{Materials.Water.getFluid(250L)}, null, 4, 1, 0);
+ GT_Recipe.GT_Recipe_Map.sFluidCannerRecipes.addRecipe(true, new ItemStack[]{iSData0}, new ItemStack[]{iLData0}, null, null, null, 4, 1, 0);
} else {
GT_Recipe.GT_Recipe_Map.sFluidCannerRecipes.addRecipe(true, new ItemStack[]{tData.emptyContainer}, new ItemStack[]{tData.filledContainer}, null, new FluidStack[]{tData.fluid}, null, tData.fluid.amount / 62, 1, 0);
GT_Recipe.GT_Recipe_Map.sFluidCannerRecipes.addRecipe(true, new ItemStack[]{tData.filledContainer}, new ItemStack[]{GT_Utility.getContainerItem(tData.filledContainer, true)}, null, null, new FluidStack[]{tData.fluid}, tData.fluid.amount / 62, 1, 0);
@@ -104,33 +108,33 @@ public class GT_PostLoad {
GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Stick to overwrite")}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Copy of the Stick")}, ItemList.Tool_DataStick.getWithName(0L, "Stick to copy"), null, null, 128, 30, 0);
GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Raw Prospection Data")}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Analyzed Prospection Data")}, null, null, null, 1000, 30, 0);
if (Loader.isModLoaded("GalacticraftCore")) {
- GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{GT_ModHandler.getModItem("GalacticraftCore", "item.schematic", 1, Short.MAX_VALUE).setStackDisplayName("Any Schematic")}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Scanned Schematic")}, ItemList.Tool_DataStick.getWithName(1L, "Stick to save it to"), null, null, 36000, 480, 0);
+ GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{Objects.requireNonNull(GT_ModHandler.getModItem("GalacticraftCore", "item.schematic", 1, Short.MAX_VALUE)).setStackDisplayName("Any Schematic")}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Scanned Schematic")}, ItemList.Tool_DataStick.getWithName(1L, "Stick to save it to"), null, null, 36000, 480, 0);
if (Loader.isModLoaded("GalacticraftMars"))
- GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{GT_ModHandler.getModItem("GalacticraftMars", "item.schematic", 1, Short.MAX_VALUE).setStackDisplayName("Any Schematic")}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Scanned Schematic")}, ItemList.Tool_DataStick.getWithName(1L, "Stick to save it to"), null, null, 36000, 480, 0);
+ GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{Objects.requireNonNull(GT_ModHandler.getModItem("GalacticraftMars", "item.schematic", 1, Short.MAX_VALUE)).setStackDisplayName("Any Schematic")}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Scanned Schematic")}, ItemList.Tool_DataStick.getWithName(1L, "Stick to save it to"), null, null, 36000, 480, 0);
if (Loader.isModLoaded("GalaxySpace")) {
for (int i = 4; i < 9; i++) {
GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{GT_ModHandler.getModItem("GalaxySpace", "item.SchematicTier" + i, 1).setStackDisplayName("Any Schematic")}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Scanned Schematic")}, ItemList.Tool_DataStick.getWithName(1L, "Stick to save it to"), null, null, 36000, 480, 0);
}
}
}
- Materials.getMaterialsMap().values().stream().forEach(tMaterial -> {
+ Materials.getMaterialsMap().values().forEach(tMaterial -> {
if ((tMaterial.mElement != null) && (!tMaterial.mElement.mIsIsotope) && (tMaterial != Materials.Magic) && (tMaterial.getMass() > 0L)) {
ItemStack tOutput = ItemList.Tool_DataOrb.get(1L);
Behaviour_DataOrb.setDataTitle(tOutput, "Elemental-Scan");
Behaviour_DataOrb.setDataName(tOutput, tMaterial.mElement.name());
ItemStack tInput = GT_OreDictUnificator.get(OrePrefixes.dust, tMaterial, 1L);
- ItemStack[] ISmat0 = new ItemStack[]{tInput};
- ItemStack[] ISmat1 = new ItemStack[]{tOutput};
+ ItemStack[] iSMat0 = new ItemStack[]{tInput};
+ ItemStack[] iSMat1 = new ItemStack[]{tOutput};
if (tInput != null) {
- GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, ISmat0, ISmat1, ItemList.Tool_DataOrb.get(1L), null, null, (int) (tMaterial.getMass() * 8192L), 30, 0);
- GT_Recipe.GT_Recipe_Map.sReplicatorFakeRecipes.addFakeRecipe(false, null, ISmat0, ISmat1, new FluidStack[]{Materials.UUMatter.getFluid(tMaterial.getMass())}, null, (int) (tMaterial.getMass() * 512L), 30, 0);
+ GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, iSMat0, iSMat1, ItemList.Tool_DataOrb.get(1L), null, null, (int) (tMaterial.getMass() * 8192L), 30, 0);
+ GT_Recipe.GT_Recipe_Map.sReplicatorFakeRecipes.addFakeRecipe(false, null, iSMat0, iSMat1, new FluidStack[]{Materials.UUMatter.getFluid(tMaterial.getMass())}, null, (int) (tMaterial.getMass() * 512L), 30, 0);
}
tInput = GT_OreDictUnificator.get(OrePrefixes.cell, tMaterial, 1L);
- ISmat0 = new ItemStack[]{tInput};
+ iSMat0 = new ItemStack[]{tInput};
if (tInput != null) {
- GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, ISmat0, ISmat1, ItemList.Tool_DataOrb.get(1L), null, null, (int) (tMaterial.getMass() * 8192L), 30, 0);
- GT_Recipe.GT_Recipe_Map.sReplicatorFakeRecipes.addFakeRecipe(false, null, ISmat0, ISmat1, new FluidStack[]{Materials.UUMatter.getFluid(tMaterial.getMass())}, null, (int) (tMaterial.getMass() * 512L), 30, 0);
+ GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, iSMat0, iSMat1, ItemList.Tool_DataOrb.get(1L), null, null, (int) (tMaterial.getMass() * 8192L), 30, 0);
+ GT_Recipe.GT_Recipe_Map.sReplicatorFakeRecipes.addFakeRecipe(false, null, iSMat0, iSMat1, new FluidStack[]{Materials.UUMatter.getFluid(tMaterial.getMass())}, null, (int) (tMaterial.getMass() * 512L), 30, 0);
}
}
});
@@ -180,11 +184,13 @@ public class GT_PostLoad {
}
public static void replaceVanillaMaterials() {
+ @SuppressWarnings("UnstableApiUsage") // Stable enough for this project
Stopwatch stopwatch = Stopwatch.createStarted();
GT_Mod.GT_FML_LOGGER.info("Replacing Vanilla Materials in recipes, please wait.");
Set<Materials> replaceVanillaItemsSet = GT_Mod.gregtechproxy.mUseGreatlyShrukenReplacementList ? Arrays.stream(Materials.values()).filter(GT_RecipeRegistrator::hasVanillaRecipes).collect(
Collectors.toSet()) : new HashSet<>(Arrays.asList(Materials.values()));
+ @SuppressWarnings("deprecation") // stable API for MC 1.7.10
ProgressManager.ProgressBar progressBar = ProgressManager.push("Register materials", replaceVanillaItemsSet.size());
if (GT_Values.cls_enabled){
try {
@@ -200,24 +206,26 @@ public class GT_PostLoad {
doActualRegistration(m);
});
}
+ //noinspection deprecation// stable API for MC 1.7.10
ProgressManager.pop(progressBar);
+ //noinspection UnstableApiUsage// stable enough for project
GT_Mod.GT_FML_LOGGER.info("Replaced Vanilla Materials (" + stopwatch.stop() + "). Have a Cake.");
}
public static void doActualRegistration(Materials m){
- String platename = OrePrefixes.plate.get(m).toString();
+ String plateName = OrePrefixes.plate.get(m).toString();
boolean noSmash = !m.contains(SubTag.NO_SMASHING);
if ((m.mTypes & 2) != 0)
- GT_RecipeRegistrator.registerUsagesForMaterials(platename, noSmash, m.getIngots(1));
+ GT_RecipeRegistrator.registerUsagesForMaterials(plateName, noSmash, m.getIngots(1));
if ((m.mTypes & 4) != 0)
- GT_RecipeRegistrator.registerUsagesForMaterials(platename, noSmash, m.getGems(1));
+ GT_RecipeRegistrator.registerUsagesForMaterials(plateName, noSmash, m.getGems(1));
if (m.getBlocks(1) != null)
GT_RecipeRegistrator.registerUsagesForMaterials(null, noSmash, m.getBlocks(1));
}
public static void createGTtoolsCreativeTab() {
- CreativeTabs mainTab = new CreativeTabs("GTtools") {
+ new CreativeTabs("GTtools") {
@SideOnly(Side.CLIENT)
@Override
public ItemStack getIconItemStack() {
@@ -230,8 +238,10 @@ public class GT_PostLoad {
return ItemList.Circuit_Integrated.getItem();
}
+ @SuppressWarnings("unchecked") // Overrides legacy method with raw types
@Override
public void displayAllReleventItems(List aList) {
+
for (int i = 0; i < 32766; i += 2) {
if (GT_MetaGenerated_Tool_01.INSTANCE.getToolStats(new ItemStack(GT_MetaGenerated_Tool_01.INSTANCE, 1, i)) != null) {
ItemStack tStack = new ItemStack(GT_MetaGenerated_Tool_01.INSTANCE, 1, i);
diff --git a/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java b/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java
index 2be2d5915f..595877f21b 100644
--- a/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java
+++ b/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java
@@ -11,7 +11,6 @@ import gregtech.common.GT_Worldgenerator;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
-@SuppressWarnings("ALL")
public class GT_Worldgenloader implements Runnable {
public void run() {
@@ -161,7 +160,7 @@ public class GT_Worldgenloader implements Runnable {
/*
* TODO: custom GTNH OreMixes
- * WARNING: NO DUPLICATS IN aName OR DEPRECATED MATERIALS IN HERE.
+ * WARNING: NO DUPLICATES IN aName OR DEPRECATED MATERIALS IN HERE.
* Materials can be used unlimited, since achievements for Ores are turned off.
*/
@@ -207,10 +206,10 @@ public class GT_Worldgenloader implements Runnable {
new GT_Worldgen_GT_Ore_Layer("ore.mix.tfgalena", true, 5, 35, 40, 4, 16, false, false, false, Materials.Galena, Materials.Silver, Materials.Lead, Materials.Cryolite);
new GT_Worldgen_GT_Ore_Layer("ore.mix.luvtantalite", true, 20, 30, 10, 4, 16, false, false, false, Materials.Pyrolusite, Materials.Apatite, Materials.Tantalite, Materials.Pyrochlore);
- //DO NOT DELETE V THIS V - this is needed so that gregtech generates its Ore Layer's first (the ones up there), which can then be transformed into "GT_Worldgen_GT_Ore_Layer_Space". Also Reflexion is slow.
+ //DO NOT DELETE V THIS V - this is needed so that gregtech generates its Ore Layer's first (the ones up there), which can then be transformed into "GT_Worldgen_GT_Ore_Layer_Space". Also, Reflexion is slow.
try {
- Class clazz = Class.forName("bloodasp.galacticgreg.WorldGenGaGT");
- Constructor constructor=clazz.getConstructor();
+ Class<?> clazz = Class.forName("bloodasp.galacticgreg.WorldGenGaGT");
+ Constructor<?> constructor=clazz.getConstructor();
Method method=clazz.getMethod("run");
method.invoke(constructor.newInstance());
GT_Log.out.println("Started Galactic Greg ore gen code");
diff --git a/src/main/java/gregtech/loaders/preload/GT_PreLoad.java b/src/main/java/gregtech/loaders/preload/GT_PreLoad.java
index 940df67f74..5d600f4dfe 100644
--- a/src/main/java/gregtech/loaders/preload/GT_PreLoad.java
+++ b/src/main/java/gregtech/loaders/preload/GT_PreLoad.java
@@ -37,13 +37,13 @@ import java.util.regex.Pattern;
import static gregtech.GT_Mod.GT_FML_LOGGER;
import static gregtech.api.enums.GT_Values.MOD_ID_AE;
-@SuppressWarnings("ALL")
public class GT_PreLoad {
public static void sortToTheEnd() {
if (GT_Mod.gregtechproxy.mSortToTheEnd) {
try {
GT_FML_LOGGER.info("GT_Mod: Sorting GregTech to the end of the Mod List for further processing.");
LoadController tLoadController = (LoadController) GT_Utility.getFieldContent(Loader.instance(), "modController", true, true);
+ assert tLoadController != null;
List<ModContainer> tModList = tLoadController.getActiveModList();
List<ModContainer> tNewModsList = new ArrayList<>();
ModContainer tGregTech = null;
@@ -59,7 +59,7 @@ public class GT_PreLoad {
if (tGregTech != null) {
tNewModsList.add(tGregTech);
}
- GT_Utility.getField(tLoadController, "activeModList", true, true).set(tLoadController, tNewModsList);
+ Objects.requireNonNull(GT_Utility.getField(tLoadController, "activeModList", true, true)).set(tLoadController, tNewModsList);
} catch (Throwable e) {
GT_Mod.logStackTrace(e);
}
@@ -112,7 +112,7 @@ public class GT_PreLoad {
GT_Log.mLogFile = new File(parentFile, "logs/GregTech.log");
if (!GT_Log.mLogFile.exists()) {
try {
- GT_Log.mLogFile.createNewFile();
+ final boolean ignored = GT_Log.mLogFile.createNewFile();
} catch (Throwable ignored) {}
}
try {
@@ -123,7 +123,7 @@ public class GT_PreLoad {
GT_Log.mOreDictLogFile = new File(parentFile, "logs/OreDict.log");
if (!GT_Log.mOreDictLogFile.exists()) {
try {
- GT_Log.mOreDictLogFile.createNewFile();
+ final boolean ignored = GT_Log.mOreDictLogFile.createNewFile();
} catch (Throwable ignored) {}
}
try {
@@ -145,7 +145,7 @@ public class GT_PreLoad {
GT_Log.mExplosionLog = new File(parentFile, "logs/Explosion.log");
if (!GT_Log.mExplosionLog.exists()) {
try {
- GT_Log.mExplosionLog.createNewFile();
+ final boolean ignored = GT_Log.mExplosionLog.createNewFile();
} catch (Throwable ignored) {}
}
try {
@@ -157,7 +157,7 @@ public class GT_PreLoad {
GT_Log.mPlayerActivityLogFile = new File(parentFile, "logs/PlayerActivity.log");
if (!GT_Log.mPlayerActivityLogFile.exists()) {
try {
- GT_Log.mPlayerActivityLogFile.createNewFile();
+ final boolean ignored = GT_Log.mPlayerActivityLogFile.createNewFile();
} catch (Throwable ignored) {}
}
try {
@@ -175,7 +175,7 @@ public class GT_PreLoad {
final File globalDir = new File("scripts");
if (globalDir.exists()) {
final List<String> scripts = new ArrayList<>();
- for (File file : globalDir.listFiles()) {
+ for (File file : Objects.requireNonNull(globalDir.listFiles())) {
if (file.getName().endsWith(".zs")) {
try (BufferedReader br = new BufferedReader(new FileReader(file))) {
String line;
@@ -294,8 +294,8 @@ public class GT_PreLoad {
public static void adjustScrap() {
GT_FML_LOGGER.info("GT_Mod: Removing all original Scrapbox Drops.");
try {
- GT_Utility.getField("ic2.core.item.ItemScrapbox$Drop", "topChance", true, true).set(null, 0);
- ((List) GT_Utility.getFieldContent(GT_Utility.getFieldContent("ic2.api.recipe.Recipes", "scrapboxDrops", true, true), "drops", true, true)).clear();
+ Objects.requireNonNull(GT_Utility.getField("ic2.core.item.ItemScrapbox$Drop", "topChance", true, true)).set(null, 0);
+ ((List<?>) Objects.requireNonNull(GT_Utility.getFieldContent(GT_Utility.getFieldContent("ic2.api.recipe.Recipes", "scrapboxDrops", true, true), "drops", true, true))).clear();
} catch (Throwable e) {
if (GT_Values.D1) {
e.printStackTrace(GT_Log.err);
@@ -341,9 +341,6 @@ public class GT_PreLoad {
System.out.close();
System.err.close();
}
- /*if (tMainConfig.get(aTextGeneral, "disable_STDERR", false).getBoolean(false)) {
- System.err.close();
- }*/
GregTech_API.sMachineExplosions = tMainConfig.get("machines", "machines_explosion_damage", true).getBoolean(false);
GregTech_API.sMachineFlammable = tMainConfig.get("machines", "machines_flammable", true).getBoolean(false);
GregTech_API.sMachineNonWrenchExplosions = tMainConfig.get("machines", "explosions_on_nonwrenching", true).getBoolean(false);
@@ -517,12 +514,12 @@ public class GT_PreLoad {
}
public static void loadClientConfig() {
- String SBdye0 = "ColorModulation.";
+ final String sBDye0 = "ColorModulation.";
Arrays.stream(Dyes.values()).filter(tDye -> (tDye != Dyes._NULL) && (tDye.mIndex < 0)).forEach(tDye -> {
- String SBdye1 = SBdye0 + tDye;
- tDye.mRGBa[0] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "R", tDye.mOriginalRGBa[0]))));
- tDye.mRGBa[1] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "G", tDye.mOriginalRGBa[1]))));
- tDye.mRGBa[2] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "B", tDye.mOriginalRGBa[2]))));
+ String sBDye1 = sBDye0 + tDye;
+ tDye.mRGBa[0] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(sBDye1, "R", tDye.mOriginalRGBa[0]))));
+ tDye.mRGBa[1] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(sBDye1, "G", tDye.mOriginalRGBa[1]))));
+ tDye.mRGBa[2] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(sBDye1, "B", tDye.mOriginalRGBa[2]))));
}
);
GT_Mod.gregtechproxy.mRenderTileAmbientOcclusion = GregTech_API.sClientDataFile.get("render", "TileAmbientOcclusion", true);