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


Java EntityItem.setDefaultPickupDelay方法代码示例

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


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

示例1: dropValuables

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
private void dropValuables(World world, EntityPlayer player)
{
	while (this.getUpkeepStored() > 0)
	{
		int amount = Main.getMaxPaymentOrderAmount();	// Defaulting to the max

		if (this.getUpkeepStored() < Main.getMaxPaymentOrderAmount()) { amount = this.getUpkeepStored(); }	// Not enough left to go over bounds, which is just fine.

		ItemStack stack = new ItemStack(Main.getPaymentOrder(), 1, amount);

		EntityItem entityitem = new EntityItem(world, player.posX, player.posY + 1.0d, player.posZ, stack);
		entityitem.setDefaultPickupDelay();

		Main.console("[TERRITORIAL DEALINGS] Dropping all valuables at position of " + player.getName() + ". Current amount: " + amount + ". Leftover: " + this.getUpkeepStored());

		// And dropping it
		world.spawnEntityInWorld(entityitem);

		this.upkeepStored -= amount;
	}

	// Done, there should now be nothing left in this faction's vault.
}
 
开发者ID:Domochevsky,项目名称:minecraft-territorialdealings,代码行数:24,代码来源:_Territory.java

示例2: breakBlock

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
    if (world.getTileEntity(pos) instanceof BlackHoleTankTile) {
        BlackHoleTankTile tile = (BlackHoleTankTile) world.getTileEntity(pos);
        ItemStack stack = new ItemStack(Item.getItemFromBlock(this), 1);
        if (tile.getAmount() > 0) {
            if (!stack.hasTagCompound()) stack.setTagCompound(new NBTTagCompound());
            if (tile.getTank().getFluid() != null) {
                stack.setTagCompound(tile.getTank().getFluid().writeToNBT(new NBTTagCompound()));
            }
        }
        float f = 0.7F;
        float d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5F;
        float d1 = world.rand.nextFloat() * f + (1.0F - f) * 0.5F;
        float d2 = world.rand.nextFloat() * f + (1.0F - f) * 0.5F;
        EntityItem entityitem = new EntityItem(world, pos.getX() + d0, pos.getY() + d1, pos.getZ() + d2, stack);
        entityitem.setDefaultPickupDelay();
        if (stack.hasTagCompound()) {
            entityitem.getItem().setTagCompound(stack.getTagCompound().copy());
        }
        world.spawnEntity(entityitem);
    }
    super.breakBlock(world, pos, state);
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:25,代码来源:BlackHoleTankBlock.java

示例3: breakBlock

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
    if (world.getTileEntity(pos) instanceof BlackHoleUnitTile) {
        BlackHoleUnitTile tile = (BlackHoleUnitTile) world.getTileEntity(pos);
        ItemStack stack = new ItemStack(Item.getItemFromBlock(this), 1);
        if (tile.getAmount() > 0) {
            if (!stack.hasTagCompound()) stack.setTagCompound(new NBTTagCompound());
            stack.getTagCompound().setInteger(BlackHoleUnitTile.NBT_AMOUNT, tile.getAmount());
            stack.getTagCompound().setString(BlackHoleUnitTile.NBT_ITEMSTACK, tile.getItemStack().getItem().getRegistryName().toString());
            stack.getTagCompound().setInteger(BlackHoleUnitTile.NBT_META, tile.getItemStack().getMetadata());
            if (tile.getItemStack().hasTagCompound())
                stack.getTagCompound().setTag(BlackHoleUnitTile.NBT_ITEM_NBT, tile.getItemStack().getTagCompound());
        }
        float f = 0.7F;
        float d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5F;
        float d1 = world.rand.nextFloat() * f + (1.0F - f) * 0.5F;
        float d2 = world.rand.nextFloat() * f + (1.0F - f) * 0.5F;
        EntityItem entityitem = new EntityItem(world, pos.getX() + d0, pos.getY() + d1, pos.getZ() + d2, stack);
        entityitem.setDefaultPickupDelay();
        if (stack.hasTagCompound()) {
            entityitem.getItem().setTagCompound(stack.getTagCompound().copy());
        }
        world.spawnEntity(entityitem);
    }
    world.removeTileEntity(pos);
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:27,代码来源:BlackHoleUnitBlock.java

示例4: spawnAsEntity

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
/**
 * Spawns the given ItemStack as an EntityItem into the World at the given position
 */
public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack)
{
    if (!worldIn.isRemote && worldIn.getGameRules().getBoolean("doTileDrops") && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe
    {
        if (captureDrops.get())
        {
            capturedDrops.get().add(stack);
            return;
        }
        float f = 0.5F;
        double d0 = (double)(worldIn.rand.nextFloat() * 0.5F) + 0.25D;
        double d1 = (double)(worldIn.rand.nextFloat() * 0.5F) + 0.25D;
        double d2 = (double)(worldIn.rand.nextFloat() * 0.5F) + 0.25D;
        EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack);
        entityitem.setDefaultPickupDelay();
        worldIn.spawnEntityInWorld(entityitem);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:Block.java

示例5: entityDropItem

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
@Nullable

    /**
     * Drops an item at the position of the entity.
     */
    public EntityItem entityDropItem(ItemStack stack, float offsetY)
    {
        if (stack.func_190926_b())
        {
            return null;
        }
        else
        {
            EntityItem entityitem = new EntityItem(this.world, this.posX, this.posY + (double)offsetY, this.posZ, stack);
            entityitem.setDefaultPickupDelay();
            this.world.spawnEntityInWorld(entityitem);
            return entityitem;
        }
    }
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:Entity.java

示例6: entityDropItem

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
/**
 * Drops an item at the position of the entity.
 */
public EntityItem entityDropItem(ItemStack itemStackIn, float offsetY)
{
    if (itemStackIn.stackSize != 0 && itemStackIn.getItem() != null)
    {
        EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, itemStackIn);
        entityitem.setDefaultPickupDelay();
        this.worldObj.spawnEntityInWorld(entityitem);
        return entityitem;
    }
    else
    {
        return null;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:18,代码来源:Entity.java

示例7: spawnAsEntity

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
/**
 * Spawns the given ItemStack as an EntityItem into the World at the given position
 */
public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack)
{
    if (!worldIn.isRemote && worldIn.getGameRules().getBoolean("doTileDrops"))
    {
        float f = 0.5F;
        double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack);
        entityitem.setDefaultPickupDelay();
        worldIn.spawnEntityInWorld(entityitem);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:17,代码来源:Block.java

示例8: dropRecord

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
private void dropRecord(World worldIn, BlockPos pos, IBlockState state)
{
    if (!worldIn.isRemote)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof BlockJukebox.TileEntityJukebox)
        {
            BlockJukebox.TileEntityJukebox blockjukebox$tileentityjukebox = (BlockJukebox.TileEntityJukebox)tileentity;
            ItemStack itemstack = blockjukebox$tileentityjukebox.getRecord();

            if (itemstack != null)
            {
                worldIn.playAuxSFX(1005, pos, 0);
                worldIn.playRecord(pos, (String)null);
                blockjukebox$tileentityjukebox.setRecord((ItemStack)null);
                float f = 0.7F;
                double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
                double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.2D + 0.6D;
                double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
                ItemStack itemstack1 = itemstack.copy();
                EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, itemstack1);
                entityitem.setDefaultPickupDelay();
                worldIn.spawnEntityInWorld(entityitem);
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:29,代码来源:BlockJukebox.java

示例9: entityDropItem

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
/**
 * Drops an item at the position of the entity.
 */
public EntityItem entityDropItem(ItemStack stack, float offsetY)
{
    EntityItem entityitem = new EntityItem(this.worldObj, this.posX + (double)((float)this.facingDirection.getFrontOffsetX() * 0.15F), this.posY + (double)offsetY, this.posZ + (double)((float)this.facingDirection.getFrontOffsetZ() * 0.15F), stack);
    entityitem.setDefaultPickupDelay();
    this.worldObj.spawnEntityInWorld(entityitem);
    return entityitem;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:11,代码来源:EntityHanging.java

示例10: placeItem

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
/** Spawn a single item at the specified position.
 * @param item the actual item to be spawned.
 * @param pos the position at which to spawn it.
 * @param world the world in which to spawn the item.
 */
public void placeItem(ItemStack stack, BlockPos pos, World world, boolean centreItem)
{
    EntityItem entityitem = createItem(stack, (double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), world, centreItem);
    // Set the motions to zero to prevent random movement.
    entityitem.motionX = 0;
    entityitem.motionY = 0;
    entityitem.motionZ = 0;
    entityitem.setDefaultPickupDelay();
    world.spawnEntityInWorld(entityitem);
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:16,代码来源:BlockDrawingHelper.java

示例11: entityDropItem

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
/**
 * Drops an item at the position of the entity.
 */
public EntityItem entityDropItem(ItemStack stack, float offsetY)
{
    EntityItem entityitem = new EntityItem(this.world, this.posX + (double)((float)this.facingDirection.getFrontOffsetX() * 0.15F), this.posY + (double)offsetY, this.posZ + (double)((float)this.facingDirection.getFrontOffsetZ() * 0.15F), stack);
    entityitem.setDefaultPickupDelay();
    this.world.spawnEntityInWorld(entityitem);
    return entityitem;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:11,代码来源:EntityHanging.java

示例12: spawnAsEntity

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
/**
 * Spawns the given ItemStack as an EntityItem into the World at the given position
 */
public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack)
{
    if (!worldIn.isRemote && !stack.func_190926_b() && worldIn.getGameRules().getBoolean("doTileDrops"))
    {
        float f = 0.5F;
        double d0 = (double)(worldIn.rand.nextFloat() * 0.5F) + 0.25D;
        double d1 = (double)(worldIn.rand.nextFloat() * 0.5F) + 0.25D;
        double d2 = (double)(worldIn.rand.nextFloat() * 0.5F) + 0.25D;
        EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack);
        entityitem.setDefaultPickupDelay();
        worldIn.spawnEntityInWorld(entityitem);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:Block.java


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