-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
something is broken but whatever. fixed something dumb though
- Loading branch information
Showing
3 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/shedar/mods/ic2/nuclearcontrol/crossmod/opencomputers/DriverEnergyCounter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package shedar.mods.ic2.nuclearcontrol.crossmod.opencomputers; | ||
|
||
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; | ||
import li.cil.oc.integration.ManagedTileEntityEnvironment; | ||
import shedar.mods.ic2.nuclearcontrol.tileentities.TileEntityAverageCounter; | ||
import li.cil.oc.api.prefab.DriverTileEntity; | ||
import net.minecraft.world.World; | ||
|
||
public class DriverEnergyCounter extends DriverTileEntity { | ||
public static final String NAME = "energy_counter"; | ||
|
||
@Override | ||
public ManagedEnvironment createEnvironment(World world, int x, int y, int z){ | ||
return new Environment((TileEntityEnergyCounter)world.getTileEntity(x, y, z)); | ||
} | ||
|
||
@Override | ||
public Class<?> getTileEntityClass(){ | ||
return TileEntityEnergyCounter.class; | ||
} | ||
|
||
public static final class Environment extends ManagedTileEntityEnvironment<TileEntityEnergyCounter> implements NamedBlock{ | ||
public Environment(final TileEntityEnergyCounter tileentity) { | ||
super(tileentity, NAME); | ||
} | ||
|
||
@Override | ||
public String preferredName() { | ||
return NAME; | ||
} | ||
|
||
@Override | ||
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 average of the counter.") | ||
public Object[] getAverage(final Context context, final Arguments args){ | ||
return new Object[]{((int)tileEntity.getClientAverage())}; | ||
} | ||
} | ||
} |