当前位置: 首页>>代码示例>>Java>>正文


Java ILuaContext类代码示例

本文整理汇总了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;
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:21,代码来源:TileEntityEnergySensor.java

示例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;
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:22,代码来源:TileEntityHolotapeReader.java

示例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;
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:19,代码来源:TileEntityAntennaController.java

示例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;
}
 
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:19,代码来源:TileDialingDevice.java

示例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;
}
 
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:17,代码来源:TileTransferFluid.java

示例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;
}
 
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:25,代码来源:TileController.java

示例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;
}
 
开发者ID:c-rizz,项目名称:ChunkyPeripherals,代码行数:25,代码来源:MinyChunkyPeripheral.java

示例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."};
	}
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:26,代码来源:TileEntityElectricMachine.java

示例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."};
	}
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:17,代码来源:TileEntityFluidicPlenisher.java

示例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;
	}
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:20,代码来源:TileEntityEnergyCube.java

示例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;
	}
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:22,代码来源:TileEntitySolarGenerator.java

示例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;
	}
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:24,代码来源:TileEntityGasGenerator.java

示例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;
	}
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:24,代码来源:TileEntityBioGenerator.java

示例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;
	}
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:24,代码来源:TileEntityHeatGenerator.java

示例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;
	}
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:22,代码来源:TileEntityWindTurbine.java


注:本文中的dan200.computercraft.api.lua.ILuaContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。