Java Code Examples for openperipheral.api.adapter.method.ReturnType#OBJECT

The following examples show how to use openperipheral.api.adapter.method.ReturnType#OBJECT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdapterNetwork.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
@ScriptCallable(description = "Retrieves details about the specified item from the ME Network.", returnTypes = ReturnType.OBJECT)
public Object getItemDetail(IGridHost host,
		@Arg(name = "item", description = "Details of the item you are looking for") ItemFingerprint needle,
		@Optionals @Arg(name = "proxy", description = "If false, method will compute whole table, instead of returning proxy") Boolean proxy) {
	final IItemList<IAEItemStack> items = getStorageGrid(host).getItemInventory().getStorageList();
	final IAEItemStack stack = findStack(items, needle);
	if (stack == null) return null;
	ItemStack vanillaStack = stack.getItemStack();
	return proxy != Boolean.FALSE? OpcAccess.itemStackMetaBuilder.createProxy(vanillaStack) : vanillaStack;
}
 
Example 2
Source File: TileEntityGlassesBridge.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@Asynchronous
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Get the surface of a user to draw privately on their screen")
public SurfaceServer getSurfaceByUUID(@Arg(name = "uuid", description = "The uuid of the user to get the draw surface for") UUID uuid) {
	SurfaceServer playerSurface = getSurface(uuid);
	Preconditions.checkNotNull(playerSurface, "Invalid player");
	return playerSurface;
}
 
Example 3
Source File: AdapterSensor.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Get the usernames of all the players in range")
public List<GameProfile> getPlayers(ISensorEnvironment env) {
	List<EntityPlayer> players = WorldUtils.getEntitiesWithinAABB(env.getWorld(), EntityPlayer.class, getBoundingBox(env));

	List<GameProfile> names = Lists.newArrayList();
	for (EntityPlayer player : players)
		names.add(player.getGameProfile());

	return names;
}
 
Example 4
Source File: IDrawableFactory.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Add a new box to the screen")
public Drawable addBox(
		@Arg(name = "x", description = "The x position from the top left") float x,
		@Arg(name = "y", description = "The y position from the top left") float y,
		@Arg(name = "width", description = "The width of the box") float width,
		@Arg(name = "height", description = "The height of the box") float height,
		@Optionals @Arg(name = "color", description = "The color of the box") Integer color,
		@Arg(name = "opacity", description = "The opacity of the box (from 0 to 1)") Float opacity);
 
Example 5
Source File: IDrawableFactory.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Add a quad")
public Drawable addQuad(
		@Arg(name = "p1", description = "Coordinates of first point") Point2d p1,
		@Arg(name = "p2", description = "Coordinates of second point") Point2d p2,
		@Arg(name = "p3", description = "Coordinates of third point") Point2d p3,
		@Arg(name = "p4", description = "Coordinates of fourth point") Point2d p4,
		@Optionals @Arg(name = "color", description = "The color of the line") Integer color,
		@Arg(name = "opacity", description = "The opacity of the line (from 0 to 1)") Float opacity);
 
Example 6
Source File: IDrawableFactory.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Add a triangle")
public Drawable addTriangle(
		@Arg(name = "p1", description = "Coordinates of first point") Point2d p1,
		@Arg(name = "p2", description = "Coordinates of second point") Point2d p2,
		@Arg(name = "p3", description = "Coordinates of third point") Point2d p3,
		@Optionals @Arg(name = "color", description = "The color of the line") Integer color,
		@Arg(name = "opacity", description = "The opacity of the line (from 0 to 1)") Float opacity);
 
Example 7
Source File: IDrawableFactory.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Add a gradient line strip")
public Drawable addGradientLineList(
		@Arg(name = "points", description = "Coordinates of points") ColorPoint2d... points);
 
Example 8
Source File: AdapterSensor.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Get full details of a particular mob if it's in range. Deprecated, please use getEntityData(id, 'mob')")
public IMetaProviderProxy getMobData(ISensorEnvironment sensor,
		@Arg(name = "mobId", description = "The id retrieved from getMobIds()") int id) {
	return getEntityInfoById(sensor, id, EntityLiving.class);
}
 
Example 9
Source File: IDrawableFactory.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Add a line strip")
public Drawable addLineList(
		@Optionals @Arg(name = "color", description = "The color of the line") Integer color,
		@Arg(name = "opacity", description = "The opacity of the line (from 0 to 1)") Float opacity,
		@Arg(name = "points", description = "Coordinates of points") Point2d... points);
 
Example 10
Source File: IDrawableFactory.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Add a line")
public Drawable addLine(
		@Arg(name = "p1", description = "Coordinates of first point") Point2d p1,
		@Arg(name = "p2", description = "Coordinate of second point") Point2d p2,
		@Optionals @Arg(name = "color", description = "The color of the line") Integer color,
		@Arg(name = "opacity", description = "The opacity of the line (from 0 to 1)") Float opacity);
 
Example 11
Source File: IDrawableFactory.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Add a gradient quad")
public Drawable addGradientQuad(
		@Arg(name = "p1", description = "Coordinates of first point") ColorPoint2d p1,
		@Arg(name = "p2", description = "Coordinates of second point") ColorPoint2d p2,
		@Arg(name = "p3", description = "Coordinates of third point") ColorPoint2d p3,
		@Arg(name = "p4", description = "Coordinates of fourth point") ColorPoint2d p4);
 
Example 12
Source File: AdapterSensor.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Get the ids of all entities of single type in range")
public List<Integer> getEntityIds(ISensorEnvironment env, @Arg(name = "type") SupportedEntityTypes type) {
	return listEntityIds(env, type.cls);
}
 
Example 13
Source File: AdapterSensor.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Get the ids of all the mobs in range. Deprecated, please use getEntityIds('mob')")
public List<Integer> getMobIds(ISensorEnvironment env) {
	return listEntityIds(env, EntityLiving.class);
}
 
Example 14
Source File: AdapterSensor.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Get full details of a particular player if they're in range")
public IMetaProviderProxy getPlayerByUUID(ISensorEnvironment env,
		@Arg(name = "uuid", description = "The players uuid") UUID uuid) {
	return getPlayerInfo(env, uuid);
}
 
Example 15
Source File: AdapterSensor.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Get full details of a particular entity if it's in range")
public IMetaProviderProxy getEntityData(ISensorEnvironment sensor,
		@Arg(name = "id", description = "The id retrieved from getEntityIds()") int id,
		@Arg(name = "type") SupportedEntityTypes type) {
	return getEntityInfoById(sensor, id, type.cls);
}
 
Example 16
Source File: IDrawableFactory.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Add a new text object to the screen")
public Drawable addText(
		@Arg(name = "x", description = "The x position from the top left") float x,
		@Arg(name = "y", description = "The y position from the top left") float y,
		@Arg(name = "text", description = "The text to display") String text,
		@Optionals @Arg(name = "color", description = "The text color") Integer color);
 
Example 17
Source File: AdapterSensor.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Get the ids of all the minecarts in range. Deprecated, please use getEntityIds('minecart')")
public List<Integer> getMinecartIds(ISensorEnvironment env) {
	return listEntityIds(env, EntityMinecart.class);
}
 
Example 18
Source File: TileEntityGlassesBridge.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@Asynchronous
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Returns object used for controlling player capture mode")
public GuiCaptureControl getCaptureControl(@Arg(name = "uuid") UUID uuid) {
	PlayerInfo info = knownPlayersByUUID.get(uuid);
	return info != null? new GuiCaptureControl(getOrCreateGuid(), info.player) : null;
}
 
Example 19
Source File: AdapterSensor.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Get full details of a particular player if they're in range")
public IMetaProviderProxy getPlayerByName(ISensorEnvironment env,
		@Arg(name = "username", description = "The players username") String username) {
	return getPlayerInfo(env, username);
}
 
Example 20
Source File: IDrawableFactory.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.OBJECT, description = "Add a gradient concave polygon")
public Drawable addGradientPolygon(
		@Arg(name = "points", description = "Coordinates of points") ColorPoint2d... points);