aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core/material
diff options
context:
space:
mode:
authorConnor-Colenso <52056774+Connor-Colenso@users.noreply.github.com>2023-10-18 17:03:23 +0100
committerGitHub <noreply@github.com>2023-10-18 18:03:23 +0200
commitfbdbb388c369fae549cfde3eed38b536f7461d90 (patch)
treeb46f7fc949d7e4c6e3be910b81ed725e6dc1648e /src/main/java/gtPlusPlus/core/material
parentb670446fdf49991093b485f0aa14050039632775 (diff)
downloadGT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.tar.gz
GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.tar.bz2
GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.zip
Cleaning up (#767)
* Kill playerAPI * Gut more events and compat that is now obsolete * Remove commented out code * Remove final modifier from methods * Make more stuff final * Remove slow building ring * Protected -> private in final classes * More cleaning * More cleaning v2 * Purging * Clean DevHelper * Clean DevHelper 2 * delete DevHelper * remove useless IFMLLoadingPlugin.MCVersion annotation from @Mod files * check for obfuscation only once in the IFMLloadingPlugin.injectData * don't instantiate the static class ASMConfig * delete unused and empty implementation of IFMLCallHook * delete empty class * delete ClassesToTransform class that just holds the class names constants * delete unused methods and unsless logging in dummymod container * delete unused transformer ClassTransformer_TT_ThaumicRestorer * spotless * Clean * Clean utils * Build checkpoint * Purge * Stage 2 * Stage 3 * Stage 4 * Stage 5 * Stage 6 * Spotless * Imports * Stage idk * Stage 1 * Fix issue * Spotless * Format numbers --------- Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Co-authored-by: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Co-authored-by: Connor Colenso <colen@CONNORSPC>
Diffstat (limited to 'src/main/java/gtPlusPlus/core/material')
-rw-r--r--src/main/java/gtPlusPlus/core/material/Material.java61
-rw-r--r--src/main/java/gtPlusPlus/core/material/MaterialGenerator.java6
-rw-r--r--src/main/java/gtPlusPlus/core/material/Particle.java2
-rw-r--r--src/main/java/gtPlusPlus/core/material/state/MaterialState.java2
4 files changed, 34 insertions, 37 deletions
diff --git a/src/main/java/gtPlusPlus/core/material/Material.java b/src/main/java/gtPlusPlus/core/material/Material.java
index fe1dcd618d..11ef72f06c 100644
--- a/src/main/java/gtPlusPlus/core/material/Material.java
+++ b/src/main/java/gtPlusPlus/core/material/Material.java
@@ -36,12 +36,12 @@ import gtPlusPlus.xmod.tinkers.material.BaseTinkersMaterial;
public class Material {
- public static final Set<Material> mMaterialMap = new HashSet<Material>();
- public static HashMap<String, Material> mMaterialCache = new HashMap<String, Material>();
+ public static final Set<Material> mMaterialMap = new HashSet<>();
+ public static HashMap<String, Material> mMaterialCache = new HashMap<>();
- public static final Map<String, Map<String, ItemStack>> mComponentMap = new HashMap<String, Map<String, ItemStack>>();
+ public static final Map<String, Map<String, ItemStack>> mComponentMap = new HashMap<>();
- public static HashMap<String, String> sChemicalFormula = new HashMap<String, String>();
+ public static HashMap<String, String> sChemicalFormula = new HashMap<>();
private String unlocalizedName;
private String localizedName;
@@ -88,7 +88,7 @@ public class Material {
public short werkstoffID;
- public static AutoMap<Materials> invalidMaterials = new AutoMap<Materials>();
+ public static AutoMap<Materials> invalidMaterials = new AutoMap<>();
public Material(final String materialName, final MaterialState defaultState, final MaterialStack... inputs) {
this(materialName, defaultState, null, inputs);
@@ -376,7 +376,7 @@ public class Material {
rgba = null;
}
- mComponentMap.put(unlocalizedName, new HashMap<String, ItemStack>());
+ mComponentMap.put(unlocalizedName, new HashMap<>());
try {
this.unlocalizedName = Utils.sanitizeString(materialName);
@@ -414,8 +414,8 @@ public class Material {
Short[] mMixedRGB = new Short[3];
AutoMap<Material> mMaterialSet = MaterialUtils.getCompoundMaterialsRecursively(this);
for (int mnh = 0; mnh < 3; mnh++) {
- AutoMap<Short> aDataSet = new AutoMap<Short>();
- Set<Material> set4 = new HashSet<Material>();
+ AutoMap<Short> aDataSet = new AutoMap<>();
+ Set<Material> set4 = new HashSet<>();
for (Material u : mMaterialSet) {
// if (u.getState() == MaterialState.ORE || u.getState() == MaterialState.SOLID)
set4.add(u);
@@ -571,7 +571,7 @@ public class Material {
this.vRadiationLevel = (byte) radiationLevel;
} else {
if (vMaterialInput.size() > 0) {
- AutoMap<Byte> aDataSet = new AutoMap<Byte>();
+ AutoMap<Byte> aDataSet = new AutoMap<>();
for (MaterialStack m : this.vMaterialInput) {
aDataSet.put(m.getStackMaterial().vRadiationLevel);
}
@@ -582,7 +582,7 @@ public class Material {
+ aAverage
+ ".");
this.isRadioactive = true;
- this.vRadiationLevel = (byte) aAverage;
+ this.vRadiationLevel = aAverage;
} else {
Logger.MATERIALS(this.getLocalizedName() + " is not radioactive.");
this.isRadioactive = false;
@@ -617,8 +617,8 @@ public class Material {
int tempSmallestSize = 0;
if (this.vSmallestRatio != null) {
- for (int v = 0; v < this.vSmallestRatio.length; v++) {
- tempSmallestSize = (int) (tempSmallestSize + this.vSmallestRatio[v]);
+ for (long l : this.vSmallestRatio) {
+ tempSmallestSize = (int) (tempSmallestSize + l);
}
this.smallestStackSizeWhenProcessing = tempSmallestSize; // Valid stacksizes
} else {
@@ -670,11 +670,11 @@ public class Material {
}
String ratio = "";
if (this.vSmallestRatio != null) {
- for (int hu = 0; hu < this.vSmallestRatio.length; hu++) {
+ for (long l : this.vSmallestRatio) {
if (ratio.equals("")) {
- ratio = String.valueOf(this.vSmallestRatio[hu]);
+ ratio = String.valueOf(l);
} else {
- ratio = ratio + ":" + this.vSmallestRatio[hu];
+ ratio = ratio + ":" + l;
}
}
}
@@ -825,7 +825,7 @@ public class Material {
}
// build hash table with count
- AutoMap<Material> sets = new AutoMap<Material>();
+ AutoMap<Material> sets = new AutoMap<>();
if (this.vMaterialInput != null) {
for (MaterialStack r : this.vMaterialInput) {
if (r.getStackMaterial().getTextureSet().mSetName.toLowerCase().contains("fluid")) {
@@ -834,8 +834,7 @@ public class Material {
sets.put(r.getStackMaterial());
}
}
- TextureSet mostUsedTypeTextureSet = MaterialUtils
- .getMostCommonTextureSet(new ArrayList<Material>(sets.values()));
+ TextureSet mostUsedTypeTextureSet = MaterialUtils.getMostCommonTextureSet(new ArrayList<>(sets.values()));
if (mostUsedTypeTextureSet != null && mostUsedTypeTextureSet instanceof TextureSet) {
Logger.MATERIALS(
"Set textureset for " + this.localizedName + " to be " + mostUsedTypeTextureSet.mSetName + ".");
@@ -938,7 +937,7 @@ public class Material {
String aKey = aPrefix.name();
Map<String, ItemStack> g = mComponentMap.get(this.unlocalizedName);
if (g == null) {
- Map<String, ItemStack> aMap = new HashMap<String, ItemStack>();
+ Map<String, ItemStack> aMap = new HashMap<>();
mComponentMap.put(unlocalizedName, aMap);
g = aMap;
}
@@ -1245,7 +1244,7 @@ public class Material {
return new int[] {};
}
- private final short getComponentCount(final MaterialStack[] inputs) {
+ private short getComponentCount(final MaterialStack[] inputs) {
if (inputs == null || inputs.length < 1) {
return 1;
@@ -1271,8 +1270,6 @@ public class Material {
// Utils.LOG_MATERIALS("length: "+inputs.length);
final long[] tempRatio = new long[tempInput.size()];
for (int x = 0; x < tempInput.size(); x++) {
- // tempPercentage = tempPercentage+inputs[x].percentageToUse;
- // this.mMaterialList.add(inputs[x]);
if (tempInput.get(x) != null) {
tempRatio[x] = tempInput.get(x).getPartsPerOneHundred();
}
@@ -1282,16 +1279,16 @@ public class Material {
if (smallestRatio.length > 0) {
String tempRatioStringThing1 = "";
- for (int r = 0; r < tempRatio.length; r++) {
- tempRatioStringThing1 = tempRatioStringThing1 + tempRatio[r] + " : ";
+ for (long value : tempRatio) {
+ tempRatioStringThing1 = tempRatioStringThing1 + value + " : ";
}
Logger.MATERIALS("Default Ratio: " + tempRatioStringThing1);
String tempRatioStringThing = "";
int tempSmallestCraftingUseSize = 0;
- for (int r = 0; r < smallestRatio.length; r++) {
- tempRatioStringThing = tempRatioStringThing + smallestRatio[r] + " : ";
- tempSmallestCraftingUseSize = (int) (tempSmallestCraftingUseSize + smallestRatio[r]);
+ for (long l : smallestRatio) {
+ tempRatioStringThing = tempRatioStringThing + l + " : ";
+ tempSmallestCraftingUseSize = (int) (tempSmallestCraftingUseSize + l);
}
// this.smallestStackSizeWhenProcessing = tempSmallestCraftingUseSize;
Logger.MATERIALS("Smallest Ratio: " + tempRatioStringThing);
@@ -1546,7 +1543,7 @@ public class Material {
public final int calculateMeltingPoint() {
try {
- AutoMap<Integer> aDataSet = new AutoMap<Integer>();
+ AutoMap<Integer> aDataSet = new AutoMap<>();
for (MaterialStack m : this.vMaterialInput) {
aDataSet.put(m.getStackMaterial().getMeltingPointC());
}
@@ -1561,7 +1558,7 @@ public class Material {
public final int calculateBoilingPoint() {
try {
- AutoMap<Integer> aDataSet = new AutoMap<Integer>();
+ AutoMap<Integer> aDataSet = new AutoMap<>();
for (MaterialStack m : this.vMaterialInput) {
aDataSet.put(m.getStackMaterial().getBoilingPointC());
}
@@ -1576,7 +1573,7 @@ public class Material {
public final long calculateProtons() {
try {
- AutoMap<Long> aDataSet = new AutoMap<Long>();
+ AutoMap<Long> aDataSet = new AutoMap<>();
for (MaterialStack m : this.vMaterialInput) {
aDataSet.put(m.getStackMaterial().getProtons());
}
@@ -1591,7 +1588,7 @@ public class Material {
public final long calculateNeutrons() {
try {
- AutoMap<Long> aDataSet = new AutoMap<Long>();
+ AutoMap<Long> aDataSet = new AutoMap<>();
for (MaterialStack m : this.vMaterialInput) {
aDataSet.put(m.getStackMaterial().getNeutrons());
}
@@ -1653,7 +1650,7 @@ public class Material {
// Register Component
Map<String, ItemStack> aMap = Material.mComponentMap.get(componentMaterial.getUnlocalizedName());
if (aMap == null) {
- aMap = new HashMap<String, ItemStack>();
+ aMap = new HashMap<>();
}
String aKey = aPrefix.name();
ItemStack x = aMap.get(aKey);
diff --git a/src/main/java/gtPlusPlus/core/material/MaterialGenerator.java b/src/main/java/gtPlusPlus/core/material/MaterialGenerator.java
index 62fe3440ec..2e120107c9 100644
--- a/src/main/java/gtPlusPlus/core/material/MaterialGenerator.java
+++ b/src/main/java/gtPlusPlus/core/material/MaterialGenerator.java
@@ -60,7 +60,7 @@ import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_ShapedCrafting;
public class MaterialGenerator {
- public static final AutoMap<Set<RunnableWithInfo<Material>>> mRecipeMapsToGenerate = new AutoMap<Set<RunnableWithInfo<Material>>>();
+ public static final AutoMap<Set<RunnableWithInfo<Material>>> mRecipeMapsToGenerate = new AutoMap<>();
@SuppressWarnings("unused")
private static volatile Item temp;
@@ -336,7 +336,7 @@ public class MaterialGenerator {
}
if (generateOre) {
- tempBlock = new BlockBaseOre(matInfo, BlockTypes.ORE, Colour.intValue());
+ tempBlock = new BlockBaseOre(matInfo, BlockTypes.ORE);
}
DustState aState = new DustState(generateDust, generateSmallTinyDusts, generateSmallTinyDusts);
@@ -385,7 +385,7 @@ public class MaterialGenerator {
final short[] C = matInfo.getRGBA();
final Integer Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]);
- tempBlock = new BlockBaseOre(matInfo, BlockTypes.ORE, Colour.intValue());
+ tempBlock = new BlockBaseOre(matInfo, BlockTypes.ORE);
tempBlock = new BlockBaseModular(matInfo, BlockTypes.STANDARD);
temp = new BaseItemIngot(matInfo);
temp = new BaseItemDust(matInfo);
diff --git a/src/main/java/gtPlusPlus/core/material/Particle.java b/src/main/java/gtPlusPlus/core/material/Particle.java
index 77ccb2ab43..099c03297f 100644
--- a/src/main/java/gtPlusPlus/core/material/Particle.java
+++ b/src/main/java/gtPlusPlus/core/material/Particle.java
@@ -42,7 +42,7 @@ public class Particle {
public static final Particle UNKNOWN;
- public static final AutoMap<Particle> aMap = new AutoMap<Particle>();
+ public static final AutoMap<Particle> aMap = new AutoMap<>();
static {
diff --git a/src/main/java/gtPlusPlus/core/material/state/MaterialState.java b/src/main/java/gtPlusPlus/core/material/state/MaterialState.java
index 34abbd0844..9fb5cde101 100644
--- a/src/main/java/gtPlusPlus/core/material/state/MaterialState.java
+++ b/src/main/java/gtPlusPlus/core/material/state/MaterialState.java
@@ -10,7 +10,7 @@ public enum MaterialState {
ORE(5),
PURE_GAS(6);
- private int STATE;
+ private final int STATE;
private MaterialState(final int State) {
this.STATE = State;