quick fix : Condition is covered by further condition

This commit is contained in:
Alexdoru committed 2023-01-25 23:27:18 +01:00
1 parent 1af7ee9205
commit efd18b873e
17 files changed
+16 -25

No files matched your search

@@ -24,8 +24,7 @@ public class AchievementEvents {
TAchievements.triggerAchievement(event.player, "tconstruct.preparedFight");
}
if (event.inventory != null
&& event.inventory instanceof ToolForgeLogic
if (event.inventory instanceof ToolForgeLogic
&& event.tool.getItem() instanceof ToolCore
&& ((ToolCore) event.tool.getItem()).durabilityTypeExtra() != 0) {
TAchievements.triggerAchievement(event.player, "tconstruct.proTinkerer");
@@ -77,7 +77,7 @@ public class ArmorAbilities {
@SubscribeEvent
public void dimensionChanged(PlayerEvent.PlayerChangedDimensionEvent event) {
if (event.player == null || !(event.player instanceof EntityPlayerMP)) return;
if (!(event.player instanceof EntityPlayerMP)) return;
// this callback is only called serverside
float oldHealth = event.player.getHealth();
@@ -27,8 +27,7 @@ public class SlotAccessory extends Slot {
*/
public boolean isItemValid(ItemStack par1ItemStack) {
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
return item != null
&& (item instanceof IAccessory)
return (item instanceof IAccessory)
&& ((IAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
}
}
@@ -28,8 +28,7 @@ public class SlotCanister extends Slot {
@Override
public boolean isItemValid(ItemStack par1ItemStack) {
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
return item != null
&& (item instanceof IHealthAccessory)
return (item instanceof IHealthAccessory)
&& ((IHealthAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
}
}
@@ -25,6 +25,6 @@ public class SlotKnapsack extends Slot {
@Override
public boolean isItemValid(ItemStack par1ItemStack) {
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
return item != null && (item instanceof Knapsack);
return (item instanceof Knapsack);
}
}
@@ -78,7 +78,7 @@ public class TabRegistry {
Class<?> c = Class.forName("codechicken.nei.NEIClientConfig");
Object hidden = c.getMethod("isHidden").invoke(null);
Object enabled = c.getMethod("isEnabled").invoke(null);
if (hidden != null && hidden instanceof Boolean && enabled != null && enabled instanceof Boolean) {
if (hidden instanceof Boolean && enabled instanceof Boolean) {
if ((Boolean) hidden || !((Boolean) enabled)) {
// If NEI is disabled or hidden, offset the tabs by 60
return 60;
@@ -219,7 +219,7 @@ public class Scythe extends Weapon {
if (world.isRemote) {
INetHandler handler = FMLClientHandler.instance()
.getClientPlayHandler();
if (handler != null && handler instanceof NetHandlerPlayClient) {
if (handler instanceof NetHandlerPlayClient) {
NetHandlerPlayClient handlerClient =
(NetHandlerPlayClient) handler;
handlerClient.addToSendQueue(new C07PacketPlayerDigging(
@@ -463,7 +463,6 @@ public abstract class ProjectileBase extends EntityArrow implements IEntityAddit
// did we hit a player?
if (movingobjectposition != null
&& movingobjectposition.entityHit != null
&& movingobjectposition.entityHit instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit;
@@ -21,7 +21,7 @@ public class SmelteryProxyCommon implements IGuiHandler {
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null && tile instanceof InventoryLogic) {
if (tile instanceof InventoryLogic) {
return ((InventoryLogic) tile).getGuiContainer(player.inventory, world, x, y, z);
}
@@ -204,7 +204,7 @@ public class SearedBlock extends InventoryBlock {
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
} else {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null && tile instanceof FaucetLogic) {
if (tile instanceof FaucetLogic) {
FaucetLogic logic = (FaucetLogic) tile;
float xMin = 0.25F;
float xMax = 0.75F;
@@ -49,7 +49,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler {
boolean flagActiveFaucet = false;
TileEntity possibleFaucet = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
if (possibleFaucet != null && possibleFaucet instanceof FaucetLogic)
if (possibleFaucet instanceof FaucetLogic)
flagActiveFaucet = ((FaucetLogic) possibleFaucet).active;
if (ticks == 6) // && !flagActiveFaucet)
@@ -297,8 +297,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler {
int tY = this.yCoord + fd.offsetY;
int tZ = this.zCoord + fd.offsetZ;
TileEntity tile = this.worldObj.getTileEntity(tX, tY, tZ);
if (tile != null && tile instanceof IFluidHandler) map.put(fd, tile);
if (tile instanceof IFluidHandler) map.put(fd, tile);
}
return map;
}
@@ -37,10 +37,7 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi
TileEntity drainte = worldObj.getTileEntity(x, yCoord, z);
TileEntity tankte = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
if (drainte != null
&& drainte instanceof IFluidHandler
&& tankte != null
&& tankte instanceof IFluidHandler) {
if (drainte instanceof IFluidHandler && tankte instanceof IFluidHandler) {
FluidStack templiquid =
((IFluidHandler) drainte).drain(getForgeDirection(), TConstruct.ingotLiquidValue, false);
if (templiquid != null) {
@@ -38,7 +38,7 @@ public class ToolProxyCommon implements IGuiHandler {
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null && tile instanceof InventoryLogic) {
if (tile instanceof InventoryLogic) {
return ((InventoryLogic) tile).getGuiContainer(player.inventory, world, x, y, z);
}
return null;
@@ -124,7 +124,7 @@ public class EquipBlock extends InventoryBlock {
public void breakBlock(World par1World, int x, int y, int z, Block par5, int meta) {
TileEntity te = par1World.getTileEntity(x, y, z);
if (te != null && te instanceof EquipLogic) {
if (te instanceof EquipLogic) {
EquipLogic logic = (EquipLogic) te;
for (int iter = 0; iter < logic.getSizeInventory(); ++iter) {
ItemStack stack = iter == 0 ? logic.getEquipmentItem() : logic.getStackInSlot(iter);
@@ -166,7 +166,6 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
}
if (movingobjectposition != null
&& movingobjectposition.entityHit != null
&& movingobjectposition.entityHit instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit;
@@ -32,7 +32,7 @@ public class PartBuilderLogic extends InventoryLogic implements ISidedInventory
for (int zPos = z - 1; zPos <= z + 1; zPos++) {
for (int yPos = y - 1; yPos <= y + 1; yPos++) {
TileEntity tile = world.getTileEntity(xPos, yPos, zPos);
if (tile != null && tile instanceof PatternChestLogic && (x == xPos || z == zPos))
if (tile instanceof PatternChestLogic && (x == xPos || z == zPos))
return new PartCrafterChestContainer(inventoryplayer, this, (PatternChestLogic) tile);
}
}
@@ -18,7 +18,7 @@ public class ItemHelper {
Class<?> clazz = Class.forName(classPackage);
Field field = clazz.getDeclaredField(name);
Object ret = field.get(null);
if (ret != null && (ret instanceof ItemStack || ret instanceof Item)) return ret;
if ((ret instanceof ItemStack || ret instanceof Item)) return ret;
return null;
} catch (Exception e) {
TConstruct.logger.warn("Could not find " + name + "from " + classPackage);