本文整理汇总了Java中cpw.mods.fml.common.Optional.Method类的典型用法代码示例。如果您正苦于以下问题:Java Method类的具体用法?Java Method怎么用?Java Method使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Method类属于cpw.mods.fml.common.Optional包,在下文中一共展示了Method类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: callMethod
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = ComputerCraft.MOD_ID)
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
if (method == 0)
return comp_Dial(arguments);
else if (method == 1)
getPortalController().deconstructConnection();
else if (method == 2)
return comp_DialStored(arguments);
else if (method == 3)
return comp_GetStoredName(arguments);
else if (method == 4)
return comp_GetStoredGlyph(arguments);
else if (method == 5)
return new Object[] { glyphList.size() };
return null;
}
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:19,代码来源:TileDialingDevice.java
示例2: receiveEnergy
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = "CoFHCore")
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
{
if(getConsumingSides().contains(from))
{
double toAdd = (int)Math.min(getMaxEnergy()-getEnergy(), maxReceive* general.FROM_TE);
if(!simulate)
{
setEnergy(getEnergy() + toAdd);
}
return (int)Math.round(toAdd* general.TO_TE);
}
return 0;
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:19,代码来源:TileEntityElectricBlock.java
示例3: register
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Method(modid = "IC2")
public void register()
{
if(!worldObj.isRemote)
{
TileEntity registered = EnergyNet.instance.getTileEntity(worldObj, xCoord, yCoord, zCoord);
if(registered != this)
{
if(registered instanceof IEnergyTile)
{
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergyTile)registered));
}
else if(registered == null)
{
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
ic2Registered = true;
}
}
}
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:22,代码来源:TileEntityInductionPort.java
示例4: getWailaHead
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = "Waila")
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
TileEntity tile = accessor.getTileEntity();
if(tile instanceof TileEntityInductionCell)
{
currenttip.set(0, EnumColor.WHITE + ((TileEntityInductionCell)tile).getInventoryName());
}
else if(tile instanceof TileEntityInductionProvider)
{
currenttip.set(0, EnumColor.WHITE + ((TileEntityInductionProvider)tile).getInventoryName());
}
else if(tile instanceof TileEntityFactory)
{
currenttip.set(0, EnumColor.WHITE + ((TileEntityFactory)tile).getInventoryName());
}
return currenttip;
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:22,代码来源:WailaDataProvider.java
示例5: callMethod
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException
{
switch(method)
{
case 0:
return new Object[] {getEnergy()};
case 1:
return new Object[] {operatingTicks};
case 2:
return new Object[] {isActive};
case 3:
return new Object[] {facing};
case 4:
return new Object[] {canOperate(getRecipe())};
case 5:
return new Object[] {getMaxEnergy()};
case 6:
return new Object[] {getMaxEnergy()-getEnergy()};
default:
Mekanism.logger.error("Attempted to call unknown method with computer ID " + computer.getID());
return new Object[] {"Unknown command."};
}
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:26,代码来源:TileEntityElectricMachine.java
示例6: callMethod
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException
{
switch(method)
{
case 0:
return new Object[] {electricityStored};
case 1:
return new Object[] {output};
case 2:
return new Object[] {BASE_MAX_ENERGY};
case 3:
return new Object[] {(BASE_MAX_ENERGY -electricityStored)};
case 4:
return new Object[] {bioFuelSlot.fluidStored};
case 5:
return new Object[] {bioFuelSlot.MAX_FLUID-bioFuelSlot.fluidStored};
default:
Mekanism.logger.error("Attempted to call unknown method with computer ID " + computer.getID());
return null;
}
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:24,代码来源:TileEntityBioGenerator.java
示例7: acceptsEnergyFrom
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = "IC2")
public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
{
if(getInv() == null)
{
return false;
}
return getInv().acceptsEnergyFrom(emitter, direction);
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:12,代码来源:TileEntityAdvancedBoundingBlock.java
示例8: callMethod
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException
{
if(getInv() == null)
{
return new Object[] {};
}
return getInv().callMethod(computer, context, method, arguments);
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:12,代码来源:TileEntityAdvancedBoundingBlock.java
示例9: addEnergy
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = "IC2")
public int addEnergy(int amount)
{
setEnergy(getEnergy() + amount*general.FROM_IC2);
return (int)Math.round(getEnergy()*general.TO_IC2);
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:8,代码来源:TileEntityInductionPort.java
示例10: injectEnergy
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = "IC2")
public double injectEnergy(ForgeDirection direction, double amount, double voltage)
{
if(Coord4D.get(this).getFromSide(direction).getTileEntity(worldObj) instanceof ITransmitterTile)
{
return amount;
}
return amount-transferEnergyToAcceptor(direction, amount*general.FROM_IC2)*general.TO_IC2;
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:12,代码来源:TileEntityElectricBlock.java
示例11: callMethod
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = ComputerCraft.MOD_ID)
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
if (method == 0)
return new Object[] { stack != null ? Item.getIdFromItem(stack.getItem()) : 0 };
else if (method == 1)
return new Object[] { stack != null ? stack.stackSize : 0 };
else if (method == 2)
return new Object[] { stack != null };
else if (method == 3)
return new Object[] { isSending };
return null;
}
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:15,代码来源:TileTransferItem.java
示例12: getType
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = "ComputerCraft")
public String getType()
{
if(getInv() == null)
{
return null;
}
return getInv().getType();
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:12,代码来源:TileEntityAdvancedBoundingBlock.java
示例13: canConnectEnergy
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = "CoFHCore")
public boolean canConnectEnergy(ForgeDirection from)
{
if(getInv() == null)
{
return false;
}
return getInv().canConnectEnergy(from);
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:12,代码来源:TileEntityAdvancedBoundingBlock.java
示例14: getPeripheral
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = "ComputerCraft")
public IPeripheral getPeripheral(World world, int x, int y, int z, int side)
{
TileEntity te = world.getTileEntity(x, y, z);
if(te != null && te instanceof IPeripheral)
{
return (IPeripheral)te;
}
return null;
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:14,代码来源:BlockEnergyCube.java
示例15: detach
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = "ComputerCraft")
public void detach(IComputerAccess computer)
{
if(getInv() == null)
{
return;
}
getInv().detach(computer);
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:12,代码来源:TileEntityAdvancedBoundingBlock.java
示例16: injectEnergy
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = "IC2")
public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage)
{
if(getInv() == null)
{
return amount;
}
return getInv().injectEnergy(directionFrom, amount, voltage);
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:12,代码来源:TileEntityAdvancedBoundingBlock.java
示例17: getPeripheral
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = ComputerCraft.MOD_ID)
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
TileEntity t = world.getTileEntity(x, y, z);
if (t != null && (t instanceof TileController || t instanceof TileNetworkInterface || t instanceof TileDialingDevice || t instanceof TileTransferEnergy || t instanceof TileTransferFluid || t instanceof TileTransferItem))
return (IPeripheral) t;
return null;
}
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:11,代码来源:BlockFrame.java
示例18: addIC2BronzeRecipe
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Method(modid = "IC2")
public static void addIC2BronzeRecipe()
{
try {
Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotBronze"), null, StackUtils.size(OreDictionary.getOres("dustBronze").get(0), 1));
} catch(Exception e) {}
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:8,代码来源:OreDictManager.java
示例19: loadCCPeripheralProviders
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Method(modid = "ComputerCraft")
public void loadCCPeripheralProviders()
{
try {
ComputerCraftAPI.registerPeripheralProvider((BlockMachine) MekanismBlocks.MachineBlock);
} catch(Exception ex) {}
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:8,代码来源:MekanismHooks.java
示例20: getPeripheral
import cpw.mods.fml.common.Optional.Method; //导入依赖的package包/类
@Override
@Method(modid = "ComputerCraft")
public IPeripheral getPeripheral(World world, int x, int y, int z, int side)
{
TileEntity te = world.getTileEntity(x, y, z);
if(te != null && te instanceof IPeripheral)
{
return (IPeripheral)te;
}
return null;
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:14,代码来源:BlockMachine.java
注:本文中的cpw.mods.fml.common.Optional.Method类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论