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


Java IPeripheral类代码示例

本文整理汇总了Java中dan200.computercraft.api.peripheral.IPeripheral的典型用法代码示例。如果您正苦于以下问题:Java IPeripheral类的具体用法?Java IPeripheral怎么用?Java IPeripheral使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IPeripheral类属于dan200.computercraft.api.peripheral包,在下文中一共展示了IPeripheral类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: equals

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的package包/类
@Override
@Optional.Method(modid = ModIds.COMPUTERCRAFT)
public boolean equals(IPeripheral other) {
    if (other == null) {
        return false;
    }
    if (this == other) {
        return true;
    }
    if (other instanceof TileEntity) {
        TileEntity tother = (TileEntity) other;
        return tother.getWorld().equals(getWorld()) && tother.getPos().equals(getPos());
    }

    return false;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:17,代码来源:TileEntityDroneInterface.java

示例2: update

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的package包/类
@Override
public void update(ITurtleAccess turtle, TurtleSide side)
{
	//CRMod.infoLog("chunky.update(): getUpgrade="+turtle.getUpgrade(side));
	if(turtle.getWorld().isRemote)//on Client getPeripheral doesn't work (CC1.63pr3)
		return;
	IPeripheral p = turtle.getPeripheral(side);
	if( p instanceof ChunkyPeripheral)
	{
		((ChunkyPeripheral) p).update();
	}
	else
	{
		if(p!=null)
			ChunkyPeripherals.logger.error("update called on a turtle without chunky module ( p is "+p.getClass().getName()+")");
		else
			ChunkyPeripherals.logger.error("update called on a turtle without chunky module ( p is null )");
	}
}
 
开发者ID:c-rizz,项目名称:ChunkyPeripherals,代码行数:20,代码来源:ChunkyUpgrade.java

示例3: syncToInfo

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的package包/类
public void syncToInfo() {
	computerInfo.label = computer.getLabel();
	computerInfo.id = computer.getID();

	for (int i = 0; i < computerInfo.sides.length; i++) {
		Side side = computerInfo.sides[i];

		side.redstoneInput = computer.getRedstoneOutput(i);
		side.bundledInput = computer.getBundledRedstoneOutput(i);
		IPeripheral peripheral = computer.getPeripheral(i);
		if (peripheral == null) {
			side.peripheral = null;
		} else {
			side.peripheral = peripheral.getType();
		}
	}
}
 
开发者ID:SquidDev-CC,项目名称:Studio,代码行数:18,代码来源:ComputerManager.java

示例4: getPeripheral

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的package包/类
@Override
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
	TileEntity tile = world.getTileEntity(x, y, z);

	ICounterContainer container = null;
	if (tile instanceof ICounterContainer)
		container = (ICounterContainer) tile;
	else {
		for (ICounterFinder finder : CountCraft.instance.finders) {
			ICounterContainer containerFrom = finder.getCounterContainerFrom(tile);
			if (containerFrom != null)
				container = containerFrom;
		}
	}
	if (container != null)
		return new CounterPeripheralWrapper(container);
	return null;
}
 
开发者ID:Shirkit,项目名称:CountCraft,代码行数:19,代码来源:ComputerCraftHandler.java

示例5: getPeripheral

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的package包/类
@Override
public IPeripheral getPeripheral( final World world, final int x, final int y, final int z, final int side )
{
	try
	{
		// Get the tile entity at that position
		TileEntity te = world.getTileEntity( x, y, z );

		// Is the entity an Essentia Provider?
		if( te instanceof TileEssentiaProvider )
		{
			// Create the peripheral
			return new EssentiaProviderPeripheral( world, x, y, z );
		}
	}
	catch( Exception e )
	{
		// Silently ignore
	}

	return null;
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:23,代码来源:ModuleCC.java

示例6: invalidate

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的package包/类
@Override
public void invalidate() {
	super.invalidate();
	if (!worldObj.isRemote) {
		ItemStack drop = new ItemStack(ModBlocks.peripheralContainer);
		if (peripheralsContained.size() > 0) {
			NBTTagCompound tag = new NBTTagCompound();
			this.writeToNBT(tag);
			drop.stackTagCompound = tag;
			List<String> text = new ArrayList<String>();
			text.add(Colors.RESET.toString()+Colors.UNDERLINE+"Contained Peripherals:");
			for (int id : NBTHelper.getIntArray(drop, "ids")) {
				Block peripheral = Block.getBlockById(id);
				IPeripheral iPeripheral = (IPeripheral) peripheral.createTileEntity(null, 0);
				text.add(Colors.RESET+iPeripheral.getType());
			}
			NBTHelper.setInfo(drop, text);
		}
		worldObj.spawnEntityInWorld(new EntityItem(worldObj, xCoord, yCoord+1, zCoord, drop.copy()));
	}
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:22,代码来源:TileEntityPeripheralContainer.java

示例7: shouldTrackWithThisEntry

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的package包/类
@Override
public boolean shouldTrackWithThisEntry(IBlockAccess world, BlockPos pos, IBlockState state, TileEntity te) {
    if (state.getBlock() instanceof IPeripheralProvider) {
        IPeripheral peripheral = ((IPeripheralProvider) state.getBlock()).getPeripheral(te.getWorld(), pos, EnumFacing.DOWN);
        return peripheral != null && peripheral.getMethodNames().length != 0;
    } else {
        return false;
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:BlockTrackEntryPeripheral.java

示例8: addInformation

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的package包/类
@Override
public void addInformation(World world, BlockPos pos, TileEntity te, List<String> infoList) {
    infoList.add("blockTracker.info.peripheral.title");
    infoList.add("blockTracker.info.peripheral.availableMethods");
    IPeripheral peripheral = ((IPeripheralProvider) world.getBlockState(pos).getBlock()).getPeripheral(world, pos, EnumFacing.DOWN);
    if (peripheral != null) {
        for (String method : peripheral.getMethodNames()) {
            infoList.add("-" + method);
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:12,代码来源:BlockTrackEntryPeripheral.java

示例9: getPeripheral

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的package包/类
/**
 * Produce an peripheral implementation from a block location.
 *
 * @return a peripheral, or null if there is not a peripheral here you'd like to handle.
 * @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(IPeripheralProvider)
 */
@Override
@Optional.Method(modid = ModIds.COMPUTERCRAFT)
public IPeripheral getPeripheral(World world, BlockPos pos, EnumFacing side) {
    TileEntity te = world.getTileEntity(pos);
    return te instanceof IPeripheral ? (IPeripheral) te : null;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:13,代码来源:BlockPneumaticCraft.java

示例10: getPeripheral

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的package包/类
@Optional.Method(modid = "ComputerCraft")
@Override
public IPeripheral getPeripheral(World world, BlockPos pos, EnumFacing side) {
    TileEntity tile = world.getTileEntity(pos);
    if(tile != null && tile instanceof TileEntityTankComputer)
        return (IPeripheral) tile;
    return null;
}
 
开发者ID:Lordmau5,项目名称:FFS,代码行数:9,代码来源:CCPeripheralProvider.java

示例11: getPeripheral

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的package包/类
@Optional.Method(modid = Configs.COMPUTERCRAFT)
@Override
public IPeripheral getPeripheral(World world, BlockPos pos, EnumFacing side) {
	TileEntity tilee = world.getTileEntity(pos);
	if (tilee instanceof TileEntityMonitor) {
		TileEntityMonitor te = ((TileEntityMonitor) tilee);
		return te.direction == side.ordinal() ? null : te;
	}
	return null;
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:11,代码来源:Monitor.java

示例12: getPeripheral

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的package包/类
@Optional.Method(modid = "ComputerCraft")
@Override
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
	TileEntity te = world.getTileEntity(x, y, z);

	if(te instanceof TileEntityRadio)
		return (IPeripheral)te;

	return null;
}
 
开发者ID:PC-Logix,项目名称:OpenFM,代码行数:11,代码来源:BlockRadio.java

示例13: getPeripheral

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的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

示例14: update

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的package包/类
@Override
public void update(ITurtleAccess turtle, TurtleSide side)
{
	//update the chunky part of the peripheral
	super.update(turtle,side);
	
	
	//do what dan does
	if(turtle.getWorld().isRemote)
		return;
	IPeripheral p = turtle.getPeripheral(side);
	if( p!=null && p instanceof WirelessChunkyPeripheral)
	{
		Object subPeripheral = ((WirelessChunkyPeripheral)p).getSubPeripheral();
		if((Boolean) CCReflectionHelper.invokeMethod(subPeripheral, true, "pollChanged"))
		{
			turtle.getUpgradeNBTData(side).setBoolean("active", (Boolean) CCReflectionHelper.invokeMethod(subPeripheral, true, "isActive"));
	        turtle.updateUpgradeNBTData(side);
		}
	}
	else
	{
		if(p!=null)
			ChunkyPeripherals.logger.error("update called on a turtle without wireless chunky module ( p is "+p.getClass().getName()+")");
		else
			ChunkyPeripherals.logger.error("update called on a turtle without wireless chunky module ( p is null )");
	}
}
 
开发者ID:c-rizz,项目名称:ChunkyPeripherals,代码行数:29,代码来源:WirelessChunkyUpgrade.java

示例15: equals

import dan200.computercraft.api.peripheral.IPeripheral; //导入依赖的package包/类
@Override
public boolean equals(IPeripheral other)
{
	if(other instanceof ChunkyPeripheral)
	{
		ChunkyPeripheral p2 = (ChunkyPeripheral)other;
		return p2.turtle.getPosition().equals(turtle.getPosition());
	}
	return false;
}
 
开发者ID:c-rizz,项目名称:ChunkyPeripherals,代码行数:11,代码来源:ChunkyPeripheral.java


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