All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mmb.engine.inv.storage.SingleItemInventory Maven / Gradle / Ivy

Go to download

Dependency for the MultiMachineBuilder, a voxel game about building an industrial empire in a finite world. THIS RELEASE IS NOT PLAYABLE. To play the game, donwload from >ITCH.IO LINK HERE< or >GH releases link here<

There is a newer version: 0.6
Show newest version
/**
 * 
 */
package mmb.engine.inv.storage;

import mmb.NN;
import mmb.Nil;
import mmb.data.variables.DataValue;
import mmb.data.variables.Variable;
import mmb.engine.item.ItemEntry;

/**
 * @author oskar
 */
public class SingleItemInventory extends BaseSingleItemInventory {
	/** The item variable used by this inventory */
	@NN public final Variable<@Nil ItemEntry> itemvar;
	
	/** Creates a single item inventory with a simple item variable and no items */
	public SingleItemInventory() {
		itemvar = new DataValue<>(null);
	}
	/**
	 * Creates a single item inventory with a simple item variable and an item
	 * @param item
	 */
	public SingleItemInventory(@Nil ItemEntry item) {
		itemvar = new DataValue<>(item);
	}
	/**
	 * Creates a single item inventory with a custom item variable
	 * @param itemvar
	 */
	public SingleItemInventory(Variable itemvar) {
		this.itemvar = itemvar;
	}
	
	/** @return contents of this inventory */
	@Override
	public ItemEntry getContents() {
		return itemvar.get();
	}
	/**  @param contents new contents of this inventory */
	@Override
	public boolean setContents(@Nil ItemEntry contents) {
		this.itemvar.set(contents);
		return true;
	}
	
	@Override
	@NN public SingleItemInventory setCapacity(double cap) {
		super.setCapacity(cap);
		return this;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy