Skip to content

Commit

Permalink
PMD Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Kittychanley committed Nov 16, 2015
1 parent dd5c34a commit 5a90a29
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 42 deletions.
21 changes: 9 additions & 12 deletions src/API/com/bioxx/tfc/api/Food.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,15 @@ private static NBTTagCompound getNBT(ItemStack is)

public static boolean areEqual(ItemStack is1, ItemStack is2)
{
if (isBrined(is1) != isBrined(is2) ||
isPickled(is1) != isPickled(is2) ||
isCooked(is1) != isCooked(is2) ||
isDried(is1) != isDried(is2) ||
isSmoked(is1) != isSmoked(is2) ||
(isSmoked(is1) && isSmoked(is2) && !isSameSmoked(is1, is2)) ||
isSalted(is1) != isSalted(is2) ||
isInfused(is1) != isInfused(is2) ||
(isInfused(is1) && isInfused(is2) && !getInfusion(is1).equals(getInfusion(is2))))
return false;

return true;
return isBrined(is1) == isBrined(is2) &&
isPickled(is1) == isPickled(is2) &&
isCooked(is1) == isCooked(is2) &&
isDried(is1) == isDried(is2) &&
isSalted(is1) == isSalted(is2) &&
(isInfused(is1) && isInfused(is2) && getInfusion(is1).equals(getInfusion(is2)) ||
!isInfused(is1) && !isInfused(is2)) &&
(isSmoked(is1) && isSmoked(is2) && isSameSmoked(is1, is2) ||
!isSmoked(is1) && !isSmoked(is2));
}

public static boolean isBrined(ItemStack is)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,8 @@ public boolean canBlockStay(World world, int i, int j, int k)

public boolean checkStackAt(World world, int x, int y, int z)
{
if (checkBlock(world, x + 1, y, z, x, z) && checkBlock(world, x - 1, y, z, x, z) && checkBlock(world, x, y, z + 1, x, z) &&
checkBlock(world, x, y, z - 1, x, z) && (world.isAirBlock(x, y, z) || world.getBlock(x, y, z) == TFCBlocks.molten))
return true;

return false;
return checkBlock(world, x + 1, y, z, x, z) &&checkBlock(world, x - 1, y, z, x, z) && checkBlock(world, x, y, z + 1, x, z) &&
checkBlock(world, x, y, z - 1, x, z) && (world.isAirBlock(x, y, z) || world.getBlock(x, y, z) == TFCBlocks.molten);
}

public boolean checkBlock(World world, int x, int y, int z, int stackX, int stackZ)
Expand Down
4 changes: 2 additions & 2 deletions src/Common/com/bioxx/tfc/Containers/Slots/SlotFirepitIn.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public int getSlotStackLimit()
public boolean isItemValid(ItemStack is)
{
HeatRegistry manager = HeatRegistry.getInstance();
return (is.getItem() == TFCItems.fireStarter ||
is.getItem() == TFCItems.flintSteel) ||
return is.getItem() == TFCItems.fireStarter ||
is.getItem() == TFCItems.flintSteel ||
!(manager.findMatchingIndex(is) == null ||
is.getItem() instanceof ItemOre);
}
Expand Down
8 changes: 0 additions & 8 deletions src/Common/com/bioxx/tfc/Entities/Mobs/EntitySheepTFC.java
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,6 @@ public float getObedienceMod()
return obedienceMod;
}

private float getPercentGrown(IAnimal animal)
{
float birth = animal.getBirthDay();
float time = TFC_Time.getTotalDays();
float percent = (time - birth) / animal.getNumberOfDaysToAdult();
return Math.min(percent, 1f);
}

public int getPregnancyRequiredTime()
{
return pregnancyRequiredTime;
Expand Down
18 changes: 9 additions & 9 deletions src/Common/com/bioxx/tfc/Entities/Mobs/EntityWolfTFC.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class EntityWolfTFC extends EntityWolf implements IAnimal, IInnateArmor,
protected EntityAITargetNonTamedTFC targetCow;
protected EntityAITargetNonTamedTFC targetDeer;
protected EntityAITargetNonTamedTFC targetHorse;
private boolean isPeacefulAI;
private boolean peacefulAI;

public EntityWolfTFC(World par1World)
{
Expand All @@ -95,7 +95,7 @@ public EntityWolfTFC(World par1World)
this.targetHorse = new EntityAITargetNonTamedTFC(this, EntityHorseTFC.class, 200, false);
if (this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL)
{
isPeacefulAI = false;
peacefulAI = false;
this.targetTasks.addTask(7, targetChicken);
this.targetTasks.addTask(7, targetPheasant);
this.targetTasks.addTask(7, targetPig);
Expand All @@ -104,7 +104,7 @@ public EntityWolfTFC(World par1World)
this.targetTasks.addTask(7, targetHorse);
}
else
isPeacefulAI = true;
peacefulAI = true;

hunger = 168000;
animalID = TFC_Time.getTotalTicks() + getEntityId();
Expand Down Expand Up @@ -608,7 +608,7 @@ public boolean isFood(ItemStack item)

public boolean isPeacefulAI()
{
return isPeacefulAI;
return peacefulAI;
}

@Override
Expand Down Expand Up @@ -751,19 +751,19 @@ public void onUpdate()
super.onUpdate();
if (!this.worldObj.isRemote)
{
if (!isPeacefulAI && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL)
if (!peacefulAI && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL)
{
isPeacefulAI = true;
peacefulAI = true;
this.targetTasks.removeTask(targetChicken);
this.targetTasks.removeTask(targetPheasant);
this.targetTasks.removeTask(targetPig);
this.targetTasks.removeTask(targetCow);
this.targetTasks.removeTask(targetDeer);
this.targetTasks.removeTask(targetHorse);
}
else if (isPeacefulAI && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL)
else if (peacefulAI && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL)
{
isPeacefulAI = false;
peacefulAI = false;
this.targetTasks.addTask(7, targetChicken);
this.targetTasks.addTask(7, targetPheasant);
this.targetTasks.addTask(7, targetPig);
Expand Down Expand Up @@ -890,7 +890,7 @@ public void setObedienceMod(float obedienceMod)

public void setPeacefulAI(boolean isPeacefulAI)
{
this.isPeacefulAI = isPeacefulAI;
this.peacefulAI = isPeacefulAI;
}

public void setPregnancyRequiredTime(int pregnancyRequiredTime)
Expand Down
2 changes: 1 addition & 1 deletion src/Common/com/bioxx/tfc/Items/ItemIngot.java
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public int getItemStackLimit(ItemStack is)
{
// hot or worked ingots cannot stack
if (is.hasTagCompound() && (TFC_ItemHeat.hasTemp(is) ||
(is.getTagCompound().hasKey("itemCraftingValue") && is.getTagCompound().getShort("itemCraftingValue") != 0)))
is.getTagCompound().hasKey("itemCraftingValue") && is.getTagCompound().getShort("itemCraftingValue") != 0))
{
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Common/com/bioxx/tfc/Items/ItemMetalSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public int getItemStackLimit(ItemStack is)
{
// hot or worked sheets cannot stack
if (is.hasTagCompound() && (TFC_ItemHeat.hasTemp(is) ||
(is.getTagCompound().hasKey("itemCraftingValue") && is.getTagCompound().getShort("itemCraftingValue") != 0)))
is.getTagCompound().hasKey("itemCraftingValue") && is.getTagCompound().getShort("itemCraftingValue") != 0))
{
return 1;
}
Expand Down
5 changes: 1 addition & 4 deletions src/Common/com/bioxx/tfc/TileEntities/TEForge.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ else if (notOpaque(xCoord, yCoord + 1, zCoord + 1) && checkChimney(xCoord, yCoor

private boolean checkChimney(int x, int y, int z)
{
if (notOpaque(x, y, z) && worldObj.canBlockSeeTheSky(x, y, z))
return true;

return false;
return notOpaque(x, y, z) && worldObj.canBlockSeeTheSky(x, y, z);
}

private boolean notOpaque(int x, int y, int z)
Expand Down

0 comments on commit 5a90a29

Please sign in to comment.