Пример #1
0
 @Override
 public Object invoke(
     XVirtualMachine vm,
     XThread thread,
     XMethodExecutor me,
     XGenericClass[] gen,
     String name,
     XObject _this,
     Object[] param) {
   return Integer.valueOf(
       ((PCws_WeaselContainer) vm.getUserData()).getTypeUnsafe(((Integer) param[0]).intValue()));
 }
Пример #2
0
 static void registerNatives(XVirtualMachine virtualMachine) {
   XNativeProvider nativeProvider = virtualMachine.getNativeProvider();
   nativeProvider.addNativeMethod(
       "weasel.devices.Device", "getTypeUnsafe{(int)int}", new GetTypeUnsafe());
   nativeProvider.addNativeMethod(
       "weasel.devices.Device", "isDevicePresent{(bool)int}", new IsDevicePresent());
   nativeProvider.addNativeMethod(
       "weasel.devices.Core",
       "getRedstoneValueUnsafe{(int, int)int}",
       new GetRedstoneValueUnsafe());
   nativeProvider.addNativeMethod(
       "weasel.devices.Core",
       "setRedstoneValueUnsafe{(int, int, int)bool}",
       new SetRedstoneValueUnsafe());
   nativeProvider.addNativeMethod(
       "weasel.devices.Console", "printUnsafe{(int, xscript.lang.String)bool}", new PrintUnsafe());
   nativeProvider.addNativeMethod(
       "weasel.devices.Console", "clsUnsafe{(int)bool}", new ClsUnsafe());
 }