mmb.engine.inv.ReadOnlyItemRecord Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multimachinebuilder Show documentation
Show all versions of multimachinebuilder Show documentation
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<
The newest version!
/**
*
*/
package mmb.engine.inv;
import mmb.NN;
import mmb.engine.item.ItemEntry;
/**
* An item record, which does not allow I/O
* @author oskar
*/
public class ReadOnlyItemRecord implements ItemRecord{
/**
* Decorates an item record
* @param itemRecord item record to decorate
* @return a read-only item record
*/
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;
}
}