aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/api/objects
diff options
context:
space:
mode:
authorJakub <53441451+kuba6000@users.noreply.github.com>2022-08-29 16:04:28 +0200
committerGitHub <noreply@github.com>2022-08-29 16:04:28 +0200
commit7d1f51a8937e0a86486267437d444696e81e8aa0 (patch)
treea5b145e7271998f7b4b968a2212ed487e54a92b5 /src/main/java/gtPlusPlus/xmod/gregtech/api/objects
parent5267969156d30b4bb5f4cb2279ebb49db6bd40e2 (diff)
downloadGT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.gz
GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.bz2
GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.zip
Buildscript + Spotless (#318)
* Convert AES.java to readable class * Buildscript * Spotless
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/objects')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_CopiedBlockTexture.java3
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_RenderedTexture.java3
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java37
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java281
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java94
5 files changed, 215 insertions, 203 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_CopiedBlockTexture.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_CopiedBlockTexture.java
index fdf237bb11..5336b60fc7 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_CopiedBlockTexture.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_CopiedBlockTexture.java
@@ -12,7 +12,7 @@ import net.minecraft.block.Block;
@SuppressWarnings("deprecation")
public class GTPP_CopiedBlockTexture extends GT_CopiedBlockTexture {
- public GTPP_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa, boolean aAllowAlpha) {
+ public GTPP_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa, boolean aAllowAlpha) {
super(aBlock, aMeta, aMeta, aRGBa, aAllowAlpha);
}
@@ -23,5 +23,4 @@ public class GTPP_CopiedBlockTexture extends GT_CopiedBlockTexture {
public GTPP_CopiedBlockTexture(Block aBlock, int aSide, int aMeta) {
this(aBlock, aSide, aMeta, Dyes._NULL.mRGBa);
}
-
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_RenderedTexture.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_RenderedTexture.java
index 562be6a8ef..6764a1e206 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_RenderedTexture.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_RenderedTexture.java
@@ -12,7 +12,7 @@ import gregtech.api.objects.GT_RenderedTexture;
@SuppressWarnings("deprecation")
public class GTPP_RenderedTexture extends GT_RenderedTexture {
- public GTPP_RenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean aAllowAlpha) {
+ public GTPP_RenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean aAllowAlpha) {
super(aIcon, aRGBa, aAllowAlpha);
}
@@ -23,5 +23,4 @@ public class GTPP_RenderedTexture extends GT_RenderedTexture {
public GTPP_RenderedTexture(IIconContainer aIcon) {
this(aIcon, Dyes._NULL.mRGBa);
}
-
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java
index 9cc0e3a315..40699aa108 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java
@@ -1,28 +1,29 @@
package gtPlusPlus.xmod.gregtech.api.objects;
import gregtech.api.GregTech_API;
-
import gtPlusPlus.core.lib.CORE;
import net.minecraftforge.fluids.Fluid;
public class GregtechFluid extends Fluid implements Runnable {
- public final String mTextureName;
- private final short[] mRGBa;
+ public final String mTextureName;
+ private final short[] mRGBa;
- public GregtechFluid(final String aName, final String aTextureName, final short[] aRGBa) {
- super(aName);
- this.mRGBa = aRGBa;
- this.mTextureName = aTextureName;
- GregTech_API.sGTBlockIconload.add(this);
- }
+ public GregtechFluid(final String aName, final String aTextureName, final short[] aRGBa) {
+ super(aName);
+ this.mRGBa = aRGBa;
+ this.mTextureName = aTextureName;
+ GregTech_API.sGTBlockIconload.add(this);
+ }
- @Override
- public int getColor() {
- return (Math.max(0, Math.min(255, this.mRGBa[0])) << 16) | (Math.max(0, Math.min(255, this.mRGBa[1])) << 8) | Math.max(0, Math.min(255, this.mRGBa[2]));
- }
+ @Override
+ public int getColor() {
+ return (Math.max(0, Math.min(255, this.mRGBa[0])) << 16)
+ | (Math.max(0, Math.min(255, this.mRGBa[1])) << 8)
+ | Math.max(0, Math.min(255, this.mRGBa[2]));
+ }
- @Override
- public void run() {
- this.setIcons(GregTech_API.sBlockIcons.registerIcon(CORE.MODID+ ":" + "fluids/fluid." + this.mTextureName));
- }
-} \ No newline at end of file
+ @Override
+ public void run() {
+ this.setIcons(GregTech_API.sBlockIcons.registerIcon(CORE.MODID + ":" + "fluids/fluid." + this.mTextureName));
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java
index eb5939caca..a26cfbb192 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java
@@ -1,144 +1,151 @@
package gtPlusPlus.xmod.gregtech.api.objects;
-import java.util.*;
-
-import net.minecraft.item.ItemStack;
-
import gregtech.api.objects.GT_ArrayList;
-
import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
+import java.util.*;
+import net.minecraft.item.ItemStack;
public class GregtechItemData {
- private static final GregtechMaterialStack[] EMPTY_GT_MaterialStack_ARRAY = new GregtechMaterialStack[0];
-
- public final List<Object> mExtraData = new GT_ArrayList<>(false, 1);
- public final GregtechOrePrefixes mPrefix;
- public final GregtechMaterialStack mMaterial;
- public final GregtechMaterialStack[] mByProducts;
- public boolean mBlackListed = false;
- public ItemStack mUnificationTarget = null;
-
- public GregtechItemData(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final boolean aBlackListed) {
- this.mPrefix = aPrefix;
- this.mMaterial = aMaterial == null ? null : new GregtechMaterialStack(aMaterial, aPrefix.mMaterialAmount);
- this.mBlackListed = aBlackListed;
- this.mByProducts = (aPrefix.mSecondaryMaterial == null) || (aPrefix.mSecondaryMaterial.mMaterial == null) ? EMPTY_GT_MaterialStack_ARRAY : new GregtechMaterialStack[]{aPrefix.mSecondaryMaterial.clone()};
- }
-
- public GregtechItemData(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial) {
- this(aPrefix, aMaterial, false);
- }
-
- public GregtechItemData(final GregtechMaterialStack aMaterial, final GregtechMaterialStack... aByProducts) {
- this.mPrefix = null;
- this.mMaterial = aMaterial.mMaterial == null ? null : aMaterial.clone();
- this.mBlackListed = true;
- if (aByProducts == null) {
- this.mByProducts = EMPTY_GT_MaterialStack_ARRAY;
- } else {
- final GregtechMaterialStack[] tByProducts = aByProducts.length < 1 ? EMPTY_GT_MaterialStack_ARRAY : new GregtechMaterialStack[aByProducts.length];
- int j = 0;
- for (int i = 0; i < aByProducts.length; i++) {
- if ((aByProducts[i] != null) && (aByProducts[i].mMaterial != null)) {
- tByProducts[j++] = aByProducts[i].clone();
- }
- }
- this.mByProducts = j > 0 ? new GregtechMaterialStack[j] : EMPTY_GT_MaterialStack_ARRAY;
- for (int i = 0; i < this.mByProducts.length; i++) {
- this.mByProducts[i] = tByProducts[i];
- }
- }
- }
-
- public GregtechItemData(final GT_Materials aMaterial, final long aAmount, final GregtechMaterialStack... aByProducts) {
- this(new GregtechMaterialStack(aMaterial, aAmount), aByProducts);
- }
-
- public GregtechItemData(final GT_Materials aMaterial, final long aAmount, final GT_Materials aByProduct, final long aByProductAmount) {
- this(new GregtechMaterialStack(aMaterial, aAmount), new GregtechMaterialStack(aByProduct, aByProductAmount));
- }
-
- public GregtechItemData(final GregtechItemData... aData) {
- this.mPrefix = null;
- this.mBlackListed = true;
-
- final ArrayList<GregtechMaterialStack> aList = new ArrayList<>(), rList = new ArrayList<>();
-
- for (final GregtechItemData tData : aData) {
- if (tData != null) {
- if (tData.hasValidMaterialData() && (tData.mMaterial.mAmount > 0)) {
- aList.add(tData.mMaterial.clone());
- }
- for (final GregtechMaterialStack tMaterial : tData.mByProducts) {
- if (tMaterial.mAmount > 0) {
- aList.add(tMaterial.clone());
- }
- }
- }
- }
-
- for (final GregtechMaterialStack aMaterial : aList) {
- boolean temp = true;
- for (final GregtechMaterialStack tMaterial : rList) {
- if (aMaterial.mMaterial == tMaterial.mMaterial) {
- tMaterial.mAmount += aMaterial.mAmount;
- temp = false;
- break;
- }
- }
- if (temp) {
- rList.add(aMaterial.clone());
- }
- }
-
- Collections.sort(rList, new Comparator<GregtechMaterialStack>() {
- @Override
- public int compare(final GregtechMaterialStack a, final GregtechMaterialStack b) {
- return a.mAmount == b.mAmount ? 0 : a.mAmount > b.mAmount ? -1 : +1;
- }
- });
-
- if (rList.isEmpty()) {
- this.mMaterial = null;
- } else {
- this.mMaterial = rList.get(0);
- rList.remove(0);
- }
-
- this.mByProducts = rList.toArray(new GregtechMaterialStack[rList.size()]);
- }
-
- public boolean hasValidPrefixMaterialData() {
- return (this.mPrefix != null) && (this.mMaterial != null) && (this.mMaterial.mMaterial != null);
- }
-
- public boolean hasValidPrefixData() {
- return this.mPrefix != null;
- }
-
- public boolean hasValidMaterialData() {
- return (this.mMaterial != null) && (this.mMaterial.mMaterial != null);
- }
-
- public ArrayList<GregtechMaterialStack> getAllGT_MaterialStacks() {
- final ArrayList<GregtechMaterialStack> rList = new ArrayList<GregtechMaterialStack>();
- if (this.hasValidMaterialData()) {
- rList.add(this.mMaterial);
- }
- rList.addAll(Arrays.asList(this.mByProducts));
- return rList;
- }
-
- public GregtechMaterialStack getByProduct(final int aIndex) {
- return (aIndex >= 0) && (aIndex < this.mByProducts.length) ? this.mByProducts[aIndex] : null;
- }
-
- @Override
- public String toString() {
- if ((this.mPrefix == null) || (this.mMaterial == null) || (this.mMaterial.mMaterial == null)) {
- return "";
- }
- return this.mPrefix.name() + this.mMaterial.mMaterial.name();
- }
-} \ No newline at end of file
+ private static final GregtechMaterialStack[] EMPTY_GT_MaterialStack_ARRAY = new GregtechMaterialStack[0];
+
+ public final List<Object> mExtraData = new GT_ArrayList<>(false, 1);
+ public final GregtechOrePrefixes mPrefix;
+ public final GregtechMaterialStack mMaterial;
+ public final GregtechMaterialStack[] mByProducts;
+ public boolean mBlackListed = false;
+ public ItemStack mUnificationTarget = null;
+
+ public GregtechItemData(
+ final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final boolean aBlackListed) {
+ this.mPrefix = aPrefix;
+ this.mMaterial = aMaterial == null ? null : new GregtechMaterialStack(aMaterial, aPrefix.mMaterialAmount);
+ this.mBlackListed = aBlackListed;
+ this.mByProducts = (aPrefix.mSecondaryMaterial == null) || (aPrefix.mSecondaryMaterial.mMaterial == null)
+ ? EMPTY_GT_MaterialStack_ARRAY
+ : new GregtechMaterialStack[] {aPrefix.mSecondaryMaterial.clone()};
+ }
+
+ public GregtechItemData(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial) {
+ this(aPrefix, aMaterial, false);
+ }
+
+ public GregtechItemData(final GregtechMaterialStack aMaterial, final GregtechMaterialStack... aByProducts) {
+ this.mPrefix = null;
+ this.mMaterial = aMaterial.mMaterial == null ? null : aMaterial.clone();
+ this.mBlackListed = true;
+ if (aByProducts == null) {
+ this.mByProducts = EMPTY_GT_MaterialStack_ARRAY;
+ } else {
+ final GregtechMaterialStack[] tByProducts = aByProducts.length < 1
+ ? EMPTY_GT_MaterialStack_ARRAY
+ : new GregtechMaterialStack[aByProducts.length];
+ int j = 0;
+ for (int i = 0; i < aByProducts.length; i++) {
+ if ((aByProducts[i] != null) && (aByProducts[i].mMaterial != null)) {
+ tByProducts[j++] = aByProducts[i].clone();
+ }
+ }
+ this.mByProducts = j > 0 ? new GregtechMaterialStack[j] : EMPTY_GT_MaterialStack_ARRAY;
+ for (int i = 0; i < this.mByProducts.length; i++) {
+ this.mByProducts[i] = tByProducts[i];
+ }
+ }
+ }
+
+ public GregtechItemData(
+ final GT_Materials aMaterial, final long aAmount, final GregtechMaterialStack... aByProducts) {
+ this(new GregtechMaterialStack(aMaterial, aAmount), aByProducts);
+ }
+
+ public GregtechItemData(
+ final GT_Materials aMaterial,
+ final long aAmount,
+ final GT_Materials aByProduct,
+ final long aByProductAmount) {
+ this(new GregtechMaterialStack(aMaterial, aAmount), new GregtechMaterialStack(aByProduct, aByProductAmount));
+ }
+
+ public GregtechItemData(final GregtechItemData... aData) {
+ this.mPrefix = null;
+ this.mBlackListed = true;
+
+ final ArrayList<GregtechMaterialStack> aList = new ArrayList<>(), rList = new ArrayList<>();
+
+ for (final GregtechItemData tData : aData) {
+ if (tData != null) {
+ if (tData.hasValidMaterialData() && (tData.mMaterial.mAmount > 0)) {
+ aList.add(tData.mMaterial.clone());
+ }
+ for (final GregtechMaterialStack tMaterial : tData.mByProducts) {
+ if (tMaterial.mAmount > 0) {
+ aList.add(tMaterial.clone());
+ }
+ }
+ }
+ }
+
+ for (final GregtechMaterialStack aMaterial : aList) {
+ boolean temp = true;
+ for (final GregtechMaterialStack tMaterial : rList) {
+ if (aMaterial.mMaterial == tMaterial.mMaterial) {
+ tMaterial.mAmount += aMaterial.mAmount;
+ temp = false;
+ break;
+ }
+ }
+ if (temp) {
+ rList.add(aMaterial.clone());
+ }
+ }
+
+ Collections.sort(rList, new Comparator<GregtechMaterialStack>() {
+ @Override
+ public int compare(final GregtechMaterialStack a, final GregtechMaterialStack b) {
+ return a.mAmount == b.mAmount ? 0 : a.mAmount > b.mAmount ? -1 : +1;
+ }
+ });
+
+ if (rList.isEmpty()) {
+ this.mMaterial = null;
+ } else {
+ this.mMaterial = rList.get(0);
+ rList.remove(0);
+ }
+
+ this.mByProducts = rList.toArray(new GregtechMaterialStack[rList.size()]);
+ }
+
+ public boolean hasValidPrefixMaterialData() {
+ return (this.mPrefix != null) && (this.mMaterial != null) && (this.mMaterial.mMaterial != null);
+ }
+
+ public boolean hasValidPrefixData() {
+ return this.mPrefix != null;
+ }
+
+ public boolean hasValidMaterialData() {
+ return (this.mMaterial != null) && (this.mMaterial.mMaterial != null);
+ }
+
+ public ArrayList<GregtechMaterialStack> getAllGT_MaterialStacks() {
+ final ArrayList<GregtechMaterialStack> rList = new ArrayList<GregtechMaterialStack>();
+ if (this.hasValidMaterialData()) {
+ rList.add(this.mMaterial);
+ }
+ rList.addAll(Arrays.asList(this.mByProducts));
+ return rList;
+ }
+
+ public GregtechMaterialStack getByProduct(final int aIndex) {
+ return (aIndex >= 0) && (aIndex < this.mByProducts.length) ? this.mByProducts[aIndex] : null;
+ }
+
+ @Override
+ public String toString() {
+ if ((this.mPrefix == null) || (this.mMaterial == null) || (this.mMaterial.mMaterial == null)) {
+ return "";
+ }
+ return this.mPrefix.name() + this.mMaterial.mMaterial.name();
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java
index 6ec5907256..107202a027 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java
@@ -3,47 +3,53 @@ package gtPlusPlus.xmod.gregtech.api.objects;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
public class GregtechMaterialStack implements Cloneable {
- public long mAmount;
- public GT_Materials mMaterial;
-
- public GregtechMaterialStack(final GT_Materials aMaterial, final long aAmount) {
- this.mMaterial = aMaterial == null ? GT_Materials._NULL : aMaterial;
- this.mAmount = aAmount;
- }
-
- public GregtechMaterialStack copy(final long aAmount) {
- return new GregtechMaterialStack(this.mMaterial, aAmount);
- }
-
- @Override
- public GregtechMaterialStack clone() {
- return new GregtechMaterialStack(this.mMaterial, this.mAmount);
- }
-
- @Override
- public boolean equals(final Object aObject) {
- if (aObject == this) {
- return true;
- }
- if (aObject == null) {
- return false;
- }
- if (aObject instanceof GT_Materials) {
- return aObject == this.mMaterial;
- }
- if (aObject instanceof GregtechMaterialStack) {
- return (((GregtechMaterialStack) aObject).mMaterial == this.mMaterial) && ((this.mAmount < 0) || (((GregtechMaterialStack) aObject).mAmount < 0) || (((GregtechMaterialStack) aObject).mAmount == this.mAmount));
- }
- return false;
- }
-
- @Override
- public String toString() {
- return ((this.mMaterial.mMaterialList.size() > 1) && (this.mAmount > 1) ? "(" : "") + this.mMaterial.getToolTip(true) + ((this.mMaterial.mMaterialList.size() > 1) && (this.mAmount > 1) ? ")" : "") + (this.mAmount > 1 ? this.mAmount : "");
- }
-
- @Override
- public int hashCode() {
- return this.mMaterial.hashCode();
- }
-} \ No newline at end of file
+ public long mAmount;
+ public GT_Materials mMaterial;
+
+ public GregtechMaterialStack(final GT_Materials aMaterial, final long aAmount) {
+ this.mMaterial = aMaterial == null ? GT_Materials._NULL : aMaterial;
+ this.mAmount = aAmount;
+ }
+
+ public GregtechMaterialStack copy(final long aAmount) {
+ return new GregtechMaterialStack(this.mMaterial, aAmount);
+ }
+
+ @Override
+ public GregtechMaterialStack clone() {
+ return new GregtechMaterialStack(this.mMaterial, this.mAmount);
+ }
+
+ @Override
+ public boolean equals(final Object aObject) {
+ if (aObject == this) {
+ return true;
+ }
+ if (aObject == null) {
+ return false;
+ }
+ if (aObject instanceof GT_Materials) {
+ return aObject == this.mMaterial;
+ }
+ if (aObject instanceof GregtechMaterialStack) {
+ return (((GregtechMaterialStack) aObject).mMaterial == this.mMaterial)
+ && ((this.mAmount < 0)
+ || (((GregtechMaterialStack) aObject).mAmount < 0)
+ || (((GregtechMaterialStack) aObject).mAmount == this.mAmount));
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return ((this.mMaterial.mMaterialList.size() > 1) && (this.mAmount > 1) ? "(" : "")
+ + this.mMaterial.getToolTip(true)
+ + ((this.mMaterial.mMaterialList.size() > 1) && (this.mAmount > 1) ? ")" : "")
+ + (this.mAmount > 1 ? this.mAmount : "");
+ }
+
+ @Override
+ public int hashCode() {
+ return this.mMaterial.hashCode();
+ }
+}