aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api
diff options
context:
space:
mode:
authorTimeConqueror <timeconqueror999@gmail.com>2021-07-15 18:29:26 +0300
committerTimeConqueror <timeconqueror999@gmail.com>2021-07-15 18:30:11 +0300
commit86c442947a6778e66b761cb2cee7a88782eb363a (patch)
tree9dcf5502ba33840519f821c83a76f344c9db36a4 /src/main/java/gregtech/api
parent77f22e029303ba48f9aabad32367e500bdcefee3 (diff)
downloadGT5-Unofficial-86c442947a6778e66b761cb2cee7a88782eb363a.tar.gz
GT5-Unofficial-86c442947a6778e66b761cb2cee7a88782eb363a.tar.bz2
GT5-Unofficial-86c442947a6778e66b761cb2cee7a88782eb363a.zip
Removed useless method callings
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r--src/main/java/gregtech/api/GregTech_API.java12
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java5
2 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java
index ba7e3ab43e..3133536de2 100644
--- a/src/main/java/gregtech/api/GregTech_API.java
+++ b/src/main/java/gregtech/api/GregTech_API.java
@@ -426,7 +426,7 @@ public class GregTech_API {
* @param aMeta the Metadata of the Blocks as Bitmask! -1 or ~0 for all Metavalues
*/
public static boolean registerMachineBlock(Block aBlock, int aMeta) {
- if (GT_Utility.isBlockInvalid(aBlock))
+ if (aBlock == null)
return false;
if (GregTech_API.sThaumcraftCompat != null)
GregTech_API.sThaumcraftCompat.registerPortholeBlacklistedBlock(aBlock);
@@ -438,7 +438,7 @@ public class GregTech_API {
* Like above but with boolean Parameters instead of a BitMask
*/
public static boolean registerMachineBlock(Block aBlock, boolean... aMeta) {
- if (GT_Utility.isBlockInvalid(aBlock) || aMeta == null || aMeta.length == 0)
+ if (aBlock == null || aMeta == null || aMeta.length == 0)
return false;
if (GregTech_API.sThaumcraftCompat != null)
GregTech_API.sThaumcraftCompat.registerPortholeBlacklistedBlock(aBlock);
@@ -452,9 +452,11 @@ public class GregTech_API {
* if this Block is a Machine Update Conducting Block
*/
public static boolean isMachineBlock(Block aBlock, int aMeta) {
- if (GT_Utility.isBlockInvalid(aBlock))
- return false;
- return (sMachineIDs.containsKey(aBlock) && (sMachineIDs.get(aBlock) & B[aMeta]) != 0);
+ if (aBlock != null) {
+ Integer id = sMachineIDs.get(aBlock);
+ return id != null && (id & B[aMeta]) != 0;
+ }
+ return false;
}
/**
diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java
index 8e839c8ba0..165ff71927 100644
--- a/src/main/java/gregtech/api/util/GT_Utility.java
+++ b/src/main/java/gregtech/api/util/GT_Utility.java
@@ -1286,6 +1286,7 @@ public class GT_Utility {
return rList;
}
+ @Deprecated // why do you use Objects?
public static Block getBlock(Object aBlock) {
return (Block) aBlock;
}
@@ -1299,12 +1300,14 @@ public class GT_Utility {
return Block.getBlockFromItem(item);
}
+ @Deprecated // why do you use Objects? And if you want to check your block to be not null, check it directly!
public static boolean isBlockValid(Object aBlock) {
return (aBlock instanceof Block);
}
+ @Deprecated // why do you use Objects? And if you want to check your block to be null, check it directly!
public static boolean isBlockInvalid(Object aBlock) {
- return aBlock == null || !(aBlock instanceof Block);
+ return !(aBlock instanceof Block);
}
public static boolean isStringValid(Object aString) {