當前位置: 首頁>>代碼示例>>Java>>正文


Java TileEntityHopper類代碼示例

本文整理匯總了Java中net.minecraft.tileentity.TileEntityHopper的典型用法代碼示例。如果您正苦於以下問題:Java TileEntityHopper類的具體用法?Java TileEntityHopper怎麽用?Java TileEntityHopper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TileEntityHopper類屬於net.minecraft.tileentity包,在下文中一共展示了TileEntityHopper類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: func_96112_aD

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
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;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:19,代碼來源:EntityMinecartHopper.java

示例2: onBlockActivated

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
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;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:20,代碼來源:BlockHopper.java

示例3: captureDroppedItems

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
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;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:19,代碼來源:EntityMinecartHopper.java

示例4: onBlockActivated

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
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;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:20,代碼來源:BlockHopper.java

示例5: captureDroppedItems

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
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;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:19,代碼來源:EntityMinecartHopper.java

示例6: onBlockActivated

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
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;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:20,代碼來源:BlockHopper.java

示例7: getItemHandler

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
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);
	}
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:21,代碼來源:TomsModUtils.java

示例8: handleItems

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
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));
		}
	}
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:27,代碼來源:TileEntityDefenseStation.java

示例9: onBlockActivated

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
@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;
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:17,代碼來源:Generator.java

示例10: canShellFitInHopper

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
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;
}
 
開發者ID:TeamMonumental,項目名稱:FissionWarfare,代碼行數:23,代碼來源:TileEntityTurretBase.java

示例11: onNexusExportCall

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
@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);
}
 
開發者ID:samvbeckmann,項目名稱:network,代碼行數:17,代碼來源:ItemItemCore.java

示例12: func_96112_aD

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
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;
    }
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:19,代碼來源:EntityMinecartHopper.java

示例13: onBlockActivated

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
/**
 * 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;
    }
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:22,代碼來源:BlockHopper.java

示例14: onBlockActivated

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
/**
 * 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;
	}
}
 
開發者ID:mookie1097,項目名稱:NightfallMod,代碼行數:23,代碼來源:BlockHopper.java

示例15: cutTree

import net.minecraft.tileentity.TileEntityHopper; //導入依賴的package包/類
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);
        }
    }
}
 
開發者ID:MineMaarten,項目名稱:AdvancedMod,代碼行數:19,代碼來源:TileEntityTreeFarm.java


注:本文中的net.minecraft.tileentity.TileEntityHopper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。