summaryrefslogtreecommitdiff
path: root/src/api/java/powercrystals
diff options
context:
space:
mode:
authorLance5057 <Lance5057@gmail.com>2016-08-06 21:47:17 -0500
committerLance5057 <Lance5057@gmail.com>2016-08-06 21:47:17 -0500
commitd10fd21692bad49e75a7d665005df940c91942f8 (patch)
treefdc1be156df395c88a934f6f97487e78b36a8138 /src/api/java/powercrystals
parentff41fd97eb377dd1ebd78b4b56e81c59ca786667 (diff)
Launch update
Only a week behind...
Diffstat (limited to 'src/api/java/powercrystals')
-rw-r--r--src/api/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java17
-rw-r--r--src/api/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java12
-rw-r--r--src/api/java/powercrystals/minefactoryreloaded/api/MobDrop.java11
-rw-r--r--src/api/java/powercrystals/minefactoryreloaded/api/ValuedItem.java24
4 files changed, 34 insertions, 30 deletions
diff --git a/src/api/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java b/src/api/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java
index 8eff88d..d83db32 100644
--- a/src/api/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java
+++ b/src/api/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java
@@ -1,12 +1,12 @@
package powercrystals.minefactoryreloaded.api;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-
/**
* @author PowerCrystals
*
@@ -94,18 +94,19 @@ public class FactoryRegistry
*/
public static void sendMessage(String message, Object value)
{
- if (!Loader.isModLoaded("MineFactoryReloaded") ||
- Loader.instance().activeModContainer() == null)
+ if(!Loader.isModLoaded("MineFactoryReloaded") || Loader.instance().activeModContainer() == null)
+ {
return;
+ }
try
{
- Method m = FMLInterModComms.class.getDeclaredMethod("enqueueMessage", Object.class, String.class, IMCMessage.class);
+ final Method m = FMLInterModComms.class.getDeclaredMethod("enqueueMessage", Object.class, String.class, IMCMessage.class);
m.setAccessible(true);
- Constructor<IMCMessage> c = IMCMessage.class.getDeclaredConstructor(String.class, Object.class);
+ final Constructor<IMCMessage> c = IMCMessage.class.getDeclaredConstructor(String.class, Object.class);
c.setAccessible(true);
m.invoke(null, Loader.instance().activeModContainer(), "MineFactoryReloaded", c.newInstance(message, value));
}
- catch(Exception e)
+ catch(final Exception e)
{
e.printStackTrace();
}
diff --git a/src/api/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java b/src/api/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java
index d4e620a..1191149 100644
--- a/src/api/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java
+++ b/src/api/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java
@@ -19,17 +19,17 @@ public interface IFactoryHarvestable
* @return The block this harvestable instance is managing.
*/
public Block getPlant();
-
+
/**
* @return The type of harvest the Harvester should perform on this block.
*/
public HarvestType getHarvestType();
-
+
/**
* @return Whether or not the Harvester should break the block when harvesting. If false, no changes will be performed by the Harvester itself.
*/
public boolean breakBlock();
-
+
/**
* @param world The world this block is in.
* @param harvesterSettings The harvester's current settings. Do not modify these.
@@ -39,7 +39,7 @@ public interface IFactoryHarvestable
* @return True if this block can be harvested.
*/
public boolean canBeHarvested(World world, Map<String, Boolean> harvesterSettings, int x, int y, int z);
-
+
/**
* @param world The world this block is in.
* @param rand A Random instance to use when generating drops.
@@ -50,7 +50,7 @@ public interface IFactoryHarvestable
* @return The drops generated by breaking this block. For a default implementation, calling Block.getBlockDropped() is usually sufficient.
*/
public List<ItemStack> getDrops(World world, Random rand, Map<String, Boolean> harvesterSettings, int x, int y, int z);
-
+
/**
* Called before the block is going to be harvested. Usually empty.
* @param world The world this block is in.
@@ -59,7 +59,7 @@ public interface IFactoryHarvestable
* @param z The Z coordinate of the block being harvested.
*/
public void preHarvest(World world, int x, int y, int z);
-
+
/**
* Called after the block is going to be harvested. Used to re-till soil, for example.
* @param world The world this block is in.
diff --git a/src/api/java/powercrystals/minefactoryreloaded/api/MobDrop.java b/src/api/java/powercrystals/minefactoryreloaded/api/MobDrop.java
index 7f5dd7c..84a34a5 100644
--- a/src/api/java/powercrystals/minefactoryreloaded/api/MobDrop.java
+++ b/src/api/java/powercrystals/minefactoryreloaded/api/MobDrop.java
@@ -5,17 +5,20 @@ import net.minecraft.util.WeightedRandom;
public class MobDrop extends WeightedRandom.Item
{
- private ItemStack _stack;
-
+ private final ItemStack _stack;
+
public MobDrop(int weight, ItemStack stack)
{
super(weight);
_stack = stack;
}
-
+
public ItemStack getStack()
{
- if(_stack == null) return null;
+ if(_stack == null)
+ {
+ return null;
+ }
return _stack.copy();
}
}
diff --git a/src/api/java/powercrystals/minefactoryreloaded/api/ValuedItem.java b/src/api/java/powercrystals/minefactoryreloaded/api/ValuedItem.java
index 3d075fa..d9b1b55 100644
--- a/src/api/java/powercrystals/minefactoryreloaded/api/ValuedItem.java
+++ b/src/api/java/powercrystals/minefactoryreloaded/api/ValuedItem.java
@@ -4,11 +4,11 @@ import net.minecraft.item.ItemStack;
public class ValuedItem
{
- public final int value;
- public final ItemStack item;
- public final String key;
- public final Object object;
-
+ public final int value;
+ public final ItemStack item;
+ public final String key;
+ public final Object object;
+
public ValuedItem(int v, ItemStack i)
{
value = v;
@@ -16,7 +16,7 @@ public class ValuedItem
key = null;
object = null;
}
-
+
public ValuedItem(String v, Object i)
{
value = -1;
@@ -24,12 +24,12 @@ public class ValuedItem
key = v;
object = i;
}
-
+
/**
* Presently unused but included so that if they do get used in the future,
* people including this in their jar and loading before MFR don't destroy everyone
*/
-
+
public ValuedItem(int v, Object i)
{
value = v;
@@ -37,7 +37,7 @@ public class ValuedItem
key = null;
object = i;
}
-
+
public ValuedItem(String v, ItemStack i)
{
value = -1;
@@ -45,7 +45,7 @@ public class ValuedItem
key = v;
object = null;
}
-
+
public ValuedItem(int v, String k, ItemStack i)
{
value = v;
@@ -53,7 +53,7 @@ public class ValuedItem
key = k;
object = null;
}
-
+
public ValuedItem(int v, String k, Object i)
{
value = v;
@@ -61,7 +61,7 @@ public class ValuedItem
key = k;
object = i;
}
-
+
public ValuedItem(int v, String k, ItemStack i, Object o)
{
value = v;