@Override @Optional.Method(modid = "ComputerCraft") public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception { switch (method) { case 0: return getGolemDecorationsImplementation(); case 1: if (golem == null) return new Integer[] {}; return new Integer[] {(int) golem.posX, (int) golem.posY, (int) golem.posZ}; case 2: return getGolemTypeImplementation(); case 3: if (golem == null) return new Float[] {}; return new Float[] {golem.getHealth()}; case 4: return getGolemCoreImplementation(); case 5: return getHomeImplementation(); case 6: if (arguments.length != 4) throw new Exception("Invalid arguments"); double x = (Double) arguments[0]; double y = (Double) arguments[0]; double z = (Double) arguments[0]; double facing = (Double) arguments[0]; return setHomeImplementation(x, y, z, facing); case 7: return getMarkersImplementation(); case 8: if (arguments.length != 1) throw new Exception("setMarkers takes 1 argument"); return setMarkersImplementation((HashMap<Double, HashMap<String, Object>>) arguments[0]); case 9: return newMarkerImplementation(); case 10: if (arguments.length != 1) throw new Exception("addMarker must have 1 argument"); return addMarkerImplementation((Map) arguments[0]); case 11: if (arguments.length != 2) throw new Exception("saveMarker must have 2 arguments"); return saveMarkerImplementation((Double) arguments[0], (Map) arguments[1]); case 12: if (arguments.length != 1) throw new Exception("deleteMarker must have 1 argument"); return deleteMarkerImplementation((Double) arguments[0]); case 13: if (arguments.length != 1) throw new Exception("getMarker must have 1 argument"); return getMarkerImplementation((Double) arguments[0]); case 14: return getMarkerCountImplementation(); } return null; }
@Callback(doc = "function():number -- Returns The golems health") @Optional.Method(modid = "OpenComputers") public Object[] getHealth(Context context, Arguments args) throws Exception { return new Float[] {golem.getHealth()}; }