Java 类net.minecraft.tileentity.TileEntityHopper 实例源码

项目:DecompiledMinecraft    文件:EntityMinecartHopper.java   
public boolean func_96112_aD()
{
    if (TileEntityHopper.captureDroppedItems(this))
    {
        return true;
    }
    else
    {
        List<EntityItem> list = this.worldObj.<EntityItem>getEntitiesWithinAABB(EntityItem.class, this.getEntityBoundingBox().expand(0.25D, 0.0D, 0.25D), EntitySelectors.selectAnything);

        if (list.size() > 0)
        {
            TileEntityHopper.putDropInInventoryAllSlots(this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:DecompiledMinecraft    文件:BlockHopper.java   
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityHopper)
        {
            playerIn.displayGUIChest((TileEntityHopper)tileentity);
            playerIn.triggerAchievement(StatList.field_181732_P);
        }

        return true;
    }
}
项目:DecompiledMinecraft    文件:EntityMinecartHopper.java   
public boolean func_96112_aD()
{
    if (TileEntityHopper.captureDroppedItems(this))
    {
        return true;
    }
    else
    {
        List<EntityItem> list = this.worldObj.<EntityItem>getEntitiesWithinAABB(EntityItem.class, this.getEntityBoundingBox().expand(0.25D, 0.0D, 0.25D), EntitySelectors.selectAnything);

        if (list.size() > 0)
        {
            TileEntityHopper.putDropInInventoryAllSlots(this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:DecompiledMinecraft    文件:BlockHopper.java   
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityHopper)
        {
            playerIn.displayGUIChest((TileEntityHopper)tileentity);
            playerIn.triggerAchievement(StatList.field_181732_P);
        }

        return true;
    }
}
项目:BaseClient    文件:EntityMinecartHopper.java   
public boolean func_96112_aD()
{
    if (TileEntityHopper.captureDroppedItems(this))
    {
        return true;
    }
    else
    {
        List<EntityItem> list = this.worldObj.<EntityItem>getEntitiesWithinAABB(EntityItem.class, this.getEntityBoundingBox().expand(0.25D, 0.0D, 0.25D), EntitySelectors.selectAnything);

        if (list.size() > 0)
        {
            TileEntityHopper.putDropInInventoryAllSlots(this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:BaseClient    文件:BlockHopper.java   
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityHopper)
        {
            playerIn.displayGUIChest((TileEntityHopper)tileentity);
            playerIn.triggerAchievement(StatList.field_181732_P);
        }

        return true;
    }
}
项目:BaseClient    文件:EntityMinecartHopper.java   
public boolean func_96112_aD()
{
    if (TileEntityHopper.captureDroppedItems(this))
    {
        return true;
    }
    else
    {
        List<EntityItem> list = this.worldObj.<EntityItem>getEntitiesWithinAABB(EntityItem.class, this.getEntityBoundingBox().expand(0.25D, 0.0D, 0.25D), EntitySelectors.selectAnything);

        if (list.size() > 0)
        {
            TileEntityHopper.putDropInInventoryAllSlots(this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:BaseClient    文件:BlockHopper.java   
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityHopper)
        {
            playerIn.displayGUIChest((TileEntityHopper)tileentity);
            playerIn.triggerAchievement(StatList.field_181732_P);
        }

        return true;
    }
}
项目:Backmemed    文件:EntityMinecartHopper.java   
public boolean captureDroppedItems()
{
    if (TileEntityHopper.captureDroppedItems(this))
    {
        return true;
    }
    else
    {
        List<EntityItem> list = this.world.<EntityItem>getEntitiesWithinAABB(EntityItem.class, this.getEntityBoundingBox().expand(0.25D, 0.0D, 0.25D), EntitySelectors.IS_ALIVE);

        if (!list.isEmpty())
        {
            TileEntityHopper.putDropInInventoryAllSlots((IInventory)null, this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:Backmemed    文件:BlockHopper.java   
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityHopper)
        {
            playerIn.displayGUIChest((TileEntityHopper)tileentity);
            playerIn.addStat(StatList.HOPPER_INSPECTED);
        }

        return true;
    }
}
项目:CustomWorldGen    文件:EntityMinecartHopper.java   
public boolean captureDroppedItems()
{
    if (TileEntityHopper.captureDroppedItems(this))
    {
        return true;
    }
    else
    {
        List<EntityItem> list = this.worldObj.<EntityItem>getEntitiesWithinAABB(EntityItem.class, this.getEntityBoundingBox().expand(0.25D, 0.0D, 0.25D), EntitySelectors.IS_ALIVE);

        if (!list.isEmpty())
        {
            TileEntityHopper.putDropInInventoryAllSlots(this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:CustomWorldGen    文件:BlockHopper.java   
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityHopper)
        {
            playerIn.displayGUIChest((TileEntityHopper)tileentity);
            playerIn.addStat(StatList.HOPPER_INSPECTED);
        }

        return true;
    }
}
项目:Toms-Mod    文件:TomsModUtils.java   
public static IItemHandler getItemHandler(World world, BlockPos pos, EnumFacing side, boolean includeEntities) {
    TileEntity te = world.getTileEntity(pos);
    if (te instanceof IDrawer) {
        return new DrawerWrapper((IDrawer) te);
    } else if (te instanceof IDrawerGroup) {
        return new DrawerGroupWrapper((IDrawerGroup) te);
    } else if (te == null || !te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side)) {
        IInventory inv = includeEntities ? TileEntityHopper.getInventoryAtPosition(world, pos.getX(), pos.getY(), pos.getZ()) : (te instanceof IInventory ? (IInventory) te : null);
        if (inv != null) {
            if (inv instanceof ISidedInventory) {
                return new SidedInvWrapper((ISidedInventory) inv, side);
            } else {
                return new InvWrapper(inv);
            }
        } else
            return null;
    } else {
        return te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side);
    }
}
项目:Toms-Mod    文件:TileEntityDefenseStation.java   
private void handleItems(IEnergyStorage energy, boolean pickup, AxisAlignedBB bounds) {
    List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, bounds.expand(1, 1, 1));
    for (EntityItem item : items) {
        if (energy.getEnergyStored() < 1)
            break;
        if (item == null) {
            continue;
        } else {
            ItemStack itemstack = item.getItem().copy();
            ItemStack itemstack1 = TileEntityHopper.putStackInInventoryAllSlots(this, this, itemstack, EnumFacing.UP);

            if (itemstack1 != null && itemstack1.getCount() != 0) {
                item.setItem(itemstack1);
            } else {
                item.setDead();
            }
            energy.extractEnergy(0.1D, false);
        }
    }
    for (int slot : SLOTS) {
        ItemStack stack = inv.getStackInSlot(slot);
        if (!stack.isEmpty()) {
            inv.setInventorySlotContents(slot, TomsModUtils.pushStackToNeighbours(stack, world, pos, EnumFacing.VALUES));
        }
    }
}
项目:Toms-Mod    文件:Generator.java   
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
    ItemStack heldItem = playerIn.getHeldItem(hand);
    if (heldItem != null) {
        TileEntityGenerator te = (TileEntityGenerator) worldIn.getTileEntity(pos);
        if (te.isItemValidForSlot(0, heldItem) && te.fuelStack == null) {
            ItemStack leftStack = TileEntityHopper.putStackInInventoryAllSlots(te, te, heldItem.splitStack(1), side);
            if (leftStack != null) {
                EntityItem item = new EntityItem(worldIn, pos.getX() + 0.5D, pos.getY() + 1, pos.getZ() + 0.5D, leftStack);
                worldIn.spawnEntity(item);
            }
            return true;
        }
    }
    return false;
}
项目:FissionWarfare    文件:TileEntityTurretBase.java   
public boolean canShellFitInHopper() {

    if (worldObj.getTileEntity(xCoord, yCoord - 1, zCoord) instanceof TileEntityHopper) {               

        TileEntityHopper hopper = (TileEntityHopper) worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);

        for (int s = 0; s < hopper.getSizeInventory(); s++) {

            if (hopper.getStackInSlot(s) == null) {
                hopper.setInventorySlotContents(s, new ItemStack(InitItems.cartridge));
                return true;
            }

            else if (hopper.getStackInSlot(s).getItem() == InitItems.cartridge && hopper.getStackInSlot(s).stackSize < hopper.getInventoryStackLimit()) {
                hopper.getStackInSlot(s).stackSize++;
                return true;
            }
        }
    }

    return false;
}
项目:network    文件:ItemItemCore.java   
@Override
public void onNexusExportCall(TileEntityTransporter nexus)
{
    if (nexus.getStackInSlot(0) != null)
    {
        TileEntity tile = nexus.getAttachedTileEntity();
        if (tile != null && tile instanceof IInventory)
        {
            IInventory inv = (IInventory) tile;
            ItemStack remainder = TileEntityHopper.func_145889_a(inv, nexus.getStackInSlot(0),
                    nexus.getBlockMetadata());
            nexus.setInventorySlotContents(0, remainder);
        }
    }
    attemptTeleport(nexus);
}
项目:Resilience-Client-Source    文件:EntityMinecartHopper.java   
public boolean func_96112_aD()
{
    if (TileEntityHopper.func_145891_a(this))
    {
        return true;
    }
    else
    {
        List var1 = this.worldObj.selectEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.25D, 0.0D, 0.25D), IEntitySelector.selectAnything);

        if (var1.size() > 0)
        {
            TileEntityHopper.func_145898_a(this, (EntityItem)var1.get(0));
        }

        return false;
    }
}
项目:Resilience-Client-Source    文件:BlockHopper.java   
/**
 * Called upon block activation (right click on the block.)
 */
public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
{
    if (p_149727_1_.isClient)
    {
        return true;
    }
    else
    {
        TileEntityHopper var10 = func_149920_e(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_);

        if (var10 != null)
        {
            p_149727_5_.func_146093_a(var10);
        }

        return true;
    }
}
项目:NightfallMod    文件:BlockHopper.java   
/**
 * Called upon block activation (right click on the block.)
 */
@Override
public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
{
    if (p_149727_1_.isRemote)
    {
        return true;
    }
    else
    {
        TileEntityHopper tileentityhopper = func_149920_e(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_);

        if (tileentityhopper != null)
        {
            p_149727_5_.func_146093_a(tileentityhopper);
        }

        return true;
    }
}
项目:AdvancedMod    文件:TileEntityTreeFarm.java   
private void cutTree(){
    if(inventory != null) {
        Block block = worldObj.getBlock(xCoord, yCoord + 2, zCoord);
        int offsetY = yCoord + 2;
        while(block.getMaterial() == Material.wood) {
            List<ItemStack> items = block.getDrops(worldObj, xCoord, offsetY, zCoord, worldObj.getBlockMetadata(xCoord, offsetY, zCoord), 0);
            for(ItemStack item : items) {
                ItemStack remainder = TileEntityHopper.func_145889_a(inventory, item, 0);
                if(remainder != null) {
                    worldObj.spawnEntityInWorld(new EntityItem(worldObj, xCoord + 0.5, yCoord + 2.5, zCoord + 0.5, remainder));
                }
            }
            worldObj.setBlock(xCoord, offsetY, zCoord, Blocks.air);
            offsetY++;
            block = worldObj.getBlock(xCoord, offsetY, zCoord);
        }
    }
}
项目:ExpandedRailsMod    文件:EntityMinecartHopper.java   
public boolean captureDroppedItems()
{
    if (TileEntityHopper.captureDroppedItems(this))
    {
        return true;
    }
    else
    {
        List<EntityItem> list = this.worldObj.<EntityItem>getEntitiesWithinAABB(EntityItem.class, this.getEntityBoundingBox().expand(0.25D, 0.0D, 0.25D), EntitySelectors.IS_ALIVE);

        if (!list.isEmpty())
        {
            TileEntityHopper.putDropInInventoryAllSlots(this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:ExpandedRailsMod    文件:BlockHopper.java   
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityHopper)
        {
            playerIn.displayGUIChest((TileEntityHopper)tileentity);
            playerIn.addStat(StatList.HOPPER_INSPECTED);
        }

        return true;
    }
}
项目:PowerAdvantageAPI    文件:TileEntityConveyorFilter.java   
protected boolean isValidItemFor(ItemStack item, TileEntity target, EnumFacing side){
    if(item == null) return false;
    if(target instanceof IInventory){
        BlockPos targetPos = target.getPos();
        ISidedInventory dt = InventoryWrapper.wrap(TileEntityHopper.getInventoryAtPosition(getWorld(),targetPos.getX(), targetPos.getY(), targetPos.getZ()));
        int[] slots = dt.getSlotsForFace(side);
        for(int i = 0; i < slots.length; i++){
            int slot = slots[i];
            if(dt.canInsertItem(slot, item, side)){
                return true;
            }
        }
        return false;
    }else{
        return true;
    }
}
项目:PowerAdvantageAPI    文件:TileEntityConveyorFilter.java   
private void dropItem(TileEntity target) {
    World w = getWorld();
    IBlockState bs = w.getBlockState(getPos().down());
    if(target == null && !(bs.getMaterial().blocksMovement())){
        // drop item in the air
        EntityItem ie = new EntityItem(w,getPos().getX()+0.5,getPos().getY()-0.5,getPos().getZ()+0.5,getInventory()[0]);
        ie.motionX = 0;
        ie.motionZ = 0;
        ie.motionY = 0;
        w.spawnEntityInWorld(ie);
        getInventory()[0] = null;
        transferCooldown = transferInvterval;
        this.markDirty();
    } else if(target instanceof IInventory){
        // add item to inventory
        EnumFacing myDir = EnumFacing.DOWN;
        EnumFacing theirDir = EnumFacing.UP;
        BlockPos targetPos = target.getPos();
        ISidedInventory targetInv = InventoryWrapper.wrap(TileEntityHopper.getInventoryAtPosition(getWorld(),targetPos.getX(), targetPos.getY(), targetPos.getZ()));
        if(transferItem(this,myDir,targetInv,theirDir)){
            transferCooldown = transferInvterval;
            this.markDirty();
        }
    }
}
项目:Cauldron    文件:EntityMinecartHopper.java   
public boolean func_96112_aD()
{
    if (TileEntityHopper.func_145891_a(this))
    {
        return true;
    }
    else
    {
        List list = this.worldObj.selectEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.25D, 0.0D, 0.25D), IEntitySelector.selectAnything);

        if (list.size() > 0)
        {
            TileEntityHopper.func_145898_a(this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:Cauldron    文件:EntityPlayerMP.java   
public void func_146093_a(TileEntityHopper p_146093_1_)
{
    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, p_146093_1_));

    if (container == null)
    {
        p_146093_1_.closeInventory(); // Cauldron - prevent chest from being stuck in open state on clients
        return;
    }

    // CraftBukkit end
    this.getNextWindowId();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 9, p_146093_1_.getInventoryName(), p_146093_1_.getSizeInventory(), p_146093_1_.hasCustomInventoryName()));
    this.openContainer = container; // CraftBukkit - Use container we passed to event
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
}
项目:Cauldron    文件:BlockHopper.java   
public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
{
    if (p_149727_1_.isRemote)
    {
        return true;
    }
    else
    {
        TileEntityHopper tileentityhopper = func_149920_e(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_);

        if (tileentityhopper != null)
        {
            p_149727_5_.func_146093_a(tileentityhopper);
        }

        return true;
    }
}
项目:Cauldron    文件:EntityMinecartHopper.java   
public boolean func_96112_aD()
{
    if (TileEntityHopper.func_145891_a(this))
    {
        return true;
    }
    else
    {
        List list = this.worldObj.selectEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.25D, 0.0D, 0.25D), IEntitySelector.selectAnything);

        if (list.size() > 0)
        {
            TileEntityHopper.func_145898_a(this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:Cauldron    文件:BlockHopper.java   
public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
{
    if (p_149727_1_.isRemote)
    {
        return true;
    }
    else
    {
        TileEntityHopper tileentityhopper = func_149920_e(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_);

        if (tileentityhopper != null)
        {
            p_149727_5_.func_146093_a(tileentityhopper);
        }

        return true;
    }
}
项目:RuneCraftery    文件:EntityMinecartHopper.java   
public boolean func_96112_aD()
{
    if (TileEntityHopper.suckItemsIntoHopper(this))
    {
        return true;
    }
    else
    {
        List list = this.worldObj.selectEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.25D, 0.0D, 0.25D), IEntitySelector.selectAnything);

        if (list.size() > 0)
        {
            TileEntityHopper.insertStackFromEntity(this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:RuneCraftery    文件:BlockHopper.java   
/**
 * Called upon block activation (right click on the block.)
 */
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
    if (par1World.isRemote)
    {
        return true;
    }
    else
    {
        TileEntityHopper tileentityhopper = getHopperTile(par1World, par2, par3, par4);

        if (tileentityhopper != null)
        {
            par5EntityPlayer.displayGUIHopper(tileentityhopper);
        }

        return true;
    }
}
项目:EarliestOfGames    文件:CrateTile.java   
public boolean captureItemsInside()
{
    boolean didCapture = false;
    List<EntityItem> itemEntities = getItemEntitiesInside();

    for (EntityItem itemEntity : itemEntities)
    {
        if (canItemEscape(itemEntity.getEntityItem()))
            continue;

        // func_145898_a = insertStackFromEntity
        didCapture = didCapture || TileEntityHopper.func_145898_a(this, itemEntity);
    }

    return didCapture;
}
项目:BetterNutritionMod    文件:EntityMinecartHopper.java   
public boolean func_96112_aD()
{
    if (TileEntityHopper.suckItemsIntoHopper(this))
    {
        return true;
    }
    else
    {
        List list = this.worldObj.selectEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.25D, 0.0D, 0.25D), IEntitySelector.selectAnything);

        if (list.size() > 0)
        {
            TileEntityHopper.insertStackFromEntity(this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:BetterNutritionMod    文件:BlockHopper.java   
/**
 * Called upon block activation (right click on the block.)
 */
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
    if (par1World.isRemote)
    {
        return true;
    }
    else
    {
        TileEntityHopper tileentityhopper = getHopperTile(par1World, par2, par3, par4);

        if (tileentityhopper != null)
        {
            par5EntityPlayer.displayGUIHopper(tileentityhopper);
        }

        return true;
    }
}
项目:PneumaticCraft    文件:BlockElevatorBase.java   
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block){
    super.onNeighborBlockChange(world, x, y, z, block);
    TileEntity te = world.getTileEntity(x, y, z);
    if(te instanceof TileEntityElevatorBase) {
        TileEntityElevatorBase thisTe = (TileEntityElevatorBase)te;
        if(thisTe.isCoreElevator()) {
            TileEntityElevatorBase teAbove = getCoreTileEntity(world, x, y, z);
            if(teAbove != null && teAbove != thisTe) {
                for(int i = 0; i < thisTe.getSizeInventory(); i++) {
                    ItemStack item = thisTe.getStackInSlot(i);
                    if(item != null) {
                        ItemStack leftover = TileEntityHopper.func_145889_a(teAbove, item, 0);
                        thisTe.setInventorySlotContents(i, null);
                        if(leftover != null) {
                            EntityItem entity = new EntityItem(world, teAbove.xCoord + 0.5, teAbove.yCoord + 1.5, teAbove.zCoord + 0.5, leftover);
                            world.spawnEntityInWorld(entity);
                        }
                    }
                }
            }
        }
    }
}
项目:DecompiledMinecraft    文件:BlockHopper.java   
/**
 * Called by ItemBlocks after a block is set in the world, to allow post-place logic
 */
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
    super.onBlockPlacedBy(worldIn, pos, state, placer, stack);

    if (stack.hasDisplayName())
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityHopper)
        {
            ((TileEntityHopper)tileentity).setCustomName(stack.getDisplayName());
        }
    }
}
项目:DecompiledMinecraft    文件:BlockHopper.java   
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityHopper)
    {
        InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityHopper)tileentity);
        worldIn.updateComparatorOutputLevel(pos, this);
    }

    super.breakBlock(worldIn, pos, state);
}
项目:DecompiledMinecraft    文件:BlockHopper.java   
/**
 * Called by ItemBlocks after a block is set in the world, to allow post-place logic
 */
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
    super.onBlockPlacedBy(worldIn, pos, state, placer, stack);

    if (stack.hasDisplayName())
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityHopper)
        {
            ((TileEntityHopper)tileentity).setCustomName(stack.getDisplayName());
        }
    }
}
项目:DecompiledMinecraft    文件:BlockHopper.java   
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityHopper)
    {
        InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityHopper)tileentity);
        worldIn.updateComparatorOutputLevel(pos, this);
    }

    super.breakBlock(worldIn, pos, state);
}