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

The following examples show how to use openperipheral.api.adapter.method.ReturnType#BOOLEAN . 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: AdapterWritingDesk.java    From OpenPeripheral-Integration with MIT License 6 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.BOOLEAN, description = "Pull an item from the target inventory into any slot in the current one. Returns true if item was consumed")
public boolean pullNotebookPage(TileEntity desk,
		@Arg(name = "deskSlot") Index deskSlot,
		@Arg(name = "direction", description = "The direction of the other inventory)") ForgeDirection direction,
		@Arg(name = "fromSlot", description = "The slot in the other inventory that you're pulling from") Index fromSlot) {

	IInventory inv = getTargetTile(desk, direction);

	fromSlot.checkElementIndex("input slot", inv.getSizeInventory());

	ItemStack stack = inv.getStackInSlot(fromSlot.value);
	Preconditions.checkNotNull(stack, "Other inventory empty");

	final NotebookWrapper wrapper = createInventoryWrapper(desk, deskSlot);

	ItemStack added = wrapper.addPage(stack);
	inv.setInventorySlotContents(fromSlot.value, added);
	inv.markDirty();
	return added == null;
}
 
Example 2
Source File: AdapterDeconstructor.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.BOOLEAN, description = "Has the Table any items")
public boolean hasItem(Object target) {
	if (target instanceof IInventory) {
		IInventory inv = (IInventory)target;
		return inv.getStackInSlot(0) != null;
	}
	return false;
}
 
Example 3
Source File: AdapterAutoSpawner.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(description = "Get value of spawn exact copy toggle", returnTypes = ReturnType.BOOLEAN)
public boolean getSpawnExact(Object tileEntityAutoSpawner) {
	return GET_SPAWN_EXACT.call(tileEntityAutoSpawner);
}
 
Example 4
Source File: MethodDescriptionTest.java    From OpenPeripheral with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.BOOLEAN)
public boolean test(A target, @Env("env1") A e) {
	return true;
}
 
Example 5
Source File: AdapterArcaneBore.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.BOOLEAN, description = "Does the bore mine native clusters as well as normal ores")
public boolean hasNativeClusters(Object target) {
	ItemStack pick = getPick(target);
	return pick != null && ITEM_ELEMENTAL_PICK.isInstance(pick.getItem());
}
 
Example 6
Source File: AdapterAutoJukebox.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(description = "Can a disc be played?", returnTypes = ReturnType.BOOLEAN)
public boolean getCanPlay(Object tileEntityAutoJukebox) {
	return GET_CAN_PLAY.call(tileEntityAutoJukebox);
}
 
Example 7
Source File: AdapterDeconstructor.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.BOOLEAN, description = "Does the Table have an aspect in it")
public boolean hasAspect(Object target) throws Exception {
	return ASPECT.get(target) != null;
}
 
Example 8
Source File: AdapterHasWork.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(description = "Returns true if has work", returnTypes = ReturnType.BOOLEAN)
public boolean hasWork(Object target) {
	return HAS_WORK.call(target);
}
 
Example 9
Source File: AdapterEnderFluidAttuned.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(description = "Can the machine input fluids via the ender net.", returnTypes = ReturnType.BOOLEAN)
public boolean canReceiveFluid(IEnderFluidHandler tileEntity) {
	return tileEntity.canReceiveFluid();
}
 
Example 10
Source File: AdapterEnderFluidAttuned.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(description = "Can the machine output fluids via the ender net.", returnTypes = ReturnType.BOOLEAN)
public boolean canSendFluid(IEnderFluidHandler tileEntity) {
	return tileEntity.canSendFluid();
}
 
Example 11
Source File: AdapterEnderFluidAttuned.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.BOOLEAN, description = "Clean the active frequency of the machine.")
public boolean clearFrequency(IEnderFluidHandler tileEntity) {
	SecurityUtils.checkAccess(tileEntity);
	return tileEntity.clearFrequency();
}
 
Example 12
Source File: AdapterHasCart.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(description = "Returns true if has cart", returnTypes = ReturnType.BOOLEAN)
public boolean hasCart(Object target) {
	return HAS_CART.call(target);
}
 
Example 13
Source File: AdapterReconfigurableFacing.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.BOOLEAN, description = "Attempt to rotate the block. Arbitrary based on implementation. Returns true if rotation was successful")
public boolean rotateBlock(IReconfigurableFacing target) {
	SecurityUtils.checkAccess(target);
	return target.rotateBlock();
}
 
Example 14
Source File: AdapterEnderItemAttuned.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(description = "Can the machine output items via the ender net.", returnTypes = ReturnType.BOOLEAN)
public boolean canSendItems(IEnderItemHandler tileEntity) {
	return tileEntity.canSendItems();
}
 
Example 15
Source File: AdapterInterface.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(description = "Returns true when the interface can export to side.", returnTypes = ReturnType.BOOLEAN)
public boolean canExport(IGridHost tileEntityInterface, @Arg(name = "direction", description = "Location of target inventory") ForgeDirection direction) {
	return getNeighborInventory(tileEntityInterface, direction) != null;
}
 
Example 16
Source File: AdapterReconfigurableSides.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.BOOLEAN, description = "Reset configs on all sides to their base values. Returns true if reset was successful")
public boolean resetSides(IReconfigurableSides target) {
	SecurityUtils.checkAccess(target);
	return target.resetSides();
}
 
Example 17
Source File: AdapterTileBoilerFirebox.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(description = "Get whether the boiler is active or not", returnTypes = ReturnType.BOOLEAN)
public boolean isBurning(Object target) {
	return IS_BURNING.call(target);
}
 
Example 18
Source File: AdapterPipe.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(description = "Checks if a wire on the pipe is active", returnTypes = ReturnType.BOOLEAN)
public boolean isWireActive(IPipeTile target,
		@Arg(name = "wire", description = "The colour of the wire") PipeWire wire) {
	return getPipe(target).isWireActive(wire);
}
 
Example 19
Source File: AdapterArcaneBore.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.BOOLEAN, description = "Does the arcane bore have a pickaxe.")
public boolean hasPickaxe(Object target) {
	return HAS_PICKAXE.get(target);
}
 
Example 20
Source File: AdapterFurnace.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.BOOLEAN, description = "Is the furnace currently burning?")
public boolean isBurning(TileEntityFurnace furnace) {
	return furnace.isBurning();
}