summaryrefslogtreecommitdiff
path: root/src/api/java/mekanism
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/java/mekanism')
-rw-r--r--src/api/java/mekanism/api/Chunk3D.java37
-rw-r--r--src/api/java/mekanism/api/Coord4D.java100
-rw-r--r--src/api/java/mekanism/api/EnumColor.java38
-rw-r--r--src/api/java/mekanism/api/IFilterAccess.java4
-rw-r--r--src/api/java/mekanism/api/IHeatTransfer.java4
-rw-r--r--src/api/java/mekanism/api/ItemRetriever.java36
-rw-r--r--src/api/java/mekanism/api/MekanismAPI.java13
-rw-r--r--src/api/java/mekanism/api/MekanismConfig.java188
-rw-r--r--src/api/java/mekanism/api/Pos3D.java222
-rw-r--r--src/api/java/mekanism/api/Range4D.java79
-rw-r--r--src/api/java/mekanism/api/TabProxy.java13
-rw-r--r--src/api/java/mekanism/api/energy/EnergizedItemManager.java8
-rw-r--r--src/api/java/mekanism/api/energy/EnergyStack.java2
-rw-r--r--src/api/java/mekanism/api/energy/package-info.java4
-rw-r--r--src/api/java/mekanism/api/gas/Gas.java23
-rw-r--r--src/api/java/mekanism/api/gas/GasNetwork.java123
-rw-r--r--src/api/java/mekanism/api/gas/GasRegistry.java8
-rw-r--r--src/api/java/mekanism/api/gas/GasStack.java14
-rw-r--r--src/api/java/mekanism/api/gas/GasTank.java26
-rw-r--r--src/api/java/mekanism/api/gas/GasTransmission.java58
-rw-r--r--src/api/java/mekanism/api/gas/IGasItem.java2
-rw-r--r--src/api/java/mekanism/api/gas/IGasTransmitter.java1
-rw-r--r--src/api/java/mekanism/api/gas/OreGas.java4
-rw-r--r--src/api/java/mekanism/api/gas/package-info.java4
-rw-r--r--src/api/java/mekanism/api/infuse/InfuseObject.java4
-rw-r--r--src/api/java/mekanism/api/infuse/InfuseRegistry.java6
-rw-r--r--src/api/java/mekanism/api/infuse/InfuseType.java10
-rw-r--r--src/api/java/mekanism/api/infuse/package-info.java4
-rw-r--r--src/api/java/mekanism/api/lasers/package-info.java4
-rw-r--r--src/api/java/mekanism/api/package-info.java4
-rw-r--r--src/api/java/mekanism/api/reactor/IFusionReactor.java3
-rw-r--r--src/api/java/mekanism/api/reactor/IReactorBlock.java1
-rw-r--r--src/api/java/mekanism/api/reactor/package-info.java4
-rw-r--r--src/api/java/mekanism/api/recipe/RecipeHelper.java203
-rw-r--r--src/api/java/mekanism/api/recipe/package-info.java4
-rw-r--r--src/api/java/mekanism/api/transmitters/DynamicNetwork.java298
-rw-r--r--src/api/java/mekanism/api/transmitters/IBlockableConnection.java2
-rw-r--r--src/api/java/mekanism/api/transmitters/IGridTransmitter.java8
-rw-r--r--src/api/java/mekanism/api/transmitters/TransmissionType.java27
-rw-r--r--src/api/java/mekanism/api/transmitters/TransmitterNetworkRegistry.java99
-rw-r--r--src/api/java/mekanism/api/transmitters/package-info.java4
-rw-r--r--src/api/java/mekanism/api/util/BlockInfo.java13
-rw-r--r--src/api/java/mekanism/api/util/ItemInfo.java8
-rw-r--r--src/api/java/mekanism/api/util/ListUtils.java89
-rw-r--r--src/api/java/mekanism/api/util/StackUtils.java73
-rw-r--r--src/api/java/mekanism/api/util/UnitDisplayUtils.java80
-rw-r--r--src/api/java/mekanism/api/util/package-info.java4
47 files changed, 1035 insertions, 928 deletions
diff --git a/src/api/java/mekanism/api/Chunk3D.java b/src/api/java/mekanism/api/Chunk3D.java
index f469d5d..11c758f 100644
--- a/src/api/java/mekanism/api/Chunk3D.java
+++ b/src/api/java/mekanism/api/Chunk3D.java
@@ -13,11 +13,11 @@ import net.minecraft.world.chunk.Chunk;
*/
public class Chunk3D
{
- public int dimensionId;
-
- public int xCoord;
- public int zCoord;
-
+ public int dimensionId;
+
+ public int xCoord;
+ public int zCoord;
+
/**
* Creates a Chunk3D object from the given x and z coordinates, as well as a dimension.
* @param x - chunk x location
@@ -28,22 +28,22 @@ public class Chunk3D
{
xCoord = x;
zCoord = z;
-
+
dimensionId = dimension;
}
-
+
/**
* Creates a Chunk3D from an entity based on it's location and dimension.
* @param entity - the entity to get the Chunk3D object from
*/
public Chunk3D(Entity entity)
{
- xCoord = ((int)entity.posX) >> 4;
- zCoord = ((int)entity.posZ) >> 4;
-
+ xCoord = ((int) entity.posX) >> 4;
+ zCoord = ((int) entity.posZ) >> 4;
+
dimensionId = entity.dimension;
}
-
+
/**
* Creates a Chunk3D from a Coord4D based on it's coordinates and dimension.
* @param coord - the Coord4D object to get this Chunk3D from
@@ -52,10 +52,10 @@ public class Chunk3D
{
xCoord = coord.xCoord >> 4;
zCoord = coord.zCoord >> 4;
-
+
dimensionId = coord.dimensionId;
}
-
+
/**
* Whether or not this chunk exists in the given world.
* @param world - the world to check in
@@ -65,7 +65,7 @@ public class Chunk3D
{
return world.getChunkProvider().chunkExists(xCoord, zCoord);
}
-
+
/**
* Gets a Chunk object corresponding to this Chunk3D's coordinates.
* @param world - the world to get the Chunk object from
@@ -75,7 +75,7 @@ public class Chunk3D
{
return world.getChunkFromChunkCoords(xCoord, zCoord);
}
-
+
/**
* Returns this Chunk3D in the Minecraft-based ChunkCoordIntPair format.
* @return this Chunk3D as a ChunkCoordIntPair
@@ -84,7 +84,7 @@ public class Chunk3D
{
return new ChunkCoordIntPair(xCoord, zCoord);
}
-
+
@Override
public Coord4D clone()
{
@@ -100,10 +100,7 @@ public class Chunk3D
@Override
public boolean equals(Object obj)
{
- return obj instanceof Chunk3D &&
- ((Chunk3D)obj).xCoord == xCoord &&
- ((Chunk3D)obj).zCoord == zCoord &&
- ((Chunk3D)obj).dimensionId == dimensionId;
+ return obj instanceof Chunk3D && ((Chunk3D) obj).xCoord == xCoord && ((Chunk3D) obj).zCoord == zCoord && ((Chunk3D) obj).dimensionId == dimensionId;
}
@Override
diff --git a/src/api/java/mekanism/api/Coord4D.java b/src/api/java/mekanism/api/Coord4D.java
index 1a0f7e4..57f82ca 100644
--- a/src/api/java/mekanism/api/Coord4D.java
+++ b/src/api/java/mekanism/api/Coord4D.java
@@ -1,7 +1,9 @@
package mekanism.api;
-import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import io.netty.buffer.ByteBuf;
+
+import java.util.ArrayList;
+
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
@@ -15,8 +17,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.util.ForgeDirection;
-
-import java.util.ArrayList;
+import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
/**
* Coord4D - an integer-based way to keep track of and perform operations on blocks in a Minecraft-based environment. This also takes
@@ -26,11 +27,11 @@ import java.util.ArrayList;
*/
public class Coord4D
{
- public int xCoord;
- public int yCoord;
- public int zCoord;
+ public int xCoord;
+ public int yCoord;
+ public int zCoord;
- public int dimensionId;
+ public int dimensionId;
/**
* Creates a Coord4D WITHOUT a dimensionId. Don't use unless absolutely necessary.
@@ -46,17 +47,17 @@ public class Coord4D
dimensionId = 0;
}
-
+
/**
* Creates a Coord4D from an entity's position, rounded down.
* @param entity - entity to create the Coord4D from
*/
public Coord4D(Entity entity)
{
- xCoord = (int)entity.posX;
- yCoord = (int)entity.posY;
- zCoord = (int)entity.posZ;
-
+ xCoord = (int) entity.posX;
+ yCoord = (int) entity.posY;
+ zCoord = (int) entity.posZ;
+
dimensionId = entity.worldObj.provider.dimensionId;
}
@@ -100,7 +101,7 @@ public class Coord4D
*/
public TileEntity getTileEntity(IBlockAccess world)
{
- if(world instanceof World && !exists((World)world))
+ if(world instanceof World && !exists((World) world))
{
return null;
}
@@ -115,11 +116,11 @@ public class Coord4D
*/
public Block getBlock(IBlockAccess world)
{
- if(world instanceof World && !exists((World)world))
+ if(world instanceof World && !exists((World) world))
{
return null;
}
-
+
return world.getBlock(xCoord, yCoord, zCoord);
}
@@ -149,7 +150,7 @@ public class Coord4D
data.add(zCoord);
data.add(dimensionId);
}
-
+
/**
* Writes this Coord4D's data to a ByteBuf for packet transfer.
* @param dataStream - the ByteBuf to add the data to
@@ -177,7 +178,7 @@ public class Coord4D
return this;
}
-
+
/**
* Translates this Coord4D by the defined Coord4D's coordinates, regardless of dimension.
* @param coord - coordinates to translate by
@@ -186,7 +187,7 @@ public class Coord4D
public Coord4D translate(Coord4D coord)
{
translate(coord.xCoord, coord.yCoord, coord.zCoord);
-
+
return this;
}
@@ -208,18 +209,20 @@ public class Coord4D
*/
public Coord4D getFromSide(ForgeDirection side, int amount)
{
- return new Coord4D(xCoord+(side.offsetX*amount), yCoord+(side.offsetY*amount), zCoord+(side.offsetZ*amount), dimensionId);
+ return new Coord4D(xCoord + (side.offsetX * amount),
+ yCoord + (side.offsetY * amount),
+ zCoord + (side.offsetZ * amount), dimensionId);
}
-
+
public ItemStack getStack(IBlockAccess world)
{
- Block block = getBlock(world);
-
+ final Block block = getBlock(world);
+
if(block == null || block == Blocks.air)
{
return null;
}
-
+
return new ItemStack(block, 1, getMetadata(world));
}
@@ -230,7 +233,9 @@ public class Coord4D
*/
public static Coord4D get(TileEntity tileEntity)
{
- return new Coord4D(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, tileEntity.getWorldObj().provider.dimensionId);
+ return new Coord4D(tileEntity.xCoord, tileEntity.yCoord,
+ tileEntity.zCoord,
+ tileEntity.getWorldObj().provider.dimensionId);
}
/**
@@ -238,10 +243,11 @@ public class Coord4D
* @param tag - tag compound to read from
* @return the Coord4D from the tag compound
*/
- public static Coord4D read(NBTTagCompound tag)
- {
- return new Coord4D(tag.getInteger("x"), tag.getInteger("y"), tag.getInteger("z"), tag.getInteger("id"));
- }
+ public static Coord4D read(NBTTagCompound tag)
+ {
+ return new Coord4D(tag.getInteger("x"), tag.getInteger("y"),
+ tag.getInteger("z"), tag.getInteger("id"));
+ }
/**
* Returns a new Coord4D from a ByteBuf.
@@ -250,7 +256,8 @@ public class Coord4D
*/
public static Coord4D read(ByteBuf dataStream)
{
- return new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
+ return new Coord4D(dataStream.readInt(), dataStream.readInt(),
+ dataStream.readInt(), dataStream.readInt());
}
/**
@@ -260,7 +267,8 @@ public class Coord4D
*/
public Coord4D difference(Coord4D other)
{
- return new Coord4D(xCoord-other.xCoord, yCoord-other.yCoord, zCoord-other.zCoord, dimensionId);
+ return new Coord4D(xCoord - other.xCoord, yCoord - other.yCoord,
+ zCoord - other.zCoord, dimensionId);
}
/**
@@ -271,9 +279,9 @@ public class Coord4D
*/
public ForgeDirection sideDifference(Coord4D other)
{
- Coord4D diff = difference(other);
+ final Coord4D diff = difference(other);
- for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
+ for(final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
if(side.offsetX == diff.xCoord && side.offsetY == diff.yCoord && side.offsetZ == diff.zCoord)
{
@@ -291,10 +299,10 @@ public class Coord4D
*/
public int distanceTo(Coord4D obj)
{
- int subX = xCoord - obj.xCoord;
- int subY = yCoord - obj.yCoord;
- int subZ = zCoord - obj.zCoord;
- return (int)MathHelper.sqrt_double(subX * subX + subY * subY + subZ * subZ);
+ final int subX = xCoord - obj.xCoord;
+ final int subY = yCoord - obj.yCoord;
+ final int subZ = zCoord - obj.zCoord;
+ return (int) MathHelper.sqrt_double(subX * subX + subY * subY + subZ * subZ);
}
/**
@@ -305,9 +313,9 @@ public class Coord4D
*/
public boolean sideVisible(ForgeDirection side, IBlockAccess world)
{
- return world.isAirBlock(xCoord+side.offsetX, yCoord+side.offsetY, zCoord+side.offsetZ);
+ return world.isAirBlock(xCoord + side.offsetX, yCoord + side.offsetY, zCoord + side.offsetZ);
}
-
+
/**
* Gets a TargetPoint with the defined range from this Coord4D with the appropriate coordinates and dimension ID.
* @param range - the range the packet can be sent in of this Coord4D
@@ -347,7 +355,7 @@ public class Coord4D
{
return world.getChunkFromBlockCoords(xCoord, zCoord);
}
-
+
/**
* Gets the Chunk3D object with chunk coordinates correlating to this Coord4D's location
* @return Chunk3D with correlating chunk coordinates.
@@ -366,7 +374,7 @@ public class Coord4D
{
return world.isAirBlock(xCoord, yCoord, zCoord);
}
-
+
/**
* Whether or not this block this Coord4D represents is replaceable.
* @param world - world this Coord4D is in
@@ -376,14 +384,14 @@ public class Coord4D
{
return getBlock(world).isReplaceable(world, xCoord, yCoord, zCoord);
}
-
+
/**
* Gets a bounding box that contains the area this Coord4D would take up in a world.
* @return this Coord4D's bounding box
*/
public AxisAlignedBB getBoundingBox()
{
- return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+1, zCoord+1);
+ return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
}
@Override
@@ -401,11 +409,7 @@ public class Coord4D
@Override
public boolean equals(Object obj)
{
- return obj instanceof Coord4D &&
- ((Coord4D)obj).xCoord == xCoord &&
- ((Coord4D)obj).yCoord == yCoord &&
- ((Coord4D)obj).zCoord == zCoord &&
- ((Coord4D)obj).dimensionId == dimensionId;
+ return obj instanceof Coord4D && ((Coord4D) obj).xCoord == xCoord && ((Coord4D) obj).yCoord == yCoord && ((Coord4D) obj).zCoord == zCoord && ((Coord4D) obj).dimensionId == dimensionId;
}
@Override
@@ -418,4 +422,4 @@ public class Coord4D
code = 31 * code + dimensionId;
return code;
}
-} \ No newline at end of file
+}
diff --git a/src/api/java/mekanism/api/EnumColor.java b/src/api/java/mekanism/api/EnumColor.java
index df9ba74..73d8b61 100644
--- a/src/api/java/mekanism/api/EnumColor.java
+++ b/src/api/java/mekanism/api/EnumColor.java
@@ -9,39 +9,23 @@ import net.minecraft.util.StatCollector;
*/
public enum EnumColor
{
- BLACK("\u00a70", "black", "Black", new int[] {0, 0, 0}, 0),
- DARK_BLUE("\u00a71", "darkBlue", "Blue", new int[] {0, 0, 170}, 4),
- DARK_GREEN("\u00a72", "darkGreen", "Green", new int[] {0, 170, 0}, 2),
- DARK_AQUA("\u00a73", "darkAqua", "Cyan", new int[] {0, 255, 255}, 6),
- DARK_RED("\u00a74", "darkRed", null, new int[] {170, 0, 0}, -1),
- PURPLE("\u00a75", "purple", "Purple", new int[] {170, 0, 170}, 5),
- ORANGE("\u00a76", "orange", "Orange", new int[] {255, 170, 0}, 14),
- GREY("\u00a77", "grey", "LightGray", new int[] {170, 170, 170}, 7),
- DARK_GREY("\u00a78", "darkGrey", "Gray", new int[] {85, 85, 85}, 8),
- INDIGO("\u00a79", "indigo", "LightBlue", new int[] {85, 85, 255}, 12),
- BRIGHT_GREEN("\u00a7a", "brightGreen", "Lime", new int[] {85, 255, 85}, 10),
- AQUA("\u00a7b", "aqua", null, new int[] {85, 255, 255}, -1),
- RED("\u00a7c", "red", "Red", new int[] {255, 0, 0}, 1),
- PINK("\u00a7d", "pink", "Magenta", new int[] {255, 85, 255}, 13),
- YELLOW("\u00a7e", "yellow", "Yellow", new int[] {255, 255, 85}, 11),
- WHITE("\u00a7f", "white", "White", new int[] {255, 255, 255}, 15),
+ BLACK("\u00a70", "black", "Black", new int[] {0, 0, 0}, 0), DARK_BLUE("\u00a71", "darkBlue", "Blue", new int[] {0, 0, 170}, 4), DARK_GREEN("\u00a72", "darkGreen", "Green", new int[] {0, 170, 0}, 2), DARK_AQUA("\u00a73", "darkAqua", "Cyan", new int[] {0, 255, 255}, 6), DARK_RED("\u00a74", "darkRed", null, new int[] {170, 0, 0}, -1), PURPLE("\u00a75", "purple", "Purple", new int[] {170, 0, 170}, 5), ORANGE("\u00a76", "orange", "Orange", new int[] {255, 170, 0}, 14), GREY("\u00a77", "grey", "LightGray", new int[] {170, 170, 170}, 7), DARK_GREY("\u00a78", "darkGrey", "Gray", new int[] {85, 85, 85}, 8), INDIGO("\u00a79", "indigo", "LightBlue", new int[] {85, 85, 255}, 12), BRIGHT_GREEN("\u00a7a", "brightGreen", "Lime", new int[] {85, 255, 85}, 10), AQUA("\u00a7b", "aqua", null, new int[] {85, 255, 255}, -1), RED("\u00a7c", "red", "Red", new int[] {255, 0, 0}, 1), PINK("\u00a7d", "pink", "Magenta", new int[] {255, 85, 255}, 13), YELLOW("\u00a7e", "yellow", "Yellow", new int[] {255, 255, 85}, 11), WHITE("\u00a7f", "white", "White", new int[] {255, 255, 255}, 15),
//Extras for dye-completeness
- BROWN("\u00a76", "brown", "Brown", new int[] {150, 75, 0}, 3),
- BRIGHT_PINK("\u00a7d", "brightPink", "Pink", new int[] {255, 192, 203}, 9);
+ BROWN("\u00a76", "brown", "Brown", new int[] {150, 75, 0}, 3), BRIGHT_PINK("\u00a7d", "brightPink", "Pink", new int[] {255, 192, 203}, 9);
- public static EnumColor[] DYES = new EnumColor[] {BLACK, RED, DARK_GREEN, BROWN, DARK_BLUE, PURPLE, DARK_AQUA, GREY, DARK_GREY, BRIGHT_PINK, BRIGHT_GREEN, YELLOW, INDIGO, PINK, ORANGE, WHITE};
+ public static EnumColor[] DYES = new EnumColor[] {BLACK, RED, DARK_GREEN, BROWN, DARK_BLUE, PURPLE, DARK_AQUA, GREY, DARK_GREY, BRIGHT_PINK, BRIGHT_GREEN, YELLOW, INDIGO, PINK, ORANGE, WHITE};
/** The color code that will be displayed */
- public final String code;
+ public final String code;
- public final int[] rgbCode;
+ public final int[] rgbCode;
- public final int mcMeta;
+ public final int mcMeta;
/** A friendly name of the color. */
- public String unlocalizedName;
-
- public String dyeName;
+ public String unlocalizedName;
+
+ public String dyeName;
private EnumColor(String s, String n, String dye, int[] rgb, int meta)
{
@@ -65,7 +49,7 @@ public enum EnumColor
{
return StatCollector.translateToLocal("dye." + unlocalizedName);
}
-
+
public String getOreDictName()
{
return dyeName;
@@ -92,7 +76,7 @@ public enum EnumColor
*/
public float getColor(int index)
{
- return (float)rgbCode[index]/255F;
+ return rgbCode[index] / 255F;
}
/**
diff --git a/src/api/java/mekanism/api/IFilterAccess.java b/src/api/java/mekanism/api/IFilterAccess.java
index abdcf29..7bb2ee3 100644
--- a/src/api/java/mekanism/api/IFilterAccess.java
+++ b/src/api/java/mekanism/api/IFilterAccess.java
@@ -16,13 +16,13 @@ public interface IFilterAccess
* @return the NBTTagCompound that now contains the TileEntity's filter card data
*/
public NBTTagCompound getFilterData(NBTTagCompound nbtTags);
-
+
/**
* Retrieves the TileEntity's data contained in the filter card based on the given NBTTagCompopund.
* @param nbtTags - the NBTTagCompound of the filter card ItemStack
*/
public void setFilterData(NBTTagCompound nbtTags);
-
+
/**
* A String name of this TileEntity that will be displayed as the type of data on the filter card.
* @return the String name of this TileEntity
diff --git a/src/api/java/mekanism/api/IHeatTransfer.java b/src/api/java/mekanism/api/IHeatTransfer.java
index da682e1..17393f7 100644
--- a/src/api/java/mekanism/api/IHeatTransfer.java
+++ b/src/api/java/mekanism/api/IHeatTransfer.java
@@ -5,10 +5,10 @@ import net.minecraftforge.common.util.ForgeDirection;
public interface IHeatTransfer
{
/**The value of the zero point of our temperature scale in kelvin*/
- public static final double AMBIENT_TEMP = 300;
+ public static final double AMBIENT_TEMP = 300;
/**The heat transfer coefficient for air*/
- public static final double AIR_INVERSE_COEFFICIENT = 10000;
+ public static final double AIR_INVERSE_COEFFICIENT = 10000;
public double getTemp();
diff --git a/src/api/java/mekanism/api/ItemRetriever.java b/src/api/java/mekanism/api/ItemRetriever.java
index c2820f0..1b6f4bd 100644
--- a/src/api/java/mekanism/api/ItemRetriever.java
+++ b/src/api/java/mekanism/api/ItemRetriever.java
@@ -13,10 +13,10 @@ import net.minecraft.item.ItemStack;
public final class ItemRetriever
{
/** The 'MekanismItems' class that items are retrieved from. */
- private static Class MekanismItems;
-
+ private static Class MekanismItems;
+
/** The 'MekanismBlocks' class that blocks are retrieved from. */
- private static Class MekanismBlocks;
+ private static Class MekanismBlocks;
/**
* Attempts to retrieve an ItemStack of an item with the declared identifier.
@@ -43,27 +43,31 @@ public final class ItemRetriever
*/
public static ItemStack getItem(String identifier)
{
- try {
+ try
+ {
if(MekanismItems == null)
{
MekanismItems = Class.forName("mekanism.common.MekanismItems");
}
- Object ret = MekanismItems.getField(identifier).get(null);
+ final Object ret = MekanismItems.getField(identifier).get(null);
if(ret instanceof Item)
{
- return new ItemStack((Item)ret, 1);
+ return new ItemStack((Item) ret, 1);
}
- else {
+ else
+ {
return null;
}
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error retrieving item with identifier '" + identifier + "': " + e.getMessage());
return null;
}
}
-
+
/**
* Attempts to retrieve an ItemStack of a block with the declared identifier.
*
@@ -89,22 +93,26 @@ public final class ItemRetriever
*/
public static ItemStack getBlock(String identifier)
{
- try {
+ try
+ {
if(MekanismBlocks == null)
{
MekanismBlocks = Class.forName("mekanism.common.MekanismBlocks");
}
- Object ret = MekanismBlocks.getField(identifier).get(null);
+ final Object ret = MekanismBlocks.getField(identifier).get(null);
if(ret instanceof Block)
{
- return new ItemStack((Block)ret, 1);
+ return new ItemStack((Block) ret, 1);
}
- else {
+ else
+ {
return null;
}
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error retrieving block with identifier '" + identifier + "': " + e.getMessage());
return null;
}
diff --git a/src/api/java/mekanism/api/MekanismAPI.java b/src/api/java/mekanism/api/MekanismAPI.java
index abdd6da..cfbdb68 100644
--- a/src/api/java/mekanism/api/MekanismAPI.java
+++ b/src/api/java/mekanism/api/MekanismAPI.java
@@ -4,7 +4,6 @@ import java.util.HashSet;
import java.util.Set;
import mekanism.api.util.BlockInfo;
-
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.oredict.OreDictionary;
@@ -13,14 +12,14 @@ import cpw.mods.fml.common.eventhandler.Event;
public class MekanismAPI
{
//Add a BlockInfo value here if you don't want a certain block to be picked up by cardboard boxes
- private static Set<BlockInfo> cardboardBoxIgnore = new HashSet<BlockInfo>();
-
+ private static Set<BlockInfo> cardboardBoxIgnore = new HashSet<BlockInfo>();
+
/** Mekanism debug mode */
- public static boolean debug = false;
+ public static boolean debug = false;
public static boolean isBlockCompatible(Item item, int meta)
{
- for(BlockInfo i : cardboardBoxIgnore)
+ for(final BlockInfo i : cardboardBoxIgnore)
{
if(i.block == Block.getBlockFromItem(item) && (i.meta == OreDictionary.WILDCARD_VALUE || i.meta == meta))
{
@@ -46,5 +45,7 @@ public class MekanismAPI
return cardboardBoxIgnore;
}
- public static class BoxBlacklistEvent extends Event {}
+ public static class BoxBlacklistEvent extends Event
+ {
+ }
}
diff --git a/src/api/java/mekanism/api/MekanismConfig.java b/src/api/java/mekanism/api/MekanismConfig.java
index 2f9ea68..81772b1 100644
--- a/src/api/java/mekanism/api/MekanismConfig.java
+++ b/src/api/java/mekanism/api/MekanismConfig.java
@@ -10,76 +10,76 @@ public class MekanismConfig
{
public static class general
{
- public static boolean updateNotifications = true;
- public static boolean controlCircuitOreDict = true;
- public static boolean logPackets = false;
- public static boolean dynamicTankEasterEgg = false;
- public static boolean voiceServerEnabled = true;
- public static boolean cardboardSpawners = true;
- public static boolean enableWorldRegeneration = true;
- public static boolean creativeOverrideElectricChest = true;
- public static boolean spawnBabySkeletons = true;
- public static int obsidianTNTBlastRadius = 12;
- public static int osmiumPerChunk = 12;
- public static int copperPerChunk = 16;
- public static int tinPerChunk = 14;
- public static int saltPerChunk = 2;
- public static int obsidianTNTDelay = 100;
- public static int UPDATE_DELAY = 10;
- public static int VOICE_PORT = 36123;
- public static int maxUpgradeMultiplier = 10;
- public static int userWorldGenVersion = 0;
- public static double ENERGY_PER_REDSTONE = 10000;
- public static int ETHENE_BURN_TIME = 40;
- public static double DISASSEMBLER_USAGE = 10;
- public static EnergyType activeType = EnergyType.J;
- public static TempType tempUnit = TempType.K;
- public static double TO_IC2;
- public static double TO_TE;
- public static double FROM_H2;
- public static double FROM_IC2;
- public static double FROM_TE;
- public static int laserRange;
- public static double laserEnergyNeededPerHardness;
- public static double minerSilkMultiplier = 6;
- public static boolean blacklistIC2;
- public static boolean blacklistRF;
- public static boolean destroyDisabledBlocks;
- public static boolean enableAmbientLighting;
- public static int ambientLightingLevel;
- public static boolean prefilledPortableTanks;
- public static double armoredJetpackDamageRatio;
- public static int armoredJetpackDamageMax;
- public static boolean aestheticWorldDamage;
- public static boolean opsBypassRestrictions;
- public static double solarEvaporationSpeed;
- public static int maxJetpackGas;
- public static int maxScubaGas;
- public static int maxFlamethrowerGas;
+ public static boolean updateNotifications = true;
+ public static boolean controlCircuitOreDict = true;
+ public static boolean logPackets = false;
+ public static boolean dynamicTankEasterEgg = false;
+ public static boolean voiceServerEnabled = true;
+ public static boolean cardboardSpawners = true;
+ public static boolean enableWorldRegeneration = true;
+ public static boolean creativeOverrideElectricChest = true;
+ public static boolean spawnBabySkeletons = true;
+ public static int obsidianTNTBlastRadius = 12;
+ public static int osmiumPerChunk = 12;
+ public static int copperPerChunk = 16;
+ public static int tinPerChunk = 14;
+ public static int saltPerChunk = 2;
+ public static int obsidianTNTDelay = 100;
+ public static int UPDATE_DELAY = 10;
+ public static int VOICE_PORT = 36123;
+ public static int maxUpgradeMultiplier = 10;
+ public static int userWorldGenVersion = 0;
+ public static double ENERGY_PER_REDSTONE = 10000;
+ public static int ETHENE_BURN_TIME = 40;
+ public static double DISASSEMBLER_USAGE = 10;
+ public static EnergyType activeType = EnergyType.J;
+ public static TempType tempUnit = TempType.K;
+ public static double TO_IC2;
+ public static double TO_TE;
+ public static double FROM_H2;
+ public static double FROM_IC2;
+ public static double FROM_TE;
+ public static int laserRange;
+ public static double laserEnergyNeededPerHardness;
+ public static double minerSilkMultiplier = 6;
+ public static boolean blacklistIC2;
+ public static boolean blacklistRF;
+ public static boolean destroyDisabledBlocks;
+ public static boolean enableAmbientLighting;
+ public static int ambientLightingLevel;
+ public static boolean prefilledPortableTanks;
+ public static double armoredJetpackDamageRatio;
+ public static int armoredJetpackDamageMax;
+ public static boolean aestheticWorldDamage;
+ public static boolean opsBypassRestrictions;
+ public static double solarEvaporationSpeed;
+ public static int maxJetpackGas;
+ public static int maxScubaGas;
+ public static int maxFlamethrowerGas;
}
public static class client
{
- public static boolean enablePlayerSounds = true;
- public static boolean enableMachineSounds = true;
- public static boolean fancyUniversalCableRender = true;
- public static boolean holidays = true;
- public static float baseSoundVolume = 1F;
- public static boolean machineEffects = true;
- public static boolean oldTransmitterRender = false;
- public static boolean replaceSoundsWhenResuming = true;
- public static boolean renderCTM = true;
+ public static boolean enablePlayerSounds = true;
+ public static boolean enableMachineSounds = true;
+ public static boolean fancyUniversalCableRender = true;
+ public static boolean holidays = true;
+ public static float baseSoundVolume = 1F;
+ public static boolean machineEffects = true;
+ public static boolean oldTransmitterRender = false;
+ public static boolean replaceSoundsWhenResuming = true;
+ public static boolean renderCTM = true;
}
-
+
public static class machines
{
- private static Map<String, Boolean> config = new HashMap<String, Boolean>();
-
+ private static Map<String, Boolean> config = new HashMap<String, Boolean>();
+
public static boolean isEnabled(String type)
{
return config.get(type) != null && config.get(type);
}
-
+
public static void setEntry(String type, boolean enabled)
{
config.put(type, enabled);
@@ -88,50 +88,50 @@ public class MekanismConfig
public static class usage
{
- public static double enrichmentChamberUsage;
- public static double osmiumCompressorUsage;
- public static double combinerUsage;
- public static double crusherUsage;
- public static double factoryUsage;
- public static double metallurgicInfuserUsage;
- public static double purificationChamberUsage;
- public static double energizedSmelterUsage;
- public static double digitalMinerUsage;
- public static double electricPumpUsage;
- public static double rotaryCondensentratorUsage;
- public static double oxidationChamberUsage;
- public static double chemicalInfuserUsage;
- public static double chemicalInjectionChamberUsage;
- public static double precisionSawmillUsage;
- public static double chemicalDissolutionChamberUsage;
- public static double chemicalWasherUsage;
- public static double chemicalCrystallizerUsage;
- public static double seismicVibratorUsage;
- public static double pressurizedReactionBaseUsage;
- public static double fluidicPlenisherUsage;
- public static double laserUsage;
- public static double gasCentrifugeUsage;
- public static double heavyWaterElectrolysisUsage;
+ public static double enrichmentChamberUsage;
+ public static double osmiumCompressorUsage;
+ public static double combinerUsage;
+ public static double crusherUsage;
+ public static double factoryUsage;
+ public static double metallurgicInfuserUsage;
+ public static double purificationChamberUsage;
+ public static double energizedSmelterUsage;
+ public static double digitalMinerUsage;
+ public static double electricPumpUsage;
+ public static double rotaryCondensentratorUsage;
+ public static double oxidationChamberUsage;
+ public static double chemicalInfuserUsage;
+ public static double chemicalInjectionChamberUsage;
+ public static double precisionSawmillUsage;
+ public static double chemicalDissolutionChamberUsage;
+ public static double chemicalWasherUsage;
+ public static double chemicalCrystallizerUsage;
+ public static double seismicVibratorUsage;
+ public static double pressurizedReactionBaseUsage;
+ public static double fluidicPlenisherUsage;
+ public static double laserUsage;
+ public static double gasCentrifugeUsage;
+ public static double heavyWaterElectrolysisUsage;
}
public static class generators
{
- public static double advancedSolarGeneration;
- public static double bioGeneration;
- public static double heatGeneration;
- public static double heatGenerationLava;
- public static double heatGenerationNether;
- public static double solarGeneration;
+ public static double advancedSolarGeneration;
+ public static double bioGeneration;
+ public static double heatGeneration;
+ public static double heatGenerationLava;
+ public static double heatGenerationNether;
+ public static double solarGeneration;
- public static double windGenerationMin;
- public static double windGenerationMax;
+ public static double windGenerationMin;
+ public static double windGenerationMax;
- public static int windGenerationMinY;
- public static int windGenerationMaxY;
+ public static int windGenerationMinY;
+ public static int windGenerationMaxY;
}
public static class tools
{
- public static double armorSpawnRate;
+ public static double armorSpawnRate;
}
}
diff --git a/src/api/java/mekanism/api/Pos3D.java b/src/api/java/mekanism/api/Pos3D.java
index 75f83a0..03c5892 100644
--- a/src/api/java/mekanism/api/Pos3D.java
+++ b/src/api/java/mekanism/api/Pos3D.java
@@ -16,22 +16,22 @@ import net.minecraftforge.common.util.ForgeDirection;
*/
public class Pos3D
{
- public double xPos;
- public double yPos;
- public double zPos;
+ public double xPos;
+ public double yPos;
+ public double zPos;
public Pos3D()
{
this(0, 0, 0);
}
-
+
public Pos3D(Vec3 vec)
{
xPos = vec.xCoord;
yPos = vec.yCoord;
zPos = vec.zCoord;
}
-
+
public Pos3D(MovingObjectPosition mop)
{
xPos = mop.blockX;
@@ -45,7 +45,7 @@ public class Pos3D
yPos = y;
zPos = z;
}
-
+
public Pos3D(Coord4D coord)
{
xPos = coord.xCoord;
@@ -70,18 +70,19 @@ public class Pos3D
{
this(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
}
-
+
/**
* Returns a new Pos3D from a tag compound.
* @param tag - tag compound to read from
* @return the Pos3D from the tag compound
*/
- public static Pos3D read(NBTTagCompound tag)
- {
- return new Pos3D(tag.getDouble("x"), tag.getDouble("y"), tag.getDouble("z"));
- }
-
- /**
+ public static Pos3D read(NBTTagCompound tag)
+ {
+ return new Pos3D(tag.getDouble("x"), tag.getDouble("y"),
+ tag.getDouble("z"));
+ }
+
+ /**
* Writes this Pos3D's data to an NBTTagCompound.
* @param nbtTags - tag compound to write to
* @return the tag compound with this Pos3D's data
@@ -102,7 +103,7 @@ public class Pos3D
*/
public Pos3D diff(Pos3D pos)
{
- return new Pos3D(xPos-pos.xPos, yPos-pos.yPos, zPos-pos.zPos);
+ return new Pos3D(xPos - pos.xPos, yPos - pos.yPos, zPos - pos.zPos);
}
/**
@@ -115,15 +116,15 @@ public class Pos3D
return new Pos3D(entity.motionX, entity.motionY, entity.motionZ);
}
- /**
- * Creates a new Coord4D representing this Pos3D in the provided dimension.
- * @param dimensionId - the dimension this Pos3D is in
- * @return Coord4D representing this Pos3D
- */
- public Coord4D getCoord(int dimensionId)
- {
- return new Coord4D((int)xPos, (int)yPos, (int)zPos, dimensionId);
- }
+ /**
+ * Creates a new Coord4D representing this Pos3D in the provided dimension.
+ * @param dimensionId - the dimension this Pos3D is in
+ * @return Coord4D representing this Pos3D
+ */
+ public Coord4D getCoord(int dimensionId)
+ {
+ return new Coord4D((int) xPos, (int) yPos, (int) zPos, dimensionId);
+ }
/**
* Centres a block-derived Pos3D
@@ -172,9 +173,18 @@ public class Pos3D
*/
public Pos3D translateExcludingSide(ForgeDirection direction, double amount)
{
- if(direction.offsetX == 0) xPos += amount;
- if(direction.offsetY == 0) yPos += amount;
- if(direction.offsetZ == 0) zPos += amount;
+ if(direction.offsetX == 0)
+ {
+ xPos += amount;
+ }
+ if(direction.offsetY == 0)
+ {
+ yPos += amount;
+ }
+ if(direction.offsetZ == 0)
+ {
+ zPos += amount;
+ }
return this;
}
@@ -186,9 +196,9 @@ public class Pos3D
*/
public double distance(Pos3D pos)
{
- double subX = xPos - pos.xPos;
- double subY = yPos - pos.yPos;
- double subZ = zPos - pos.zPos;
+ final double subX = xPos - pos.xPos;
+ final double subY = yPos - pos.yPos;
+ final double subZ = zPos - pos.zPos;
return MathHelper.sqrt_double(subX * subX + subY * subY + subZ * subZ);
}
@@ -199,10 +209,10 @@ public class Pos3D
*/
public Pos3D rotateYaw(double yaw)
{
- double yawRadians = Math.toRadians(yaw);
+ final double yawRadians = Math.toRadians(yaw);
- double x = xPos;
- double z = zPos;
+ final double x = xPos;
+ final double z = zPos;
if(yaw != 0)
{
@@ -212,51 +222,51 @@ public class Pos3D
return this;
}
-
+
public Pos3D rotatePitch(double pitch)
{
- double pitchRadians = Math.toRadians(pitch);
-
- double y = yPos;
- double z = zPos;
-
+ final double pitchRadians = Math.toRadians(pitch);
+
+ final double y = yPos;
+ final double z = zPos;
+
if(pitch != 0)
{
yPos = y * Math.cos(pitchRadians) - z * Math.sin(pitchRadians);
zPos = z * Math.cos(pitchRadians) + y * Math.sin(pitchRadians);
}
-
+
return this;
}
-
+
public Pos3D rotate(double yaw, double pitch)
{
return rotate(yaw, pitch, 0);
}
- public Pos3D rotate(double yaw, double pitch, double roll)
- {
- double yawRadians = Math.toRadians(yaw);
- double pitchRadians = Math.toRadians(pitch);
- double rollRadians = Math.toRadians(roll);
+ public Pos3D rotate(double yaw, double pitch, double roll)
+ {
+ final double yawRadians = Math.toRadians(yaw);
+ final double pitchRadians = Math.toRadians(pitch);
+ final double rollRadians = Math.toRadians(roll);
+
+ final double x = xPos;
+ final double y = yPos;
+ final double z = zPos;
+
+ xPos = x * Math.cos(yawRadians) * Math.cos(pitchRadians) + z * (Math.cos(yawRadians) * Math.sin(pitchRadians) * Math.sin(rollRadians) - Math.sin(yawRadians) * Math.cos(rollRadians)) + y * (Math.cos(yawRadians) * Math.sin(pitchRadians) * Math.cos(rollRadians) + Math.sin(yawRadians) * Math.sin(rollRadians));
+ zPos = x * Math.sin(yawRadians) * Math.cos(pitchRadians) + z * (Math.sin(yawRadians) * Math.sin(pitchRadians) * Math.sin(rollRadians) + Math.cos(yawRadians) * Math.cos(rollRadians)) + y * (Math.sin(yawRadians) * Math.sin(pitchRadians) * Math.cos(rollRadians) - Math.cos(yawRadians) * Math.sin(rollRadians));
+ yPos = -x * Math.sin(pitchRadians) + z * Math.cos(pitchRadians) * Math.sin(rollRadians) + y * Math.cos(pitchRadians) * Math.cos(rollRadians);
- double x = xPos;
- double y = yPos;
- double z = zPos;
+ return this;
+ }
- xPos = x * Math.cos(yawRadians) * Math.cos(pitchRadians) + z * (Math.cos(yawRadians) * Math.sin(pitchRadians) * Math.sin(rollRadians) - Math.sin(yawRadians) * Math.cos(rollRadians)) + y * (Math.cos(yawRadians) * Math.sin(pitchRadians) * Math.cos(rollRadians) + Math.sin(yawRadians) * Math.sin(rollRadians));
- zPos = x * Math.sin(yawRadians) * Math.cos(pitchRadians) + z * (Math.sin(yawRadians) * Math.sin(pitchRadians) * Math.sin(rollRadians) + Math.cos(yawRadians) * Math.cos(rollRadians)) + y * (Math.sin(yawRadians) * Math.sin(pitchRadians) * Math.cos(rollRadians) - Math.cos(yawRadians) * Math.sin(rollRadians));
- yPos = -x * Math.sin(pitchRadians) + z * Math.cos(pitchRadians) * Math.sin(rollRadians) + y * Math.cos(pitchRadians) * Math.cos(rollRadians);
-
- return this;
- }
-
public Pos3D multiply(Pos3D pos)
{
xPos *= pos.xPos;
yPos *= pos.yPos;
zPos *= pos.zPos;
-
+
return this;
}
@@ -285,7 +295,7 @@ public class Pos3D
{
return scale(scale, scale, scale);
}
-
+
public Pos3D rotate(float angle, Pos3D axis)
{
return translateMatrix(getRotationMatrix(angle, axis), this);
@@ -293,19 +303,19 @@ public class Pos3D
public double[] getRotationMatrix(float angle)
{
- double[] matrix = new double[16];
- Pos3D axis = clone().normalize();
-
- double x = axis.xPos;
- double y = axis.yPos;
- double z = axis.zPos;
-
+ final double[] matrix = new double[16];
+ final Pos3D axis = clone().normalize();
+
+ final double x = axis.xPos;
+ final double y = axis.yPos;
+ final double z = axis.zPos;
+
angle *= 0.0174532925D;
-
- float cos = (float)Math.cos(angle);
- float ocos = 1.0F - cos;
- float sin = (float)Math.sin(angle);
-
+
+ final float cos = (float) Math.cos(angle);
+ final float ocos = 1.0F - cos;
+ final float sin = (float) Math.sin(angle);
+
matrix[0] = (x * x * ocos + cos);
matrix[1] = (y * x * ocos + z * sin);
matrix[2] = (x * z * ocos - y * sin);
@@ -316,20 +326,20 @@ public class Pos3D
matrix[9] = (y * z * ocos - x * sin);
matrix[10] = (z * z * ocos + cos);
matrix[15] = 1.0F;
-
+
return matrix;
}
public static Pos3D translateMatrix(double[] matrix, Pos3D translation)
{
- double x = translation.xPos * matrix[0] + translation.yPos * matrix[1] + translation.zPos * matrix[2] + matrix[3];
- double y = translation.xPos * matrix[4] + translation.yPos * matrix[5] + translation.zPos * matrix[6] + matrix[7];
- double z = translation.xPos * matrix[8] + translation.yPos * matrix[9] + translation.zPos * matrix[10] + matrix[11];
-
+ final double x = translation.xPos * matrix[0] + translation.yPos * matrix[1] + translation.zPos * matrix[2] + matrix[3];
+ final double y = translation.xPos * matrix[4] + translation.yPos * matrix[5] + translation.zPos * matrix[6] + matrix[7];
+ final double z = translation.xPos * matrix[8] + translation.yPos * matrix[9] + translation.zPos * matrix[10] + matrix[11];
+
translation.xPos = x;
translation.yPos = y;
translation.zPos = z;
-
+
return translation;
}
@@ -337,7 +347,7 @@ public class Pos3D
{
return axis.getRotationMatrix(angle);
}
-
+
public double anglePreNorm(Pos3D pos2)
{
return Math.acos(dotProduct(pos2));
@@ -347,27 +357,27 @@ public class Pos3D
{
return Math.acos(pos1.clone().dotProduct(pos2));
}
-
+
public double dotProduct(Pos3D pos)
{
return xPos * pos.xPos + yPos * pos.yPos + zPos * pos.zPos;
}
-
+
public Pos3D crossProduct(Pos3D compare)
{
return clone().toCrossProduct(compare);
}
-
+
public Pos3D toCrossProduct(Pos3D compare)
{
- double newX = yPos * compare.zPos - zPos * compare.yPos;
- double newY = zPos * compare.xPos - xPos * compare.zPos;
- double newZ = xPos * compare.yPos - yPos * compare.xPos;
-
+ final double newX = yPos * compare.zPos - zPos * compare.yPos;
+ final double newY = zPos * compare.xPos - xPos * compare.zPos;
+ final double newZ = xPos * compare.yPos - yPos * compare.xPos;
+
xPos = newX;
yPos = newY;
zPos = newZ;
-
+
return this;
}
@@ -380,7 +390,7 @@ public class Pos3D
{
return new Pos3D(-yPos, xPos, 0.0D);
}
-
+
public Pos3D getPerpendicular()
{
if(zPos == 0)
@@ -390,39 +400,32 @@ public class Pos3D
return xCrossProduct();
}
-
+
public Pos3D floor()
{
return new Pos3D(Math.floor(xPos), Math.floor(yPos), Math.floor(zPos));
}
- public double getMagnitude()
- {
- return Math.sqrt(xPos * xPos + yPos * yPos + zPos * zPos);
- }
+ public double getMagnitude()
+ {
+ return Math.sqrt(xPos * xPos + yPos * yPos + zPos * zPos);
+ }
- public Pos3D normalize()
- {
- double d = getMagnitude();
+ public Pos3D normalize()
+ {
+ final double d = getMagnitude();
- if (d != 0)
- {
- this.scale(1 / d);
- }
+ if(d != 0)
+ {
+ this.scale(1 / d);
+ }
- return this;
- }
+ return this;
+ }
public static AxisAlignedBB getAABB(Pos3D pos1, Pos3D pos2)
{
- return AxisAlignedBB.getBoundingBox(
- Math.min(pos1.xPos, pos2.xPos),
- Math.min(pos1.yPos, pos2.yPos),
- Math.min(pos1.zPos, pos2.zPos),
- Math.max(pos1.xPos, pos2.xPos),
- Math.max(pos1.yPos, pos2.yPos),
- Math.max(pos1.zPos, pos2.zPos)
- );
+ return AxisAlignedBB.getBoundingBox(Math.min(pos1.xPos, pos2.xPos), Math.min(pos1.yPos, pos2.yPos), Math.min(pos1.zPos, pos2.zPos), Math.max(pos1.xPos, pos2.xPos), Math.max(pos1.yPos, pos2.yPos), Math.max(pos1.zPos, pos2.zPos));
}
@Override
@@ -440,10 +443,7 @@ public class Pos3D
@Override
public boolean equals(Object obj)
{
- return obj instanceof Pos3D &&
- ((Pos3D)obj).xPos == xPos &&
- ((Pos3D)obj).yPos == yPos &&
- ((Pos3D)obj).zPos == zPos;
+ return obj instanceof Pos3D && ((Pos3D) obj).xPos == xPos && ((Pos3D) obj).yPos == yPos && ((Pos3D) obj).zPos == zPos;
}
@Override
diff --git a/src/api/java/mekanism/api/Range4D.java b/src/api/java/mekanism/api/Range4D.java
index 40905a6..7e4f6ae 100644
--- a/src/api/java/mekanism/api/Range4D.java
+++ b/src/api/java/mekanism/api/Range4D.java
@@ -3,17 +3,17 @@ package mekanism.api;
import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.common.FMLCommonHandler;
-public class Range4D
+public class Range4D
{
- public int dimensionId;
-
- public int xMin;
- public int yMin;
- public int zMin;
- public int xMax;
- public int yMax;
- public int zMax;
-
+ public int dimensionId;
+
+ public int xMin;
+ public int yMin;
+ public int zMin;
+ public int xMax;
+ public int yMax;
+ public int zMax;
+
public Range4D(int minX, int minY, int minZ, int maxX, int maxY, int maxZ, int dimension)
{
xMin = minX;
@@ -22,57 +22,57 @@ public class Range4D
xMax = maxX;
yMax = maxY;
zMax = maxZ;
-
+
dimensionId = dimension;
}
-
+
public Range4D(Chunk3D chunk)
{
- xMin = chunk.xCoord*16;
+ xMin = chunk.xCoord * 16;
yMin = 0;
- zMin = chunk.zCoord*16;
- xMax = xMin+16;
+ zMin = chunk.zCoord * 16;
+ xMax = xMin + 16;
yMax = 255;
- zMax = zMin+16;
-
+ zMax = zMin + 16;
+
dimensionId = chunk.dimensionId;
}
-
+
public Range4D(Coord4D coord)
{
xMin = coord.xCoord;
yMin = coord.yCoord;
zMin = coord.zCoord;
-
- xMax = coord.xCoord+1;
- yMax = coord.yCoord+1;
- zMax = coord.zCoord+1;
-
+
+ xMax = coord.xCoord + 1;
+ yMax = coord.yCoord + 1;
+ zMax = coord.zCoord + 1;
+
dimensionId = coord.dimensionId;
}
-
+
public static Range4D getChunkRange(EntityPlayer player)
{
- int radius = FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().getViewDistance();
-
+ final int radius = FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().getViewDistance();
+
return new Range4D(new Chunk3D(player)).expandChunks(radius);
}
-
+
public Range4D expandChunks(int chunks)
{
- xMin -= chunks*16;
- xMax += chunks*16;
- zMin -= chunks*16;
- zMax += chunks*16;
-
+ xMin -= chunks * 16;
+ xMax += chunks * 16;
+ zMin -= chunks * 16;
+ zMax += chunks * 16;
+
return this;
}
-
+
public boolean intersects(Range4D range)
{
- return (xMax+1 - 1.E-05D > range.xMin) && (range.xMax+1 - 1.E-05D > xMin) && (yMax+1 - 1.E-05D > range.yMin) && (range.yMax+1 - 1.E-05D > yMin) && (zMax+1 - 1.E-05D > range.zMin) && (range.zMax+1 - 1.E-05D > zMin);
+ return (xMax + 1 - 1.E-05D > range.xMin) && (range.xMax + 1 - 1.E-05D > xMin) && (yMax + 1 - 1.E-05D > range.yMin) && (range.yMax + 1 - 1.E-05D > yMin) && (zMax + 1 - 1.E-05D > range.zMin) && (range.zMax + 1 - 1.E-05D > zMin);
}
-
+
@Override
public Range4D clone()
{
@@ -88,14 +88,7 @@ public class Range4D
@Override
public boolean equals(Object obj)
{
- return obj instanceof Range4D &&
- ((Range4D)obj).xMin == xMin &&
- ((Range4D)obj).yMin == yMin &&
- ((Range4D)obj).zMin == zMin &&
- ((Range4D)obj).xMax == xMax &&
- ((Range4D)obj).yMax == yMax &&
- ((Range4D)obj).zMax == zMax &&
- ((Range4D)obj).dimensionId == dimensionId;
+ return obj instanceof Range4D && ((Range4D) obj).xMin == xMin && ((Range4D) obj).yMin == yMin && ((Range4D) obj).zMin == zMin && ((Range4D) obj).xMax == xMax && ((Range4D) obj).yMax == yMax && ((Range4D) obj).zMax == zMax && ((Range4D) obj).dimensionId == dimensionId;
}
@Override
diff --git a/src/api/java/mekanism/api/TabProxy.java b/src/api/java/mekanism/api/TabProxy.java
index c562c02..a96813c 100644
--- a/src/api/java/mekanism/api/TabProxy.java
+++ b/src/api/java/mekanism/api/TabProxy.java
@@ -10,7 +10,7 @@ import net.minecraft.creativetab.CreativeTabs;
public final class TabProxy
{
/** The 'Mekanism' class where the tab instance is stored. */
- public static Class Mekanism;
+ public static Class Mekanism;
/**
* Attempts to get the Mekanism creative tab instance from the 'Mekanism' class. Will return
@@ -20,21 +20,24 @@ public final class TabProxy
*/
public static CreativeTabs tabMekanism(CreativeTabs preferred)
{
- try {
+ try
+ {
if(Mekanism == null)
{
Mekanism = Class.forName("mekanism.common.Mekanism");
}
- Object ret = Mekanism.getField("tabMekanism").get(null);
+ final Object ret = Mekanism.getField("tabMekanism").get(null);
if(ret instanceof CreativeTabs)
{
- return (CreativeTabs)ret;
+ return (CreativeTabs) ret;
}
return preferred;
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error retrieving Mekanism creative tab.");
return preferred;
}
diff --git a/src/api/java/mekanism/api/energy/EnergizedItemManager.java b/src/api/java/mekanism/api/energy/EnergizedItemManager.java
index 165bdf6..458c480 100644
--- a/src/api/java/mekanism/api/energy/EnergizedItemManager.java
+++ b/src/api/java/mekanism/api/energy/EnergizedItemManager.java
@@ -16,11 +16,11 @@ public class EnergizedItemManager
{
if(itemStack.getItem() instanceof IEnergizedItem)
{
- IEnergizedItem energizedItem = (IEnergizedItem)itemStack.getItem();
+ final IEnergizedItem energizedItem = (IEnergizedItem) itemStack.getItem();
if(energizedItem.canSend(itemStack))
{
- double energyToUse = Math.min(energizedItem.getMaxTransfer(itemStack), Math.min(energizedItem.getEnergy(itemStack), amount));
+ final double energyToUse = Math.min(energizedItem.getMaxTransfer(itemStack), Math.min(energizedItem.getEnergy(itemStack), amount));
energizedItem.setEnergy(itemStack, energizedItem.getEnergy(itemStack) - energyToUse);
return energyToUse;
@@ -43,11 +43,11 @@ public class EnergizedItemManager
{
if(itemStack.getItem() instanceof IEnergizedItem)
{
- IEnergizedItem energizedItem = (IEnergizedItem)itemStack.getItem();
+ final IEnergizedItem energizedItem = (IEnergizedItem) itemStack.getItem();
if(energizedItem.canReceive(itemStack))
{
- double energyToSend = Math.min(energizedItem.getMaxTransfer(itemStack), Math.min(energizedItem.getMaxEnergy(itemStack) - energizedItem.getEnergy(itemStack), amount));
+ final double energyToSend = Math.min(energizedItem.getMaxTransfer(itemStack), Math.min(energizedItem.getMaxEnergy(itemStack) - energizedItem.getEnergy(itemStack), amount));
energizedItem.setEnergy(itemStack, energizedItem.getEnergy(itemStack) + energyToSend);
return energyToSend;
diff --git a/src/api/java/mekanism/api/energy/EnergyStack.java b/src/api/java/mekanism/api/energy/EnergyStack.java
index 3f57621..807262d 100644
--- a/src/api/java/mekanism/api/energy/EnergyStack.java
+++ b/src/api/java/mekanism/api/energy/EnergyStack.java
@@ -5,7 +5,7 @@ package mekanism.api.energy;
*/
public class EnergyStack
{
- public double amount;
+ public double amount;
public EnergyStack(double newAmount)
{
diff --git a/src/api/java/mekanism/api/energy/package-info.java b/src/api/java/mekanism/api/energy/package-info.java
index 8f3d371..d16dddf 100644
--- a/src/api/java/mekanism/api/energy/package-info.java
+++ b/src/api/java/mekanism/api/energy/package-info.java
@@ -1,3 +1,5 @@
@API(apiVersion = "8.0.0", owner = "Mekanism", provides = "MekanismAPI|energy")
package mekanism.api.energy;
-import cpw.mods.fml.common.API; \ No newline at end of file
+
+import cpw.mods.fml.common.API;
+
diff --git a/src/api/java/mekanism/api/gas/Gas.java b/src/api/java/mekanism/api/gas/Gas.java
index f05be52..b65353e 100644
--- a/src/api/java/mekanism/api/gas/Gas.java
+++ b/src/api/java/mekanism/api/gas/Gas.java
@@ -13,17 +13,17 @@ import net.minecraftforge.fluids.FluidRegistry;
*/
public class Gas
{
- private String name;
+ private String name;
- private String unlocalizedName;
+ private String unlocalizedName;
- private Fluid fluid;
+ private Fluid fluid;
- private IIcon icon;
+ private IIcon icon;
- private boolean visible = true;
+ private boolean visible = true;
- private boolean from_fluid = false;
+ private boolean from_fluid = false;
/**
* Creates a new Gas object with a defined name or key value.
@@ -113,9 +113,9 @@ public class Gas
{
if(from_fluid)
{
- return this.getFluid().getIcon();
+ return getFluid().getIcon();
}
-
+
return icon;
}
@@ -132,9 +132,9 @@ public class Gas
{
fluid.setIcons(getIcon());
}
-
+
from_fluid = false;
-
+
return this;
}
@@ -205,7 +205,8 @@ public class Gas
fluid = new Fluid(getName()).setGaseous(true);
FluidRegistry.registerFluid(fluid);
}
- else {
+ else
+ {
fluid = FluidRegistry.getFluid(getName());
}
}
diff --git a/src/api/java/mekanism/api/gas/GasNetwork.java b/src/api/java/mekanism/api/gas/GasNetwork.java
index ea81d12..05e18be 100644
--- a/src/api/java/mekanism/api/gas/GasNetwork.java
+++ b/src/api/java/mekanism/api/gas/GasNetwork.java
@@ -1,8 +1,12 @@
package mekanism.api.gas;
-import com.google.common.collect.Lists;
-import cpw.mods.fml.common.FMLCommonHandler;
-import cpw.mods.fml.common.eventhandler.Event;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
import mekanism.api.Coord4D;
import mekanism.api.transmitters.DynamicNetwork;
import mekanism.api.transmitters.IGridTransmitter;
@@ -10,7 +14,10 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
-import java.util.*;
+import com.google.common.collect.Lists;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.eventhandler.Event;
/**
* A DynamicNetwork extension created specifically for the transfer of Gasses. By default this is server-only, but if ticked on
@@ -20,25 +27,27 @@ import java.util.*;
*/
public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
{
- public int transferDelay = 0;
+ public int transferDelay = 0;
- public boolean didTransfer;
- public boolean prevTransfer;
+ public boolean didTransfer;
+ public boolean prevTransfer;
- public float gasScale;
+ public float gasScale;
- public Gas refGas;
+ public Gas refGas;
- public GasStack buffer;
- public int prevStored;
+ public GasStack buffer;
+ public int prevStored;
- public int prevTransferAmount = 0;
+ public int prevTransferAmount = 0;
- public GasNetwork() {}
+ public GasNetwork()
+ {
+ }
public GasNetwork(Collection<GasNetwork> networks)
{
- for(GasNetwork net : networks)
+ for(final GasNetwork net : networks)
{
if(net != null)
{
@@ -54,14 +63,16 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
net.refGas = null;
net.buffer = null;
}
- } else
+ }
+ else
{
if(net.buffer != null)
{
if(buffer == null)
{
buffer = net.buffer.copy();
- } else
+ }
+ else
{
if(buffer.isGasEqual(net.buffer))
{
@@ -91,19 +102,19 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
@Override
public void absorbBuffer(IGridTransmitter<IGasHandler, GasNetwork> transmitter)
{
- Object b = transmitter.getBuffer();
-
- if(!(b instanceof GasStack) || ((GasStack)b).getGas() == null || ((GasStack)b).amount == 0)
+ final Object b = transmitter.getBuffer();
+
+ if(!(b instanceof GasStack) || ((GasStack) b).getGas() == null || ((GasStack) b).amount == 0)
{
return;
}
- GasStack gas = (GasStack)b;
+ final GasStack gas = (GasStack) b;
if(buffer == null || buffer.getGas() == null || buffer.amount == 0)
{
buffer = gas.copy();
- gas.amount = 0;
+ gas.amount = 0;
return;
}
@@ -112,7 +123,7 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
{
buffer.amount += gas.amount;
}
-
+
gas.amount = 0;
}
@@ -127,30 +138,30 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
public int getGasNeeded()
{
- return getCapacity()-(buffer != null ? buffer.amount : 0);
+ return getCapacity() - (buffer != null ? buffer.amount : 0);
}
public int tickEmit(GasStack stack)
{
- List<IGasHandler> availableAcceptors = Lists.newArrayList();
+ final List<IGasHandler> availableAcceptors = Lists.newArrayList();
availableAcceptors.addAll(getAcceptors(stack.getGas()));
Collections.shuffle(availableAcceptors);
int toSend = stack.amount;
- int prevSending = toSend;
+ final int prevSending = toSend;
if(!availableAcceptors.isEmpty())
{
- int divider = availableAcceptors.size();
+ final int divider = availableAcceptors.size();
int remaining = toSend % divider;
- int sending = (toSend-remaining)/divider;
+ final int sending = (toSend - remaining) / divider;
- for(IGasHandler acceptor : availableAcceptors)
+ for(final IGasHandler acceptor : availableAcceptors)
{
int currentSending = sending;
- EnumSet<ForgeDirection> sides = acceptorDirections.get(Coord4D.get((TileEntity)acceptor));
+ final EnumSet<ForgeDirection> sides = acceptorDirections.get(Coord4D.get((TileEntity) acceptor));
if(remaining > 0)
{
@@ -158,11 +169,12 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
remaining--;
}
- for(ForgeDirection side : sides)
+ for(final ForgeDirection side : sides)
{
- int prev = toSend;
+ final int prev = toSend;
- toSend -= acceptor.receiveGas(side, new GasStack(stack.getGas(), currentSending), true);
+ toSend -= acceptor.receiveGas(side, new GasStack(
+ stack.getGas(), currentSending), true);
if(toSend < prev)
{
@@ -172,7 +184,7 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
}
}
- int sent = prevSending-toSend;
+ final int sent = prevSending - toSend;
if(sent > 0 && FMLCommonHandler.instance().getEffectiveSide().isServer())
{
@@ -190,7 +202,7 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
return 0;
}
- int toUse = Math.min(getGasNeeded(), stack.amount);
+ final int toUse = Math.min(getGasNeeded(), stack.amount);
if(doTransfer)
{
@@ -199,7 +211,8 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
buffer = stack.copy();
buffer.amount = toUse;
}
- else {
+ else
+ {
buffer.amount += toUse;
}
}
@@ -220,11 +233,12 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
{
didTransfer = false;
}
- else {
+ else
+ {
transferDelay--;
}
- int stored = buffer != null ? buffer.amount : 0;
+ final int stored = buffer != null ? buffer.amount : 0;
if(stored != prevStored)
{
@@ -235,7 +249,8 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
if(didTransfer != prevTransfer || needsUpdate)
{
- MinecraftForge.EVENT_BUS.post(new GasTransferEvent(this, buffer, didTransfer));
+ MinecraftForge.EVENT_BUS.post(new GasTransferEvent(this,
+ buffer, didTransfer));
needsUpdate = false;
}
@@ -263,11 +278,11 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
if(didTransfer && gasScale < 1)
{
- gasScale = Math.max(getScale(), Math.min(1, gasScale+0.02F));
+ gasScale = Math.max(getScale(), Math.min(1, gasScale + 0.02F));
}
else if(!didTransfer && gasScale > 0)
{
- gasScale = Math.max(getScale(), Math.max(0, gasScale-0.02F));
+ gasScale = Math.max(getScale(), Math.max(0, gasScale - 0.02F));
if(gasScale == 0)
{
@@ -279,27 +294,27 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
@Override
public Set<IGasHandler> getAcceptors(Object data)
{
- Gas type = (Gas)data;
- Set<IGasHandler> toReturn = new HashSet<IGasHandler>();
-
+ final Gas type = (Gas) data;
+ final Set<IGasHandler> toReturn = new HashSet<IGasHandler>();
+
if(FMLCommonHandler.instance().getEffectiveSide().isClient())
{
return toReturn;
}
- for(Coord4D coord : possibleAcceptors.keySet())
+ for(final Coord4D coord : possibleAcceptors.keySet())
{
- EnumSet<ForgeDirection> sides = acceptorDirections.get(coord);
- TileEntity tile = coord.getTileEntity(getWorld());
-
+ final EnumSet<ForgeDirection> sides = acceptorDirections.get(coord);
+ final TileEntity tile = coord.getTileEntity(getWorld());
+
if(!(tile instanceof IGasHandler) || sides == null || sides.isEmpty())
{
continue;
}
-
- IGasHandler acceptor = (IGasHandler)tile;
- for(ForgeDirection side : sides)
+ final IGasHandler acceptor = (IGasHandler) tile;
+
+ for(final ForgeDirection side : sides)
{
if(acceptor != null && acceptor.canReceiveGas(side, type))
{
@@ -314,10 +329,10 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
public static class GasTransferEvent extends Event
{
- public final GasNetwork gasNetwork;
+ public final GasNetwork gasNetwork;
- public final GasStack transferType;
- public final boolean didTransfer;
+ public final GasStack transferType;
+ public final boolean didTransfer;
public GasTransferEvent(GasNetwork network, GasStack type, boolean did)
{
@@ -329,7 +344,7 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
public float getScale()
{
- return Math.min(1, (buffer == null || getCapacity() == 0 ? 0 : (float)buffer.amount/getCapacity()));
+ return Math.min(1, (buffer == null || getCapacity() == 0 ? 0 : (float) buffer.amount / getCapacity()));
}
@Override
diff --git a/src/api/java/mekanism/api/gas/GasRegistry.java b/src/api/java/mekanism/api/gas/GasRegistry.java
index 25db966..37a6363 100644
--- a/src/api/java/mekanism/api/gas/GasRegistry.java
+++ b/src/api/java/mekanism/api/gas/GasRegistry.java
@@ -7,7 +7,7 @@ import net.minecraftforge.fluids.Fluid;
public class GasRegistry
{
- private static ArrayList<Gas> registeredGasses = new ArrayList<Gas>();
+ private static ArrayList<Gas> registeredGasses = new ArrayList<Gas>();
/**
* Register a new gas into GasRegistry.
@@ -48,7 +48,7 @@ public class GasRegistry
*/
public static Gas getGas(Fluid f)
{
- for(Gas gas : getRegisteredGasses())
+ for(final Gas gas : getRegisteredGasses())
{
if(gas.hasFluid() && gas.getFluid() == f)
{
@@ -75,7 +75,7 @@ public class GasRegistry
*/
public static List<Gas> getRegisteredGasses()
{
- return (List<Gas>)registeredGasses.clone();
+ return (List<Gas>) registeredGasses.clone();
}
/**
@@ -85,7 +85,7 @@ public class GasRegistry
*/
public static Gas getGas(String name)
{
- for(Gas gas : registeredGasses)
+ for(final Gas gas : registeredGasses)
{
if(gas.getName().toLowerCase().equals(name.toLowerCase()))
{
diff --git a/src/api/java/mekanism/api/gas/GasStack.java b/src/api/java/mekanism/api/gas/GasStack.java
index 05e5ae6..6d04a53 100644
--- a/src/api/java/mekanism/api/gas/GasStack.java
+++ b/src/api/java/mekanism/api/gas/GasStack.java
@@ -9,9 +9,9 @@ import net.minecraft.nbt.NBTTagCompound;
*/
public class GasStack
{
- private Gas type;
+ private Gas type;
- public int amount;
+ public int amount;
/**
* Creates a new GasStack with a defined gas ID and quantity.
@@ -35,7 +35,9 @@ public class GasStack
amount = quantity;
}
- private GasStack() {}
+ private GasStack()
+ {
+ }
/**
* Gets the Gas type of this GasStack.
@@ -45,11 +47,11 @@ public class GasStack
{
return type;
}
-
+
public GasStack withAmount(int newAmount)
{
amount = newAmount;
-
+
return this;
}
@@ -88,7 +90,7 @@ public class GasStack
return null;
}
- GasStack stack = new GasStack();
+ final GasStack stack = new GasStack();
stack.read(nbtTags);
if(stack.getGas() == null || stack.amount <= 0)
diff --git a/src/api/java/mekanism/api/gas/GasTank.java b/src/api/java/mekanism/api/gas/GasTank.java
index a5d4c20..69b7a3c 100644
--- a/src/api/java/mekanism/api/gas/GasTank.java
+++ b/src/api/java/mekanism/api/gas/GasTank.java
@@ -9,11 +9,13 @@ import net.minecraft.nbt.NBTTagCompound;
*/
public class GasTank
{
- public GasStack stored;
+ public GasStack stored;
- private int maxGas;
+ private int maxGas;
- private GasTank() {}
+ private GasTank()
+ {
+ }
/**
* Creates a tank with a defined capacity.
@@ -51,7 +53,8 @@ public class GasTank
return null;
}
- GasStack ret = new GasStack(getGas().getGas(), Math.min(getStored(), amount));
+ final GasStack ret = new GasStack(getGas().getGas(),
+ Math.min(getStored(), amount));
if(ret.amount > 0)
{
@@ -84,16 +87,17 @@ public class GasTank
return 0;
}
- int toFill = Math.min(getMaxGas()-getStored(), amount.amount);
+ final int toFill = Math.min(getMaxGas() - getStored(), amount.amount);
if(doReceive)
{
if(stored == null)
{
- stored = amount.copy().withAmount(getStored()+toFill);
+ stored = amount.copy().withAmount(getStored() + toFill);
}
- else {
- stored.amount = Math.min(getMaxGas(), getStored()+amount.amount);
+ else
+ {
+ stored.amount = Math.min(getMaxGas(), getStored() + amount.amount);
}
}
@@ -151,7 +155,7 @@ public class GasTank
*/
public int getNeeded()
{
- return getMaxGas()-getStored();
+ return getMaxGas() - getStored();
}
/**
@@ -179,7 +183,7 @@ public class GasTank
{
return stored;
}
-
+
/**
* Gets the type of gas currently stored in this GasTank.
* @return gas type contained
@@ -244,7 +248,7 @@ public class GasTank
return null;
}
- GasTank tank = new GasTank();
+ final GasTank tank = new GasTank();
tank.read(nbtTags);
return tank;
diff --git a/src/api/java/mekanism/api/gas/GasTransmission.java b/src/api/java/mekanism/api/gas/GasTransmission.java
index c043eb8..a714af0 100644
--- a/src/api/java/mekanism/api/gas/GasTransmission.java
+++ b/src/api/java/mekanism/api/gas/GasTransmission.java
@@ -8,7 +8,6 @@ import java.util.List;
import mekanism.api.Coord4D;
import mekanism.api.transmitters.ITransmitterTile;
import mekanism.api.transmitters.TransmissionType;
-
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
@@ -27,15 +26,15 @@ public final class GasTransmission
*/
public static IGasHandler[] getConnectedAcceptors(TileEntity tileEntity)
{
- IGasHandler[] acceptors = new IGasHandler[] {null, null, null, null, null, null};
+ final IGasHandler[] acceptors = new IGasHandler[] {null, null, null, null, null, null};
- for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS)
+ for(final ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS)
{
- TileEntity acceptor = Coord4D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.getWorldObj());
+ final TileEntity acceptor = Coord4D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.getWorldObj());
if(acceptor instanceof IGasHandler)
{
- acceptors[orientation.ordinal()] = (IGasHandler)acceptor;
+ acceptors[orientation.ordinal()] = (IGasHandler) acceptor;
}
}
@@ -49,15 +48,15 @@ public final class GasTransmission
*/
public static ITubeConnection[] getConnections(TileEntity tileEntity)
{
- ITubeConnection[] connections = new ITubeConnection[] {null, null, null, null, null, null};
+ final ITubeConnection[] connections = new ITubeConnection[] {null, null, null, null, null, null};
- for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS)
+ for(final ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS)
{
- TileEntity connection = Coord4D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.getWorldObj());
+ final TileEntity connection = Coord4D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.getWorldObj());
if(canConnect(connection, orientation))
{
- connections[orientation.ordinal()] = (ITubeConnection)connection;
+ connections[orientation.ordinal()] = (ITubeConnection) connection;
}
}
@@ -72,9 +71,9 @@ public final class GasTransmission
*/
public static boolean canConnect(TileEntity tileEntity, ForgeDirection side)
{
- if(tileEntity instanceof ITubeConnection && (!(tileEntity instanceof ITransmitterTile) || TransmissionType.checkTransmissionType(((ITransmitterTile)tileEntity).getTransmitter(), TransmissionType.GAS)))
+ if(tileEntity instanceof ITubeConnection && (!(tileEntity instanceof ITransmitterTile) || TransmissionType.checkTransmissionType(((ITransmitterTile) tileEntity).getTransmitter(), TransmissionType.GAS)))
{
- if(((ITubeConnection)tileEntity).canTubeConnect(side.getOpposite()))
+ if(((ITubeConnection) tileEntity).canTubeConnect(side.getOpposite()))
{
return true;
}
@@ -94,7 +93,7 @@ public final class GasTransmission
{
if(itemStack != null && itemStack.getItem() instanceof IGasItem)
{
- IGasItem item = (IGasItem)itemStack.getItem();
+ final IGasItem item = (IGasItem) itemStack.getItem();
if(type != null && item.getGas(itemStack) != null && item.getGas(itemStack).getGas() != type || !item.canProvideGas(itemStack, type))
{
@@ -115,14 +114,14 @@ public final class GasTransmission
*/
public static int addGas(ItemStack itemStack, GasStack stack)
{
- if(itemStack != null && itemStack.getItem() instanceof IGasItem && ((IGasItem)itemStack.getItem()).canReceiveGas(itemStack, stack.getGas()))
+ if(itemStack != null && itemStack.getItem() instanceof IGasItem && ((IGasItem) itemStack.getItem()).canReceiveGas(itemStack, stack.getGas()))
{
- return ((IGasItem)itemStack.getItem()).addGas(itemStack, stack.copy());
+ return ((IGasItem) itemStack.getItem()).addGas(itemStack, stack.copy());
}
return 0;
}
-
+
/**
* Emits gas from a central block by splitting the received stack among the sides given.
* @param sides - the list of sides to output from
@@ -136,14 +135,14 @@ public final class GasTransmission
{
return 0;
}
-
- List<IGasHandler> availableAcceptors = new ArrayList<IGasHandler>();
- IGasHandler[] possibleAcceptors = getConnectedAcceptors(from);
-
+
+ final List<IGasHandler> availableAcceptors = new ArrayList<IGasHandler>();
+ final IGasHandler[] possibleAcceptors = getConnectedAcceptors(from);
+
for(int i = 0; i < possibleAcceptors.length; i++)
{
- IGasHandler handler = possibleAcceptors[i];
-
+ final IGasHandler handler = possibleAcceptors[i];
+
if(handler != null && handler.canReceiveGas(ForgeDirection.getOrientation(i).getOpposite(), stack.getGas()))
{
availableAcceptors.add(handler);
@@ -153,15 +152,15 @@ public final class GasTransmission
Collections.shuffle(availableAcceptors);
int toSend = stack.amount;
- int prevSending = toSend;
+ final int prevSending = toSend;
if(!availableAcceptors.isEmpty())
{
- int divider = availableAcceptors.size();
+ final int divider = availableAcceptors.size();
int remaining = toSend % divider;
- int sending = (toSend-remaining)/divider;
+ final int sending = (toSend - remaining) / divider;
- for(IGasHandler acceptor : availableAcceptors)
+ for(final IGasHandler acceptor : availableAcceptors)
{
int currentSending = sending;
@@ -170,12 +169,13 @@ public final class GasTransmission
currentSending++;
remaining--;
}
-
- ForgeDirection dir = ForgeDirection.getOrientation(Arrays.asList(possibleAcceptors).indexOf(acceptor)).getOpposite();
- toSend -= acceptor.receiveGas(dir, new GasStack(stack.getGas(), currentSending), true);
+
+ final ForgeDirection dir = ForgeDirection.getOrientation(Arrays.asList(possibleAcceptors).indexOf(acceptor)).getOpposite();
+ toSend -= acceptor.receiveGas(dir, new GasStack(stack.getGas(),
+ currentSending), true);
}
}
- return prevSending-toSend;
+ return prevSending - toSend;
}
}
diff --git a/src/api/java/mekanism/api/gas/IGasItem.java b/src/api/java/mekanism/api/gas/IGasItem.java
index 9c7d332..f95baa3 100644
--- a/src/api/java/mekanism/api/gas/IGasItem.java
+++ b/src/api/java/mekanism/api/gas/IGasItem.java
@@ -72,7 +72,7 @@ public interface IGasItem
* @return maximum gas
*/
public int getMaxGas(ItemStack itemstack);
-
+
/**
* Returns whether or not this item contains metadata-specific subtypes instead of using metadata for damage display.
* @return if the item contains metadata-specific subtypes
diff --git a/src/api/java/mekanism/api/gas/IGasTransmitter.java b/src/api/java/mekanism/api/gas/IGasTransmitter.java
index 57ec4c1..2785ac1 100644
--- a/src/api/java/mekanism/api/gas/IGasTransmitter.java
+++ b/src/api/java/mekanism/api/gas/IGasTransmitter.java
@@ -1,7 +1,6 @@
package mekanism.api.gas;
import mekanism.api.transmitters.IGridTransmitter;
-
import net.minecraft.tileentity.TileEntity;
public interface IGasTransmitter extends IGridTransmitter<IGasHandler, GasNetwork>
diff --git a/src/api/java/mekanism/api/gas/OreGas.java b/src/api/java/mekanism/api/gas/OreGas.java
index 316169c..c9d7ad8 100644
--- a/src/api/java/mekanism/api/gas/OreGas.java
+++ b/src/api/java/mekanism/api/gas/OreGas.java
@@ -4,8 +4,8 @@ import net.minecraft.util.StatCollector;
public class OreGas extends Gas
{
- private String oreName;
- private OreGas cleanGas;
+ private final String oreName;
+ private OreGas cleanGas;
public OreGas(String s, String name)
{
diff --git a/src/api/java/mekanism/api/gas/package-info.java b/src/api/java/mekanism/api/gas/package-info.java
index 4418451..2a6464c 100644
--- a/src/api/java/mekanism/api/gas/package-info.java
+++ b/src/api/java/mekanism/api/gas/package-info.java
@@ -1,3 +1,5 @@
@API(apiVersion = "8.0.0", owner = "Mekanism", provides = "MekanismAPI|gas")
package mekanism.api.gas;
-import cpw.mods.fml.common.API; \ No newline at end of file
+
+import cpw.mods.fml.common.API;
+
diff --git a/src/api/java/mekanism/api/infuse/InfuseObject.java b/src/api/java/mekanism/api/infuse/InfuseObject.java
index a86c02f..de9005e 100644
--- a/src/api/java/mekanism/api/infuse/InfuseObject.java
+++ b/src/api/java/mekanism/api/infuse/InfuseObject.java
@@ -8,10 +8,10 @@ package mekanism.api.infuse;
public class InfuseObject
{
/** The type of infuse this item stores */
- public InfuseType type;
+ public InfuseType type;
/** How much infuse this item stores */
- public int stored;
+ public int stored;
public InfuseObject(InfuseType infusion, int i)
{
diff --git a/src/api/java/mekanism/api/infuse/InfuseRegistry.java b/src/api/java/mekanism/api/infuse/InfuseRegistry.java
index 308b9c5..6916878 100644
--- a/src/api/java/mekanism/api/infuse/InfuseRegistry.java
+++ b/src/api/java/mekanism/api/infuse/InfuseRegistry.java
@@ -13,10 +13,10 @@ import net.minecraft.item.ItemStack;
public class InfuseRegistry
{
/** The (private) map of ItemStacks and their related InfuseObjects. */
- private static Map<ItemStack, InfuseObject> infuseObjects = new HashMap<ItemStack, InfuseObject>();
+ private static Map<ItemStack, InfuseObject> infuseObjects = new HashMap<ItemStack, InfuseObject>();
/** The (private) map of infuse names and their corresponding InfuseTypes. */
- private static Map<String, InfuseType> infuseTypes = new HashMap<String, InfuseType>();
+ private static Map<String, InfuseType> infuseTypes = new HashMap<String, InfuseType>();
/**
* Registers an InfuseType into the registry. Call this in PreInit!
@@ -82,7 +82,7 @@ public class InfuseRegistry
*/
public static InfuseObject getObject(ItemStack itemStack)
{
- for(Map.Entry<ItemStack, InfuseObject> obj : infuseObjects.entrySet())
+ for(final Map.Entry<ItemStack, InfuseObject> obj : infuseObjects.entrySet())
{
if(itemStack.isItemEqual(obj.getKey()))
{
diff --git a/src/api/java/mekanism/api/infuse/InfuseType.java b/src/api/java/mekanism/api/infuse/InfuseType.java
index 1f5215c..76820a8 100644
--- a/src/api/java/mekanism/api/infuse/InfuseType.java
+++ b/src/api/java/mekanism/api/infuse/InfuseType.java
@@ -11,19 +11,19 @@ import net.minecraft.util.StatCollector;
public final class InfuseType
{
/** The name of this infusion */
- public String name;
+ public String name;
/** The location of this infuse's GUI texture */
- public ResourceLocation texture;
+ public ResourceLocation texture;
/** The infuse's GUI texture X offset. */
- public int texX;
+ public int texX;
/** The infuse's GUI texture Y offset. */
- public int texY;
+ public int texY;
/** The unlocalized name of this type. */
- public String unlocalizedName;
+ public String unlocalizedName;
public InfuseType(String s, ResourceLocation location, int x, int y)
{
diff --git a/src/api/java/mekanism/api/infuse/package-info.java b/src/api/java/mekanism/api/infuse/package-info.java
index 8718996..a826ca2 100644
--- a/src/api/java/mekanism/api/infuse/package-info.java
+++ b/src/api/java/mekanism/api/infuse/package-info.java
@@ -1,3 +1,5 @@
@API(apiVersion = "8.0.0", owner = "Mekanism", provides = "MekanismAPI|infuse")
package mekanism.api.infuse;
-import cpw.mods.fml.common.API; \ No newline at end of file
+
+import cpw.mods.fml.common.API;
+
diff --git a/src/api/java/mekanism/api/lasers/package-info.java b/src/api/java/mekanism/api/lasers/package-info.java
index b456937..957b64f 100644
--- a/src/api/java/mekanism/api/lasers/package-info.java
+++ b/src/api/java/mekanism/api/lasers/package-info.java
@@ -1,3 +1,5 @@
@API(apiVersion = "8.0.0", owner = "Mekanism", provides = "MekanismAPI|laser")
package mekanism.api.lasers;
-import cpw.mods.fml.common.API; \ No newline at end of file
+
+import cpw.mods.fml.common.API;
+
diff --git a/src/api/java/mekanism/api/package-info.java b/src/api/java/mekanism/api/package-info.java
index 2b9fcab..f515694 100644
--- a/src/api/java/mekanism/api/package-info.java
+++ b/src/api/java/mekanism/api/package-info.java
@@ -1,3 +1,5 @@
@API(apiVersion = "8.0.0", owner = "Mekanism", provides = "MekanismAPI|core")
package mekanism.api;
-import cpw.mods.fml.common.API; \ No newline at end of file
+
+import cpw.mods.fml.common.API;
+
diff --git a/src/api/java/mekanism/api/reactor/IFusionReactor.java b/src/api/java/mekanism/api/reactor/IFusionReactor.java
index 9d9d96d..33d474c 100644
--- a/src/api/java/mekanism/api/reactor/IFusionReactor.java
+++ b/src/api/java/mekanism/api/reactor/IFusionReactor.java
@@ -2,7 +2,6 @@ package mekanism.api.reactor;
import mekanism.api.IHeatTransfer;
import mekanism.api.gas.GasTank;
-
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidTank;
@@ -61,6 +60,6 @@ public interface IFusionReactor extends IHeatTransfer
public int getSteamPerTick(boolean current);
public void updateTemperatures();
-
+
public ItemStack[] getInventory();
}
diff --git a/src/api/java/mekanism/api/reactor/IReactorBlock.java b/src/api/java/mekanism/api/reactor/IReactorBlock.java
index b3b8518..96d161b 100644
--- a/src/api/java/mekanism/api/reactor/IReactorBlock.java
+++ b/src/api/java/mekanism/api/reactor/IReactorBlock.java
@@ -1,6 +1,5 @@
package mekanism.api.reactor;
-
public interface IReactorBlock
{
public boolean isFrame();
diff --git a/src/api/java/mekanism/api/reactor/package-info.java b/src/api/java/mekanism/api/reactor/package-info.java
index 6a00fc6..6f11811 100644
--- a/src/api/java/mekanism/api/reactor/package-info.java
+++ b/src/api/java/mekanism/api/reactor/package-info.java
@@ -1,3 +1,5 @@
@API(apiVersion = "8.0.0", owner = "Mekanism", provides = "MekanismAPI|reactor")
package mekanism.api.reactor;
-import cpw.mods.fml.common.API; \ No newline at end of file
+
+import cpw.mods.fml.common.API;
+
diff --git a/src/api/java/mekanism/api/recipe/RecipeHelper.java b/src/api/java/mekanism/api/recipe/RecipeHelper.java
index 1040aa2..8884d44 100644
--- a/src/api/java/mekanism/api/recipe/RecipeHelper.java
+++ b/src/api/java/mekanism/api/recipe/RecipeHelper.java
@@ -4,7 +4,6 @@ import java.lang.reflect.Method;
import mekanism.api.gas.GasStack;
import mekanism.api.infuse.InfuseType;
-
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -24,11 +23,14 @@ public final class RecipeHelper
*/
public static void addEnrichmentChamberRecipe(ItemStack input, ItemStack output)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addEnrichmentChamberRecipe", ItemStack.class, ItemStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addEnrichmentChamberRecipe", ItemStack.class, ItemStack.class);
m.invoke(null, input, output);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -40,11 +42,14 @@ public final class RecipeHelper
*/
public static void addOsmiumCompressorRecipe(ItemStack input, ItemStack output)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addOsmiumCompressorRecipe", ItemStack.class, ItemStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addOsmiumCompressorRecipe", ItemStack.class, ItemStack.class);
m.invoke(null, input, output);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -56,11 +61,14 @@ public final class RecipeHelper
*/
public static void addCombinerRecipe(ItemStack input, ItemStack output)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addCombinerRecipe", ItemStack.class, ItemStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addCombinerRecipe", ItemStack.class, ItemStack.class);
m.invoke(null, input, output);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -72,11 +80,14 @@ public final class RecipeHelper
*/
public static void addCrusherRecipe(ItemStack input, ItemStack output)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addCrusherRecipe", ItemStack.class, ItemStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addCrusherRecipe", ItemStack.class, ItemStack.class);
m.invoke(null, input, output);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -88,11 +99,14 @@ public final class RecipeHelper
*/
public static void addPurificationChamberRecipe(ItemStack input, ItemStack output)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addPurificationChamberRecipe", ItemStack.class, ItemStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addPurificationChamberRecipe", ItemStack.class, ItemStack.class);
m.invoke(null, input, output);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -104,11 +118,14 @@ public final class RecipeHelper
*/
public static void addChemicalOxidizerRecipe(ItemStack input, GasStack output)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addChemicalOxidizerRecipe", ItemStack.class, GasStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addChemicalOxidizerRecipe", ItemStack.class, GasStack.class);
m.invoke(null, input, output);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -121,11 +138,14 @@ public final class RecipeHelper
*/
public static void addChemicalInfuserRecipe(GasStack leftInput, GasStack rightInput, GasStack output)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addChemicalInfuserRecipe", GasStack.class, GasStack.class, GasStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addChemicalInfuserRecipe", GasStack.class, GasStack.class, GasStack.class);
m.invoke(null, leftInput, rightInput, output);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -139,11 +159,14 @@ public final class RecipeHelper
*/
public static void addPrecisionSawmillRecipe(ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, double chance)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addPrecisionSawmillRecipe", ItemStack.class, ItemStack.class, ItemStack.class, Double.TYPE);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addPrecisionSawmillRecipe", ItemStack.class, ItemStack.class, ItemStack.class, Double.TYPE);
m.invoke(null, input, primaryOutput, secondaryOutput, chance);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -155,11 +178,14 @@ public final class RecipeHelper
*/
public static void addPrecisionSawmillRecipe(ItemStack input, ItemStack primaryOutput)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addPrecisionSawmillRecipe", ItemStack.class, ItemStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addPrecisionSawmillRecipe", ItemStack.class, ItemStack.class);
m.invoke(null, input, primaryOutput);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -171,11 +197,14 @@ public final class RecipeHelper
*/
public static void addChemicalInjectionChamberRecipe(ItemStack input, String gasName, ItemStack output)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addChemicalInjectionChamberRecipe", ItemStack.class, String.class, ItemStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addChemicalInjectionChamberRecipe", ItemStack.class, String.class, ItemStack.class);
m.invoke(null, input, gasName, output);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -189,11 +218,14 @@ public final class RecipeHelper
*/
public static void addElectrolyticSeparatorRecipe(FluidStack input, double energy, GasStack leftOutput, GasStack rightOutput)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addElectrolyticSeparatorRecipe", FluidStack.class, Double.TYPE, GasStack.class, GasStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addElectrolyticSeparatorRecipe", FluidStack.class, Double.TYPE, GasStack.class, GasStack.class);
m.invoke(null, input, energy, leftOutput, rightOutput);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -205,11 +237,14 @@ public final class RecipeHelper
*/
public static void addChemicalDissolutionChamberRecipe(ItemStack input, GasStack output)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addChemicalDissolutionChamberRecipe", ItemStack.class, GasStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addChemicalDissolutionChamberRecipe", ItemStack.class, GasStack.class);
m.invoke(null, input, output);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -221,11 +256,14 @@ public final class RecipeHelper
*/
public static void addChemicalWasherRecipe(GasStack input, GasStack output)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addChemicalWasherRecipe", GasStack.class, GasStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addChemicalWasherRecipe", GasStack.class, GasStack.class);
m.invoke(null, input, output);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -237,11 +275,14 @@ public final class RecipeHelper
*/
public static void addChemicalCrystallizerRecipe(GasStack input, ItemStack output)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addChemicalCrystallizerRecipe", GasStack.class, ItemStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addChemicalCrystallizerRecipe", GasStack.class, ItemStack.class);
m.invoke(null, input, output);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -255,11 +296,14 @@ public final class RecipeHelper
*/
public static void addMetallurgicInfuserRecipe(InfuseType infuse, int amount, ItemStack input, ItemStack output)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addMetallurgicInfuserRecipe", InfuseType.class, Integer.TYPE, ItemStack.class, ItemStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addMetallurgicInfuserRecipe", InfuseType.class, Integer.TYPE, ItemStack.class, ItemStack.class);
m.invoke(null, infuse, amount, input, output);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
@@ -276,15 +320,18 @@ public final class RecipeHelper
*/
public static void addPRCRecipe(ItemStack inputSolid, FluidStack inputFluid, GasStack inputGas, ItemStack outputSolid, GasStack outputGas, double extraEnergy, int ticks)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addPRCRecipe", ItemStack.class, FluidStack.class, GasStack.class, ItemStack.class, GasStack.class, Double.TYPE, Integer.TYPE);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addPRCRecipe", ItemStack.class, FluidStack.class, GasStack.class, ItemStack.class, GasStack.class, Double.TYPE, Integer.TYPE);
m.invoke(null, inputSolid, inputFluid, inputGas, outputSolid, outputGas, extraEnergy, ticks);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
-
+
/**
* Add a Solar Evaporation Plant recipe.
* @param input - input GasStack
@@ -292,15 +339,18 @@ public final class RecipeHelper
*/
public static void addSolarEvaporationRecipe(FluidStack input, FluidStack output)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addSolarEvaporationRecipe", FluidStack.class, FluidStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addSolarEvaporationRecipe", FluidStack.class, FluidStack.class);
m.invoke(null, input, output);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
-
+
/**
* Add a Solar Neutron Activator recipe.
* @param input - input GasStack
@@ -308,11 +358,14 @@ public final class RecipeHelper
*/
public static void addSolarNeutronRecipe(GasStack input, GasStack output)
{
- try {
- Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
- Method m = recipeClass.getMethod("addSolarEvaporationRecipe", GasStack.class, GasStack.class);
+ try
+ {
+ final Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
+ final Method m = recipeClass.getMethod("addSolarEvaporationRecipe", GasStack.class, GasStack.class);
m.invoke(null, input, output);
- } catch(Exception e) {
+ }
+ catch(final Exception e)
+ {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
diff --git a/src/api/java/mekanism/api/recipe/package-info.java b/src/api/java/mekanism/api/recipe/package-info.java
index f166da4..060e5ab 100644
--- a/src/api/java/mekanism/api/recipe/package-info.java
+++ b/src/api/java/mekanism/api/recipe/package-info.java
@@ -1,3 +1,5 @@
@API(apiVersion = "8.0.0", owner = "Mekanism", provides = "MekanismAPI|recipe")
package mekanism.api.recipe;
-import cpw.mods.fml.common.API; \ No newline at end of file
+
+import cpw.mods.fml.common.API;
+
diff --git a/src/api/java/mekanism/api/transmitters/DynamicNetwork.java b/src/api/java/mekanism/api/transmitters/DynamicNetwork.java
index ee4e8a2..39932c7 100644
--- a/src/api/java/mekanism/api/transmitters/DynamicNetwork.java
+++ b/src/api/java/mekanism/api/transmitters/DynamicNetwork.java
@@ -1,10 +1,13 @@
package mekanism.api.transmitters;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import cpw.mods.fml.common.FMLCommonHandler;
-import cpw.mods.fml.common.eventhandler.Event;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map.Entry;
+import java.util.Set;
+
import mekanism.api.Coord4D;
import mekanism.api.IClientTicker;
import mekanism.api.Range4D;
@@ -14,31 +17,35 @@ import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
-import java.util.*;
-import java.util.Map.Entry;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.eventhandler.Event;
public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implements IClientTicker, INetworkDataHandler
{
- public LinkedHashSet<IGridTransmitter<A, N>> transmitters = Sets.newLinkedHashSet();
- public LinkedHashSet<IGridTransmitter<A, N>> transmittersToAdd = Sets.newLinkedHashSet();
- public LinkedHashSet<IGridTransmitter<A, N>> transmittersAdded = Sets.newLinkedHashSet();
+ public LinkedHashSet<IGridTransmitter<A, N>> transmitters = Sets.newLinkedHashSet();
+ public LinkedHashSet<IGridTransmitter<A, N>> transmittersToAdd = Sets.newLinkedHashSet();
+ public LinkedHashSet<IGridTransmitter<A, N>> transmittersAdded = Sets.newLinkedHashSet();
- public HashMap<Coord4D, A> possibleAcceptors = new HashMap<Coord4D, A>();
- public HashMap<Coord4D, EnumSet<ForgeDirection>> acceptorDirections = new HashMap<Coord4D, EnumSet<ForgeDirection>>();
- public HashMap<IGridTransmitter<A, N>, EnumSet<ForgeDirection>> changedAcceptors = Maps.newHashMap();
+ public HashMap<Coord4D, A> possibleAcceptors = new HashMap<Coord4D, A>();
+ public HashMap<Coord4D, EnumSet<ForgeDirection>> acceptorDirections = new HashMap<Coord4D, EnumSet<ForgeDirection>>();
+ public HashMap<IGridTransmitter<A, N>, EnumSet<ForgeDirection>> changedAcceptors = Maps.newHashMap();
- private Set<DelayQueue> updateQueue = new LinkedHashSet<DelayQueue>();
+ private final Set<DelayQueue> updateQueue = new LinkedHashSet<DelayQueue>();
- protected Range4D packetRange = null;
+ protected Range4D packetRange = null;
- protected int capacity = 0;
- protected double meanCapacity = 0;
+ protected int capacity = 0;
+ protected double meanCapacity = 0;
- protected boolean needsUpdate = false;
- protected int updateDelay = 0;
+ protected boolean needsUpdate = false;
+ protected int updateDelay = 0;
- protected boolean firstUpdate = true;
- protected World worldObj = null;
+ protected boolean firstUpdate = true;
+ protected World worldObj = null;
public void addNewTransmitters(Collection<IGridTransmitter<A, N>> newTransmitters)
{
@@ -49,7 +56,7 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
{
if(!transmittersToAdd.isEmpty())
{
- for(IGridTransmitter<A, N> transmitter : transmittersToAdd)
+ for(final IGridTransmitter<A, N> transmitter : transmittersToAdd)
{
if(transmitter.isValid())
{
@@ -58,17 +65,17 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
worldObj = transmitter.world();
}
- for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
+ for(final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
updateTransmitterOnSide(transmitter, side);
}
-
- transmitter.setTransmitterNetwork((N)this);
+
+ transmitter.setTransmitterNetwork((N) this);
absorbBuffer(transmitter);
transmitters.add(transmitter);
}
}
-
+
updateCapacity();
clampBuffer();
queueClientUpdate(Lists.newArrayList(transmittersToAdd));
@@ -77,30 +84,30 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
if(!changedAcceptors.isEmpty())
{
- for(Entry<IGridTransmitter<A, N>, EnumSet<ForgeDirection>> entry : changedAcceptors.entrySet())
+ for(final Entry<IGridTransmitter<A, N>, EnumSet<ForgeDirection>> entry : changedAcceptors.entrySet())
{
- IGridTransmitter<A, N> transmitter = entry.getKey();
-
+ final IGridTransmitter<A, N> transmitter = entry.getKey();
+
if(transmitter.isValid())
{
- EnumSet<ForgeDirection> directionsChanged = entry.getValue();
+ final EnumSet<ForgeDirection> directionsChanged = entry.getValue();
- for(ForgeDirection side : directionsChanged)
+ for(final ForgeDirection side : directionsChanged)
{
updateTransmitterOnSide(transmitter, side);
}
}
}
-
+
changedAcceptors.clear();
}
}
public void updateTransmitterOnSide(IGridTransmitter<A, N> transmitter, ForgeDirection side)
{
- A acceptor = transmitter.getAcceptor(side);
- Coord4D acceptorCoord = transmitter.coord().getFromSide(side);
- EnumSet<ForgeDirection> directions = acceptorDirections.get(acceptorCoord);
+ final A acceptor = transmitter.getAcceptor(side);
+ final Coord4D acceptorCoord = transmitter.coord().getFromSide(side);
+ final EnumSet<ForgeDirection> directions = acceptorDirections.get(acceptorCoord);
if(acceptor != null)
{
@@ -110,11 +117,13 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
{
directions.add(side.getOpposite());
}
- else {
+ else
+ {
acceptorDirections.put(acceptorCoord, EnumSet.of(side.getOpposite()));
}
}
- else {
+ else
+ {
if(directions != null)
{
directions.remove(side.getOpposite());
@@ -125,7 +134,8 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
acceptorDirections.remove(acceptorCoord);
}
}
- else {
+ else
+ {
possibleAcceptors.remove(acceptorCoord);
acceptorDirections.remove(acceptorCoord);
}
@@ -139,33 +149,33 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
public void invalidate()
{
- //Remove invalid transmitters first for share calculations
- for(Iterator<IGridTransmitter<A, N>> iter = transmitters.iterator(); iter.hasNext();)
- {
- IGridTransmitter<A, N> transmitter = iter.next();
-
- if(!transmitter.isValid())
- {
- iter.remove();
- continue;
- }
- }
-
- //Clamp the new buffer
- clampBuffer();
-
- //Update all shares
- for(IGridTransmitter<A, N> transmitter : transmitters)
- {
- transmitter.updateShare();
- }
-
- //Now invalidate the transmitters
- for(IGridTransmitter<A, N> transmitter : transmitters)
+ //Remove invalid transmitters first for share calculations
+ for(final Iterator<IGridTransmitter<A, N>> iter = transmitters.iterator(); iter.hasNext();)
+ {
+ final IGridTransmitter<A, N> transmitter = iter.next();
+
+ if(!transmitter.isValid())
+ {
+ iter.remove();
+ continue;
+ }
+ }
+
+ //Clamp the new buffer
+ clampBuffer();
+
+ //Update all shares
+ for(final IGridTransmitter<A, N> transmitter : transmitters)
+ {
+ transmitter.updateShare();
+ }
+
+ //Now invalidate the transmitters
+ for(final IGridTransmitter<A, N> transmitter : transmitters)
{
invalidateTransmitter(transmitter);
}
-
+
transmitters.clear();
deregister();
}
@@ -182,39 +192,41 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
public void acceptorChanged(IGridTransmitter<A, N> transmitter, ForgeDirection side)
{
- EnumSet<ForgeDirection> directions = changedAcceptors.get(transmitter);
-
+ final EnumSet<ForgeDirection> directions = changedAcceptors.get(transmitter);
+
if(directions != null)
{
directions.add(side);
- }
- else {
+ }
+ else
+ {
changedAcceptors.put(transmitter, EnumSet.of(side));
}
-
+
TransmitterNetworkRegistry.registerChangedNetwork(this);
}
public void adoptTransmittersAndAcceptorsFrom(N net)
{
- for(IGridTransmitter<A, N> transmitter : net.transmitters)
+ for(final IGridTransmitter<A, N> transmitter : net.transmitters)
{
- transmitter.setTransmitterNetwork((N)this);
+ transmitter.setTransmitterNetwork((N) this);
transmitters.add(transmitter);
transmittersAdded.add(transmitter);
}
-
+
possibleAcceptors.putAll(net.possibleAcceptors);
-
- for(Entry<Coord4D, EnumSet<ForgeDirection>> entry : net.acceptorDirections.entrySet())
+
+ for(final Entry<Coord4D, EnumSet<ForgeDirection>> entry : net.acceptorDirections.entrySet())
{
- Coord4D coord = entry.getKey();
-
+ final Coord4D coord = entry.getKey();
+
if(acceptorDirections.containsKey(coord))
{
acceptorDirections.get(coord).addAll(entry.getValue());
}
- else {
+ else
+ {
acceptorDirections.put(coord, entry.getValue());
}
}
@@ -227,10 +239,10 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
{
return genPacketRange();
}
-
+
return packetRange;
}
-
+
protected Range4D genPacketRange()
{
if(getSize() == 0)
@@ -239,29 +251,48 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
return null;
}
- IGridTransmitter<A, N> initTransmitter = transmitters.iterator().next();
- Coord4D initCoord = initTransmitter.coord();
-
+ final IGridTransmitter<A, N> initTransmitter = transmitters.iterator().next();
+ final Coord4D initCoord = initTransmitter.coord();
+
int minX = initCoord.xCoord;
int minY = initCoord.yCoord;
int minZ = initCoord.zCoord;
int maxX = initCoord.xCoord;
int maxY = initCoord.yCoord;
int maxZ = initCoord.zCoord;
-
- for(IGridTransmitter transmitter : transmitters)
+
+ for(final IGridTransmitter transmitter : transmitters)
{
- Coord4D coord = transmitter.coord();
-
- if(coord.xCoord < minX) minX = coord.xCoord;
- if(coord.yCoord < minY) minY = coord.yCoord;
- if(coord.zCoord < minZ) minZ = coord.zCoord;
- if(coord.xCoord > maxX) maxX = coord.xCoord;
- if(coord.yCoord > maxY) maxY = coord.yCoord;
- if(coord.zCoord > maxZ) maxZ = coord.zCoord;
+ final Coord4D coord = transmitter.coord();
+
+ if(coord.xCoord < minX)
+ {
+ minX = coord.xCoord;
+ }
+ if(coord.yCoord < minY)
+ {
+ minY = coord.yCoord;
+ }
+ if(coord.zCoord < minZ)
+ {
+ minZ = coord.zCoord;
+ }
+ if(coord.xCoord > maxX)
+ {
+ maxX = coord.xCoord;
+ }
+ if(coord.yCoord > maxY)
+ {
+ maxY = coord.yCoord;
+ }
+ if(coord.zCoord > maxZ)
+ {
+ maxZ = coord.zCoord;
+ }
}
-
- return new Range4D(minX, minY, minZ, maxX, maxY, maxZ, initTransmitter.world().provider.dimensionId);
+
+ return new Range4D(minX, minY, minZ, maxX, maxY, maxZ,
+ initTransmitter.world().provider.dimensionId);
}
public void register()
@@ -270,8 +301,9 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
{
TransmitterNetworkRegistry.getInstance().registerNetwork(this);
}
- else {
- MinecraftForge.EVENT_BUS.post(new ClientTickUpdate(this, (byte)1));
+ else
+ {
+ MinecraftForge.EVENT_BUS.post(new ClientTickUpdate(this, (byte) 1));
}
}
@@ -283,8 +315,9 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
{
TransmitterNetworkRegistry.getInstance().removeNetwork(this);
}
- else {
- MinecraftForge.EVENT_BUS.post(new ClientTickUpdate(this, (byte)0));
+ else
+ {
+ MinecraftForge.EVENT_BUS.post(new ClientTickUpdate(this, (byte) 0));
}
}
@@ -298,31 +331,32 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
return possibleAcceptors.size();
}
- public synchronized void updateCapacity()
+ public synchronized void updateCapacity()
{
updateMeanCapacity();
- capacity = (int)meanCapacity * transmitters.size();
+ capacity = (int) meanCapacity * transmitters.size();
}
- /**
- * Override this if things can have variable capacity along the network.
- * @return An 'average' value of capacity. Calculate it how you will.
- */
- protected synchronized void updateMeanCapacity()
+ /**
+ * Override this if things can have variable capacity along the network.
+ * @return An 'average' value of capacity. Calculate it how you will.
+ */
+ protected synchronized void updateMeanCapacity()
{
- if(transmitters.size() > 0)
+ if(transmitters.size() > 0)
{
meanCapacity = transmitters.iterator().next().getCapacity();
- }
- else {
+ }
+ else
+ {
meanCapacity = 0;
}
}
-
- public int getCapacity()
- {
- return capacity;
- }
+
+ public int getCapacity()
+ {
+ return capacity;
+ }
public World getWorld()
{
@@ -340,24 +374,29 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
{
if(FMLCommonHandler.instance().getEffectiveSide().isServer())
{
- Iterator<DelayQueue> i = updateQueue.iterator();
+ final Iterator<DelayQueue> i = updateQueue.iterator();
- try {
+ try
+ {
while(i.hasNext())
{
- DelayQueue q = i.next();
+ final DelayQueue q = i.next();
if(q.delay > 0)
{
q.delay--;
- }
- else {
+ }
+ else
+ {
transmittersAdded.addAll(transmitters);
updateDelay = 1;
i.remove();
}
}
- } catch(Exception e) {}
+ }
+ catch(final Exception e)
+ {
+ }
if(updateDelay > 0)
{
@@ -365,7 +404,8 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
if(updateDelay == 0)
{
- MinecraftForge.EVENT_BUS.post(new TransmittersAddedEvent(this, firstUpdate, (Collection)transmittersAdded));
+ MinecraftForge.EVENT_BUS.post(new TransmittersAddedEvent(
+ this, firstUpdate, (Collection) transmittersAdded));
firstUpdate = false;
transmittersAdded.clear();
needsUpdate = true;
@@ -381,7 +421,9 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
}
@Override
- public void clientTick() {}
+ public void clientTick()
+ {
+ }
public void queueClientUpdate(Collection<IGridTransmitter<A, N>> newTransmitters)
{
@@ -391,9 +433,9 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
public static class TransmittersAddedEvent extends Event
{
- public DynamicNetwork<?, ?> network;
- public boolean newNetwork;
- public Collection<IGridTransmitter> newTransmitters;
+ public DynamicNetwork<?, ?> network;
+ public boolean newNetwork;
+ public Collection<IGridTransmitter> newTransmitters;
public TransmittersAddedEvent(DynamicNetwork net, boolean newNet, Collection<IGridTransmitter> added)
{
@@ -405,8 +447,8 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
public static class ClientTickUpdate extends Event
{
- public DynamicNetwork network;
- public byte operation; /*0 remove, 1 add*/
+ public DynamicNetwork network;
+ public byte operation; /*0 remove, 1 add*/
public ClientTickUpdate(DynamicNetwork net, byte b)
{
@@ -417,7 +459,7 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
public static class NetworkClientRequest extends Event
{
- public TileEntity tileEntity;
+ public TileEntity tileEntity;
public NetworkClientRequest(TileEntity tile)
{
@@ -432,8 +474,8 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
public static class DelayQueue
{
- public EntityPlayer player;
- public int delay;
+ public EntityPlayer player;
+ public int delay;
public DelayQueue(EntityPlayer p)
{
@@ -450,7 +492,7 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
@Override
public boolean equals(Object o)
{
- return o instanceof DelayQueue && ((DelayQueue)o).player.equals(this.player);
+ return o instanceof DelayQueue && ((DelayQueue) o).player.equals(this.player);
}
}
}
diff --git a/src/api/java/mekanism/api/transmitters/IBlockableConnection.java b/src/api/java/mekanism/api/transmitters/IBlockableConnection.java
index f6811fb..1183975 100644
--- a/src/api/java/mekanism/api/transmitters/IBlockableConnection.java
+++ b/src/api/java/mekanism/api/transmitters/IBlockableConnection.java
@@ -5,6 +5,6 @@ import net.minecraftforge.common.util.ForgeDirection;
public interface IBlockableConnection
{
public boolean canConnectMutual(ForgeDirection side);
-
+
public boolean canConnect(ForgeDirection side);
}
diff --git a/src/api/java/mekanism/api/transmitters/IGridTransmitter.java b/src/api/java/mekanism/api/transmitters/IGridTransmitter.java
index 9d82d48..a184377 100644
--- a/src/api/java/mekanism/api/transmitters/IGridTransmitter.java
+++ b/src/api/java/mekanism/api/transmitters/IGridTransmitter.java
@@ -1,11 +1,11 @@
package mekanism.api.transmitters;
+import java.util.Collection;
+
import mekanism.api.Coord4D;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
-import java.util.Collection;
-
public interface IGridTransmitter<A, N extends DynamicNetwork<A, N>> extends ITransmitter
{
public boolean hasTransmitterNetwork();
@@ -37,7 +37,7 @@ public interface IGridTransmitter<A, N extends DynamicNetwork<A, N>> extends ITr
public int getCapacity();
public World world();
-
+
public Coord4D coord();
public Coord4D getAdjacentConnectableTransmitterCoord(ForgeDirection side);
@@ -58,7 +58,7 @@ public interface IGridTransmitter<A, N extends DynamicNetwork<A, N>> extends ITr
public void takeShare();
- public void updateShare();
+ public void updateShare();
public Object getBuffer();
}
diff --git a/src/api/java/mekanism/api/transmitters/TransmissionType.java b/src/api/java/mekanism/api/transmitters/TransmissionType.java
index 7b54e9c..34aed37 100644
--- a/src/api/java/mekanism/api/transmitters/TransmissionType.java
+++ b/src/api/java/mekanism/api/transmitters/TransmissionType.java
@@ -1,37 +1,32 @@
package mekanism.api.transmitters;
import mekanism.api.gas.IGasTransmitter;
-
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.StatCollector;
public enum TransmissionType
{
- ENERGY("EnergyNetwork", "Energy"),
- FLUID("FluidNetwork", "Fluids"),
- GAS("GasNetwork", "Gases"),
- ITEM("InventoryNetwork", "Items"),
- HEAT("HeatNetwork", "Heat");
-
- private String name;
- private String transmission;
-
+ ENERGY("EnergyNetwork", "Energy"), FLUID("FluidNetwork", "Fluids"), GAS("GasNetwork", "Gases"), ITEM("InventoryNetwork", "Items"), HEAT("HeatNetwork", "Heat");
+
+ private String name;
+ private String transmission;
+
private TransmissionType(String n, String t)
{
name = n;
transmission = t;
}
-
+
public String getName()
{
return name;
}
-
+
public String getTransmission()
{
return transmission;
}
-
+
public String localize()
{
return StatCollector.translateToLocal("transmission." + getTransmission());
@@ -61,7 +56,7 @@ public enum TransmissionType
{
if(sideTile instanceof ITransmitter)
{
- if(((ITransmitter)sideTile).getTransmissionType() == this)
+ if(((ITransmitter) sideTile).getTransmissionType() == this)
{
return true;
}
@@ -69,7 +64,7 @@ public enum TransmissionType
if(this == GAS && currentTile instanceof IGasTransmitter)
{
- if(((IGasTransmitter)currentTile).canTransferGasToTube(sideTile))
+ if(((IGasTransmitter) currentTile).canTransferGasToTube(sideTile))
{
return true;
}
@@ -77,4 +72,4 @@ public enum TransmissionType
return false;
}
-} \ No newline at end of file
+}
diff --git a/src/api/java/mekanism/api/transmitters/TransmitterNetworkRegistry.java b/src/api/java/mekanism/api/transmitters/TransmitterNetworkRegistry.java
index 0f9c1c5..4bf6a22 100644
--- a/src/api/java/mekanism/api/transmitters/TransmitterNetworkRegistry.java
+++ b/src/api/java/mekanism/api/transmitters/TransmitterNetworkRegistry.java
@@ -21,16 +21,16 @@ import cpw.mods.fml.relauncher.Side;
public class TransmitterNetworkRegistry
{
- private static TransmitterNetworkRegistry INSTANCE = new TransmitterNetworkRegistry();
- private static boolean loaderRegistered = false;
+ private static TransmitterNetworkRegistry INSTANCE = new TransmitterNetworkRegistry();
+ private static boolean loaderRegistered = false;
- private HashSet<DynamicNetwork> networks = Sets.newHashSet();
- private HashSet<DynamicNetwork> networksToChange = Sets.newHashSet();
+ private final HashSet<DynamicNetwork> networks = Sets.newHashSet();
+ private final HashSet<DynamicNetwork> networksToChange = Sets.newHashSet();
- private HashSet<IGridTransmitter> invalidTransmitters = Sets.newHashSet();
- private HashMap<Coord4D, IGridTransmitter> orphanTransmitters = Maps.newHashMap();
+ private final HashSet<IGridTransmitter> invalidTransmitters = Sets.newHashSet();
+ private final HashMap<Coord4D, IGridTransmitter> orphanTransmitters = Maps.newHashMap();
- private Logger logger = LogManager.getLogger("MekanismTransmitters");
+ private final Logger logger = LogManager.getLogger("MekanismTransmitters");
public static void initiate()
{
@@ -100,7 +100,7 @@ public class TransmitterNetworkRegistry
commitChanges();
- for(DynamicNetwork net : networks)
+ for(final DynamicNetwork net : networks)
{
net.tick();
}
@@ -112,20 +112,20 @@ public class TransmitterNetworkRegistry
{
logger.info("Dealing with " + invalidTransmitters.size() + " invalid Transmitters");
}
-
- for(IGridTransmitter invalid : invalidTransmitters)
+
+ for(final IGridTransmitter invalid : invalidTransmitters)
{
if(!(invalid.isOrphan() && invalid.isValid()))
{
- DynamicNetwork n = invalid.getTransmitterNetwork();
-
+ final DynamicNetwork n = invalid.getTransmitterNetwork();
+
if(n != null)
{
n.invalidate();
}
}
}
-
+
invalidTransmitters.clear();
}
@@ -135,18 +135,18 @@ public class TransmitterNetworkRegistry
{
logger.info("Dealing with " + orphanTransmitters.size() + " orphan Transmitters");
}
-
- for(IGridTransmitter orphanTransmitter : orphanTransmitters.values())
+
+ for(final IGridTransmitter orphanTransmitter : orphanTransmitters.values())
{
- DynamicNetwork network = getNetworkFromOrphan(orphanTransmitter);
-
+ final DynamicNetwork network = getNetworkFromOrphan(orphanTransmitter);
+
if(network != null)
{
networksToChange.add(network);
network.register();
}
}
-
+
orphanTransmitters.clear();
}
@@ -154,10 +154,11 @@ public class TransmitterNetworkRegistry
{
if(startOrphan.isValid() && startOrphan.isOrphan())
{
- OrphanPathFinder<A, N> finder = new OrphanPathFinder<A, N>(startOrphan);
+ final OrphanPathFinder<A, N> finder = new OrphanPathFinder<A, N>(
+ startOrphan);
finder.start();
N network;
-
+
switch(finder.networksFound.size())
{
case 0:
@@ -165,43 +166,43 @@ public class TransmitterNetworkRegistry
{
logger.info("No networks found. Creating new network for " + finder.connectedTransmitters.size() + " transmitters");
}
-
+
network = startOrphan.createEmptyNetwork();
-
+
break;
case 1:
if(MekanismAPI.debug)
{
logger.info("Adding " + finder.connectedTransmitters.size() + " transmitters to single found network");
}
-
+
network = finder.networksFound.iterator().next();
-
+
break;
default:
if(MekanismAPI.debug)
{
logger.info("Merging " + finder.networksFound.size() + " networks with " + finder.connectedTransmitters.size() + " new transmitters");
}
-
+
network = startOrphan.mergeNetworks(finder.networksFound);
}
-
+
network.addNewTransmitters(finder.connectedTransmitters);
-
+
return network;
}
-
+
return null;
}
public void commitChanges()
{
- for(DynamicNetwork network : networksToChange)
+ for(final DynamicNetwork network : networksToChange)
{
network.commit();
}
-
+
networksToChange.clear();
}
@@ -213,10 +214,10 @@ public class TransmitterNetworkRegistry
public String[] toStrings()
{
- String[] strings = new String[networks.size()];
+ final String[] strings = new String[networks.size()];
int i = 0;
- for(DynamicNetwork network : networks)
+ for(final DynamicNetwork network : networks)
{
strings[i++] = network.toString();
}
@@ -226,12 +227,12 @@ public class TransmitterNetworkRegistry
public class OrphanPathFinder<A, N extends DynamicNetwork<A, N>>
{
- public IGridTransmitter<A, N> startPoint;
+ public IGridTransmitter<A, N> startPoint;
- public HashSet<Coord4D> iterated = Sets.newHashSet();
+ public HashSet<Coord4D> iterated = Sets.newHashSet();
- public HashSet<IGridTransmitter<A, N>> connectedTransmitters = Sets.newHashSet();
- public HashSet<N> networksFound = Sets.newHashSet();
+ public HashSet<IGridTransmitter<A, N>> connectedTransmitters = Sets.newHashSet();
+ public HashSet<N> networksFound = Sets.newHashSet();
public OrphanPathFinder(IGridTransmitter<A, N> start)
{
@@ -251,22 +252,22 @@ public class TransmitterNetworkRegistry
}
iterated.add(from);
-
+
if(orphanTransmitters.containsKey(from))
{
- IGridTransmitter<A, N> transmitter = orphanTransmitters.get(from);
-
+ final IGridTransmitter<A, N> transmitter = orphanTransmitters.get(from);
+
if(transmitter.isValid() && transmitter.isOrphan())
{
connectedTransmitters.add(transmitter);
transmitter.setOrphan(false);
-
- for(ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
+
+ for(final ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
{
if(direction != fromDirection)
{
- Coord4D directionCoord = transmitter.getAdjacentConnectableTransmitterCoord(direction);
-
+ final Coord4D directionCoord = transmitter.getAdjacentConnectableTransmitterCoord(direction);
+
if(!(directionCoord == null || iterated.contains(directionCoord)))
{
iterate(directionCoord, direction.getOpposite());
@@ -274,16 +275,20 @@ public class TransmitterNetworkRegistry
}
}
}
- }
- else {
+ }
+ else
+ {
addNetworkToIterated(from);
}
}
public void addNetworkToIterated(Coord4D from)
{
- N net = startPoint.getExternalNetwork(from);
- if(net != null) networksFound.add(net);
+ final N net = startPoint.getExternalNetwork(from);
+ if(net != null)
+ {
+ networksFound.add(net);
+ }
}
}
}
diff --git a/src/api/java/mekanism/api/transmitters/package-info.java b/src/api/java/mekanism/api/transmitters/package-info.java
index 06819e7..e959a85 100644
--- a/src/api/java/mekanism/api/transmitters/package-info.java
+++ b/src/api/java/mekanism/api/transmitters/package-info.java
@@ -1,3 +1,5 @@
@API(apiVersion = "8.0.0", owner = "Mekanism", provides = "MekanismAPI|transmitter")
package mekanism.api.transmitters;
-import cpw.mods.fml.common.API; \ No newline at end of file
+
+import cpw.mods.fml.common.API;
+
diff --git a/src/api/java/mekanism/api/util/BlockInfo.java b/src/api/java/mekanism/api/util/BlockInfo.java
index 2cb40d7..a0e349d 100644
--- a/src/api/java/mekanism/api/util/BlockInfo.java
+++ b/src/api/java/mekanism/api/util/BlockInfo.java
@@ -5,8 +5,8 @@ import net.minecraft.item.ItemStack;
public class BlockInfo
{
- public Block block;
- public int meta;
+ public Block block;
+ public int meta;
public BlockInfo(Block b, int j)
{
@@ -16,15 +16,14 @@ public class BlockInfo
public static BlockInfo get(ItemStack stack)
{
- return new BlockInfo(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage());
+ return new BlockInfo(Block.getBlockFromItem(stack.getItem()),
+ stack.getItemDamage());
}
@Override
public boolean equals(Object obj)
{
- return obj instanceof BlockInfo &&
- ((BlockInfo)obj).block == block &&
- ((BlockInfo)obj).meta == meta;
+ return obj instanceof BlockInfo && ((BlockInfo) obj).block == block && ((BlockInfo) obj).meta == meta;
}
@Override
@@ -35,4 +34,4 @@ public class BlockInfo
code = 31 * code + meta;
return code;
}
-} \ No newline at end of file
+}
diff --git a/src/api/java/mekanism/api/util/ItemInfo.java b/src/api/java/mekanism/api/util/ItemInfo.java
index f27065b..9a810b7 100644
--- a/src/api/java/mekanism/api/util/ItemInfo.java
+++ b/src/api/java/mekanism/api/util/ItemInfo.java
@@ -5,8 +5,8 @@ import net.minecraft.item.ItemStack;
public class ItemInfo
{
- public Item item;
- public int meta;
+ public Item item;
+ public int meta;
public ItemInfo(Item i, int j)
{
@@ -22,9 +22,7 @@ public class ItemInfo
@Override
public boolean equals(Object obj)
{
- return obj instanceof ItemInfo &&
- ((ItemInfo)obj).item == item &&
- ((ItemInfo)obj).meta == meta;
+ return obj instanceof ItemInfo && ((ItemInfo) obj).item == item && ((ItemInfo) obj).meta == meta;
}
@Override
diff --git a/src/api/java/mekanism/api/util/ListUtils.java b/src/api/java/mekanism/api/util/ListUtils.java
index e20807c..4637ae3 100644
--- a/src/api/java/mekanism/api/util/ListUtils.java
+++ b/src/api/java/mekanism/api/util/ListUtils.java
@@ -9,7 +9,7 @@ public class ListUtils
{
public static <V> List<V> inverse(List<V> list)
{
- List<V> toReturn = new ArrayList<V>();
+ final List<V> toReturn = new ArrayList<V>();
for(int i = list.size() - 1; i >= 0; i--)
{
@@ -27,10 +27,11 @@ public class ListUtils
{
toReturn = copy(list);
}
- else {
+ else
+ {
int count = 0;
- for(V obj : list)
+ for(final V obj : list)
{
count++;
@@ -48,9 +49,9 @@ public class ListUtils
public static <V> List<V> copy(List<V> list)
{
- List<V> toReturn = new ArrayList<V>();
+ final List<V> toReturn = new ArrayList<V>();
- for(V obj : list)
+ for(final V obj : list)
{
toReturn.add(obj);
}
@@ -60,14 +61,14 @@ public class ListUtils
public static <V> List<V> merge(List<V> listOne, List<V> listTwo)
{
- List<V> newList = new ArrayList<V>();
+ final List<V> newList = new ArrayList<V>();
- for(V obj : listOne)
+ for(final V obj : listOne)
{
newList.add(obj);
}
- for(V obj : listTwo)
+ for(final V obj : listTwo)
{
newList.add(obj);
}
@@ -77,19 +78,20 @@ public class ListUtils
public static <V> List<V> capRemains(List<V> list, int cap)
{
- List<V> toReturn = new ArrayList<V>();
+ final List<V> toReturn = new ArrayList<V>();
if(list.size() <= cap)
{
return toReturn;
}
- else {
- List<V> inverse = inverse(list);
+ else
+ {
+ inverse(list);
- int iterNeeded = list.size() - cap;
+ final int iterNeeded = list.size() - cap;
int count = 0;
- for(V obj : list)
+ for(final V obj : list)
{
count++;
@@ -108,18 +110,18 @@ public class ListUtils
public static <V> ArrayList<List<V>> split(List<V> list, int divide)
{
int remain = list.size() % divide;
- int size = (list.size() - remain) / divide;
+ final int size = (list.size() - remain) / divide;
- ArrayList<List<V>> toReturn = new ArrayList<List<V>>();
+ final ArrayList<List<V>> toReturn = new ArrayList<List<V>>();
for(int i = 0; i < divide; i++)
{
toReturn.add(i, new ArrayList<V>());
}
- for(List<V> iterSet : toReturn)
+ for(final List<V> iterSet : toReturn)
{
- List<V> removed = new ArrayList<V>();
+ final List<V> removed = new ArrayList<V>();
int toAdd = size;
@@ -129,7 +131,7 @@ public class ListUtils
toAdd++;
}
- for(V obj : list)
+ for(final V obj : list)
{
if(toAdd == 0)
{
@@ -141,7 +143,7 @@ public class ListUtils
toAdd--;
}
- for(V obj : removed)
+ for(final V obj : removed)
{
list.remove(obj);
}
@@ -152,7 +154,7 @@ public class ListUtils
public static <V> V getTop(List<V> list)
{
- for(V obj : list)
+ for(final V obj : list)
{
return obj;
}
@@ -162,22 +164,22 @@ public class ListUtils
public static <V> List<V> asList(Set<V> set)
{
- return (List<V>)Arrays.asList(set.toArray());
+ return (List<V>) Arrays.asList(set.toArray());
}
public static <V> List<V> asList(V... values)
{
- return (List<V>)Arrays.asList(values);
+ return Arrays.asList(values);
}
public static double[] splitDouble(int size, double num)
{
- double[] split = new double[size];
+ final double[] split = new double[size];
for(int i = 0; i < size; i++)
{
- double remain = num%size;
- double ret = (num-remain)/size;
+ final double remain = num % size;
+ double ret = (num - remain) / size;
ret += remain;
split[i] = ret;
@@ -189,14 +191,17 @@ public class ListUtils
public static double[] percent(double[] values)
{
- double[] ret = new double[values.length];
+ final double[] ret = new double[values.length];
double total = 0;
- for(double d : values) total += d;
+ for(final double d : values)
+ {
+ total += d;
+ }
for(int i = 0; i < values.length; i++)
{
- ret[i] = values[i]/total;
+ ret[i] = values[i] / total;
}
return ret;
@@ -204,23 +209,26 @@ public class ListUtils
public static int[] calcPercentInt(double[] percent, int val)
{
- int[] ret = new int[percent.length];
+ final int[] ret = new int[percent.length];
for(int i = 0; i < percent.length; i++)
{
- ret[i] = (int)Math.round(val*percent[i]);
+ ret[i] = (int) Math.round(val * percent[i]);
}
int newTotal = 0;
- for(int i : ret) newTotal += i;
+ for(final int i : ret)
+ {
+ newTotal += i;
+ }
- int diff = val-newTotal;
+ int diff = val - newTotal;
if(diff != val)
{
for(int i = 0; i < ret.length; i++)
{
- int num = ret[i];
+ final int num = ret[i];
if(diff < 0 && num == 0)
{
@@ -250,12 +258,12 @@ public class ListUtils
public static int[] splitInt(int size, int num)
{
- int[] split = new int[size];
+ final int[] split = new int[size];
for(int i = 0; i < size; i++)
{
- int remain = num%size;
- int ret = (num-remain)/size;
+ final int remain = num % size;
+ int ret = (num - remain) / size;
ret += remain;
split[i] = ret;
@@ -267,14 +275,17 @@ public class ListUtils
public static double[] percent(int[] values)
{
- double[] ret = new double[values.length];
+ final double[] ret = new double[values.length];
double total = 0;
- for(double d : values) total += d;
+ for(final double d : values)
+ {
+ total += d;
+ }
for(int i = 0; i < values.length; i++)
{
- ret[i] = values[i]/total;
+ ret[i] = values[i] / total;
}
return ret;
diff --git a/src/api/java/mekanism/api/util/StackUtils.java b/src/api/java/mekanism/api/util/StackUtils.java
index 7363c75..17cfe3e 100644
--- a/src/api/java/mekanism/api/util/StackUtils.java
+++ b/src/api/java/mekanism/api/util/StackUtils.java
@@ -16,7 +16,7 @@ public final class StackUtils
return null;
}
- List<ItemStack> ret = new ArrayList<ItemStack>();
+ final List<ItemStack> ret = new ArrayList<ItemStack>();
if(stack.stackSize == 1)
{
@@ -24,10 +24,10 @@ public final class StackUtils
return ret;
}
- int remain = stack.stackSize % 2;
- int split = (int)((float)(stack.stackSize)/2F);
+ final int remain = stack.stackSize % 2;
+ final int split = (int) ((stack.stackSize) / 2F);
- ret.add(size(stack, split+remain));
+ ret.add(size(stack, split + remain));
ret.add(size(stack, split));
return ret;
@@ -59,7 +59,7 @@ public final class StackUtils
{
return check == wild;
}
-
+
return wild.getItem() == check.getItem() && (wild.getItemDamage() == OreDictionary.WILDCARD_VALUE || wild.getItemDamage() == check.getItemDamage());
}
@@ -70,9 +70,9 @@ public final class StackUtils
public static List<ItemStack> even(ItemStack stack1, ItemStack stack2)
{
- ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ final ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
- if(getSize(stack1) == getSize(stack2) || Math.abs(getSize(stack1)-getSize(stack2)) == 1)
+ if(getSize(stack1) == getSize(stack2) || Math.abs(getSize(stack1) - getSize(stack2)) == 1)
{
ret.add(stack1);
ret.add(stack2);
@@ -82,18 +82,18 @@ public final class StackUtils
if(getSize(stack1) > getSize(stack2))
{
- int diff = getSize(stack1)-getSize(stack2);
+ final int diff = getSize(stack1) - getSize(stack2);
- List<ItemStack> split = split(size(stack1, diff));
+ final List<ItemStack> split = split(size(stack1, diff));
ret.add(subtract(stack1, split.get(0)));
ret.add(add(stack2, split.get(0)));
}
else if(getSize(stack2) > getSize(stack1))
{
- int diff = getSize(stack2)-getSize(stack1);
+ final int diff = getSize(stack2) - getSize(stack1);
- List<ItemStack> split = split(size(stack2, diff));
+ final List<ItemStack> split = split(size(stack2, diff));
ret.add(subtract(stack2, split.get(0)));
ret.add(add(stack1, split.get(0)));
@@ -113,7 +113,7 @@ public final class StackUtils
return stack1;
}
- return size(stack1, getSize(stack1)+getSize(stack2));
+ return size(stack1, getSize(stack1) + getSize(stack2));
}
public static ItemStack subtract(ItemStack stack1, ItemStack stack2)
@@ -127,7 +127,7 @@ public final class StackUtils
return stack1;
}
- return size(stack1, getSize(stack1)-getSize(stack2));
+ return size(stack1, getSize(stack1) - getSize(stack2));
}
public static ItemStack size(ItemStack stack, int size)
@@ -137,7 +137,7 @@ public final class StackUtils
return null;
}
- ItemStack ret = stack.copy();
+ final ItemStack ret = stack.copy();
ret.stackSize = size;
return ret;
}
@@ -156,27 +156,27 @@ public final class StackUtils
{
return stack != null ? stack.stackSize : 0;
}
-
+
public static List<ItemStack> getMergeRejects(ItemStack[] orig, ItemStack[] toAdd)
{
- List<ItemStack> ret = new ArrayList<ItemStack>();
-
+ final List<ItemStack> ret = new ArrayList<ItemStack>();
+
for(int i = 0; i < toAdd.length; i++)
{
if(toAdd[i] != null)
{
- ItemStack reject = getMergeReject(orig[i], toAdd[i]);
-
+ final ItemStack reject = getMergeReject(orig[i], toAdd[i]);
+
if(reject != null)
{
ret.add(reject);
}
}
}
-
+
return ret;
}
-
+
public static void merge(ItemStack[] orig, ItemStack[] toAdd)
{
for(int i = 0; i < toAdd.length; i++)
@@ -187,51 +187,52 @@ public final class StackUtils
}
}
}
-
+
public static ItemStack merge(ItemStack orig, ItemStack toAdd)
{
if(orig == null)
{
return toAdd;
}
-
+
if(toAdd == null)
{
return orig;
}
-
+
if(!orig.isItemEqual(toAdd) || !ItemStack.areItemStackTagsEqual(orig, toAdd))
{
return orig;
}
-
- return StackUtils.size(orig, Math.min(orig.getMaxStackSize(), orig.stackSize+toAdd.stackSize));
+
+ return StackUtils.size(orig, Math.min(orig.getMaxStackSize(), orig.stackSize + toAdd.stackSize));
}
-
+
public static ItemStack getMergeReject(ItemStack orig, ItemStack toAdd)
{
if(orig == null)
{
return null;
}
-
+
if(toAdd == null)
{
return orig;
}
-
+
if(!orig.isItemEqual(toAdd) || !ItemStack.areItemStackTagsEqual(orig, toAdd))
{
return orig;
}
-
- int newSize = orig.stackSize+toAdd.stackSize;
-
+
+ final int newSize = orig.stackSize + toAdd.stackSize;
+
if(newSize > orig.getMaxStackSize())
{
- return StackUtils.size(orig, newSize-orig.getMaxStackSize());
+ return StackUtils.size(orig, newSize - orig.getMaxStackSize());
}
- else {
+ else
+ {
return StackUtils.size(orig, newSize);
}
}
@@ -247,8 +248,8 @@ public final class StackUtils
{
return -1;
}
-
- String name = stack.getItemDamage() == OreDictionary.WILDCARD_VALUE ? stack.getItem().getUnlocalizedName() : stack.getItem().getUnlocalizedName(stack);
+
+ final String name = stack.getItemDamage() == OreDictionary.WILDCARD_VALUE ? stack.getItem().getUnlocalizedName() : stack.getItem().getUnlocalizedName(stack);
return name.hashCode() << 8 | stack.getItemDamage();
}
}
diff --git a/src/api/java/mekanism/api/util/UnitDisplayUtils.java b/src/api/java/mekanism/api/util/UnitDisplayUtils.java
index 9dd3e28..30eace1 100644
--- a/src/api/java/mekanism/api/util/UnitDisplayUtils.java
+++ b/src/api/java/mekanism/api/util/UnitDisplayUtils.java
@@ -7,13 +7,10 @@ public class UnitDisplayUtils
{
public static enum ElectricUnit
{
- JOULES("Joule", "J"),
- REDSTONE_FLUX("Redstone Flux", "RF"),
- MINECRAFT_JOULES("Minecraft Joule", "MJ"),
- ELECTRICAL_UNITS("Electrical Unit", "EU");
+ JOULES("Joule", "J"), REDSTONE_FLUX("Redstone Flux", "RF"), MINECRAFT_JOULES("Minecraft Joule", "MJ"), ELECTRICAL_UNITS("Electrical Unit", "EU");
- public String name;
- public String symbol;
+ public String name;
+ public String symbol;
private ElectricUnit(String s, String s1)
{
@@ -29,16 +26,12 @@ public class UnitDisplayUtils
public static enum TemperatureUnit
{
- KELVIN("Kelvin", "K", 0, 1),
- CELSIUS("Celsius", "°C", 273.15, 1),
- RANKINE("Rankine", "R", 0, 9D/5D),
- FAHRENHEIT("Fahrenheit", "°F", 459.67, 9D/5D),
- AMBIENT("Ambient", "+STP", 300, 1);
+ KELVIN("Kelvin", "K", 0, 1), CELSIUS("Celsius", "°C", 273.15, 1), RANKINE("Rankine", "R", 0, 9D / 5D), FAHRENHEIT("Fahrenheit", "°F", 459.67, 9D / 5D), AMBIENT("Ambient", "+STP", 300, 1);
- public String name;
- public String symbol;
- double zeroOffset;
- double intervalSize;
+ public String name;
+ public String symbol;
+ double zeroOffset;
+ double intervalSize;
private TemperatureUnit(String s, String s1, double offset, double size)
{
@@ -62,29 +55,16 @@ public class UnitDisplayUtils
/** Metric system of measurement. */
public static enum MeasurementUnit
{
- FEMTO("Femto", "f", 0.000000000000001D),
- PICO("Pico", "p", 0.000000000001D),
- NANO("Nano", "n", 0.000000001D),
- MICRO("Micro", "u", 0.000001D),
- MILLI("Milli", "m", 0.001D),
- BASE("", "", 1),
- KILO("Kilo", "k", 1000D),
- MEGA("Mega", "M", 1000000D),
- GIGA("Giga", "G", 1000000000D),
- TERA("Tera", "T", 1000000000000D),
- PETA("Peta", "P", 1000000000000000D),
- EXA("Exa", "E", 1000000000000000000D),
- ZETTA("Zetta", "Z", 1000000000000000000000D),
- YOTTA("Yotta", "Y", 1000000000000000000000000D);
+ FEMTO("Femto", "f", 0.000000000000001D), PICO("Pico", "p", 0.000000000001D), NANO("Nano", "n", 0.000000001D), MICRO("Micro", "u", 0.000001D), MILLI("Milli", "m", 0.001D), BASE("", "", 1), KILO("Kilo", "k", 1000D), MEGA("Mega", "M", 1000000D), GIGA("Giga", "G", 1000000000D), TERA("Tera", "T", 1000000000000D), PETA("Peta", "P", 1000000000000000D), EXA("Exa", "E", 1000000000000000000D), ZETTA("Zetta", "Z", 1000000000000000000000D), YOTTA("Yotta", "Y", 1000000000000000000000000D);
/** long name for the unit */
- public String name;
+ public String name;
/** short unit version of the unit */
- public String symbol;
+ public String symbol;
/** Point by which a number is consider to be of this unit */
- public double value;
+ public double value;
private MeasurementUnit(String s, String s1, double v)
{
@@ -99,7 +79,8 @@ public class UnitDisplayUtils
{
return symbol;
}
- else {
+ else
+ {
return name;
}
}
@@ -149,10 +130,11 @@ public class UnitDisplayUtils
{
return value + " " + unitName;
}
- else {
+ else
+ {
for(int i = 0; i < MeasurementUnit.values().length; i++)
{
- MeasurementUnit lowerMeasure = MeasurementUnit.values()[i];
+ final MeasurementUnit lowerMeasure = MeasurementUnit.values()[i];
if(lowerMeasure.below(value) && lowerMeasure.ordinal() == 0)
{
@@ -164,7 +146,7 @@ public class UnitDisplayUtils
return prefix + roundDecimals(lowerMeasure.process(value), decimalPlaces) + " " + lowerMeasure.getName(isShort) + unitName;
}
- MeasurementUnit upperMeasure = MeasurementUnit.values()[i + 1];
+ final MeasurementUnit upperMeasure = MeasurementUnit.values()[i + 1];
if((lowerMeasure.above(value) && upperMeasure.below(value)) || lowerMeasure.value == value)
{
@@ -192,7 +174,7 @@ public class UnitDisplayUtils
{
if(decimalPlaces < 1)
{
- return (int)value + " " + unit.getPlural();
+ return (int) value + " " + unit.getPlural();
}
return roundDecimals(value, decimalPlaces) + " " + unit.getPlural();
@@ -200,7 +182,7 @@ public class UnitDisplayUtils
if(decimalPlaces < 1)
{
- return (int)value + " " + unit.name;
+ return (int) value + " " + unit.name;
}
return roundDecimals(value, decimalPlaces) + " " + unit.name;
@@ -228,10 +210,11 @@ public class UnitDisplayUtils
{
return value + (isShort ? "" : " ") + unitName;
}
- else {
+ else
+ {
for(int i = 0; i < MeasurementUnit.values().length; i++)
{
- MeasurementUnit lowerMeasure = MeasurementUnit.values()[i];
+ final MeasurementUnit lowerMeasure = MeasurementUnit.values()[i];
if(lowerMeasure.below(value) && lowerMeasure.ordinal() == 0)
{
@@ -243,7 +226,7 @@ public class UnitDisplayUtils
return prefix + roundDecimals(lowerMeasure.process(value), decimalPlaces) + (isShort ? "" : " ") + lowerMeasure.getName(isShort) + unitName;
}
- MeasurementUnit upperMeasure = MeasurementUnit.values()[i + 1];
+ final MeasurementUnit upperMeasure = MeasurementUnit.values()[i + 1];
if((lowerMeasure.above(value) && upperMeasure.below(value)) || lowerMeasure.value == value)
{
@@ -267,8 +250,8 @@ public class UnitDisplayUtils
public static double roundDecimals(double d, int decimalPlaces)
{
- int j = (int)(d*Math.pow(10, decimalPlaces));
- return j/Math.pow(10, decimalPlaces);
+ final int j = (int) (d * Math.pow(10, decimalPlaces));
+ return j / Math.pow(10, decimalPlaces);
}
public static double roundDecimals(double d)
@@ -278,18 +261,11 @@ public class UnitDisplayUtils
public static enum EnergyType
{
- J,
- RF,
- EU,
- MJ
+ J, RF, EU, MJ
}
public static enum TempType
{
- K,
- C,
- R,
- F,
- STP
+ K, C, R, F, STP
}
}
diff --git a/src/api/java/mekanism/api/util/package-info.java b/src/api/java/mekanism/api/util/package-info.java
index e5253bc..78fd35b 100644
--- a/src/api/java/mekanism/api/util/package-info.java
+++ b/src/api/java/mekanism/api/util/package-info.java
@@ -1,3 +1,5 @@
@API(apiVersion = "8.0.0", owner = "Mekanism", provides = "MekanismAPI|util")
package mekanism.api.util;
-import cpw.mods.fml.common.API; \ No newline at end of file
+
+import cpw.mods.fml.common.API;
+