Skip to content
This repository has been archived by the owner on May 2, 2018. It is now read-only.

Commit

Permalink
Fix FindBugs warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
unascribed committed Jun 28, 2015
1 parent a02b7df commit 5574e63
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 17 deletions.
12 changes: 6 additions & 6 deletions src/main/java/com/unascribed/farrago/FarragoMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ public class FarragoMod {

public static SimpleNetworkWrapper CHANNEL;

public static Map<Long, List<IRecipe>> recipes = new HashMap<Long, List<IRecipe>>();
public static final Map<Long, List<IRecipe>> recipes = new HashMap<Long, List<IRecipe>>();

public static String brand = null;
public static boolean showBrand = true;

public static boolean copperlessEnvironment;
public static CreativeTabs creativeTab = new CreativeTabs("farrago") {
public static final CreativeTabs creativeTab = new CreativeTabs("farrago") {
private ItemStack iconItemStack;
@Override
public ItemStack getIconItemStack() {
Expand All @@ -199,11 +199,11 @@ public Item getTabIconItem() {
public static int scopeTicks;
private YttriumGenerator yttrGen;
private XenotimeGenerator xenoGen;
public static Map<Selector, String> disabled = Maps.newHashMap();
public static final Map<Selector, String> disabled = Maps.newHashMap();
public static Config config;
public static int lightPipeRenderType;
public static List<Material> materials = Lists.newArrayList();
public static Map<String, Material> monikerLookup = Maps.newHashMap();
public static final List<Material> materials = Lists.newArrayList();
public static final Map<String, Material> monikerLookup = Maps.newHashMap();

@EventHandler
public void onPreInit(FMLPreInitializationEvent e) {
Expand Down Expand Up @@ -1023,7 +1023,7 @@ public static long hashItemStack(ItemStack toHash) {
hash |= (toHash.getItemDamage() & Short.MAX_VALUE) << Short.SIZE;
hash |= (Item.getIdFromItem(toHash.getItem()) & Short.MAX_VALUE);
if (toHash.hasTagCompound()) {
hash |= (toHash.getTagCompound().hashCode() << 32);
hash |= ((long)toHash.getTagCompound().hashCode() << 32);
}
return hash;
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/unascribed/farrago/Masses.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import cpw.mods.fml.relauncher.ReflectionHelper;

public class Masses {
public static Map<Long, List<Float>> mass = Maps.newHashMap();
public static Map<Long, Float> bakedMass = Maps.newHashMap();
public static final Map<Long, List<Float>> mass = Maps.newHashMap();
public static final Map<Long, Float> bakedMass = Maps.newHashMap();
static boolean baked = false;
public static void calculateMass(Item i, int depth, int durability) {
if (!FarragoMod.config.getBoolean("kahur.calculateMasses")) {
Expand Down Expand Up @@ -145,7 +145,7 @@ static void updateMass(ItemStack is, float newMass) {
if (Float.isInfinite(newMass) || Float.isNaN(newMass) || newMass <= 0) {
newMass = 0;
}
List<Float> list = mass.get(is);
List<Float> list = mass.get(FarragoMod.hashItemStack(is));
if (list == null) {
list = Lists.newArrayList();
mass.put(FarragoMod.hashItemStack(is), list);
Expand Down Expand Up @@ -249,7 +249,7 @@ private static float average(float[] array) {
total += f;
}
float avg = total / array.length;
return avg == Float.NaN || avg == Float.NEGATIVE_INFINITY || avg == Float.POSITIVE_INFINITY ? 0f : avg;
return Float.isNaN(avg) || avg == Float.NEGATIVE_INFINITY || avg == Float.POSITIVE_INFINITY ? 0f : avg;
}

private static float average(List<Float> list) {
Expand All @@ -258,7 +258,7 @@ private static float average(List<Float> list) {
total += f;
}
float avg = total / list.size();
return avg == Float.NaN || avg == Float.NEGATIVE_INFINITY || avg == Float.POSITIVE_INFINITY ? 0f : avg;
return Float.isNaN(avg) || avg == Float.NEGATIVE_INFINITY || avg == Float.POSITIVE_INFINITY ? 0f : avg;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void updateTick(World world, int x, int y, int z, Random rand) {
if (mMeta != 0) {
mType = ((int) Math.ceil(mMeta/3f))-1;
mBase = mType*3;
mCount = (mMeta == 0 ? 0 : mMeta-mBase);
mCount = mMeta-mBase;
} else {
mType = type;
mBase = base;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
if (meta != 0) {
type = ((int) Math.ceil(meta/3f))-1;
int base = type*3;
count = (meta == 0 ? 0 : meta-base);
count = meta-base;
}

if (junction) {
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/com/unascribed/farrago/item/gun/ItemKahur.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,6 @@ public ItemStack onItemRightClick(final ItemStack gun, final World world, final
ent.motionX *= (double)1.5f;
ent.motionY *= (double)1.5f;
ent.motionZ *= (double)1.5f;
ent.motionX = ent.motionX;
ent.motionY = ent.motionY;
ent.motionZ = ent.motionZ;
float f3 = MathHelper.sqrt_double(ent.motionX * ent.motionX + ent.motionZ * ent.motionZ);
ent.prevRotationYaw = ent.rotationYaw = (float)(Math.atan2(ent.motionX, ent.motionZ) * 180.0D / Math.PI);
ent.prevRotationPitch = ent.rotationPitch = (float)(Math.atan2(ent.motionY, (double)f3) * 180.0D / Math.PI);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public boolean isOrePresent() {
} else {
oresPresent = true;
oreRepresentation = ores.get(0);
oreId = OreDictionary.getOreID(ore);
}
oresChecked = true;
return oresPresent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public abstract class TileEntityMachineFurnaceLike extends TileEntityMachine {
protected static final int[] slotsTop = new int[] { 0 };
protected static final int[] slotsBottom = new int[] { 2, 1 };
protected static final int[] slotsSides = new int[] { 1 };
protected String customName;
public int burnTime;
public int currentItemBurnTime;
public int cookTime;
Expand Down

0 comments on commit 5574e63

Please sign in to comment.