/FileExtraction/Java_unseen/Wind-Development_WindSpigot/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java
package org.bukkit.craftbukkit.block;

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Hopper;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.inventory.Inventory;

import net.minecraft.server.TileEntityHopper;

public class CraftHopper extends CraftBlockState implements Hopper {
	private final TileEntityHopper hopper;

	public CraftHopper(final Block block) {
		super(block);

		hopper = (TileEntityHopper) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ());
	}

	public CraftHopper(final Material material, final TileEntityHopper te) {
		super(material);

		hopper = te;
	}

	@Override
	public Inventory getInventory() {
		return new CraftInventory(hopper);
	}

	@Override
	public boolean update(boolean force, boolean applyPhysics) {
		boolean result = super.update(force, applyPhysics);

		if (result) {
			hopper.update();
		}

		return result;
	}

	@Override
	public TileEntityHopper getTileEntity() {
		return hopper;
	}
}
