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

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

import mmb.beans.Positioned;
import mmb.engine.craft.RecipeOutput;
import mmb.engine.item.ItemEntry;
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, 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;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy