diff options
| author | TimeConqueror <timeconqueror999@gmail.com> | 2021-07-15 18:29:26 +0300 |
|---|---|---|
| committer | TimeConqueror <timeconqueror999@gmail.com> | 2021-07-15 18:30:11 +0300 |
| commit | 86c442947a6778e66b761cb2cee7a88782eb363a (patch) | |
| tree | 9dcf5502ba33840519f821c83a76f344c9db36a4 /src/main/java/gregtech/api | |
| parent | 77f22e029303ba48f9aabad32367e500bdcefee3 (diff) | |
| download | GT5-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.java | 12 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/util/GT_Utility.java | 5 |
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) { |
