Aaaaaaand ComputerCraft.

This commit is contained in:
Ben Spiers 2014-06-26 21:07:46 +01:00
parent f463416c0c
commit 3a027d0ef4
40 changed files with 127 additions and 5 deletions

View file

@ -17,7 +17,8 @@ import dan200.computercraft.api.peripheral.IPeripheral;
@InterfaceList({ @InterfaceList({
@Interface(iface = "buildcraft.api.power.IPowerReceptor", modid = "BuildCraftAPI|power"), @Interface(iface = "buildcraft.api.power.IPowerReceptor", modid = "BuildCraftAPI|power"),
@Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2API", striprefs = true), @Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2API", striprefs = true),
@Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHAPI|energy") @Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHAPI|energy"),
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
}) })
public interface IAdvancedBoundingBlock extends IBoundingBlock, ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IPowerReceptor, IStrictEnergyStorage, IEnergyHandler, IPeripheral, IFilterAccess public interface IAdvancedBoundingBlock extends IBoundingBlock, ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IPowerReceptor, IStrictEnergyStorage, IEnergyHandler, IPeripheral, IFilterAccess
{ {

View file

@ -87,6 +87,8 @@ import net.minecraftforge.fluids.FluidStack;
import buildcraft.api.tools.IToolWrench; import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.common.ModAPIManager; import cpw.mods.fml.common.ModAPIManager;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
@ -125,6 +127,7 @@ import dan200.computercraft.api.peripheral.IPeripheralProvider;
* @author AidanBrady * @author AidanBrady
* *
*/ */
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheralProvider", modid = "ComputerCraft")
public class BlockMachine extends BlockContainer implements ISpecialBounds, IPeripheralProvider public class BlockMachine extends BlockContainer implements ISpecialBounds, IPeripheralProvider
{ {
public IIcon[][] icons = new IIcon[16][16]; public IIcon[][] icons = new IIcon[16][16];
@ -1347,6 +1350,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
} }
@Override @Override
@Method(modid = "ComputerCraft")
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) public IPeripheral getPeripheral(World world, int x, int y, int z, int side)
{ {
TileEntity te = world.getTileEntity(x, y, z); TileEntity te = world.getTileEntity(x, y, z);

View file

@ -94,9 +94,7 @@ public final class MekanismHooks
if(CCLoaded) if(CCLoaded)
{ {
try { loadCCPeripheralProviders();
ComputerCraftAPI.registerPeripheralProvider((BlockMachine)Mekanism.MachineBlock);
} catch(Exception ex) {}
} }
} }
@ -157,6 +155,14 @@ public final class MekanismHooks
Recipes.matterAmplifier.addRecipe(new RecipeInputItemStack(new ItemStack(Mekanism.EnrichedAlloy), 1), tag); Recipes.matterAmplifier.addRecipe(new RecipeInputItemStack(new ItemStack(Mekanism.EnrichedAlloy), 1), tag);
} }
@Method(modid = "ComputerCraft")
public void loadCCPeripheralProviders()
{
try {
ComputerCraftAPI.registerPeripheralProvider((BlockMachine)Mekanism.MachineBlock);
} catch(Exception ex) {}
}
public void addPulverizerRecipe(ItemStack input, ItemStack output, int energy) public void addPulverizerRecipe(ItemStack input, ItemStack output, int energy)
{ {
NBTTagCompound nbtTags = new NBTTagCompound(); NBTTagCompound nbtTags = new NBTTagCompound();

View file

@ -29,7 +29,8 @@ import dan200.computercraft.api.peripheral.IPeripheral;
@InterfaceList({ @InterfaceList({
@Interface(iface = "buildcraft.api.power.IPowerReceptor", modid = "BuildCraftAPI|power"), @Interface(iface = "buildcraft.api.power.IPowerReceptor", modid = "BuildCraftAPI|power"),
@Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2API", striprefs = true), @Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2API", striprefs = true),
@Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHAPI|energy") @Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHAPI|energy"),
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
}) })
public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock implements ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IPowerReceptor, IStrictEnergyStorage, IEnergyHandler, IPeripheral, IFilterAccess public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock implements ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IPowerReceptor, IStrictEnergyStorage, IEnergyHandler, IPeripheral, IFilterAccess
{ {
@ -428,6 +429,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String getType() public String getType()
{ {
if(getInv() == null) if(getInv() == null)
@ -439,6 +441,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
if(getInv() == null) if(getInv() == null)
@ -450,6 +453,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
if(getInv() == null) if(getInv() == null)
@ -461,6 +465,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
} }
@Override @Override
@Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) public void attach(IComputerAccess computer)
{ {
if(getInv() == null) if(getInv() == null)
@ -472,6 +477,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
} }
@Override @Override
@Method(modid = "ComputerCraft")
public void detach(IComputerAccess computer) public void detach(IComputerAccess computer)
{ {
if(getInv() == null) if(getInv() == null)
@ -483,6 +489,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
} }
@Override @Override
@Method(modid = "ComputerCraft")
public boolean equals(IPeripheral other) public boolean equals(IPeripheral other)
{ {
return this == other; return this == other;

View file

@ -25,6 +25,8 @@ import mekanism.common.util.StackUtils;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
@ -355,12 +357,14 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return new String[] {"getStored", "getSecondaryStored", "getProgress", "isActive", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded"}; return new String[] {"getStored", "getSecondaryStored", "getProgress", "isActive", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded"};
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
switch(method) switch(method)

View file

@ -23,10 +23,12 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.common.Optional.Interface; import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.InterfaceList; import cpw.mods.fml.common.Optional.InterfaceList;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public abstract class TileEntityBasicMachine extends TileEntityElectricBlock implements IElectricMachine, IPeripheral, IActiveState, IInvConfiguration, IUpgradeTile, IHasSound, IRedstoneControl public abstract class TileEntityBasicMachine extends TileEntityElectricBlock implements IElectricMachine, IPeripheral, IActiveState, IInvConfiguration, IUpgradeTile, IHasSound, IRedstoneControl
{ {
/** This machine's side configuration. */ /** This machine's side configuration. */
@ -249,12 +251,14 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String getType() public String getType()
{ {
return getInventoryName(); return getInventoryName();
} }
@Override @Override
@Method(modid = "ComputerCraft")
public boolean equals(IPeripheral other) public boolean equals(IPeripheral other)
{ {
return this == other; return this == other;
@ -267,9 +271,11 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
} }
@Override @Override
@Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {} public void attach(IComputerAccess computer) {}
@Override @Override
@Method(modid = "ComputerCraft")
public void detach(IComputerAccess computer) {} public void detach(IComputerAccess computer) {}
@Override @Override

View file

@ -14,9 +14,12 @@ import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
public abstract class TileEntityChanceMachine extends TileEntityBasicMachine public abstract class TileEntityChanceMachine extends TileEntityBasicMachine
{ {
public TileEntityChanceMachine(String soundPath, String name, ResourceLocation location, double perTick, int ticksRequired, double maxEnergy) public TileEntityChanceMachine(String soundPath, String name, ResourceLocation location, double perTick, int ticksRequired, double maxEnergy)
@ -208,12 +211,14 @@ public abstract class TileEntityChanceMachine extends TileEntityBasicMachine
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return null; return null;
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
return null; return null;

View file

@ -47,12 +47,15 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public class TileEntityDigitalMiner extends TileEntityElectricBlock implements IPeripheral, IUpgradeTile, IRedstoneControl, IActiveState, IAdvancedBoundingBlock public class TileEntityDigitalMiner extends TileEntityElectricBlock implements IPeripheral, IUpgradeTile, IRedstoneControl, IActiveState, IAdvancedBoundingBlock
{ {
public static int[] EJECT_INV; public static int[] EJECT_INV;
@ -1138,6 +1141,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String getType() public String getType()
{ {
return getInventoryName(); return getInventoryName();
@ -1146,12 +1150,14 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
public String[] names = {"setRadius", "setMin", "setMax", "setReplace", "addFilter", "removeFilter", "addOreFilter", "removeOreFilter", "reset", "start", "stop"}; public String[] names = {"setRadius", "setMin", "setMax", "setReplace", "addFilter", "removeFilter", "addOreFilter", "removeOreFilter", "reset", "start", "stop"};
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return names; return names;
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
if(arguments.length > 0) if(arguments.length > 0)
@ -1284,15 +1290,18 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
} }
@Override @Override
@Method(modid = "ComputerCraft")
public boolean equals(IPeripheral other) public boolean equals(IPeripheral other)
{ {
return this == other; return this == other;
} }
@Override @Override
@Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {} public void attach(IComputerAccess computer) {}
@Override @Override
@Method(modid = "ComputerCraft")
public void detach(IComputerAccess computer) {} public void detach(IComputerAccess computer) {}
@Override @Override

View file

@ -13,6 +13,7 @@ import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Optional.Interface; import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.InterfaceList; import cpw.mods.fml.common.Optional.InterfaceList;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
@ -179,12 +180,14 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return new String[] {"getStored", "getProgress", "isActive", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded"}; return new String[] {"getStored", "getProgress", "isActive", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded"};
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
switch(method) switch(method)

View file

@ -34,10 +34,14 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock implements IFluidHandler, IPeripheral, ITubeConnection, ISustainedTank, IGasHandler public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock implements IFluidHandler, IPeripheral, ITubeConnection, ISustainedTank, IGasHandler
{ {
/** This separator's water slot. */ /** This separator's water slot. */
@ -497,18 +501,21 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String getType() public String getType()
{ {
return getInventoryName(); return getInventoryName();
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getWater", "getWaterNeeded", "getHydrogen", "getHydrogenNeeded", "getOxygen", "getOxygenNeeded"}; return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getWater", "getWaterNeeded", "getHydrogen", "getHydrogenNeeded", "getOxygen", "getOxygenNeeded"};
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
switch(method) switch(method)
@ -540,15 +547,18 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
} }
@Override @Override
@Method(modid = "ComputerCraft")
public boolean equals(IPeripheral other) public boolean equals(IPeripheral other)
{ {
return this == other; return this == other;
} }
@Override @Override
@Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {} public void attach(IComputerAccess computer) {}
@Override @Override
@Method(modid = "ComputerCraft")
public void detach(IComputerAccess computer) {} public void detach(IComputerAccess computer) {}
@Override @Override

View file

@ -18,10 +18,14 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPeripheral, IRedstoneControl public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPeripheral, IRedstoneControl
{ {
/** This Energy Cube's tier. */ /** This Energy Cube's tier. */
@ -146,18 +150,21 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPe
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String getType() public String getType()
{ {
return getInventoryName(); return getInventoryName();
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded"}; return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded"};
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
switch(method) switch(method)
@ -177,15 +184,18 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPe
} }
@Override @Override
@Method(modid = "ComputerCraft")
public boolean equals(IPeripheral other) public boolean equals(IPeripheral other)
{ {
return this == other; return this == other;
} }
@Override @Override
@Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {} public void attach(IComputerAccess computer) {}
@Override @Override
@Method(modid = "ComputerCraft")
public void detach(IComputerAccess computer) {} public void detach(IComputerAccess computer) {}
@Override @Override

View file

@ -37,10 +37,14 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public class TileEntityFactory extends TileEntityElectricBlock implements IPeripheral, IActiveState, IInvConfiguration, IUpgradeTile, IHasSound, IRedstoneControl, IGasHandler, ITubeConnection public class TileEntityFactory extends TileEntityElectricBlock implements IPeripheral, IActiveState, IInvConfiguration, IUpgradeTile, IHasSound, IRedstoneControl, IGasHandler, ITubeConnection
{ {
/** This Factory's tier. */ /** This Factory's tier. */
@ -681,18 +685,21 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String getType() public String getType()
{ {
return getInventoryName(); return getInventoryName();
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return new String[] {"getStored", "getProgress", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded"}; return new String[] {"getStored", "getProgress", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded"};
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
switch(method) switch(method)
@ -746,12 +753,15 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
} }
@Override @Override
@Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {} public void attach(IComputerAccess computer) {}
@Override @Override
@Method(modid = "ComputerCraft")
public void detach(IComputerAccess computer) {} public void detach(IComputerAccess computer) {}
@Override @Override
@Method(modid = "ComputerCraft")
public boolean equals(IPeripheral other) public boolean equals(IPeripheral other)
{ {
return this == other; return this == other;

View file

@ -31,10 +31,14 @@ import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implements IPeripheral, IActiveState, IInvConfiguration, IUpgradeTile, IHasSound, IRedstoneControl public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implements IPeripheral, IActiveState, IInvConfiguration, IUpgradeTile, IHasSound, IRedstoneControl
{ {
/** This machine's side configuration. */ /** This machine's side configuration. */
@ -434,18 +438,21 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String getType() public String getType()
{ {
return getInventoryName(); return getInventoryName();
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return new String[] {"getStored", "getProgress", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded", "getInfuse", "getInfuseNeeded"}; return new String[] {"getStored", "getProgress", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded", "getInfuse", "getInfuseNeeded"};
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
switch(method) switch(method)
@ -473,15 +480,18 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
} }
@Override @Override
@Method(modid = "ComputerCraft")
public boolean equals(IPeripheral other) public boolean equals(IPeripheral other)
{ {
return this == other; return this == other;
} }
@Override @Override
@Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {} public void attach(IComputerAccess computer) {}
@Override @Override
@Method(modid = "ComputerCraft")
public void detach(IComputerAccess computer) {} public void detach(IComputerAccess computer) {}
@Override @Override

View file

@ -37,6 +37,8 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
@ -328,12 +330,14 @@ public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandl
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return null; return null;
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
return null; return null;

View file

@ -30,12 +30,15 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public class TileEntityTeleporter extends TileEntityElectricBlock implements IPeripheral public class TileEntityTeleporter extends TileEntityElectricBlock implements IPeripheral
{ {
private MinecraftServer server = MinecraftServer.getServer(); private MinecraftServer server = MinecraftServer.getServer();
@ -519,18 +522,21 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IPe
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String getType() public String getType()
{ {
return getInventoryName(); return getInventoryName();
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return new String[] {"getStored", "canTeleport", "getMaxEnergy", "getEnergyNeeded", "teleport", "set"}; return new String[] {"getStored", "canTeleport", "getMaxEnergy", "getEnergyNeeded", "teleport", "set"};
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
switch(method) switch(method)
@ -579,15 +585,18 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IPe
} }
@Override @Override
@Method(modid = "ComputerCraft")
public boolean equals(IPeripheral other) public boolean equals(IPeripheral other)
{ {
return this == other; return this == other;
} }
@Override @Override
@Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {} public void attach(IComputerAccess computer) {}
@Override @Override
@Method(modid = "ComputerCraft")
public void detach(IComputerAccess computer) {} public void detach(IComputerAccess computer) {}
@Override @Override

View file

@ -20,6 +20,7 @@ import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
@ -226,12 +227,14 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IFlui
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getBioFuel", "getBioFuelNeeded"}; return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getBioFuel", "getBioFuelNeeded"};
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
switch(method) switch(method)

View file

@ -20,6 +20,8 @@ import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
@ -156,12 +158,14 @@ public class TileEntityGasGenerator extends TileEntityGenerator implements IGasH
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getGas", "getGasNeeded"}; return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getGas", "getGasNeeded"};
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
switch(method) switch(method)

View file

@ -18,12 +18,14 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method; import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public abstract class TileEntityGenerator extends TileEntityElectricBlock implements IPeripheral, IActiveState, IHasSound, IRedstoneControl public abstract class TileEntityGenerator extends TileEntityElectricBlock implements IPeripheral, IActiveState, IHasSound, IRedstoneControl
{ {
/** Output per tick this generator can transfer. */ /** Output per tick this generator can transfer. */
@ -157,18 +159,22 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String getType() public String getType()
{ {
return getInventoryName(); return getInventoryName();
} }
@Override @Override
@Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {} public void attach(IComputerAccess computer) {}
@Override @Override
@Method(modid = "ComputerCraft")
public void detach(IComputerAccess computer) {} public void detach(IComputerAccess computer) {}
@Override @Override
@Method(modid = "ComputerCraft")
public boolean equals(IPeripheral other) public boolean equals(IPeripheral other)
{ {
return this == other; return this == other;

View file

@ -21,6 +21,8 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
@ -255,12 +257,14 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getFuel", "getFuelNeeded"}; return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getFuel", "getFuelNeeded"};
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
switch(method) switch(method)

View file

@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenDesert; import net.minecraft.world.biome.BiomeGenDesert;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.ModAPIManager; import cpw.mods.fml.common.ModAPIManager;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
@ -143,12 +144,14 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getSeesSun"}; return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getSeesSun"};
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
switch(method) switch(method)

View file

@ -7,6 +7,8 @@ import mekanism.common.util.ChargeUtils;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import mekanism.generators.common.MekanismGenerators; import mekanism.generators.common.MekanismGenerators;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
@ -54,12 +56,14 @@ public class TileEntityWindTurbine extends TileEntityGenerator implements IBound
} }
@Override @Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames() public String[] getMethodNames()
{ {
return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getMultiplier"}; return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getMultiplier"};
} }
@Override @Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{ {
switch(method) switch(method)