quick fix : Constant conditions & exceptions

This commit is contained in:
Alexdoru authored and Jason Mitchell committed 2023-01-28 18:02:41 -08:00
1 parent 2b6b01314d
commit d12e70dd52
4 files changed
+46 -61

No files matched your search

@@ -141,14 +141,12 @@ public class BlockLandmine extends BlockContainer {
&& (!explodeOnBroken || !hasItems(par1World, par2, par3, par4))
&& par6 != 193
&& !tileentity.isExploding) {
if (this != null) {
ItemStack is = new ItemStack(this, 1, damageDropped(tileentity.triggerType));
if (tileentity.hasCustomInventoryName()) {
is.setStackDisplayName(tileentity.getInventoryName());
}
dropBlockAsItem(
par1World, par2, par3, par4, new ItemStack(this, 1, damageDropped(tileentity.triggerType)));
ItemStack is = new ItemStack(this, 1, damageDropped(tileentity.triggerType));
if (tileentity.hasCustomInventoryName()) {
is.setStackDisplayName(tileentity.getInventoryName());
}
dropBlockAsItem(
par1World, par2, par3, par4, new ItemStack(this, 1, damageDropped(tileentity.triggerType)));
for (int j1 = 0; j1 < tileentity.getSizeInventory(); ++j1) {
ItemStack itemstack = tileentity.getStackInSlot(j1);
@@ -174,7 +174,7 @@ public class ContainerLandmine extends Container {
if ((par3 == 0 || par3 == 1) && (par2 == 0 || par2 == 1)) {
if (par1 == -999) {
if (inventoryplayer.getItemStack() != null && par1 == -999) {
if (inventoryplayer.getItemStack() != null) {
if (par2 == 0) {
par4EntityPlayer.dropPlayerItemWithRandomChoice(inventoryplayer.getItemStack(), false);
inventoryplayer.setItemStack(null);
@@ -205,9 +205,7 @@ public class ContainerLandmine extends Container {
localObject2 = itemstack1.getItem();
itemstack = itemstack1.copy();
if (slot2 != null
&& slot2.getStack() != null
&& slot2.getStack().getItem() == localObject2) {
if (slot2.getStack() != null && slot2.getStack().getItem() == localObject2) {
this.retrySlotClick(par1, par2, true, par4EntityPlayer);
}
}
@@ -244,11 +242,8 @@ public class ContainerLandmine extends Container {
if (itemstack4.stackSize == 0) {
inventoryplayer.setItemStack(null);
}
} else if (shouldDoStuff
&& slot2 instanceof SlotBehavedOnly
&& itemstack4 != null
&& slot2.isItemValid(
new ItemStack(itemstack4.getItem(), 1, itemstack4.getItemDamage()))) {
} else if (shouldDoStuff && itemstack4 != null && slot2.isItemValid(
new ItemStack(itemstack4.getItem(), 1, itemstack4.getItemDamage()))) {
k1 = par2 == 0 ? 1 : 1;
if (k1 > slot2.getSlotStackLimit()) {
@@ -646,13 +646,7 @@ public class CartEntity extends Entity implements IInventory, IEntityAdditionalS
public void applyEntityCollision(Entity par1Entity) {
if (!this.worldObj.isRemote) {
if (par1Entity != this.riddenByEntity) {
if (par1Entity instanceof EntityLiving
&& !(par1Entity instanceof EntityPlayer)
&& !(par1Entity instanceof EntityIronGolem)
&& canBeRidden()
&& this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D
&& this.riddenByEntity == null
&& par1Entity.ridingEntity == null) {
if (par1Entity instanceof EntityLiving && !(par1Entity instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null) {
par1Entity.mountEntity(this);
}
@@ -33,47 +33,45 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler {
static final float LIGHT_XZ_POS = 0.6F;
public boolean renderRotatedBlock(Block block, int x, int y, int z, IBlockAccess world, RenderBlocks renderer) {
if (true) {
Tessellator tessellator = Tessellator.instance;
int bMeta = world.getBlockMetadata(x, y, z);
IIcon iconStill = block.getIcon(1, bMeta);
float flowDir = (float) (bMeta / 8f * 2 * Math.PI); // Tau, radians
Tessellator tessellator = Tessellator.instance;
int bMeta = world.getBlockMetadata(x, y, z);
IIcon iconStill = block.getIcon(1, bMeta);
float flowDir = (float) (bMeta / 8f * 2 * Math.PI); // Tau, radians
double u1, u2, u3, u4, v1, v2, v3, v4;
double u1, u2, u3, u4, v1, v2, v3, v4;
if (flowDir < -999.0F) {
u2 = iconStill.getInterpolatedU(0.0D);
v2 = iconStill.getInterpolatedV(0.0D);
u1 = u2;
v1 = iconStill.getInterpolatedV(16.0D);
u4 = iconStill.getInterpolatedU(16.0D);
v4 = v1;
u3 = u4;
v3 = v2;
} else {
float xFlow = MathHelper.sin(flowDir) * 0.25F;
float zFlow = MathHelper.cos(flowDir) * 0.25F;
u2 = iconStill.getInterpolatedU(8.0F + (-zFlow - xFlow) * 16.0F);
v2 = iconStill.getInterpolatedV(8.0F + (-zFlow + xFlow) * 16.0F);
u1 = iconStill.getInterpolatedU(8.0F + (-zFlow + xFlow) * 16.0F);
v1 = iconStill.getInterpolatedV(8.0F + (zFlow + xFlow) * 16.0F);
u4 = iconStill.getInterpolatedU(8.0F + (zFlow + xFlow) * 16.0F);
v4 = iconStill.getInterpolatedV(8.0F + (zFlow - xFlow) * 16.0F);
u3 = iconStill.getInterpolatedU(8.0F + (zFlow - xFlow) * 16.0F);
v3 = iconStill.getInterpolatedV(8.0F + (-zFlow - xFlow) * 16.0F);
}
int color = block.colorMultiplier(world, x, y, z);
float red = (color >> 16 & 255) / 255.0F;
float green = (color >> 8 & 255) / 255.0F;
float blue = (color & 255) / 255.0F;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(LIGHT_Y_POS * red, LIGHT_Y_POS * green, LIGHT_Y_POS * blue);
tessellator.addVertexWithUV(x + 0, y + 0.5, z + 0, u2, v2);
tessellator.addVertexWithUV(x + 0, y + 0.5, z + 1, u1, v1);
tessellator.addVertexWithUV(x + 1, y + 0.5, z + 1, u4, v4);
tessellator.addVertexWithUV(x + 1, y + 0.5, z + 0, u3, v3);
if (flowDir < -999.0F) {
u2 = iconStill.getInterpolatedU(0.0D);
v2 = iconStill.getInterpolatedV(0.0D);
u1 = u2;
v1 = iconStill.getInterpolatedV(16.0D);
u4 = iconStill.getInterpolatedU(16.0D);
v4 = v1;
u3 = u4;
v3 = v2;
} else {
float xFlow = MathHelper.sin(flowDir) * 0.25F;
float zFlow = MathHelper.cos(flowDir) * 0.25F;
u2 = iconStill.getInterpolatedU(8.0F + (-zFlow - xFlow) * 16.0F);
v2 = iconStill.getInterpolatedV(8.0F + (-zFlow + xFlow) * 16.0F);
u1 = iconStill.getInterpolatedU(8.0F + (-zFlow + xFlow) * 16.0F);
v1 = iconStill.getInterpolatedV(8.0F + (zFlow + xFlow) * 16.0F);
u4 = iconStill.getInterpolatedU(8.0F + (zFlow + xFlow) * 16.0F);
v4 = iconStill.getInterpolatedV(8.0F + (zFlow - xFlow) * 16.0F);
u3 = iconStill.getInterpolatedU(8.0F + (zFlow - xFlow) * 16.0F);
v3 = iconStill.getInterpolatedV(8.0F + (-zFlow - xFlow) * 16.0F);
}
int color = block.colorMultiplier(world, x, y, z);
float red = (color >> 16 & 255) / 255.0F;
float green = (color >> 8 & 255) / 255.0F;
float blue = (color & 255) / 255.0F;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(LIGHT_Y_POS * red, LIGHT_Y_POS * green, LIGHT_Y_POS * blue);
tessellator.addVertexWithUV(x + 0, y + 0.5, z + 0, u2, v2);
tessellator.addVertexWithUV(x + 0, y + 0.5, z + 1, u1, v1);
tessellator.addVertexWithUV(x + 1, y + 0.5, z + 1, u4, v4);
tessellator.addVertexWithUV(x + 1, y + 0.5, z + 0, u3, v3);
renderer.renderStandardBlock(block, x, y, z);
/*
* int direction = world.getBlockMetadata(x, y, z) % 4; if (direction ==