quick fix : 'if' statement with identical branches

This commit is contained in:
Alexdoru authored and Jason Mitchell committed 2023-01-28 18:02:41 -08:00
1 parent 04c7d32b53
commit fc54dde7ce
16 files changed
+39 -84

No files matched your search

@@ -63,10 +63,8 @@ public class BarricadeBlock extends MantleBlock {
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
if (meta % 4 > 0) {
world.setBlock(x, y, z, this, meta - 1, 3);
dropBlockAsItem(world, x, y, z, new ItemStack(this));
} else {
dropBlockAsItem(world, x, y, z, new ItemStack(this));
}
dropBlockAsItem(world, x, y, z, new ItemStack(this));
}
@Override
@@ -61,14 +61,13 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
ItemStack itemstack = playerIn.getEquipmentInSlot(slot);
if (itemstack == null) {
playerIn.setCurrentItemOrArmor(slot, itemStackIn.copy());
itemStackIn.stackSize--;
} else {
itemstack = itemstack.copy();
playerIn.setCurrentItemOrArmor(1, itemStackIn.copy());
// playerIn.setCurrentItemOrArmor(0, itemstack);
playerIn.entityDropItem(itemstack, 0);
itemStackIn.stackSize--;
}
itemStackIn.stackSize--;
return itemStackIn;
}
@@ -78,7 +78,6 @@ public class MultiFluidTank extends LogicComponent implements IFluidTank {
if (fluidlist.size() == 0) {
fluidlist.add(liquid.copy());
currentLiquid += liquid.amount;
return true;
} else {
if (liquid.amount + currentLiquid > maxLiquid) return false;
@@ -99,8 +98,8 @@ public class MultiFluidTank extends LogicComponent implements IFluidTank {
if (first) fluidlist.add(0, liquid.copy());
else fluidlist.add(liquid.copy());
}
return true;
}
return true;
}
@Override
@@ -542,13 +542,11 @@ public class AbilityHelper {
(block1.stepSound.getVolume() + 1.0F) / 2.0F,
block1.stepSound.getPitch() * 0.8F);
if (world.isRemote) {
return true;
} else {
if (!world.isRemote) {
world.setBlock(x, y, z, block1);
damageTool(stack, 1, player, false);
return true;
}
return true;
} else {
return false;
}
@@ -79,9 +79,6 @@ public abstract class Behavior {
return (Behavior) behaviorsListBlocks.values().toArray()[i];
}
}
return null;
} else {
return null;
}
} else {
if (!behaviorsListItems.isEmpty()) {
@@ -92,11 +89,9 @@ public abstract class Behavior {
return (Behavior) behaviorsListItems.values().toArray()[i];
}
}
return null;
} else {
return null;
}
}
return null;
}
public static Behavior getDefaulBehavior() {
@@ -110,7 +110,6 @@ public class TileEntityLandmine extends TileEntity implements IInventory {
if (inventory[par1].stackSize <= par2) {
itemstack = inventory[par1];
inventory[par1] = null;
return itemstack;
} else {
itemstack = inventory[par1].splitStack(par2);
@@ -118,8 +117,8 @@ public class TileEntityLandmine extends TileEntity implements IInventory {
inventory[par1] = null;
}
return itemstack;
}
return itemstack;
} else {
return null;
}
@@ -188,15 +187,16 @@ public class TileEntityLandmine extends TileEntity implements IInventory {
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
// Should automatic camo insertion be allowed.
if (i == 3) {
return false;
} else {
// Here for mDiyo to decide if he wants automation for
// insertion/extraction of the items to be an option.
// Would be useful for building automated mine laying machines.
return false;
}
//// Should automatic camo insertion be allowed.
//if (i == 3) {
// return false;
//} else {
// // Here for mDiyo to decide if he wants automation for
// // insertion/extraction of the items to be an option.
// // Would be useful for building automated mine laying machines.
// return false;
//}
return false;
}
public void setSoundPlayed() {
@@ -72,12 +72,11 @@ public class ModButtertouch extends ModBoolean {
hasEnchant = true;
enchantTag.setShort("id", (short) index);
enchantTag.setShort("lvl", (short) ((byte) level));
tags.appendTag(enchantTag);
} else {
enchantTag.setShort("id", (short) index);
enchantTag.setShort("lvl", (short) ((byte) lvl));
tags.appendTag(enchantTag);
}
tags.appendTag(enchantTag);
}
if (!hasEnchant) {
NBTTagCompound enchantTag = new NBTTagCompound();
@@ -137,12 +137,11 @@ public class ModLapis extends ItemModTypeFilter {
hasEnchant = true;
enchantTag.setShort("id", (short) index);
enchantTag.setShort("lvl", (short) ((byte) level));
tags.appendTag(enchantTag);
} else {
enchantTag.setShort("id", (short) index);
enchantTag.setShort("lvl", (short) ((byte) lvl));
tags.appendTag(enchantTag);
}
tags.appendTag(enchantTag);
}
if (!hasEnchant) {
NBTTagCompound enchantTag = new NBTTagCompound();
@@ -53,12 +53,7 @@ public class TinkerSmelteryEvents {
if (evt.entityPlayer.capabilities.isCreativeMode) {
WorldHelper.setBlockToAir(evt.world, hitX, hitY, hitZ);
} else {
if (TinkerSmeltery.fluidBlocks[id] instanceof LiquidMetalFinite) {
WorldHelper.setBlockToAir(evt.world, hitX, hitY, hitZ);
} else {
WorldHelper.setBlockToAir(evt.world, hitX, hitY, hitZ);
}
WorldHelper.setBlockToAir(evt.world, hitX, hitY, hitZ);
evt.setResult(Result.ALLOW);
evt.result = new ItemStack(TinkerSmeltery.buckets, 1, id);
}
@@ -36,9 +36,7 @@ public class FilledBucket extends ItemBucket {
boolean wannabeFull = false;
MovingObjectPosition position = this.getMovingObjectPositionFromPlayer(world, player, wannabeFull);
if (position == null) {
return stack;
} else {
if (position != null) {
/*
* FillBucketEvent event = new FillBucketEvent(player, stack, world,
* position); if (MinecraftForge.EVENT_BUS.post(event)) { return
@@ -98,8 +96,8 @@ public class FilledBucket extends ItemBucket {
}
}
return stack;
}
return stack;
}
public boolean tryPlaceContainedLiquid(World world, int clickX, int clickY, int clickZ, int type) {
@@ -448,7 +448,6 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
moltenMetal.add(liquid.copy());
updateCurrentLiquid();
return true;
} else {
// update liquid amount..
updateCurrentLiquid();
@@ -476,8 +475,8 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
if (first) moltenMetal.add(0, liquid.copy());
else moltenMetal.add(liquid.copy());
}
return true;
}
return true;
}
private void updateCurrentLiquid() {
@@ -55,7 +55,6 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler {
if (!outputs.contains(ForgeDirection.DOWN)) // CentrePiece, floor is removed if tank below is found
{
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
} else
// "Guiding Borders" when tank below is found
{
@@ -66,8 +65,8 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler {
renderer.setRenderBounds(0.3125D, 0.125D, 0.3125D, 0.375D, 0.5D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625D, 0.125D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
}
renderer.renderStandardBlock(block, x, y, z);
if (outputs.contains(ForgeDirection.NORTH)) // Channel to Z-
{
renderer.setRenderBounds(0.3125D, 0.375D, 0D, 0.6875D, 0.5D, 0.3125D);
@@ -75,13 +74,12 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler {
renderer.setRenderBounds(0.3125D, 0.5D, 0D, 0.375D, 0.625D, 0.3125D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625D, 0.5D, 0D, 0.6875D, 0.625D, 0.3125D);
renderer.renderStandardBlock(block, x, y, z);
} else
// Wall to Z-
{
renderer.setRenderBounds(0.375D, 0.5D, 0.3125D, 0.625D, 0.625D, 0.375D);
renderer.renderStandardBlock(block, x, y, z);
}
renderer.renderStandardBlock(block, x, y, z);
if (outputs.contains(ForgeDirection.SOUTH)) // Channel to Z+
{
@@ -90,13 +88,12 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler {
renderer.setRenderBounds(0.3125D, 0.5D, 0.6875D, 0.375D, 0.625D, 1D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625D, 0.5D, 0.6875D, 0.6875D, 0.625D, 1D);
renderer.renderStandardBlock(block, x, y, z);
} else
// Wall to Z+
{
renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.625D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
}
renderer.renderStandardBlock(block, x, y, z);
if (outputs.contains(ForgeDirection.WEST)) // Channel to X-
{
@@ -105,13 +102,12 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler {
renderer.setRenderBounds(0D, 0.5D, 0.3125D, 0.375D, 0.625D, 0.375D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0D, 0.5D, 0.625D, 0.375D, 0.625D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
} else
// Wall to X-
{
renderer.setRenderBounds(0.3125D, 0.5D, 0.3125D, 0.375D, 0.625D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
}
renderer.renderStandardBlock(block, x, y, z);
if (outputs.contains(ForgeDirection.EAST)) // Channel to X+
{
@@ -120,13 +116,12 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler {
renderer.setRenderBounds(0.625D, 0.5D, 0.3125D, 1D, 0.625D, 0.375D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625D, 0.5D, 0.625D, 1D, 0.625D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
} else
// Wall to X+
{
renderer.setRenderBounds(0.625D, 0.5D, 0.3125D, 0.6875D, 0.625D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
}
renderer.renderStandardBlock(block, x, y, z);
FluidTankInfo tankMain = tile.getTankInfo(null)[0];
if (tankMain.fluid != null) {
float liquidAmount = (float) tankMain.fluid.amount / (float) tankMain.capacity * 0.125f;
@@ -461,17 +461,15 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
l = 64 - stack.stackSize;
}
if (l == 0) {
return stackSize;
} else {
if (l != 0) {
stackSize -= l;
stack.stackSize += l;
living.setCurrentItemOrArmor(slotID, stack);
if (living instanceof EntityLiving)
if (living instanceof EntityLiving) {
((EntityLiving) living).setEquipmentDropChance(slotID, 2.0f);
return stackSize;
}
}
return stackSize;
}
}
}
@@ -70,23 +70,14 @@ public class InventoryCraftingStation extends InventoryCrafting {
ItemStack stack = logic.getStackInSlot(slotID + 1);
if (stack != null) {
ItemStack itemstack;
if (stack.stackSize <= par2) {
itemstack = stack.copy();
stack = null;
logic.setInventorySlotContents(slotID + 1, null);
this.eventHandler.onCraftMatrixChanged(this);
return itemstack;
} else {
itemstack = stack.splitStack(par2);
if (stack.stackSize == 0) {
stack = null;
}
this.eventHandler.onCraftMatrixChanged(this);
return itemstack;
}
this.eventHandler.onCraftMatrixChanged(this);
return itemstack;
} else {
return null;
}
@@ -171,15 +171,12 @@ public class FrypanLogic extends EquipLogic implements IActiveLogic {
}
public ItemStack getResultFor(ItemStack stack) {
if (stack == null) {
return null;
} else {
if (stack != null) {
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(stack);
if (result != null && result.getItem() instanceof ItemFood) // Only valid for food
return result.copy();
return null;
return result.copy();
}
return null;
}
public static int getItemBurnTime(ItemStack stack) {
@@ -355,11 +355,10 @@ public class CartEntity extends Entity implements IInventory, IEntityAdditionalS
+ (this.minecartPitch - (double) this.rotationPitch) / (double) this.turnProgress);
--this.turnProgress;
this.setPosition(var46, var48, var5);
this.setRotation(this.rotationYaw, this.rotationPitch);
} else {
this.setPosition(this.posX, this.posY, this.posZ);
this.setRotation(this.rotationYaw, this.rotationPitch);
}
this.setRotation(this.rotationYaw, this.rotationPitch);
} else {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
@@ -753,20 +752,16 @@ public class CartEntity extends Entity implements IInventory, IEntityAdditionalS
public ItemStack decrStackSize(int par1, int par2) {
if (this.cargoItems[par1] != null) {
ItemStack var3;
if (this.cargoItems[par1].stackSize <= par2) {
var3 = this.cargoItems[par1];
this.cargoItems[par1] = null;
return var3;
} else {
var3 = this.cargoItems[par1].splitStack(par2);
if (this.cargoItems[par1].stackSize == 0) {
this.cargoItems[par1] = null;
}
return var3;
}
return var3;
} else {
return null;
}