本文整理汇总了Java中dan200.computercraft.api.lua.ILuaContext类的典型用法代码示例。如果您正苦于以下问题:Java ILuaContext类的具体用法?Java ILuaContext怎么用?Java ILuaContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ILuaContext类属于dan200.computercraft.api.lua包,在下文中一共展示了ILuaContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的package包/类
@Override
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException {
if (method == 0) {
return new Object[]{this.energyPushedLast};
} else if (method == 1) {
return new Object[]{MathHelper.floor(Math.pow(10, this.energyRate))};
} else if (method == 2) {
return new Object[]{this.comparator};
} else if (method == 3) {
return new Object[]{this.energyRate};
} else if (method == 4) {
if (arguments[0] instanceof Double) {
this.energyRate = MathHelper.floor((Double) arguments[0]);
return new Object[]{true};
} else {
throw new LuaException("Bad argument #1 number excepted");
}
}
return null;
}
示例2: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的package包/类
@Override
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException {
if (method == 0) {
return new Object[]{this.isValidHolotape()};
} else if (method == 1) {
if (!holotape.getStackInSlot(0).isEmpty()) {
if (holotape.getStackInSlot(0).getTagCompound() == null)
holotape.getStackInSlot(0).setTagCompound(new NBTTagCompound());
if (holotape.getStackInSlot(0).getTagCompound().hasKey("w") && holotape.getStackInSlot(0).getTagCompound().getBoolean("w") && holotape.getStackInSlot(0).getTagCompound().hasKey("data") && holotape.getStackInSlot(0).getTagCompound().hasKey("name")) {
String data = holotape.getStackInSlot(0).getTagCompound().getString("data");
String name = holotape.getStackInSlot(0).getTagCompound().getString("name");
return new Object[]{name, data};
} else {
throw new LuaException("This holotape hasn't written yet!");
}
} else {
throw new LuaException("No Holotape in the machine!");
}
}
return null;
}
示例3: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的package包/类
@Override
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] a) throws LuaException, InterruptedException {
if (method == 0) {
Object[] o = new Object[methods.length];
for (int i = 0;i < o.length;i++) {
o[i] = methods[i];
}
return o;
} else if (method == 1) {
if (a.length > 1 && a[0] instanceof String) {
String pName = (String) a[0];
for (TileEntityAntennaBase ant : this.antennas) {
ant.sendMsg(pName, a[1]);
}
}
}
return null;
}
示例4: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的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;
}
示例5: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的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[] { tank.getFluid() != null ? tank.getFluid().getFluid().getName() : "" };
else if (method == 1)
return new Object[] { tank.getFluidAmount() };
else if (method == 2)
return new Object[] { tank.getFluidAmount() == tank.getCapacity() };
else if (method == 3)
return new Object[] { tank.getFluidAmount() == 0 };
else if (method == 4)
return new Object[] { isSending };
return null;
}
示例6: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的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[] { isPortalActive() };
else if (method == 1)
return comp_GetUniqueIdentifier();
else if (method == 2)
return comp_SetUniqueIdentifier(arguments);
else if (method == 3)
return new Object[] { activeTextureData.getFrameColour() };
else if (method == 4)
return comp_SetFrameColour(arguments);
else if (method == 5)
return new Object[] { activeTextureData.getPortalColour() };
else if (method == 6)
return comp_SetPortalColour(arguments);
else if (method == 7)
return new Object[] { activeTextureData.getParticleColour() };
else if (method == 8)
return comp_SetParticleColour(arguments);
return null;
}
示例7: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的package包/类
@Override
public Object[] callMethod(IComputerAccess computer, ILuaContext context,int method, Object[] arguments) throws InterruptedException, LuaException
{
super.callMethod(computer, context, method, arguments);
method -= super.methodsNumber;
switch (method)
{
case 0:
return turtle.executeCommand(context, new DigCommand(2));//front
case 1:
return turtle.executeCommand(context, new DigCommand(0));//down
case 2:
return turtle.executeCommand(context, new DigCommand(1));//up
case 3:
return turtle.executeCommand(context, new AttackCommand(2));//front
case 4:
return turtle.executeCommand(context, new AttackCommand(0));//Down
case 5:
return turtle.executeCommand(context, new AttackCommand(1));//Up
default:
ChunkyPeripherals.logger.error("called unknown method ("+method+")");
}
return null;
}
示例8: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的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."};
}
}
示例9: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的package包/类
@Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException
{
switch(method)
{
case 0:
activeNodes.clear();
usedNodes.clear();
finishedCalc = false;
return new Object[] {"Plenisher calculation reset."};
default:
return new Object[] {"Unknown command."};
}
}
示例10: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的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[] {tier.output};
case 2:
return new Object[] {getMaxEnergy()};
case 3:
return new Object[] {(getMaxEnergy()-getEnergy())};
default:
Mekanism.logger.error("Attempted to call unknown method with computer ID " + computer.getID());
return null;
}
}
示例11: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的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[] {seesSun};
default:
Mekanism.logger.error("Attempted to call unknown method with computer ID " + computer.getID());
return null;
}
}
示例12: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的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[] {output};
case 2:
return new Object[] {getMaxEnergy()};
case 3:
return new Object[] {getMaxEnergy()-getEnergy()};
case 4:
return new Object[] {fuelTank.getStored()};
case 5:
return new Object[] {fuelTank.getNeeded()};
default:
Mekanism.logger.error("Attempted to call unknown method with computer ID " + computer.getID());
return null;
}
}
示例13: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的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;
}
}
示例14: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的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[] {lavaTank.getFluid() != null ? lavaTank.getFluid().amount : 0};
case 5:
return new Object[] {lavaTank.getCapacity()-(lavaTank.getFluid() != null ? lavaTank.getFluid().amount : 0)};
default:
Mekanism.logger.error("Attempted to call unknown method with computer ID " + computer.getID());
return null;
}
}
示例15: callMethod
import dan200.computercraft.api.lua.ILuaContext; //导入依赖的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[] {getMultiplier()};
default:
Mekanism.logger.error("Attempted to call unknown method with computer ID " + computer.getID());
return null;
}
}