appeng.api.networking.IGridNode Java Examples

The following examples show how to use appeng.api.networking.IGridNode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MotorModifierAE2.java    From Framez with GNU General Public License v3.0 6 votes vote down vote up
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
        }
 
Example #2
Source File: SemiBlockRequester.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Optional.Method(modid = ModIds.AE2)
public TickRateModulation tickingRequest(IGridNode arg0, int arg1){
    notifyNetworkOfCraftingChange();
    if(gridNode != null) {
        getGridNode(null).getGrid().postEvent(new MENetworkCellArrayUpdate());//Doing it on interval, as doing it right after  AEApi.instance().createGridConnection doesn't seem to work..
    }
    return TickRateModulation.SAME;
}
 
Example #3
Source File: MotorModifierAE2.java    From Framez with GNU General Public License v3.0 5 votes vote down vote up
@Override
public IGridNode getGridNode(ForgeDirection dir) {

    // if (getWorld() != null && !getWorld().isRemote) {
    // if (node == null)
    // node = AEApi.instance().createGridNode(this);
    // node.updateState();
    // }

    return node;
}
 
Example #4
Source File: SemiBlockRequester.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Optional.Method(modid = ModIds.AE2)
private void notifyNetworkOfCraftingChange(){
    if(gridNode != null) {
        IGrid grid = ((IGridNode)gridNode).getGrid();
        if(grid != null) grid.postEvent(new MENetworkCraftingPatternChange(this, (IGridNode)gridNode));
    }
}
 
Example #5
Source File: SemiBlockRequester.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Optional.Method(modid = ModIds.AE2)
public IGridNode getGridNode(ForgeDirection d){
    if(gridNode == null) {
        gridNode = AEApi.instance().createGridNode(this);
    }
    return (IGridNode)gridNode;
}
 
Example #6
Source File: CraftingRequester.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@Override
public IGridNode getGridNode(ForgeDirection dir) {
	return original.getGridNode(dir);
}
 
Example #7
Source File: SemiBlockRequester.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
@Optional.Method(modid = ModIds.AE2)
public TickingRequest getTickingRequest(IGridNode node){
    return new TickingRequest(120, 120, false, false);
}
 
Example #8
Source File: SemiBlockRequester.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
@Optional.Method(modid = ModIds.AE2)
public IGridNode getActionableNode(){
    return getGridNode(null);
}
 
Example #9
Source File: SemiBlockRequester.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Optional.Method(modid = ModIds.AE2)
private void disconnectFromInterface(){
    ((IGridNode)gridNode).destroy();
    gridNode = null;
}
 
Example #10
Source File: MENetworkChannelChanged.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public MENetworkChannelChanged( IGridNode n )
{
	this.node = n;
}
 
Example #11
Source File: MENetworkPowerIdleChange.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public MENetworkPowerIdleChange( IGridNode nodeThatChanged )
{
	this.node = nodeThatChanged;
}
 
Example #12
Source File: MENetworkCraftingPatternChange.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public MENetworkCraftingPatternChange( ICraftingProvider p, IGridNode n )
{
	this.provider = p;
	this.node = n;
}
 
Example #13
Source File: MENetworkCraftingCpuChange.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public MENetworkCraftingCpuChange( IGridNode n )
{
	this.node = n;
}
 
Example #14
Source File: MENetworkCraftingPatternChange.java    From Framez with GNU General Public License v3.0 4 votes vote down vote up
public MENetworkCraftingPatternChange(ICraftingProvider p, IGridNode n) {
	provider = p;
	node = n;
}
 
Example #15
Source File: CraftingRequester.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@Override
public IGridNode getActionableNode() {
	return original.getActionableNode();
}
 
Example #16
Source File: MENetworkCraftingCpuChange.java    From Framez with GNU General Public License v3.0 4 votes vote down vote up
public MENetworkCraftingCpuChange(IGridNode n) {
	node = n;
}
 
Example #17
Source File: MENetworkChannelChanged.java    From Framez with GNU General Public License v3.0 4 votes vote down vote up
public MENetworkChannelChanged(IGridNode n) {
	node = n;
}
 
Example #18
Source File: MENetworkPowerIdleChange.java    From Framez with GNU General Public License v3.0 4 votes vote down vote up
public MENetworkPowerIdleChange(IGridNode nodeThatChanged) {
	node = nodeThatChanged;
}
 
Example #19
Source File: IPart.java    From PneumaticCraft with GNU General Public License v3.0 2 votes vote down vote up
/**
 * get the Grid Node for the Bus, be sure your IGridBlock is NOT isWorldAccessible, if it is your going to cause
 * crashes.
 *
 * or null if you don't have a grid node.
 *
 * @return grid node
 */
IGridNode getGridNode();
 
Example #20
Source File: IPart.java    From Framez with GNU General Public License v3.0 2 votes vote down vote up
/**
 * get the Grid Node for the Bus, be sure your IGridBlock is NOT isWorldAccessible, if it is your going to cause
 * crashes.
 *
 * or null if you don't have a grid node.
 *
 * @return grid node
 */
IGridNode getGridNode();
 
Example #21
Source File: IActionHost.java    From Framez with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Used to for calculating security rules, you must supply a node from your
 * IGridHost for the security test, this should be the primary node for the
 * machine, unless the action is preformed by a non primary node.
 * 
 * @return the the gridnode that actions from this IGridHost are preformed
 *         by.
 */
IGridNode getActionableNode();
 
Example #22
Source File: IGridTickable.java    From Framez with GNU General Public License v3.0 2 votes vote down vote up
/**
 * You can return null, if you wish to tick using MC's ticking mechanism, or
 * you can return a valid TickingRequest to tell AE a guide for which type
 * of responsiveness your device wants.
 * 
 * this will be called for your tile any time your tile changes grids, this
 * can happen at any time, so if your using the sleep feature you may wish
 * to preserve your sleep, in the result of this method. or you can simply
 * reset it.
 * 
 * @return null or a valid new TickingRequest
 * 
 */
TickingRequest getTickingRequest(IGridNode node);
 
Example #23
Source File: IGridTickable.java    From Framez with GNU General Public License v3.0 2 votes vote down vote up
/**
 * AE lets you adjust your tick rate based on the results of your tick, if
 * your block as accomplished work you may wish to increase the ticking
 * speed, if your block is idle you may wish to slow it down.
 * 
 * Its up to you.
 * 
 * Note: this is never called if you return null from getTickingRequest.
 * 
 * @param TicksSinceLastCall
 *            the number of world ticks that were skipped since your last
 *            tick, you can use this to adjust speed of processing or adjust
 *            your tick rate.
 * 
 * @return tick rate adjustment.
 * 
 */
TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall);
 
Example #24
Source File: ITickManager.java    From Framez with GNU General Public License v3.0 2 votes vote down vote up
/**
 * immediately sets the node to tick, only valid if your node is marked as "Alertable" in its TickingRequest
 * 
 * Sleeping Devices Still Alertable, when your tile is alerted its new status is determined by the result of its
 * tick.
 * 
 * @param node gridnode
 */
boolean alertDevice(IGridNode node);
 
Example #25
Source File: ITickManager.java    From Framez with GNU General Public License v3.0 2 votes vote down vote up
/**
 * 
 * disables ticking for your device.
 * 
 * @param node gridnode
 * 
 * @return if the call was successful.
 */
boolean sleepDevice(IGridNode node);
 
Example #26
Source File: IAppEngApi.java    From PneumaticCraft with GNU General Public License v3.0 2 votes vote down vote up
/**
 * create a connection between two {@link appeng.api.networking.IGridNode}
 *
 * @param a to be connected gridnode
 * @param b to be connected gridnode
 *
 * @throws appeng.api.exceptions.FailedConnection
 */
IGridConnection createGridConnection( IGridNode a, IGridNode b ) throws FailedConnection;
 
Example #27
Source File: IAppEngApi.java    From PneumaticCraft with GNU General Public License v3.0 2 votes vote down vote up
/**
 * create a grid node for your {@link appeng.api.networking.IGridHost}
 *
 * @param block grid block
 *
 * @return grid node of block
 */
IGridNode createGridNode( IGridBlock block );
 
Example #28
Source File: IPart.java    From PneumaticCraft with GNU General Public License v3.0 2 votes vote down vote up
/**
 * used for tunnels.
 *
 * @return a grid node that represents the external facing side, these must be isWorldAccessible with the correct
 * faces marked as external
 */
IGridNode getExternalFacingNode();
 
Example #29
Source File: IActionHost.java    From PneumaticCraft with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Used to for calculating security rules, you must supply a node from your
 * IGridHost for the security test, this should be the primary node for the
 * machine, unless the action is preformed by a non primary node.
 *
 * @return the the gridnode that actions from this IGridHost are preformed
 * by.
 */
IGridNode getActionableNode();
 
Example #30
Source File: ITickManager.java    From Framez with GNU General Public License v3.0 2 votes vote down vote up
/**
 * 
 * enables ticking for your device, undoes a sleepDevice call.
 * 
 * @param node gridnode
 * 
 * @return if the call was successful.
 */
boolean wakeDevice(IGridNode node);