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

mmb.engine.inv.ReadOnlyItemRecord 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;

import mmb.NN;
import mmb.engine.item.ItemEntry;

/**
 * @author oskar
 *
 */
public class ReadOnlyItemRecord implements ItemRecord{

	/**
	 * @param itemRecord
	 * @return
	 */
	public static @NN ItemRecord decorate(ItemRecord itemRecord) {
		return new ReadOnlyItemRecord(itemRecord);
	}

	private final ItemRecord rec;

	private ReadOnlyItemRecord(ItemRecord rec) {
		super();
		this.rec = rec;
	}

	@Override
	public int amount() {
		return rec.amount();
	}

	@Override
	public Inventory inventory() {
		return rec.inventory().readOnly();
	}

	@Override
	public ItemEntry item() {
		return rec.item();
	}

	@Override
	public int insert(int amount) {
		return 0;
	}

	@Override
	public int extract(int amount) {
		return 0;
	}

	@Override
	public boolean canExtract() {
		return false;
	}

	@Override
	public boolean canInsert() {
		return false;
	}

	@Override
	public ItemRecord lockInsertions() {
		return this;
	}

	@Override
	public ItemRecord lockExtractions() {
		return this;
	}

	@Override
	public ItemRecord readOnly() {
		return this;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy