本文整理汇总了Java中appeng.api.networking.IGridNode类的典型用法代码示例。如果您正苦于以下问题:Java IGridNode类的具体用法?Java IGridNode怎么用?Java IGridNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IGridNode类属于appeng.api.networking包,在下文中一共展示了IGridNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onBlockPlacedBy
import appeng.api.networking.IGridNode; //导入依赖的package包/类
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
if (world.isRemote) {
return;
}
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null && tile instanceof TileAERuneAssembler) {
TileAERuneAssembler tileC = (TileAERuneAssembler) tile;
tileC.getProxy().onReady();
IGridNode node = tileC.getGridNode(ForgeDirection.UNKNOWN);
if (entity != null && entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
node.setPlayerID(AEApi.instance().registries().players().getID(player));
}
node.updateState();
}
}
开发者ID:ParadoxCodersTeam,项目名称:Botanic-Energistics,代码行数:18,代码来源:AEElvenPortal.java
示例2: onBlockPlacedBy
import appeng.api.networking.IGridNode; //导入依赖的package包/类
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
if (world.isRemote) {
return;
}
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null && tile instanceof TileAEDaisy) {
TileAEDaisy tileC = (TileAEDaisy) tile;
tileC.getProxy().onReady();
IGridNode node = tileC.getGridNode(ForgeDirection.UNKNOWN);
if (entity != null && entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
node.setPlayerID(AEApi.instance().registries().players().getID(player));
}
node.updateState();
}
}
开发者ID:ParadoxCodersTeam,项目名称:Botanic-Energistics,代码行数:17,代码来源:AEPureDaisy.java
示例3: getTotalStored
import appeng.api.networking.IGridNode; //导入依赖的package包/类
public double getTotalStored() {
double nodePower = 0;
if (node != null) {
for (IGridNode n : node.getGrid().getNodes()) {
if (n != node) {
IGridHost host = n.getGridBlock().getMachine();
if (host instanceof IAEPowerStorage) {
IAEPowerStorage storage = (IAEPowerStorage) host;
if (storage.isAEPublicPowerStorage()
&& (storage.getPowerFlow() == AccessRestriction.READ || storage.getPowerFlow() == AccessRestriction.READ_WRITE))
nodePower += storage.getAECurrentPower();
}
}
}
}
return Math.min(getEnergyBuffer() + nodePower, getEnergyBufferSize());// FIXME
}
开发者ID:amadornes,项目名称:Framez,代码行数:21,代码来源:MotorModifierAE2.java
示例4: addNode
import appeng.api.networking.IGridNode; //导入依赖的package包/类
@Override
public void addNode( final IGridNode gridNode, final IGridHost machine )
{
// Does the node wish to watch for changes?
if( machine instanceof IEssentiaWatcherHost )
{
// Cast
IEssentiaWatcherHost host = (IEssentiaWatcherHost)machine;
// Create the watcher
EssentiaWatcher watcher = new EssentiaWatcher( this.essentiaWatcherManger, host );
// Add to the watcher manager
this.essentiaWatcherManger.addWatcher( gridNode, watcher );
// Inform the host it has a watcher
host.updateWatcher( watcher );
}
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:20,代码来源:GridEssentiaCache.java
示例5: removeWatcher
import appeng.api.networking.IGridNode; //导入依赖的package包/类
/**
* Removes a watcher.
*
* @param node
*/
public void removeWatcher( final IGridNode node )
{
// Get the watcher
IEssentiaWatcher watcher = this.watchers.get( node );
if( watcher != null )
{
// Clear the watcher
watcher.clear();
// Remove the watcher
this.watchers.remove( node );
// Is the list empty?
if( this.watchers.isEmpty() )
{
// Ensure the watched aspects is also empty
this.watchedAspects.clear();
// Stop listening
this.gridCache.removeListener( this );
this.isListeningForChanges = false;
}
}
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:30,代码来源:EssentiaWatcherManager.java
示例6: onBlockPreDestroy
import appeng.api.networking.IGridNode; //导入依赖的package包/类
@Override
public void onBlockPreDestroy(World world, int x, int y, int z, int meta) {
if (world.isRemote)
return;
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null) {
if (tile instanceof TileAERuneAssembler) {
IGridNode node = ((TileAERuneAssembler) tile).getGridNode(ForgeDirection.UNKNOWN);
if (node != null) {
node.destroy();
}
}
}
}
开发者ID:ParadoxCodersTeam,项目名称:Botanic-Energistics,代码行数:15,代码来源:AEElvenPortal.java
示例7: onBlockPreDestroy
import appeng.api.networking.IGridNode; //导入依赖的package包/类
@Override
public void onBlockPreDestroy(World world, int x, int y, int z, int meta) {
if (world.isRemote)
return;
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null) {
if (tile instanceof TileAEDaisy) {
IGridNode node = ((TileAEDaisy) tile).getGridNode(ForgeDirection.UNKNOWN);
if (node != null) {
node.destroy();
}
}
}
}
开发者ID:ParadoxCodersTeam,项目名称:Botanic-Energistics,代码行数:15,代码来源:AEPureDaisy.java
示例8: getGridNode
import appeng.api.networking.IGridNode; //导入依赖的package包/类
@Override
public IGridNode getGridNode(ForgeDirection dir) {
// if (getWorld() != null && !getWorld().isRemote) {
// if (node == null)
// node = AEApi.instance().createGridNode(this);
// node.updateState();
// }
return node;
}
开发者ID:amadornes,项目名称:Framez,代码行数:12,代码来源:MotorModifierAE2.java
示例9: getTiles
import appeng.api.networking.IGridNode; //导入依赖的package包/类
private List<TileEntity> getTiles(){
//List<ICellContainer> list = new ArrayList<ICellContainer>();
List<TileEntity> list = new ArrayList<TileEntity>();
//IGridNode gridNode = this.getGridNode(ForgeDirection.UNKNOWN);
try {
//IGrid grid = gridNode.getGrid();
IGrid grid = this.getProxy().getNode().getGrid();
for (Class<? extends IGridHost> clazz : grid.getMachinesClasses()) {
for (Class clazz2 : clazz.getInterfaces()) {
//NCLog.fatal("Passed Class 2");
//NCLog.fatal(clazz2);
if (clazz2 == IChestOrDrive.class) {
//NCLog.fatal("Passed If is IChestorDrive");
//NCLog.fatal(grid.getMachines(TileDrive.class));
for (IGridNode con : grid.getMachines(TileDrive.class)) {
//list.add((ICellContainer) con.getMachine());
list.add(getBaseTileEntity(con.getGridBlock().getLocation()));//.getMachine().getGridNode(ForgeDirection.UNKNOWN)
}
//for (IGridNode con : grid.getMachines(TileChest.class)) {
// list.add(getBaseTileEntity(con.getGridBlock().getLocation()));
//}
}
}
}
}catch (Exception e){}
return list;
}
开发者ID:xbony2,项目名称:Nuclear-Control,代码行数:28,代码来源:TileEntityNetworkLink.java
示例10: removeNode
import appeng.api.networking.IGridNode; //导入依赖的package包/类
@Override
public void removeNode( final IGridNode gridNode, final IGridHost machine )
{
// Was the node an essentia watcher?
if( machine instanceof IEssentiaWatcherHost )
{
this.essentiaWatcherManger.removeWatcher( gridNode );
}
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:10,代码来源:GridEssentiaCache.java
示例11: addWatcher
import appeng.api.networking.IGridNode; //导入依赖的package包/类
/**
* Adds a watcher.
*
* @param node
* @param watcher
*/
public void addWatcher( final IGridNode node, final IEssentiaWatcher watcher )
{
// Add the watcher
this.watchers.put( node, watcher );
// Is the manager not listening for changes?
if( !this.isListeningForChanges )
{
// Listen for changes
this.gridCache.addListener( this, this.gridCache.internalGrid );
this.isListeningForChanges = true;
}
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:20,代码来源:EssentiaWatcherManager.java
示例12: locateAPsInRange
import appeng.api.networking.IGridNode; //导入依赖的package包/类
/**
* @param world
* @param x
* @param y
* @param z
* @param grid
* @return
*/
private static ArrayList<IWirelessAccessPoint> locateAPsInRange( final World world, final int x, final int y, final int z, final IGrid grid )
{
// Get all AP's on the grid
IMachineSet accessPoints = grid.getMachines( TileWireless.class );
if( accessPoints.isEmpty() )
{
return null;
}
// Create the list
ArrayList<IWirelessAccessPoint> aps = new ArrayList<IWirelessAccessPoint>();
// Loop over AP's and see if any are close enough to communicate with
for( IGridNode APNode : accessPoints )
{
// Get the AP
IWirelessAccessPoint AP = (IWirelessAccessPoint)APNode.getMachine();
// Is the AP active?
if( AP.isActive() )
{
// Close enough to the AP?
if( isAPInRange( AP.getLocation(), AP.getRange(), world, x, y, z ) )
{
aps.add( AP );
}
}
}
return aps;
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:40,代码来源:WirelessAELink.java
示例13: tickingRequest
import appeng.api.networking.IGridNode; //导入依赖的package包/类
@Override
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
{
if( this.canDoWork() )
{
// Calculate the amount to transfer per second
int transferAmountPerSecond = this.getTransferAmountPerSecond();
// Calculate amount to transfer this operation
int transferAmount = (int)( transferAmountPerSecond * ( ticksSinceLastCall / 20.F ) );
// Clamp
if( transferAmount < MINIMUM_TRANSFER_PER_SECOND )
{
transferAmount = MINIMUM_TRANSFER_PER_SECOND;
}
else if( transferAmount > MAXIMUM_TRANSFER_PER_SECOND )
{
transferAmount = MAXIMUM_TRANSFER_PER_SECOND;
}
if( this.doWork( transferAmount ) )
{
return TickRateModulation.URGENT;
}
}
return TickRateModulation.IDLE;
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:30,代码来源:ThEPartEssentiaIOBus_Base.java
示例14: getTickingRequest
import appeng.api.networking.IGridNode; //导入依赖的package包/类
/**
* Sets how often we would like ticks.
*/
@Override
public TickingRequest getTickingRequest( final IGridNode node )
{
// We would like a tick ever 20 MC ticks
return new TickingRequest( 20, 20, false, false );
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:10,代码来源:PartEssentiaStorageBus.java
示例15: tickingRequest
import appeng.api.networking.IGridNode; //导入依赖的package包/类
/**
* Called periodically by AE2. Passes the tick to the handler.
*/
@Override
public TickRateModulation tickingRequest( final IGridNode node, final int TicksSinceLastCall )
{
// Update the handler.
this.handler.tickingRequest( node, TicksSinceLastCall );
// Keep chugging along
return TickRateModulation.SAME;
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:13,代码来源:PartEssentiaStorageBus.java
示例16: tickingRequest
import appeng.api.networking.IGridNode; //导入依赖的package包/类
@Override
public void tickingRequest( final IGridNode node, final int TicksSinceLastCall )
{
// Ensure we have an internal handler
if( this.internalHandler != null )
{
// Pass to handler
this.internalHandler.tickingRequest( node, TicksSinceLastCall );
}
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:11,代码来源:HandlerEssentiaStorageBusDuality.java
示例17: getActionableNode
import appeng.api.networking.IGridNode; //导入依赖的package包/类
@Override
public IGridNode getActionableNode()
{
if( this.accessPoint != null )
{
return this.accessPoint.getActionableNode();
}
return null;
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:10,代码来源:HandlerWirelessEssentiaTerminal.java
示例18: checkSecurityPermission
import appeng.api.networking.IGridNode; //导入依赖的package包/类
/**
* Returns if the player has the requested permission or not.
*
* @param perm
* @param actionSource
* @return
*/
private boolean checkSecurityPermission( final SecurityPermissions perm, final BaseActionSource actionSource )
{
// Ensure there is an action source.
if( actionSource == null )
{
return false;
}
// Get the source node
IGridNode sourceNode = null;
if( actionSource instanceof MachineSource )
{
sourceNode = ( (MachineSource)actionSource ).via.getActionableNode();
}
else if( actionSource instanceof PlayerSource )
{
sourceNode = ( (PlayerSource)actionSource ).via.getActionableNode();
}
// Ensure there is a node
if( sourceNode == null )
{
return false;
}
// Get the security grid for the node.
ISecurityGrid sGrid = sourceNode.getGrid().getCache( ISecurityGrid.class );
// Return the permission.
return sGrid.hasPermission( this.player, perm );
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:40,代码来源:ContainerEssentiaCellTerminalBase.java
示例19: getTickingRequest
import appeng.api.networking.IGridNode; //导入依赖的package包/类
/**
* How often to tick?
*
* @param node
* @return
*/
@Override
public TickingRequest getTickingRequest( final IGridNode node )
{
// Half second, to 2 seconds.
return new TickingRequest( TileEssentiaVibrationChamber.TICKRATE_MIN, TileEssentiaVibrationChamber.TICKRATE_MAX, false, false );
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:14,代码来源:TileEssentiaVibrationChamber.java
示例20: getEssentiaMonitor
import appeng.api.networking.IGridNode; //导入依赖的package包/类
/**
* Gets the essentia monitor from the network.
* Returns true if a monitor was retrieved.
*
* @return
*/
protected boolean getEssentiaMonitor()
{
IMEEssentiaMonitor essentiaMonitor = null;
IGrid grid = null;
// Get the grid node
IGridNode node = this.getProxy().getNode();
// Ensure we have the node
if( node != null )
{
// Get the grid that node is connected to
grid = node.getGrid();
// Is there a grid?
if( grid != null )
{
// Get the monitor
essentiaMonitor = (IMEEssentiaMonitor)grid.getCache( IEssentiaGrid.class );
}
}
// Set the monitor
this.monitor = essentiaMonitor;
// Return true if the monitor is not null
return( this.monitor != null );
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:35,代码来源:TileProviderBase.java
注:本文中的appeng.api.networking.IGridNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论