当前位置: 首页>>代码示例>>Java>>正文


Java TileEntityDispenser.getStackInSlot方法代码示例

本文整理汇总了Java中net.minecraft.tileentity.TileEntityDispenser.getStackInSlot方法的典型用法代码示例。如果您正苦于以下问题:Java TileEntityDispenser.getStackInSlot方法的具体用法?Java TileEntityDispenser.getStackInSlot怎么用?Java TileEntityDispenser.getStackInSlot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.tileentity.TileEntityDispenser的用法示例。


在下文中一共展示了TileEntityDispenser.getStackInSlot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dispense

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
protected void dispense(World worldIn, BlockPos pos)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int i = tileentitydispenser.getDispenseSlot();

        if (i < 0)
        {
            worldIn.playAuxSFX(1001, pos, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(i);
            IBehaviorDispenseItem ibehaviordispenseitem = this.getBehavior(itemstack);

            if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider)
            {
                ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack);
                tileentitydispenser.setInventorySlotContents(i, itemstack1.stackSize <= 0 ? null : itemstack1);
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:BlockDispenser.java

示例2: dispense

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
protected void dispense(World worldIn, BlockPos pos)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int i = tileentitydispenser.getDispenseSlot();

        if (i < 0)
        {
            worldIn.playEvent(1001, pos, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(i);
            IBehaviorDispenseItem ibehaviordispenseitem = this.getBehavior(itemstack);

            if (ibehaviordispenseitem != IBehaviorDispenseItem.DEFAULT_BEHAVIOR)
            {
                tileentitydispenser.setInventorySlotContents(i, ibehaviordispenseitem.dispense(blocksourceimpl, itemstack));
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:BlockDispenser.java

示例3: dispense

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
protected void dispense(World worldIn, BlockPos pos)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int i = tileentitydispenser.getDispenseSlot();

        if (i < 0)
        {
            worldIn.playEvent(1001, pos, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(i);
            IBehaviorDispenseItem ibehaviordispenseitem = this.getBehavior(itemstack);

            if (ibehaviordispenseitem != IBehaviorDispenseItem.DEFAULT_BEHAVIOR)
            {
                ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack);
                tileentitydispenser.setInventorySlotContents(i, itemstack1.stackSize <= 0 ? null : itemstack1);
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:BlockDispenser.java

示例4: func_149941_e

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
protected void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_)
{
    BlockSourceImpl var5 = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_);
    TileEntityDispenser var6 = (TileEntityDispenser)var5.getBlockTileEntity();

    if (var6 != null)
    {
        int var7 = var6.func_146017_i();

        if (var7 < 0)
        {
            p_149941_1_.playAuxSFX(1001, p_149941_2_, p_149941_3_, p_149941_4_, 0);
        }
        else
        {
            ItemStack var8 = var6.getStackInSlot(var7);
            IBehaviorDispenseItem var9 = this.func_149940_a(var8);

            if (var9 != IBehaviorDispenseItem.itemDispenseBehaviorProvider)
            {
                ItemStack var10 = var9.dispense(var5, var8);
                var6.setInventorySlotContents(var7, var10.stackSize == 0 ? null : var10);
            }
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:27,代码来源:BlockDispenser.java

示例5: func_149941_e

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
protected void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int l = tileentitydispenser.func_146017_i();

        if (l < 0)
        {
            p_149941_1_.playAuxSFX(1001, p_149941_2_, p_149941_3_, p_149941_4_, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(l);
            IBehaviorDispenseItem ibehaviordispenseitem = this.func_149940_a(itemstack);

            if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider)
            {
                ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack);
                tileentitydispenser.setInventorySlotContents(l, itemstack1.stackSize == 0 ? null : itemstack1);
            }
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:27,代码来源:BlockDispenser.java

示例6: dispense

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
protected void dispense(World par1World, int par2, int par3, int par4)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(par1World, par2, par3, par4);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int l = tileentitydispenser.getRandomStackFromInventory();

        if (l < 0)
        {
            par1World.playAuxSFX(1001, par2, par3, par4, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(l);
            IBehaviorDispenseItem ibehaviordispenseitem = this.getBehaviorForItemStack(itemstack);

            if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider)
            {
                ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack);
                tileentitydispenser.setInventorySlotContents(l, itemstack1.stackSize == 0 ? null : itemstack1);
            }
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:27,代码来源:BlockDispenser.java

示例7: dispense

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
protected void dispense(World worldIn, BlockPos pos)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int i = tileentitydispenser.getDispenseSlot();
        	
        if (i < 0)
        {
            worldIn.playAuxSFX(1001, pos, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(i);
            IBehaviorDispenseItem ibehaviordispenseitem = this.getBehavior(itemstack);

            if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider)
            {
            	try{
            	    IPosition iposition = BlockDispenser.getDispensePosition(blocksourceimpl);
            	    BlockPos pos1 = new BlockPos(iposition.getX(), iposition.getY(), iposition.getZ());
            		Block block = Block.getBlockFromItem(itemstack.getItem());
            		if (worldIn.canBlockBePlaced(block,pos1,true,BlockPistonBase.getFacing(1),en,itemstack)){
            	ItemStack itemstack1 = this.dispenseStack(blocksourceimpl, itemstack, worldIn);
            	worldIn.playSoundEffect(iposition.getX(), iposition.getY(), iposition.getZ(), block.stepSound.getPlaceSound(), 1.0f, 1.0f);
                if (block.getStateFromMeta(itemstack1.getMetadata())==worldIn.getBlockState(pos1))tileentitydispenser.setInventorySlotContents(i, itemstack1.stackSize == 0 ? null : itemstack1);
            	    }}
            	    catch (Exception e) {}
            }
        }
    }
}
 
开发者ID:ORCHARD-Minecraft-Mod-Class,项目名称:RandomMine,代码行数:35,代码来源:BlockPlacer.java

示例8: func_149941_e

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
public void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int l = tileentitydispenser.func_146017_i();

        if (l < 0)
        {
            p_149941_1_.playAuxSFX(1001, p_149941_2_, p_149941_3_, p_149941_4_, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(l);
            IBehaviorDispenseItem ibehaviordispenseitem = this.func_149940_a(itemstack);

            if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider)
            {
                ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack);
                eventFired = false; // CraftBukkit - reset event status
                tileentitydispenser.setInventorySlotContents(l, itemstack1.stackSize == 0 ? null : itemstack1);
            }
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:28,代码来源:BlockDispenser.java

示例9: updateTick

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
/**
 * Ticks the block if it's been scheduled
 */
@Override
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
	if (!par1World.isRemote)
	{
		TileEntity te = par1World.getTileEntity(par2, par3, par4);
		TileEntityDispenser dis;
		if(te instanceof TileEntityDispenser) {
			dis = ((TileEntityDispenser) te);
 		AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(par2-0.2, par3-0.2, par4-0.2, par2+1.2, par3+1.2, par4+1.2);
 		List<EntitySpecialArrow> arrs = par1World.getEntitiesWithinAABB(EntitySpecialArrow.class, aabb);
 		for(int a = arrs.size()-1; a>=0; a--) {
 			EntityArrow arr = arrs.get(a);
 			for(int s=0; s<9; s++) {
 				ItemStack is = dis.getStackInSlot(s);
 				if(is == null) {
 					dis.setInventorySlotContents(s, new ItemStack(Items.arrow, 1));
 					arr.setDead();
 					break;
 				}
 				else if(is != null && is.getItem() == Items.arrow) {
 					if(is.stackSize < 64) {
 						is.stackSize++;
 						arr.setDead();
 						break;
 					}
 				}
 			}
 		}
 		
 		this.dispense(par1World, par2, par3, par4, par5Random.nextInt(4)+1);
 		this.dispense(par1World, par2, par3, par4, par5Random.nextInt(4)+1);
		}
	}
}
 
开发者ID:Draco18s,项目名称:Artifacts,代码行数:39,代码来源:BlockTrap.java

示例10: dispense

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
protected void dispense(World worldIn, BlockPos pos)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int i = tileentitydispenser.getDispenseSlot();

        if (i < 0)
        {
            worldIn.playAuxSFX(1001, pos, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(i);

            if (itemstack != null)
            {
                EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING);
                BlockPos blockpos = pos.offset(enumfacing);
                IInventory iinventory = TileEntityHopper.getInventoryAtPosition(worldIn, (double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ());
                ItemStack itemstack1;

                if (iinventory == null)
                {
                    itemstack1 = this.dropBehavior.dispense(blocksourceimpl, itemstack);

                    if (itemstack1 != null && itemstack1.stackSize <= 0)
                    {
                        itemstack1 = null;
                    }
                }
                else
                {
                    itemstack1 = TileEntityHopper.putStackInInventoryAllSlots(iinventory, itemstack.copy().splitStack(1), enumfacing.getOpposite());

                    if (itemstack1 == null)
                    {
                        itemstack1 = itemstack.copy();

                        if (--itemstack1.stackSize <= 0)
                        {
                            itemstack1 = null;
                        }
                    }
                    else
                    {
                        itemstack1 = itemstack.copy();
                    }
                }

                tileentitydispenser.setInventorySlotContents(i, itemstack1);
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:58,代码来源:BlockDropper.java

示例11: dispense

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
protected void dispense(World worldIn, BlockPos pos)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int i = tileentitydispenser.getDispenseSlot();

        if (i < 0)
        {
            worldIn.playEvent(1001, pos, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(i);

            if (!itemstack.func_190926_b())
            {
                EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING);
                BlockPos blockpos = pos.offset(enumfacing);
                IInventory iinventory = TileEntityHopper.getInventoryAtPosition(worldIn, (double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ());
                ItemStack itemstack1;

                if (iinventory == null)
                {
                    itemstack1 = this.dropBehavior.dispense(blocksourceimpl, itemstack);
                }
                else
                {
                    itemstack1 = TileEntityHopper.putStackInInventoryAllSlots(tileentitydispenser, iinventory, itemstack.copy().splitStack(1), enumfacing.getOpposite());

                    if (itemstack1.func_190926_b())
                    {
                        itemstack1 = itemstack.copy();
                        itemstack1.func_190918_g(1);
                    }
                    else
                    {
                        itemstack1 = itemstack.copy();
                    }
                }

                tileentitydispenser.setInventorySlotContents(i, itemstack1);
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:49,代码来源:BlockDropper.java

示例12: dispense

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
protected void dispense(World worldIn, BlockPos pos)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int i = tileentitydispenser.getDispenseSlot();

        if (i < 0)
        {
            worldIn.playEvent(1001, pos, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(i);

            if (itemstack != null && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(worldIn, pos, tileentitydispenser, i, itemstack))
            {
                EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING);
                BlockPos blockpos = pos.offset(enumfacing);
                IInventory iinventory = TileEntityHopper.getInventoryAtPosition(worldIn, (double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ());
                ItemStack itemstack1;

                if (iinventory == null)
                {
                    itemstack1 = this.dropBehavior.dispense(blocksourceimpl, itemstack);

                    if (itemstack1 != null && itemstack1.stackSize <= 0)
                    {
                        itemstack1 = null;
                    }
                }
                else
                {
                    itemstack1 = TileEntityHopper.putStackInInventoryAllSlots(iinventory, itemstack.copy().splitStack(1), enumfacing.getOpposite());

                    if (itemstack1 == null)
                    {
                        itemstack1 = itemstack.copy();

                        if (--itemstack1.stackSize <= 0)
                        {
                            itemstack1 = null;
                        }
                    }
                    else
                    {
                        itemstack1 = itemstack.copy();
                    }
                }

                tileentitydispenser.setInventorySlotContents(i, itemstack1);
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:58,代码来源:BlockDropper.java

示例13: dispense

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
/** Custom dispense routines */
@Override
protected void dispense(World worldIn, BlockPos pos) {
       BlockSourceImpl src = new BlockSourceImpl(worldIn, pos);
       TileEntityDispenser tile = (TileEntityDispenser)src.getBlockTileEntity();

       if (tile != null) {
           int i = tile.getDispenseSlot();

           if (i < 0) {
               worldIn.playEvent(1001, pos, 0);
           } else {
           	
           	// get the active item from its slot
               ItemStack itemstack = tile.getStackInSlot(i);
               IBehaviorDispenseItem defaultbehavior = this.getBehavior(itemstack);

               // make sure it's not regular dropper behavior
               if (defaultbehavior != IBehaviorDispenseItem.DEFAULT_BEHAVIOR) {
               	ItemStack itemstack1 = null;
               	
               	// replace vanilla behavior
               	if(defaultbehavior instanceof BehaviorProjectileDispense) {
               		itemstack1 = this.dispenseProjectile((BehaviorProjectileDispense)defaultbehavior, src, itemstack);
               	} else if(itemstack.getItem() instanceof ItemSplashPotion || itemstack.getItem() instanceof ItemLingeringPotion) {
               		itemstack1 = this.dispensePotion(src, itemstack);
               	} else if(itemstack.getItem() instanceof ItemFireball) {
               		itemstack1 = this.dispenseFireball(src, itemstack);
               	}
               	
               	// revert to vanilla on failure
               	if(itemstack1 == null) {
               		itemstack1 = defaultbehavior.dispense(src, itemstack);
               	}
               	
               	// update the inventory
                   tile.setInventorySlotContents(i, itemstack1.getCount() <= 0 ? ItemStack.EMPTY : itemstack1);
               }
           }
       }
   }
 
开发者ID:sblectric,项目名称:AdvancedCombat,代码行数:42,代码来源:BlockTrackingDispenser.java

示例14: dispenseStack

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
@Override
public ItemStack dispenseStack(IBlockSource blocksource, ItemStack itemstack)
{

	BlockPos blockpos = blocksource.getBlockPos();
	boolean canfire = false;
	normalDispense = false;

	// / double x = MathHelper.floor_double(blockpos.getX());
	// double y = MathHelper.floor_double(blockpos.getY());
	// double z = MathHelper.floor_double(blockpos.getZ());

	TileEntity tileentity = blocksource.getWorld().getTileEntity(blockpos);
	if (tileentity instanceof TileEntityDispenser)
	{
		TileEntityDispenser dispenser = ((TileEntityDispenser) tileentity);
		Item itemtocheck = null;
		if (itemstack.getItem() == Items.gunpowder)
		{
			itemtocheck = WeaponModule.items.ballista_bolt;
		}
		else if (itemstack.getItem() == WeaponModule.items.ballista_bolt)
		{
			itemtocheck = Items.gunpowder;
		}

		for (int i = 0; i < dispenser.getSizeInventory(); i++)
		{
			ItemStack itemstack1 = dispenser.getStackInSlot(i);
			if (itemstack1 != null && itemstack1.getItem() == itemtocheck)
			{
				dispenser.decrStackSize(i, 1);
				canfire = true;
				break;
			}
		}
	}

	if (!canfire)
	{
		normalDispense = true;
		return super.dispenseStack(blocksource, itemstack);
	}

	EnumFacing face = BlockDispenser.getFacing(blocksource.getBlockMetadata());
	double xvel = face.getFrontOffsetX() * 1.5D;
	double yvel = face.getFrontOffsetY() * 1.5D;
	double zvel = face.getFrontOffsetZ() * 1.5D;
	IPosition pos = BlockDispenser.getDispensePosition(blocksource);

	EntityBallistaBolt entityballistabolt = new EntityBallistaBolt(blocksource.getWorld(),
			pos.getX() + xvel, pos.getY() + yvel, pos.getZ() + zvel);
	entityballistabolt.setThrowableHeading(xvel, yvel + 0.15D, zvel, 2.0F, 2.0F);
	blocksource.getWorld().spawnEntityInWorld(entityballistabolt);
	itemstack.splitStack(1);
	return itemstack;
}
 
开发者ID:Archiving,项目名称:ARKCraft-Code,代码行数:58,代码来源:DispenseBallistaBolt.java

示例15: breakBlock

import net.minecraft.tileentity.TileEntityDispenser; //导入方法依赖的package包/类
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
{
    TileEntityDispenser var7 = (TileEntityDispenser)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);

    if (var7 != null)
    {
        for (int var8 = 0; var8 < var7.getSizeInventory(); ++var8)
        {
            ItemStack var9 = var7.getStackInSlot(var8);

            if (var9 != null)
            {
                float var10 = this.field_149942_b.nextFloat() * 0.8F + 0.1F;
                float var11 = this.field_149942_b.nextFloat() * 0.8F + 0.1F;
                float var12 = this.field_149942_b.nextFloat() * 0.8F + 0.1F;

                while (var9.stackSize > 0)
                {
                    int var13 = this.field_149942_b.nextInt(21) + 10;

                    if (var13 > var9.stackSize)
                    {
                        var13 = var9.stackSize;
                    }

                    var9.stackSize -= var13;
                    EntityItem var14 = new EntityItem(p_149749_1_, (double)((float)p_149749_2_ + var10), (double)((float)p_149749_3_ + var11), (double)((float)p_149749_4_ + var12), new ItemStack(var9.getItem(), var13, var9.getItemDamage()));

                    if (var9.hasTagCompound())
                    {
                        var14.getEntityItem().setTagCompound((NBTTagCompound)var9.getTagCompound().copy());
                    }

                    float var15 = 0.05F;
                    var14.motionX = (double)((float)this.field_149942_b.nextGaussian() * var15);
                    var14.motionY = (double)((float)this.field_149942_b.nextGaussian() * var15 + 0.2F);
                    var14.motionZ = (double)((float)this.field_149942_b.nextGaussian() * var15);
                    p_149749_1_.spawnEntityInWorld(var14);
                }
            }
        }

        p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
    }

    super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:48,代码来源:BlockDispenser.java


注:本文中的net.minecraft.tileentity.TileEntityDispenser.getStackInSlot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。