Java Code Examples for erogenousbeef.bigreactors.api.registry.Reactants#getSolidToReactant()

The following examples show how to use erogenousbeef.bigreactors.api.registry.Reactants#getSolidToReactant() . 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: TileEntityReactorAccessPort.java    From BigReactors with MIT License 5 votes vote down vote up
public int getInputReactantAmount() {
	ItemStack inputItem = getStackInSlot(SLOT_INLET);
	if(inputItem == null) { return 0; }

	SourceProductMapping mapping = Reactants.getSolidToReactant(inputItem);
	return mapping != null ? mapping.getProductAmount(inputItem.stackSize) : 0;
}
 
Example 2
Source File: TileEntityReactorAccessPort.java    From BigReactors with MIT License 5 votes vote down vote up
/**
 * Consume items from the input slot.
 * Returns the amount of reactant produced.
 * @param reactantDesired The amount of reactant desired, in reactant units (mB)
 * @return The amount of reactant actually produced, in reactant units (mB)
 */
public int consumeReactantItem(int reactantDesired) {
	ItemStack inputItem = getStackInSlot(SLOT_INLET);
	if(inputItem == null) { return 0; }
	
	SourceProductMapping mapping = Reactants.getSolidToReactant(inputItem);
	if(mapping == null) { return 0; }
	
	int sourceItemsToConsume = Math.min(inputItem.stackSize, mapping.getSourceAmount(reactantDesired));
	
	if(sourceItemsToConsume <= 0) { return 0; }

	decrStackSize(SLOT_INLET, sourceItemsToConsume);
	return mapping.getProductAmount(sourceItemsToConsume);
}
 
Example 3
Source File: TileEntityReactorAccessPort.java    From BigReactors with MIT License 4 votes vote down vote up
public String getInputReactantType() {
	ItemStack inputItem = getStackInSlot(SLOT_INLET);
	if(inputItem == null) { return null; }
	SourceProductMapping mapping = Reactants.getSolidToReactant(inputItem);
	return mapping != null ? mapping.getProduct() : null;
}