Re-added MFR API
This commit is contained in:
parent
e78f941deb
commit
b79c1e28c1
32 changed files with 1681 additions and 0 deletions
498
apis/powercrystals/minefactoryreloaded/api/FactoryRegistry.java
Normal file
498
apis/powercrystals/minefactoryreloaded/api/FactoryRegistry.java
Normal file
|
@ -0,0 +1,498 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import powercrystals.minefactoryreloaded.api.rednet.IRedNetLogicCircuit;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
*
|
||||||
|
* Class used to register plants and other farming-related things with MFR. Will do nothing if MFR does not exist, but your mod should be set to load
|
||||||
|
* after MFR or things may not work properly.
|
||||||
|
*
|
||||||
|
* To avoid breaking the API, additional FactoryRegistry##s will appear on major MFR versions that contain API additions. On a Minecraft version change,
|
||||||
|
* these will be rolled back into this class.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class FactoryRegistry
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Registers a plantable object with the Planter.
|
||||||
|
*
|
||||||
|
* @param plantable The thing to plant.
|
||||||
|
*/
|
||||||
|
public static void registerPlantable(IFactoryPlantable plantable)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerPlantable", IFactoryPlantable.class);
|
||||||
|
reg.invoke(registry, plantable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a harvestable block with the Harvester.
|
||||||
|
*
|
||||||
|
* @param harvestable The thing to harvest.
|
||||||
|
*/
|
||||||
|
public static void registerHarvestable(IFactoryHarvestable harvestable)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerHarvestable", IFactoryHarvestable.class);
|
||||||
|
reg.invoke(registry, harvestable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a fertilizable block with the Fertilizer.
|
||||||
|
*
|
||||||
|
* @param fertilizable The thing to fertilize.
|
||||||
|
*/
|
||||||
|
public static void registerFertilizable(IFactoryFertilizable fertilizable)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerFertilizable", IFactoryFertilizable.class);
|
||||||
|
reg.invoke(registry, fertilizable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a fertilizer item Fertilizer.
|
||||||
|
*
|
||||||
|
* @param fertilizable The thing to fertilize with.
|
||||||
|
*/
|
||||||
|
public static void registerFertilizer(IFactoryFertilizer fertilizer)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerFertilizer", IFactoryFertilizer.class);
|
||||||
|
reg.invoke(registry, fertilizer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a ranchable entity with the Rancher.
|
||||||
|
*
|
||||||
|
* @param ranchable The entity to ranch.
|
||||||
|
*/
|
||||||
|
public static void registerRanchable(IFactoryRanchable ranchable)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerRanchable", IFactoryRanchable.class);
|
||||||
|
reg.invoke(registry, ranchable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a grindable entity with the Grinder using the new grinder interface. This method will be renamed to the standard "registerGrindable"
|
||||||
|
* on MC 1.6.
|
||||||
|
*
|
||||||
|
* @param grindable The entity to grind.
|
||||||
|
*/
|
||||||
|
public static void registerGrindable(IFactoryGrindable grindable)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerGrindable", IFactoryGrindable.class);
|
||||||
|
reg.invoke(registry, grindable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a grindable entity with the Grinder using the new grinder interface. This method will be renamed to the standard "registerGrindable"
|
||||||
|
* on MC 1.6.
|
||||||
|
*
|
||||||
|
* @param grindable The entity to grind.
|
||||||
|
*/
|
||||||
|
public static void registerGrinderBlacklist(Class<?> ...ungrindables)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerGrinderBlacklist", Class[].class);
|
||||||
|
reg.invoke(registry, (Object[])ungrindables);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a possible output with the sludge boiler.
|
||||||
|
*
|
||||||
|
* @param weight Likelihood that this item will be produced. Lower means rarer.
|
||||||
|
* @param drop The thing being produced by the sludge boiler.
|
||||||
|
*/
|
||||||
|
public static void registerSludgeDrop(int weight, ItemStack drop)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerSludgeDrop", int.class, ItemStack.class);
|
||||||
|
reg.invoke(registry, weight, drop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers specific food to use in the Breeder (instead of wheat) for a given mob.
|
||||||
|
*
|
||||||
|
* @param entityToBreed Entity this food will be used with.
|
||||||
|
* @param food The item to use when breeding this entity.
|
||||||
|
*/
|
||||||
|
public static void registerBreederFood(Class<?> entityToBreed, ItemStack food)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerBreederFood", Class.class, ItemStack.class);
|
||||||
|
reg.invoke(registry, entityToBreed, food);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bans an entity class from being collected by Safari Nets
|
||||||
|
*
|
||||||
|
* @param blacklistedEntity Class to blacklist
|
||||||
|
*/
|
||||||
|
public static void registerSafariNetBlacklist(Class<?> blacklistedEntity)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerSafariNetBlacklist", Class.class);
|
||||||
|
reg.invoke(registry, blacklistedEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a Safari Net handler to properly serialize a type of mob.
|
||||||
|
*
|
||||||
|
* @param handler The Safari Net handler.
|
||||||
|
*/
|
||||||
|
public static void registerSafariNetHandler(ISafariNetHandler handler)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerSafariNetHandler", ISafariNetHandler.class);
|
||||||
|
reg.invoke(registry, handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a mob egg handler, which allows the Safari Net to properly change colors.
|
||||||
|
*
|
||||||
|
* @param handler The mob egg handler
|
||||||
|
*/
|
||||||
|
public static void registerMobEggHandler(IMobEggHandler handler)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerMobEggHandler", IMobEggHandler.class);
|
||||||
|
reg.invoke(registry, handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows Rubber Trees to spawn in the specified biome.
|
||||||
|
*
|
||||||
|
* @param biome The biome name.
|
||||||
|
*/
|
||||||
|
public static void registerRubberTreeBiome(String biome)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerRubberTreeBiome", String.class);
|
||||||
|
reg.invoke(registry, biome);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers an entity as a possible output from villager random safari nets. Note that the "id" field must be initialized
|
||||||
|
* (i.e. with Entity.addEntityID()) for it to work correctly.
|
||||||
|
*
|
||||||
|
* @param savedMob A serialized mob that will be unloaded by the safari net
|
||||||
|
* @param weight The weight of this mob in the random selection
|
||||||
|
*/
|
||||||
|
public static void registerVillagerTradeMob(IRandomMobProvider mobProvider)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerVillagerTradeMob", IRandomMobProvider.class);
|
||||||
|
reg.invoke(registry, mobProvider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a handler for drinking liquids with the straw.
|
||||||
|
*
|
||||||
|
* @param liquidId The block ID the handler handles.
|
||||||
|
* @param liquidDrinkHandler The drink handler instance.
|
||||||
|
*/
|
||||||
|
public static void registerLiquidDrinkHandler(int liquidId, ILiquidDrinkHandler liquidDrinkHandler)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerLiquidDrinkHandler", int.class, ILiquidDrinkHandler.class);
|
||||||
|
reg.invoke(registry, liquidId, liquidDrinkHandler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a possible output with the laser drill.
|
||||||
|
*
|
||||||
|
* @param weight Likelihood that this item will be produced. Lower means rarer.
|
||||||
|
* @param drop The thing being produced by the laser drill.
|
||||||
|
*/
|
||||||
|
public static void registerLaserOre(int weight, ItemStack drop)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerLaserOre", int.class, ItemStack.class);
|
||||||
|
reg.invoke(registry, weight, drop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a preferred ore with the laser drill. Focuses with the specified color will make the specified ore more likely.
|
||||||
|
* Used by MFR itself for vanilla: Black (Coal), Light Blue (Diamond), Lime (Emerald), Yellow (Gold), Brown (Iron), Blue (Lapis),
|
||||||
|
* Red (Redstone), and White (nether quartz).
|
||||||
|
*
|
||||||
|
* This will replace setLaserPreferredOre on MC 1.6.
|
||||||
|
*
|
||||||
|
* @param color The color that the preferred ore is being set for. White is 0.
|
||||||
|
* @param ore The ore that will be preferred by the drill when a focus with the specified color is present.
|
||||||
|
*/
|
||||||
|
public static void addLaserPreferredOre(int color, ItemStack ore)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("addLaserPreferredOre", int.class, ItemStack.class);
|
||||||
|
reg.invoke(registry, color, ore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a block ID as a fruit tree log. When the Fruit Picker sees this block on the ground, it will
|
||||||
|
* begin a search in tree mode for any fruit nearby.
|
||||||
|
*
|
||||||
|
* @param fruitLogBlockId The block ID to mark as a fruit tree log.
|
||||||
|
*/
|
||||||
|
public static void registerFruitLogBlockId(Integer fruitLogBlockId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerFruitLogBlockId", Integer.class);
|
||||||
|
reg.invoke(registry, fruitLogBlockId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a fruit for the Fruit Picker.
|
||||||
|
*
|
||||||
|
* @param fruit The fruit to be picked.
|
||||||
|
*/
|
||||||
|
public static void registerFruit(IFactoryFruit fruit)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerFruit", IFactoryFruit.class);
|
||||||
|
reg.invoke(registry, fruit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers an entity string as an invalid entry for the autospawner.
|
||||||
|
* See also: {@link net.minecraft.entity.EntityList}'s classToStringMapping and stringToClassMapping.
|
||||||
|
*
|
||||||
|
* @param entityString The entity string to blacklist.
|
||||||
|
*/
|
||||||
|
public static void registerAutoSpawnerBlacklist(String entityString)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerAutoSpawnerBlacklist", String.class);
|
||||||
|
reg.invoke(registry, entityString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers logic circuit to be usable in the Programmable RedNet Controller.
|
||||||
|
*
|
||||||
|
* @param circuit The circuit to be registered.
|
||||||
|
*/
|
||||||
|
public static void registerRedNetLogicCircuit(IRedNetLogicCircuit circuit)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
|
||||||
|
if(registry != null)
|
||||||
|
{
|
||||||
|
Method reg = registry.getMethod("registerRedNetLogicCircuit", IRedNetLogicCircuit.class);
|
||||||
|
reg.invoke(registry, circuit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
*
|
||||||
|
* Determines what kind of action a given fertilizer can perform. Your IFactoryFertilizable instances should check this before
|
||||||
|
* performing any action to maintain future compatibility.
|
||||||
|
*/
|
||||||
|
public enum FertilizerType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The fertilizer will fertilize grass.
|
||||||
|
*/
|
||||||
|
Grass,
|
||||||
|
/**
|
||||||
|
* The fertilizer will grow a plant.
|
||||||
|
*/
|
||||||
|
GrowPlant,
|
||||||
|
/**
|
||||||
|
* The fertilizer will grow magical crops.
|
||||||
|
*/
|
||||||
|
GrowMagicalCrop,
|
||||||
|
}
|
34
apis/powercrystals/minefactoryreloaded/api/HarvestType.java
Normal file
34
apis/powercrystals/minefactoryreloaded/api/HarvestType.java
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
*
|
||||||
|
* Determines what algorithm the Harvester uses when it encounters this IFactoryHarvestable in the world.
|
||||||
|
*/
|
||||||
|
public enum HarvestType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Just break the single block - no special action needed. Carrots, flowers, etc.
|
||||||
|
*/
|
||||||
|
Normal,
|
||||||
|
/**
|
||||||
|
* Search for identical blocks above.
|
||||||
|
*/
|
||||||
|
Column,
|
||||||
|
/**
|
||||||
|
* Search for identical blocks above but leave this bottom one for the future. Cactus and sugarcane.
|
||||||
|
*/
|
||||||
|
LeaveBottom,
|
||||||
|
/**
|
||||||
|
* This block is the base of a tree and the harvester should enter tree-cutting mode.
|
||||||
|
*/
|
||||||
|
Tree,
|
||||||
|
/**
|
||||||
|
* This block is the base of the tree and the harvester should enter tree-cutting mode, but the tree grows upside-down.
|
||||||
|
*/
|
||||||
|
TreeFlipped,
|
||||||
|
/**
|
||||||
|
* This block is part of a tree as above, but leaves are cut before tree logs so that leaves do not decay more than necessary.
|
||||||
|
*/
|
||||||
|
TreeLeaf
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public interface IDeepStorageUnit
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return A populated ItemStack with stackSize for the full amount of materials in the DSU. May have a stackSize > getMaxStackSize().
|
||||||
|
*/
|
||||||
|
ItemStack getStoredItemType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the total amount of the item currently being stored, or zero if it wants to remove all items.
|
||||||
|
*/
|
||||||
|
void setStoredItemCount(int amount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the type of the stored item and initializes the number of stored items to amount. Will overwrite any existing stored items.
|
||||||
|
*/
|
||||||
|
void setStoredItemType(ItemStack type, int amount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The maximum number of items the DSU can hold.
|
||||||
|
*/
|
||||||
|
int getMaxStoredCount();
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
*
|
||||||
|
* Defines a fertilizable block, and the process to fertilize it. You can assume that you will never have to check that block ID matches the one returned by
|
||||||
|
* getFertilizableBlockId().
|
||||||
|
*/
|
||||||
|
public interface IFactoryFertilizable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return The block ID this instance is managing.
|
||||||
|
*/
|
||||||
|
public int getFertilizableBlockId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world The world this block belongs to.
|
||||||
|
* @param x The X coordinate of this block.
|
||||||
|
* @param y The Y coordinate of this block.
|
||||||
|
* @param z The Z coordinate of this block.
|
||||||
|
* @param fertilizerType The kind of fertilizer being used.
|
||||||
|
* @return True if the block at (x,y,z) can be fertilized with the given type of fertilizer.
|
||||||
|
*/
|
||||||
|
public boolean canFertilizeBlock(World world, int x, int y, int z, FertilizerType fertilizerType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world The world this block belongs to.
|
||||||
|
* @param rand A Random instance to use when fertilizing, if necessary.
|
||||||
|
* @param x The X coordinate of this block.
|
||||||
|
* @param y The Y coordinate of this block.
|
||||||
|
* @param z The Z coordinate of this block.
|
||||||
|
* @param fertilizerType The kind of fertilizer being used.
|
||||||
|
* @return True if fertilization was successful. If false, the Fertilizer will not consume a fertilizer item and will not drain power.
|
||||||
|
*/
|
||||||
|
public boolean fertilize(World world, Random rand, int x, int y, int z, FertilizerType fertilizerType);
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
*
|
||||||
|
* Defines a fertilizer item for use in the Fertilizer.
|
||||||
|
*/
|
||||||
|
public interface IFactoryFertilizer
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return The ID of this fertilizer item.
|
||||||
|
*/
|
||||||
|
int getFertilizerId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The metadata of this fertilizer item.
|
||||||
|
*/
|
||||||
|
int getFertilizerMeta();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The type of fertilizer this is.
|
||||||
|
*/
|
||||||
|
FertilizerType getFertilizerType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a fertilization is successful. If you set the ItemStack size to 0, it will be deleted by the fertilizer.
|
||||||
|
*
|
||||||
|
* @param fertilizer The ItemStack used to fertilize.
|
||||||
|
*/
|
||||||
|
void consume(ItemStack fertilizer);
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a fruit entry for the Fruit Picker.
|
||||||
|
*
|
||||||
|
* @author powercrystals
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IFactoryFruit
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return The block ID this fruit has in the world.
|
||||||
|
*/
|
||||||
|
public int getSourceBlockId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to determine if this fruit can be picked (is it ripe yet, etc)
|
||||||
|
* @param world The world where the fruit is being picked
|
||||||
|
* @param x The x-coordinate of the fruit
|
||||||
|
* @param y The y-coordinate of the fruit
|
||||||
|
* @param z The z-coordinate of the fruit
|
||||||
|
* @return True if the fruit can be picked
|
||||||
|
*/
|
||||||
|
public boolean canBePicked(World world, int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by the Fruit Picker to determine what block to replace the picked block with. Only ID and meta/damage will be used.
|
||||||
|
* At the time this method is called, the fruit still exists. Do not pass an item ID as the return value.
|
||||||
|
* @param world The world where the fruit is being picked
|
||||||
|
* @param x The x-coordinate of the fruit
|
||||||
|
* @param y The y-coordinate of the fruit
|
||||||
|
* @param z The z-coordinate of the fruit
|
||||||
|
* @return The block to replace the fruit block with, or null for air.
|
||||||
|
*/
|
||||||
|
public ItemStack getReplacementBlock(World world, int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by the Fruit Picker before the fruit is picked.
|
||||||
|
* @param world The world where the fruit is being picked
|
||||||
|
* @param x The x-coordinate of the fruit
|
||||||
|
* @param y The y-coordinate of the fruit
|
||||||
|
* @param z The z-coordinate of the fruit
|
||||||
|
*/
|
||||||
|
public void prePick(World world, int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by the Fruit Picker to determine what drops to generate. At the time this method is called, the fruit still exists.
|
||||||
|
* @param world The world where the fruit is being picked
|
||||||
|
* @param x The x-coordinate of the fruit
|
||||||
|
* @param y The y-coordinate of the fruit
|
||||||
|
* @param z The z-coordinate of the fruit
|
||||||
|
*/
|
||||||
|
public List<ItemStack> getDrops(World world, Random rand, int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by the Fruit Picker after the fruit is picked.
|
||||||
|
* @param world The world where the fruit is being picked
|
||||||
|
* @param x The x-coordinate of the fruit
|
||||||
|
* @param y The y-coordinate of the fruit
|
||||||
|
* @param z The z-coordinate of the fruit
|
||||||
|
*/
|
||||||
|
public void postPick(World world, int x, int y, int z);
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
*
|
||||||
|
* Defines a grindable entity for the Grinder.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public interface IFactoryGrindable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return The class that this grindable instance is handling. This must be a subtype of EntityLivingBase or the entity will never
|
||||||
|
* be noticed by the Grinder.
|
||||||
|
*/
|
||||||
|
public Class<?> getGrindableEntity();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world The world this entity is in.
|
||||||
|
* @param entity The entity instance being ground.
|
||||||
|
* @param random A Random instance.
|
||||||
|
* @return The drops generated when this entity is killed.
|
||||||
|
*/
|
||||||
|
public List<MobDrop> grind(World world, EntityLivingBase entity, Random random);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param entity The entity instance being ground.
|
||||||
|
* @return Whether this entity has been fully processed or not.
|
||||||
|
*/
|
||||||
|
public boolean processEntity(EntityLivingBase entity);
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
*
|
||||||
|
* Defines a harvestable block for the Harvester.
|
||||||
|
*/
|
||||||
|
public interface IFactoryHarvestable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return The block ID this harvestable instance is managing.
|
||||||
|
*/
|
||||||
|
public int getPlantId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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.
|
||||||
|
* @param x The X coordinate of the block being harvested.
|
||||||
|
* @param y The Y coordinate of the block being harvested.
|
||||||
|
* @param z The Z coordinate of the block being harvested.
|
||||||
|
* @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.
|
||||||
|
* @param harvesterSettings The harvester's current settings. Do not modify these.
|
||||||
|
* @param x The X coordinate of the block being harvested.
|
||||||
|
* @param y The Y coordinate of the block being harvested.
|
||||||
|
* @param z The Z coordinate of the block being harvested.
|
||||||
|
* @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.
|
||||||
|
* @param x The X coordinate of the block being harvested.
|
||||||
|
* @param y The Y coordinate of the block being harvested.
|
||||||
|
* @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.
|
||||||
|
* @param x The X coordinate of the block being harvested.
|
||||||
|
* @param y The Y coordinate of the block being harvested.
|
||||||
|
* @param z The Z coordinate of the block being harvested.
|
||||||
|
*/
|
||||||
|
public void postHarvest(World world, int x, int y, int z);
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
*
|
||||||
|
* Defines a plantable object for use in the Planter.
|
||||||
|
*/
|
||||||
|
public interface IFactoryPlantable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return The block or item ID this plantable is managing.
|
||||||
|
*/
|
||||||
|
public int getSeedId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world The world instance this block or item will be placed into.
|
||||||
|
* @param x The destination X coordinate.
|
||||||
|
* @param y The destination Y coordinate.
|
||||||
|
* @param z The destination Z coordinate.
|
||||||
|
* @param stack The stack being planted.
|
||||||
|
* @return The block ID that will be placed into the world.
|
||||||
|
*/
|
||||||
|
public int getPlantedBlockId(World world, int x, int y, int z, ItemStack stack);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world The world instance this block or item will be placed into.
|
||||||
|
* @param x The destination X coordinate.
|
||||||
|
* @param y The destination Y coordinate.
|
||||||
|
* @param z The destination Z coordinate.
|
||||||
|
* @param stack The stack being planted.
|
||||||
|
* @return The block metadata that will be placed into the world.
|
||||||
|
*/
|
||||||
|
public int getPlantedBlockMetadata(World world, int x, int y, int z, ItemStack stack);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world The world instance this block or item will be placed into.
|
||||||
|
* @param x The destination X coordinate.
|
||||||
|
* @param y The destination Y coordinate.
|
||||||
|
* @param z The destination Z coordinate.
|
||||||
|
* @param stack The stack being planted.
|
||||||
|
* @return True if this plantable can be placed at the provided coordinates.
|
||||||
|
*/
|
||||||
|
public boolean canBePlantedHere(World world, int x, int y, int z, ItemStack stack);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called before planting is performed. Used to till soil, for example.
|
||||||
|
* @param world The world instance this block or item will be placed into.
|
||||||
|
* @param x The destination X coordinate.
|
||||||
|
* @param y The destination Y coordinate.
|
||||||
|
* @param z The destination Z coordinate.
|
||||||
|
* @param stack The stack being planted.
|
||||||
|
*/
|
||||||
|
public void prePlant(World world, int x, int y, int z, ItemStack stack);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called after planting is performed. Usually empty.
|
||||||
|
* @param world The world instance this block or item will be placed into.
|
||||||
|
* @param x The destination X coordinate.
|
||||||
|
* @param y The destination Y coordinate.
|
||||||
|
* @param z The destination Z coordinate.
|
||||||
|
* @param stack The stack being planted.
|
||||||
|
*/
|
||||||
|
public void postPlant(World world, int x, int y, int z, ItemStack stack);
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
*
|
||||||
|
* Defines a ranchable entity for use in the Rancher.
|
||||||
|
*/
|
||||||
|
public interface IFactoryRanchable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return The entity being ranched. Must be a subtype of EntityLivingBase.
|
||||||
|
*/
|
||||||
|
public Class<?> getRanchableEntity();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world The world this entity is in.
|
||||||
|
* @param entity The entity instance being ranched.
|
||||||
|
* @param rancher The rancher instance doing the ranching. Used to access the Rancher's inventory when milking cows, for example.
|
||||||
|
* @return A list of drops.
|
||||||
|
*/
|
||||||
|
public List<RanchedItem> ranch(World world, EntityLivingBase entity, IInventory rancher);
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
|
public interface ILiquidDrinkHandler
|
||||||
|
{
|
||||||
|
public void onDrink(EntityPlayer player);
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityEggInfo;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
*
|
||||||
|
* Defines a class that MFR will use to local egg info for a given mob. This is used to color the Safari Net based on the captured mob.
|
||||||
|
*/
|
||||||
|
public interface IMobEggHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param safariNet The Safari Net that is looking for egg info.
|
||||||
|
* @return An EntityEggInfo, or null if this instance cannot handle this mob.
|
||||||
|
*/
|
||||||
|
public EntityEggInfo getEgg(ItemStack safariNet);
|
||||||
|
}
|
12
apis/powercrystals/minefactoryreloaded/api/INeedleAmmo.java
Normal file
12
apis/powercrystals/minefactoryreloaded/api/INeedleAmmo.java
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public interface INeedleAmmo
|
||||||
|
{
|
||||||
|
public boolean onHitEntity(EntityPlayer owner, Entity hit, double distance);
|
||||||
|
public void onHitBlock(EntityPlayer owner, World world, int x, int y, int z, int side, double distance);
|
||||||
|
public float getSpread();
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
|
||||||
|
public interface IRandomMobProvider
|
||||||
|
{
|
||||||
|
public List<RandomMob> getRandomMobs(World world);
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
*
|
||||||
|
* Defines an object that can display information about a captured mob in a Safari net.
|
||||||
|
*/
|
||||||
|
public interface ISafariNetHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return The class of mob that this handler applies to.
|
||||||
|
*/
|
||||||
|
public Class<?> validFor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param safariNetStack The Safari Net that is requesting information.
|
||||||
|
* @param player The player holding the Safari Net.
|
||||||
|
* @param infoList The current list of information strings. Add yours to this.
|
||||||
|
* @param advancedTooltips True if the advanced tooltips option is on.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
public void addInformation(ItemStack safariNetStack, EntityPlayer player, List infoList, boolean advancedTooltips);
|
||||||
|
}
|
31
apis/powercrystals/minefactoryreloaded/api/ISyringe.java
Normal file
31
apis/powercrystals/minefactoryreloaded/api/ISyringe.java
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
*
|
||||||
|
* Defines a syringe for use in the Vet machine.
|
||||||
|
*/
|
||||||
|
public interface ISyringe
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Called when the vet is deciding if it should use this syringe.
|
||||||
|
* @param world The world instance.
|
||||||
|
* @param entity The entity being injected.
|
||||||
|
* @param syringe The syringe ItemStack.
|
||||||
|
* @return True if the entity can be injected by this syringe.
|
||||||
|
*/
|
||||||
|
public boolean canInject(World world, EntityLivingBase entity, ItemStack syringe);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to perform an injection.
|
||||||
|
* @param world The world instance.
|
||||||
|
* @param entity The entity being injected.
|
||||||
|
* @param syringe The syringe ItemStack.
|
||||||
|
* @return True if injection was successful.
|
||||||
|
*/
|
||||||
|
public boolean inject(World world, EntityLivingBase entity, ItemStack syringe);
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
* Defines a tool that can rotate MFR machines. Implement on an Item class. Requires no additional work on your part.
|
||||||
|
*/
|
||||||
|
public interface IToolHammer
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
*
|
||||||
|
* This interface is like IToolHammer, but is for items that change state on a per-stack basis. Implement this
|
||||||
|
* instead of IToolHammer - not both!
|
||||||
|
*
|
||||||
|
* This interface will replace IToolHammer in MC 1.6.
|
||||||
|
*/
|
||||||
|
public interface IToolHammerAdvanced
|
||||||
|
{
|
||||||
|
public boolean isActive(ItemStack stack);
|
||||||
|
}
|
21
apis/powercrystals/minefactoryreloaded/api/MobDrop.java
Normal file
21
apis/powercrystals/minefactoryreloaded/api/MobDrop.java
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.WeightedRandomItem;
|
||||||
|
|
||||||
|
public class MobDrop extends WeightedRandomItem
|
||||||
|
{
|
||||||
|
private ItemStack _stack;
|
||||||
|
|
||||||
|
public MobDrop(int weight, ItemStack stack)
|
||||||
|
{
|
||||||
|
super(weight);
|
||||||
|
_stack = stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getStack()
|
||||||
|
{
|
||||||
|
if(_stack == null) return null;
|
||||||
|
return _stack.copy();
|
||||||
|
}
|
||||||
|
}
|
68
apis/powercrystals/minefactoryreloaded/api/RanchedItem.java
Normal file
68
apis/powercrystals/minefactoryreloaded/api/RanchedItem.java
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author skyboy026
|
||||||
|
*
|
||||||
|
* Defines an ItemStack or a FluidStack that is the result of an entity being ranched
|
||||||
|
*/
|
||||||
|
public final class RanchedItem {
|
||||||
|
private final ItemStack item;
|
||||||
|
private final FluidStack fluid;
|
||||||
|
|
||||||
|
public RanchedItem(Block item, int amount, int meta)
|
||||||
|
{
|
||||||
|
this(new ItemStack(item, amount, meta));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RanchedItem(Block item, int amount)
|
||||||
|
{
|
||||||
|
this(new ItemStack(item, amount));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RanchedItem(Block item)
|
||||||
|
{
|
||||||
|
this(new ItemStack(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RanchedItem(Item item, int amount, int meta)
|
||||||
|
{
|
||||||
|
this(new ItemStack(item, amount, meta));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RanchedItem(Item item, int amount)
|
||||||
|
{
|
||||||
|
this(new ItemStack(item, amount));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RanchedItem(Item item)
|
||||||
|
{
|
||||||
|
this(new ItemStack(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RanchedItem(ItemStack item)
|
||||||
|
{
|
||||||
|
this.item = item;
|
||||||
|
fluid = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RanchedItem(FluidStack fluid)
|
||||||
|
{
|
||||||
|
this.fluid = fluid;
|
||||||
|
item = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasFluid()
|
||||||
|
{
|
||||||
|
return item == null & fluid != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getResult()
|
||||||
|
{
|
||||||
|
return item == null ? fluid : item;
|
||||||
|
}
|
||||||
|
}
|
21
apis/powercrystals/minefactoryreloaded/api/RandomMob.java
Normal file
21
apis/powercrystals/minefactoryreloaded/api/RandomMob.java
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.WeightedRandomItem;
|
||||||
|
|
||||||
|
public class RandomMob extends WeightedRandomItem
|
||||||
|
{
|
||||||
|
private Entity _mob;
|
||||||
|
|
||||||
|
public RandomMob(Entity savedMob, int weight)
|
||||||
|
{
|
||||||
|
super(weight);
|
||||||
|
_mob = savedMob;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Entity getMob()
|
||||||
|
{
|
||||||
|
if(_mob == null) return null;
|
||||||
|
return _mob;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a Block that can connect to RedNet cables. This must be implemented on your Block class.
|
||||||
|
* Note that when you implement this, the RedNet network makes several assumptions about your code -
|
||||||
|
* primarily, it will not clamp values to 0 <= x <= 15. This means you must be able to accept any
|
||||||
|
* possible integer without crashing, even negatives. It will also assume that calling the onInput(s)Changed()
|
||||||
|
* methods are sufficient, and will not issue block updates. Finally, it will never call the vanilla redstone
|
||||||
|
* output methods in All mode, and will only query the methods contained in this interface in that case. In Single
|
||||||
|
* mode, it will call onInputChanged, and will check for strong power (or weak if in Plate mode) through the vanilla
|
||||||
|
* method calls.
|
||||||
|
*
|
||||||
|
* RedNet cables have their subnets indicated to the user by colored bands on the cable.
|
||||||
|
* The color of a given subnet is the same as the wool with metadata equal to the subnet number.
|
||||||
|
* For reference:
|
||||||
|
* 0:White, 1:Orange, 2:Magenta, 3:LightBlue, 4:Yellow, 5:Lime, 6:Pink, 7:Gray,
|
||||||
|
* 8:LightGray, 9:Cyan, 10:Purple, 11:Blue, 12:Brown, 13:Green, 14:Red, 15:Black
|
||||||
|
*/
|
||||||
|
public interface IConnectableRedNet
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns the connection type of this Block. "All" types will cause getOutputValues() and onInputsChanged() to be used,
|
||||||
|
* whereas "Single" types will onInputChanged() to be called for input changes and the normal redstone power output methods
|
||||||
|
* to be called for output. If this value must be changed while the block is alive, it must perform a block update on any
|
||||||
|
* adjacent RedNet wires.
|
||||||
|
* @param world The world this block is in.
|
||||||
|
* @param x This block's X coordinate.
|
||||||
|
* @param y This block's Y coordinate.
|
||||||
|
* @param z This block's Z coordinate.
|
||||||
|
* @param side The side that connection information is required for.
|
||||||
|
* @return The connection type.
|
||||||
|
*/
|
||||||
|
public RedNetConnectionType getConnectionType(World world, int x, int y, int z, ForgeDirection side);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the output values of this RedNet node. This array must be 16 elements long. Only called if your block is connected in "All" mode.
|
||||||
|
* @param world The world this block is in.
|
||||||
|
* @param x This block's X coordinate.
|
||||||
|
* @param y This block's Y coordinate.
|
||||||
|
* @param z This block's Z coordinate.
|
||||||
|
* @param side The side the output values are required for.
|
||||||
|
* @return The output values.
|
||||||
|
*/
|
||||||
|
public int[] getOutputValues(World world, int x, int y, int z, ForgeDirection side);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the output value of this RedNet node for a given subnet. Only called if your block is connected in "All" mode.
|
||||||
|
* @param world The world this block is in.
|
||||||
|
* @param x This block's X coordinate.
|
||||||
|
* @param y This block's Y coordinate.
|
||||||
|
* @param z This block's Z coordinate.
|
||||||
|
* @param side The side the output value is required for.
|
||||||
|
* @param subnet The subnet to get the output value for (0-15).
|
||||||
|
* @return The output value.
|
||||||
|
*/
|
||||||
|
public int getOutputValue(World world, int x, int y, int z, ForgeDirection side, int subnet);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the input values to this block change. Only called if your block is connected in "All" mode.
|
||||||
|
* Do not issue a network value update from inside this method call; it will be ignored. Issue your updates
|
||||||
|
* on the next tick.
|
||||||
|
* @param world The world this block is in.
|
||||||
|
* @param x This block's X coordinate.
|
||||||
|
* @param y This block's Y coordinate.
|
||||||
|
* @param z This block's Z coordinate.
|
||||||
|
* @param side The side the input values are being changed on.
|
||||||
|
* @param inputValues The new set of input values. This array will be 16 elements long.
|
||||||
|
*/
|
||||||
|
public void onInputsChanged(World world, int x, int y, int z, ForgeDirection side, int[] inputValues);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the input value to this block changes. Only called if your block is connected in "Single" mode.
|
||||||
|
* Do not issue a network value update from inside this method call; it will be ignored. Issue your updates
|
||||||
|
* on the next tick.
|
||||||
|
* @param world The world this block is in.
|
||||||
|
* @param x This block's X coordinate.
|
||||||
|
* @param y This block's Y coordinate.
|
||||||
|
* @param z This block's Z coordinate.
|
||||||
|
* @param side The side the input values are being changed on.
|
||||||
|
* @param inputValue The new input value
|
||||||
|
*/
|
||||||
|
public void onInputChanged(World world, int x, int y, int z, ForgeDirection side, int inputValue);
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
public interface IRedNetLogicCircuit
|
||||||
|
{
|
||||||
|
public int getInputCount();
|
||||||
|
|
||||||
|
public int getOutputCount();
|
||||||
|
|
||||||
|
public int[] recalculateOutputValues(long worldTime, int[] inputValues);
|
||||||
|
|
||||||
|
public String getUnlocalizedName();
|
||||||
|
public String getInputPinLabel(int pin);
|
||||||
|
public String getOutputPinLabel(int pin);
|
||||||
|
|
||||||
|
public void readFromNBT(NBTTagCompound tag);
|
||||||
|
public void writeToNBT(NBTTagCompound tag);
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* You should not implement this yourself. Instead, use this to look for cables to notify from your IConnectableRedNet as this does not
|
||||||
|
* require a block update. This will be implemented on the cable's Block class.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IRedNetNetworkContainer
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Tells the network to recalculate all subnets.
|
||||||
|
* @param world The world this cable is in.
|
||||||
|
* @param x The x-coordinate of this cable.
|
||||||
|
* @param x The y-coordinate of this cable.
|
||||||
|
* @param x The z-coordinate of this cable.
|
||||||
|
*/
|
||||||
|
public void updateNetwork(World world, int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells the network to recalculate a specific subnet.
|
||||||
|
* @param world The world this cable is in.
|
||||||
|
* @param x The x-coordinate of this cable.
|
||||||
|
* @param x The y-coordinate of this cable.
|
||||||
|
* @param x The z-coordinate of this cable.
|
||||||
|
* @param subnet The subnet to recalculate.
|
||||||
|
*/
|
||||||
|
public void updateNetwork(World world, int x, int y, int z, int subnet);
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet;
|
||||||
|
|
||||||
|
public interface IRedNetNoConnection
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines how RedNet cable connects to a block
|
||||||
|
*
|
||||||
|
* None: RedNet will never connect to this block (if this is all you want: use IRedNetNoConnection)
|
||||||
|
*
|
||||||
|
* CableSingle: Connections will use the cable renderer with a single band, best used for whole blocks
|
||||||
|
* PlateSingle: Connections will use the plate renderer with a single band, used for conveyers and rails
|
||||||
|
*
|
||||||
|
* CableAll: Connections permit access to all 16 bands
|
||||||
|
* PlateAll: Connections permit access to all 16 bands
|
||||||
|
*
|
||||||
|
* Forced connection modes are best used for decoration blocks: RedNet will not connect normally, but will if the user forces it
|
||||||
|
*
|
||||||
|
* ForcedCableSingle: Connections permit access to a single band only when the cable is in forced connection mode
|
||||||
|
* ForcedPlateSingle: Connections permit access to a single band only when the cable is in forced connection mode
|
||||||
|
*
|
||||||
|
* ForcedCableAll: Connections permit access to all 16 bands only when the cable is in forced connection mode
|
||||||
|
* ForcedPlateAll: Connections permit access to all 16 bands only when the cable is in forced connection mode
|
||||||
|
*/
|
||||||
|
public enum RedNetConnectionType
|
||||||
|
{
|
||||||
|
None, // 0
|
||||||
|
CableSingle, // 11
|
||||||
|
PlateSingle, // 13
|
||||||
|
CableAll, // 19
|
||||||
|
PlateAll, // 21
|
||||||
|
ForcedCableSingle, // 43
|
||||||
|
ForcedPlateSingle, // 45
|
||||||
|
ForcedCableAll, // 51
|
||||||
|
ForcedPlateAll; // 53
|
||||||
|
|
||||||
|
public final boolean isConnected = this.ordinal() != 0;
|
||||||
|
public final boolean isSingleSubnet = this.name().endsWith("Single");
|
||||||
|
public final boolean isAllSubnets = this.name().endsWith("All");
|
||||||
|
public final boolean isConnectionForced = this.name().startsWith("Forced");
|
||||||
|
public final boolean isPlate = this.name().contains("Plate");
|
||||||
|
public final boolean isCable = this.name().contains("Cable");
|
||||||
|
public final short flags = toFlags(isConnected, isCable, isPlate, isSingleSubnet, isAllSubnets, isConnectionForced);
|
||||||
|
|
||||||
|
public static final RedNetConnectionType fromFlags(short flags)
|
||||||
|
{
|
||||||
|
return connections.get(flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final short toFlags(boolean ...flags)
|
||||||
|
{
|
||||||
|
short ret = 0;
|
||||||
|
for (int i = flags.length; i --> 0;)
|
||||||
|
ret |= (flags[i] ? 1 : 0) << i;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<Short, RedNetConnectionType> connections = new HashMap<Short, RedNetConnectionType>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
for (RedNetConnectionType type : RedNetConnectionType.values())
|
||||||
|
connections.put(type.flags, type);
|
||||||
|
}
|
||||||
|
}
|
|
@ -89,6 +89,7 @@ public class BOPCrossIntegration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
if (Loader.isModLoaded("ATG"))
|
if (Loader.isModLoaded("ATG"))
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
@ -99,5 +100,17 @@ public class BOPCrossIntegration {
|
||||||
e.printStackTrace(System.err);
|
e.printStackTrace(System.err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
if (Loader.isModLoaded("MineFactoryReloaded"))
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// MFRIntegration.init();
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
System.out.println("[BiomesOPlenty] There was an error while integrating MineFactory Reloaded with Biomes O' Plenty!");
|
||||||
|
e.printStackTrace(System.err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>>>>>>> parent of 3e8fda0... Completely ripped out the MFR API as it is no longer needed (BOP integration is now in MFR itself)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
91
common/biomesoplenty/integration/MFRIntegration.java
Normal file
91
common/biomesoplenty/integration/MFRIntegration.java
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
package biomesoplenty.integration;
|
||||||
|
|
||||||
|
import biomesoplenty.api.Biomes;
|
||||||
|
import biomesoplenty.api.BlockReferences;
|
||||||
|
import biomesoplenty.api.Blocks;
|
||||||
|
import biomesoplenty.api.Items;
|
||||||
|
import biomesoplenty.integration.minefactoryreloaded.Fertilizable;
|
||||||
|
import biomesoplenty.integration.minefactoryreloaded.FruitLeaves;
|
||||||
|
import biomesoplenty.integration.minefactoryreloaded.Harvestable;
|
||||||
|
import com.google.common.base.Optional;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import powercrystals.minefactoryreloaded.api.FarmingRegistry;
|
||||||
|
import powercrystals.minefactoryreloaded.api.HarvestType;
|
||||||
|
|
||||||
|
public class MFRIntegration
|
||||||
|
{
|
||||||
|
protected static void init()
|
||||||
|
{
|
||||||
|
registerRubberTreeBiomes();
|
||||||
|
registerFarmables();
|
||||||
|
registerSludgeDrops();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void registerRubberTreeBiomes()
|
||||||
|
{
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.bayou.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.birchForest.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.bog.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.borealForest.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.deciduousForest.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.forestNew.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.grove.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.jungleNew.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.lushSwamp.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.mapleWoods.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.rainforest.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.seasonalForest.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.shield.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.swamplandNew.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.temperateRainforest.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.thicket.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.tropicalRainforest.get().biomeName);
|
||||||
|
FarmingRegistry.registerRubberTreeBiome(Biomes.woodland.get().biomeName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
private static void registerFarmables()
|
||||||
|
{
|
||||||
|
Optional[] bopLeaves = { Blocks.leaves1, Blocks.leaves2, Blocks.leavesColorized, Blocks.treeMoss, Blocks.willow, Blocks.ivy, Blocks.moss };
|
||||||
|
Optional[] bopFruitLeaves = { Blocks.leavesFruit };
|
||||||
|
Optional[] bopLogs = { Blocks.logs1, Blocks.logs2, Blocks.logs3, Blocks.logs4, Blocks.bamboo };
|
||||||
|
Optional[] bopMiscStandardHarvestables = { Blocks.flowers, Blocks.plants, Blocks.foliage, Blocks.mushrooms };
|
||||||
|
Optional[] bopSaplings = { Blocks.saplings, Blocks.colorizedSaplings };
|
||||||
|
|
||||||
|
for(Optional<? extends Block> leaves : bopLeaves)
|
||||||
|
{
|
||||||
|
FarmingRegistry.registerHarvestable(new Harvestable(leaves.get().blockID, HarvestType.TreeLeaf));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Optional<? extends Block> log : bopLogs)
|
||||||
|
{
|
||||||
|
FarmingRegistry.registerHarvestable(new Harvestable(log.get().blockID, HarvestType.Tree));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Optional<? extends Block> harvestable : bopMiscStandardHarvestables)
|
||||||
|
{
|
||||||
|
FarmingRegistry.registerHarvestable(new Harvestable(harvestable.get().blockID, HarvestType.Normal));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Optional<? extends Block> sapling : bopSaplings)
|
||||||
|
{
|
||||||
|
FarmingRegistry.registerFertilizable(new Fertilizable(sapling.get().blockID));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Optional<? extends Block> leaves : bopFruitLeaves)
|
||||||
|
{
|
||||||
|
FarmingRegistry.registerHarvestable(new Harvestable(leaves.get().blockID, HarvestType.TreeLeaf));
|
||||||
|
FarmingRegistry.registerFruit(new FruitLeaves(leaves.get().blockID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void registerSludgeDrops()
|
||||||
|
{
|
||||||
|
FarmingRegistry.registerSludgeDrop(15, BlockReferences.getBlockItemStack("driedDirt"));
|
||||||
|
FarmingRegistry.registerSludgeDrop(15, BlockReferences.getBlockItemStack("hardSand"));
|
||||||
|
FarmingRegistry.registerSludgeDrop(15, BlockReferences.getBlockItemStack("hardDirt"));
|
||||||
|
FarmingRegistry.registerSludgeDrop(15, new ItemStack(Items.miscItems.get(), 4, 1));
|
||||||
|
FarmingRegistry.registerSludgeDrop(25, new ItemStack(Items.mudball.get(), 4));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package biomesoplenty.integration.minefactoryreloaded;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockSapling;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import powercrystals.minefactoryreloaded.api.FertilizerType;
|
||||||
|
import powercrystals.minefactoryreloaded.api.IFactoryFertilizable;
|
||||||
|
|
||||||
|
public class Fertilizable implements IFactoryFertilizable
|
||||||
|
{
|
||||||
|
private int blockId;
|
||||||
|
|
||||||
|
public Fertilizable(int blockId)
|
||||||
|
{
|
||||||
|
this.blockId = blockId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFertilizableBlockId()
|
||||||
|
{
|
||||||
|
return blockId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canFertilizeBlock(World world, int x, int y, int z, FertilizerType fertilizerType)
|
||||||
|
{
|
||||||
|
return fertilizerType == FertilizerType.GrowPlant;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean fertilize(World world, Random rand, int x, int y, int z, FertilizerType fertilizerType)
|
||||||
|
{
|
||||||
|
((BlockSapling)Block.blocksList[world.getBlockId(x, y, z)]).growTree(world, x, y, z, world.rand);
|
||||||
|
return world.getBlockId(x, y, z) != blockId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package biomesoplenty.integration.minefactoryreloaded;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import powercrystals.minefactoryreloaded.api.IFactoryFruit;
|
||||||
|
|
||||||
|
public class FruitLeaves implements IFactoryFruit
|
||||||
|
{
|
||||||
|
private int sourceId;
|
||||||
|
|
||||||
|
public FruitLeaves(int sourceId)
|
||||||
|
{
|
||||||
|
if(sourceId > Block.blocksList.length)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("Passed an Item ID to FactoryHarvestableStandard's source block argument");
|
||||||
|
}
|
||||||
|
this.sourceId = sourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSourceBlockId()
|
||||||
|
{
|
||||||
|
return sourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBePicked(World world, int x, int y, int z)
|
||||||
|
{
|
||||||
|
return (world.getBlockMetadata(x, y, z) & 3) == 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getReplacementBlock(World world, int x, int y, int z)
|
||||||
|
{
|
||||||
|
return new ItemStack(world.getBlockId(x, y, z), 1, world.getBlockMetadata(x,y,z));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void prePick(World world, int x, int y, int z)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDrops(World world, Random rand, int x, int y, int z)
|
||||||
|
{
|
||||||
|
ArrayList<ItemStack> result = new ArrayList<ItemStack>();
|
||||||
|
result.add(new ItemStack(Item.appleRed));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postPick(World world, int x, int y, int z)
|
||||||
|
{
|
||||||
|
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x,y,z) - 3, 2);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
package biomesoplenty.integration.minefactoryreloaded;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import powercrystals.minefactoryreloaded.api.HarvestType;
|
||||||
|
import powercrystals.minefactoryreloaded.api.IFactoryHarvestable;
|
||||||
|
|
||||||
|
public class Harvestable implements IFactoryHarvestable
|
||||||
|
{
|
||||||
|
private int sourceId;
|
||||||
|
private HarvestType harvestType;
|
||||||
|
|
||||||
|
public Harvestable(int sourceId, HarvestType harvestType)
|
||||||
|
{
|
||||||
|
if(sourceId > Block.blocksList.length)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("Passed an Item ID to FactoryHarvestableStandard's source block argument");
|
||||||
|
}
|
||||||
|
this.sourceId = sourceId;
|
||||||
|
this.harvestType = harvestType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPlantId()
|
||||||
|
{
|
||||||
|
return sourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HarvestType getHarvestType()
|
||||||
|
{
|
||||||
|
return harvestType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean breakBlock()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBeHarvested(World world, Map<String, Boolean> harvesterSettings, int x, int y, int z)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDrops(World world, Random rand, Map<String, Boolean> harvesterSettings, int x, int y, int z)
|
||||||
|
{
|
||||||
|
if(harvesterSettings.get("silkTouch") != null && harvesterSettings.get("silkTouch") && harvestType == HarvestType.TreeLeaf)
|
||||||
|
{
|
||||||
|
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||||
|
drops.add(new ItemStack(sourceId, 1, world.getBlockMetadata(x, y, z)));
|
||||||
|
return drops;
|
||||||
|
}
|
||||||
|
// else if(getPlantId() == Blocks.leavesFruit.get().blockID)
|
||||||
|
// {
|
||||||
|
// ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||||
|
//
|
||||||
|
// int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
// if ((meta & 3) == 3)
|
||||||
|
// {
|
||||||
|
// drops.add(new ItemStack(Item.appleRed));
|
||||||
|
// }
|
||||||
|
// else if ((meta & 3) == 2)
|
||||||
|
// {
|
||||||
|
// if(rand.nextInt(16) == 0) drops.add(new ItemStack(Item.appleRed));
|
||||||
|
// if(rand.nextInt(80) == 0) drops.add(new ItemStack(Block.sapling));
|
||||||
|
// }
|
||||||
|
// else if ((meta & 3) == 1)
|
||||||
|
// {
|
||||||
|
// if(rand.nextInt(64) == 0) drops.add(new ItemStack(Item.appleRed));
|
||||||
|
// if(rand.nextInt(40) == 0) drops.add(new ItemStack(Block.sapling));
|
||||||
|
// }
|
||||||
|
// else if ((meta & 3) == 0)
|
||||||
|
// {
|
||||||
|
// if(rand.nextInt(20) == 0) drops.add(new ItemStack(Block.sapling));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return drops;
|
||||||
|
// }
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Block.blocksList[getPlantId()].getBlockDropped(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void preHarvest(World world, int x, int y, int z)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postHarvest(World world, int x, int y, int z)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue