mmb.engine.inv.io.Dropper 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.io;
import mmb.beans.Positioned;
import mmb.engine.item.ItemEntry;
import mmb.engine.recipe.RecipeOutput;
import mmb.engine.worlds.world.World;
/**
* A dropper is an inventory writer, which drops items at a specific location
* @author oskar
*/
public class Dropper implements InventoryWriter, Positioned {
private final World map;
private int x;
private int y;
/**
* Creates a dropper
* @param x X coordinate
* @param y Y coordinate
* @param map
*/
public Dropper(int x, int y, World map) {
this.map = map;
this.x = x;
this.y = y;
}
@Override
public int insert(ItemEntry ent, int amount) {
map.dropItem(ent, amount, x, y);
return amount; //always accepts
}
@Override
public int posX() {
return x;
}
@Override
public int posY() {
return y;
}
@Override
public void setX(int x) {
this.x = x;
}
@Override
public void setY(int y) {
this.y = y;
}
@Override
public int bulkInsert(RecipeOutput block, int amount) {
map.dropItems(block, amount, x, y);
return amount; //always accepts
}
@Override
public int toInsertBulk(RecipeOutput block, int amount) {
return amount;
}
@Override
public int toInsert(ItemEntry item, int amount) {
return amount;
}
}