Skip to content

Commit

Permalink
some fixing, some new methods (hello #41 , yeh old issue)
Browse files Browse the repository at this point in the history
  • Loading branch information
xbony2 committed Jul 18, 2015
1 parent 4b8d82e commit 5bb39a3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package shedar.mods.ic2.nuclearcontrol.crossmod.opencomputers;

import li.cil.oc.api.machine.Callback;

import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.driver.NamedBlock;
Expand Down Expand Up @@ -54,5 +53,10 @@ public Object[] getPeriod(final Context context, final Arguments args){
public Object[] getAverage(final Context context, final Arguments args){
return new Object[]{((int)tileEntity.getClientAverage())};
}

@Callback(doc = "function():number -- gets the energy type (0 for EU, 1 for RF, -1 for unknown/nil)")
public Object[] getEnergyType(final Context context, final Arguments args){
return new Object[]{((int)tileEntity.powerType)};
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package shedar.mods.ic2.nuclearcontrol.crossmod.opencomputers;

import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.machine.Context;

import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.machine.Callback;
import shedar.mods.ic2.nuclearcontrol.tileentities.TileEntityEnergyCounter;
import li.cil.oc.api.driver.NamedBlock;
Expand Down Expand Up @@ -38,14 +40,14 @@ public int priority() {
return 0;
}

@Callback(doc = "function():number -- gets the period (in seconds) of the average counter.")
public Object[] getPeriod(final Context context, final Arguments args){
return new Object[]{((int)tileEntity.period)};
@Callback(doc = "function():number -- gets the count of the counter.")
public Object[] getCount(final Context context, final Arguments args){
return new Object[]{((int)tileEntity.counter)};
}

@Callback(doc = "function():number -- gets the average of the counter.")
public Object[] getAverage(final Context context, final Arguments args){
return new Object[]{((int)tileEntity.getClientAverage())};
@Callback(doc = "function():number -- gets the energy type (0 for EU, 1 for RF, -1 for unknown/nil)")
public Object[] getEnergyType(final Context context, final Arguments args){
return new Object[]{((int)tileEntity.powerType)};
}
}
}

0 comments on commit 5bb39a3

Please sign in to comment.