Galacticraft and MFR API Optional-ing

This commit is contained in:
Ben Spiers committed 2014-06-26 20:17:45 +01:00
1 parent 8ddda5d0dc
commit 26463711de
8 files changed
+53 -11

No files matched your search

@@ -41,8 +41,12 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.util.Constants;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method;
import cofh.api.energy.IEnergyContainerItem;
@Interface(iface = "micdoodle8.mods.galacticraft.api.entity.IEntityBreathable", modid = "Galacticrat API")
public class EntityRobit extends EntityCreature implements IInventory, ISustainedInventory, IEntityBreathable
{
public double MAX_ELECTRICITY = 100000;
@@ -24,8 +24,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.Optional.Interface;
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
@Interface(iface = "powercrystals.minefactoryreloaded.api.IDeepStorageUnit", modid = "MineFactoryReloaded")
public class TileEntityBin extends TileEntityBasicBlock implements ISidedInventory, IActiveState, IDeepStorageUnit, IConfigurable
{
public boolean isActive;
@@ -13,6 +13,8 @@ import micdoodle8.mods.galacticraft.api.world.ISolarLevel;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenDesert;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.ModAPIManager;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess;
@@ -124,7 +126,7 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
{
ret = GENERATION_RATE;
if(worldObj.provider instanceof ISolarLevel)
if(ModAPIManager.INSTANCE.hasAPI("Galacticraft API") && worldObj.provider instanceof ISolarLevel)
{
ret *= ((ISolarLevel)worldObj.provider).getSolarEnergyMultiplier();
}
@@ -1,13 +0,0 @@
package micdoodle8.mods.galacticraft.api.entity;
/**
* Implement into entities that are living, but can breath without oxygen
*/
public interface IEntityBreathable
{
/**
* Whether or not this entity can currently breathe without oxygen in it's
* vicinity
*/
public boolean canBreath();
}
@@ -1,18 +0,0 @@
package micdoodle8.mods.galacticraft.api.world;
/**
* Used to change the solar multiplier of certain world providers
*
* If you have a solar feature in your mod, check whether the world's provider
* inherits this class and multiply the solar generation by the solar multiplier
* double
*
* for example:
*
* if (worldObj.provider instanceof ISolarLevel) solarStrength *= ((ISolarLevel)
* worldObj.provider).getSolarEnergyMultiplier();
*/
public interface ISolarLevel
{
public double getSolarEnergyMultiplier();
}
@@ -1,26 +0,0 @@
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();
}