-
Notifications
You must be signed in to change notification settings - Fork 40
Conversation
- Factorize operands - Replace (X && Y) || (!X && Z) by X ? Y : Z - Use '==' or '^' on booleans - Merge conditions of if/else if/else that have the same blocks - Pull down common code from if/else statement - Single 'if' statement rather than duplicate blocks that fall through - Remove redundant end of block with jump statement - Remove redundant if condition - Pull out a duplicate 'if' from an if/else
Warning: 2 uncommitted changes |
Co-authored-by: GitHub GTNH Actions <>
@glowredman can you solve the conflicts? |
@glowredman sorry |
} | ||
if (this.waitForPipes()) { | ||
return false; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove the else to go down 1 more layer of indentation
@@ -198,7 +199,8 @@ private static int getTierOfBlock(Block block, int meta) { | |||
} | |||
if (block == GregTech_API.sBlockMetal5 && meta == 2) { | |||
return 1; // Neutronium | |||
} else if (block == LudicrousBlocks.resource_block && meta == 1) { | |||
} | |||
if (block == LudicrousBlocks.resource_block && meta == 1) { | |||
return 2; // Infinity | |||
} else if (block == GregTech_API.sBlockMetal9) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason you only removed one of the elses? can remove this one too.
|| GT_OreDictUnificator.getAssociation(itemStack).mMaterial.mMaterial.getDust(1) == null) | ||
return new float[] { 1f, 1f }; | ||
else if (OrePrefixes.ore.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.oreNetherrack.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.oreEndstone.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.oreBlackgranite.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.oreRedgranite.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.oreMarble.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.oreBasalt.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix)) | ||
return new float[] { 0.5f, 1f }; | ||
else if (OrePrefixes.stone.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.stoneBricks.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.stoneChiseled.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.stoneCobble.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.stoneCracked.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.stoneMossy.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.stoneMossyBricks.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.stoneSmooth.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.cobblestone.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix)) | ||
return new float[] { 1f, 1.5f }; | ||
|| GT_OreDictUnificator.getAssociation(itemStack).mMaterial.mMaterial.getDust(1) == null) {} else | ||
if (OrePrefixes.ore.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.oreNetherrack.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.oreEndstone.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.oreBlackgranite.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.oreRedgranite.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.oreMarble.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.oreBasalt.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix)) | ||
return new float[] { 0.5f, 1f }; | ||
else if (OrePrefixes.stone.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.stoneBricks.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.stoneChiseled.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.stoneCobble.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.stoneCracked.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.stoneMossy.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.stoneMossyBricks.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.stoneSmooth.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix) | ||
|| OrePrefixes.cobblestone.equals(GT_OreDictUnificator.getAssociation(itemStack).mPrefix)) | ||
return new float[] { 1f, 1.5f }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible add brackets to the return statement and actually remove the elses. No need to just remove one of them otherwise...
int aMetaData = aStack.getItemDamage(); | ||
Werkstoff werkstoff = werkstoffHashMap.get((short) aMetaData); | ||
if (werkstoff == null) werkstoff = Werkstoff.default_null_Werkstoff; | ||
return ((BW_MetaGenerated_Blocks) block).blockTypeLocalizedName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can make a variable in the if instead of converting at place
public void breakBlock(World world, int x, int y, int z, Block block, int meta) { | ||
TileEntity tTileEntity = world.getTileEntity(x, y, z); | ||
if ((tTileEntity instanceof BW_MetaGenerated_Block_TE)) { | ||
if (tTileEntity instanceof BW_MetaGenerated_Block_TE) { | ||
mTemporaryTileEntity.set((BW_MetaGenerated_Block_TE) tTileEntity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can make a variable at the instance of.
|| aRecipe[i] instanceof ItemData | ||
|| aRecipe[i] instanceof String | ||
|| aRecipe[i] instanceof Character)) | ||
else if (aRecipe[i] instanceof Enum) aRecipe[i] = ((Enum<?>) aRecipe[i]).name(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enum could just have a variable on it
@@ -1018,11 +903,11 @@ public static ShapedOreRecipe createGTCraftingRecipe(ItemStack aResult, Enchantm | |||
|
|||
for (byte i = 0; i < aRecipe.length; i++) { | |||
if (aRecipe[i] instanceof IItemContainer) aRecipe[i] = ((IItemContainer) aRecipe[i]).get(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can make a variable for IItemContantainer instead of converting at place
if (t != null && !new Coords(C.x, C.y + 1, C.z, wID).equals(Controller)) { | ||
if (t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
} | ||
if (t != null && !new Coords(C.x, C.y + 1, C.z, wID).equals(Controller) | ||
&& t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
t = w.getTileEntity(C.x, C.y - 1, C.z); | ||
if (t != null && !new Coords(C.x, C.y - 1, C.z, wID).equals(Controller)) { | ||
if (t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
} | ||
if (t != null && !new Coords(C.x, C.y - 1, C.z, wID).equals(Controller) | ||
&& t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
t = w.getTileEntity(C.x + 1, C.y, C.z); | ||
if (t != null && !new Coords(C.x + 1, C.y, C.z, wID).equals(Controller)) { | ||
if (t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
} | ||
if (t != null && !new Coords(C.x + 1, C.y, C.z, wID).equals(Controller) | ||
&& t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
t = w.getTileEntity(C.x - 1, C.y, C.z); | ||
if (t != null && !new Coords(C.x - 1, C.y, C.z, wID).equals(Controller)) { | ||
if (t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
} | ||
if (t != null && !new Coords(C.x - 1, C.y, C.z, wID).equals(Controller) | ||
&& t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
t = w.getTileEntity(C.x, C.y, C.z + 1); | ||
if (t != null && !new Coords(C.x, C.y, C.z + 1, wID).equals(Controller)) { | ||
if (t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
} | ||
if (t != null && !new Coords(C.x, C.y, C.z + 1, wID).equals(Controller) | ||
&& t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
t = w.getTileEntity(C.x, C.y, C.z - 1); | ||
if (t != null && !new Coords(C.x, C.y, C.z - 1, wID).equals(Controller)) { | ||
if (t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
} | ||
if (t != null && !new Coords(C.x, C.y, C.z - 1, wID).equals(Controller) | ||
&& t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
} else { | ||
if (n == w.getBlockMetadata(C.x, C.y + 1, C.z) | ||
&& !new Coords(C.x, C.y + 1, C.z, wID).equals(Controller)) | ||
return true; | ||
if (n == w.getBlockMetadata(C.x, C.y - 1, C.z) | ||
&& !new Coords(C.x, C.y - 1, C.z, wID).equals(Controller)) | ||
if (n == w.getBlockMetadata(C.x, C.y + 1, C.z) && !new Coords(C.x, C.y + 1, C.z, wID).equals(Controller) | ||
|| n == w.getBlockMetadata(C.x, C.y - 1, C.z) | ||
&& !new Coords(C.x, C.y - 1, C.z, wID).equals(Controller)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
every instanceof check could just get a variable... no? and if brackets for what each if is doing.. please. I am barely able to read this
if (t != null && !new Coords(C.x, C.y + 1, C.z, wID).equals(Controller)) { | ||
if (t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
} | ||
if (t != null && !new Coords(C.x, C.y + 1, C.z, wID).equals(Controller) | ||
&& t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
t = w.getTileEntity(C.x, C.y - 1, C.z); | ||
if (t != null && !new Coords(C.x, C.y - 1, C.z, wID).equals(Controller)) { | ||
if (t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
} | ||
if (t != null && !new Coords(C.x, C.y - 1, C.z, wID).equals(Controller) | ||
&& t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
t = w.getTileEntity(C.x + 1, C.y, C.z); | ||
if (t != null && !new Coords(C.x + 1, C.y, C.z, wID).equals(Controller)) { | ||
if (t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
} | ||
if (t != null && !new Coords(C.x + 1, C.y, C.z, wID).equals(Controller) | ||
&& t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
t = w.getTileEntity(C.x - 1, C.y, C.z); | ||
if (t != null && !new Coords(C.x - 1, C.y, C.z, wID).equals(Controller)) { | ||
if (t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
} | ||
if (t != null && !new Coords(C.x - 1, C.y, C.z, wID).equals(Controller) | ||
&& t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
t = w.getTileEntity(C.x, C.y, C.z + 1); | ||
if (t != null && !new Coords(C.x, C.y, C.z + 1, wID).equals(Controller)) { | ||
if (t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
} | ||
if (t != null && !new Coords(C.x, C.y, C.z + 1, wID).equals(Controller) | ||
&& t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
t = w.getTileEntity(C.x, C.y, C.z - 1); | ||
if (t != null && !new Coords(C.x, C.y, C.z - 1, wID).equals(Controller)) { | ||
if (t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; | ||
} | ||
if (t != null && !new Coords(C.x, C.y, C.z - 1, wID).equals(Controller) | ||
&& t instanceof IGregTechTileEntity) | ||
if (((IGregTechTileEntity) t).getMetaTileID() == n) return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as what i said in ConnectedBlocksChecker
} else if (aMetaTileEntity instanceof LowPowerLaser && ((LowPowerLaser) aMetaTileEntity).isTunnel()) { | ||
if (!((LowPowerLaser) aMetaTileEntity).isConnectedCorrectly(front)) return; | ||
} | ||
} else if (aMetaTileEntity instanceof LowPowerLaser && ((LowPowerLaser) aMetaTileEntity).isTunnel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can use an instanceof check variable here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for you work.
* Fix most `@SuppressWarnings` * Update buildscript * Remove dead code * Add missing `@Override` annotations * Deobfuscate parameters * Collapse switch statements * Fix * Combine nested if statements in else block to else if * Reduce indentation when possible * Convert to switch when reasonable * Extract increment/decrement from statement * Pull up assignment * Simplify lambda expression and method reference syntax * Deduplicate code - Factorize operands - Replace (X && Y) || (!X && Z) by X ? Y : Z - Use '==' or '^' on booleans - Merge conditions of if/else if/else that have the same blocks - Pull down common code from if/else statement - Single 'if' statement rather than duplicate blocks that fall through - Remove redundant end of block with jump statement - Remove redundant if condition - Pull out a duplicate 'if' from an if/else * Use pattern matching for instanceof * Convert String concatenation to Text Block * Convert to switch expression where possible * Use diamond operator * Convert to enhanced 'for' loops * Always use 'this' qualifier * Convert fields into local variables if the use is only local * Use String.replace() instead of String.replaceAll() when possible * Avoid Object.equals() or String.equalsIgnoreCase() on null objects * Remove unnecessary casts * Push down negation * Remove redundant super() call in constructor * Remove overridden assignment * Remove redundant modifiers * Raise embedded if into parent if * Create array with curly brrackets when possible * Remove variable assignment before return * Remove unnecessary parentheses * spotlessApply (#355) Co-authored-by: GitHub GTNH Actions <> * Update dependencies.gradle * Update dependencies.gradle * Update dependencies.gradle * sa+deps * add back GG mod in dep file * Make requested changes --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Martin Robertz <[email protected]> Former-commit-id: b636a9e208af261b0c17032bb7a0884397846eb6
* Fix most `@SuppressWarnings` * Update buildscript * Remove dead code * Add missing `@Override` annotations * Deobfuscate parameters * Collapse switch statements * Fix * Combine nested if statements in else block to else if * Reduce indentation when possible * Convert to switch when reasonable * Extract increment/decrement from statement * Pull up assignment * Simplify lambda expression and method reference syntax * Deduplicate code - Factorize operands - Replace (X && Y) || (!X && Z) by X ? Y : Z - Use '==' or '^' on booleans - Merge conditions of if/else if/else that have the same blocks - Pull down common code from if/else statement - Single 'if' statement rather than duplicate blocks that fall through - Remove redundant end of block with jump statement - Remove redundant if condition - Pull out a duplicate 'if' from an if/else * Use pattern matching for instanceof * Convert String concatenation to Text Block * Convert to switch expression where possible * Use diamond operator * Convert to enhanced 'for' loops * Always use 'this' qualifier * Convert fields into local variables if the use is only local * Use String.replace() instead of String.replaceAll() when possible * Avoid Object.equals() or String.equalsIgnoreCase() on null objects * Remove unnecessary casts * Push down negation * Remove redundant super() call in constructor * Remove overridden assignment * Remove redundant modifiers * Raise embedded if into parent if * Create array with curly brrackets when possible * Remove variable assignment before return * Remove unnecessary parentheses * spotlessApply (#355) Co-authored-by: GitHub GTNH Actions <> * Update dependencies.gradle * Update dependencies.gradle * Update dependencies.gradle * sa+deps * add back GG mod in dep file * Make requested changes --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Martin Robertz <[email protected]> Former-commit-id: 11b283613ab93b60bf0e52aad99dbcaf9ace3a1f
deobfParams
task