コード例 #1
0
public class DriverBoilerFirebox extends DriverTileEntity {
  private static final Class<?> TileBoilerFirebox =
      Reflection.getClass("mods.railcraft.common.blocks.machine.beta.TileBoilerFirebox");

  @Override
  public ManagedEnvironment createEnvironment(
      final World world, final int x, final int y, final int z) {
    return new Environment(world.getTileEntity(x, y, z));
  }

  @Override
  public Class<?> getTileEntityClass() {
    return TileBoilerFirebox;
  }

  public static final class Environment extends ManagedTileEntityEnvironment<TileEntity>
      implements NamedBlock {
    public Environment(final TileEntity tileEntity) {
      super(tileEntity, "boiler_firebox");
    }

    @Override
    public String preferredName() {
      return "boiler_firebox";
    }

    @Override
    public int priority() {
      return 0;
    }

    @Callback(doc = "function():boolean -- Get whether the boiler is active or not")
    public Object[] isBurning(final Context context, final Arguments args) {
      return new Object[] {Reflection.tryInvoke(tileEntity, "isBurning")};
    }

    @Callback(doc = "function():number -- Get the temperature of the boiler")
    public Object[] getTemperature(final Context context, final Arguments args) {
      return new Object[] {Reflection.tryInvoke(tileEntity, "getTemperature")};
    }
  }
}
コード例 #2
0
 @Callback(doc = "function():number -- Get the temperature of the boiler")
 public Object[] getTemperature(final Context context, final Arguments args) {
   return new Object[] {Reflection.tryInvoke(tileEntity, "getTemperature")};
 }
コード例 #3
0
 @Callback(doc = "function():boolean -- Get whether the boiler is active or not")
 public Object[] isBurning(final Context context, final Arguments args) {
   return new Object[] {Reflection.tryInvoke(tileEntity, "isBurning")};
 }