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


Java EntityItem.setThrower方法代码示例

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


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

示例1: dropItem

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem)
{
    if (droppedItem == null)
    {
        return null;
    }
    else if (droppedItem.stackSize == 0)
    {
        return null;
    }
    else
    {
        double d0 = this.posY - 0.30000001192092896D + (double)this.getEyeHeight();
        EntityItem entityitem = new EntityItem(this.worldObj, this.posX, d0, this.posZ, droppedItem);
        entityitem.setPickupDelay(40);

        if (traceItem)
        {
            entityitem.setThrower(this.getName());
        }

        if (dropAround)
        {
            float f = this.rand.nextFloat() * 0.5F;
            float f1 = this.rand.nextFloat() * (float)Math.PI * 2.0F;
            entityitem.motionX = (double)(-MathHelper.sin(f1) * f);
            entityitem.motionZ = (double)(MathHelper.cos(f1) * f);
            entityitem.motionY = 0.20000000298023224D;
        }
        else
        {
            float f2 = 0.3F;
            entityitem.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f2);
            entityitem.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f2);
            entityitem.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI) * f2 + 0.1F);
            float f3 = this.rand.nextFloat() * (float)Math.PI * 2.0F;
            f2 = 0.02F * this.rand.nextFloat();
            entityitem.motionX += Math.cos((double)f3) * (double)f2;
            entityitem.motionY += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
            entityitem.motionZ += Math.sin((double)f3) * (double)f2;
        }

        this.joinEntityItemWithWorld(entityitem);

        if (traceItem)
        {
            this.triggerAchievement(StatList.dropStat);
        }

        return entityitem;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:53,代码来源:EntityPlayer.java

示例2: dropItem

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
@Nullable
public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem)
{
    if (droppedItem.func_190926_b())
    {
        return null;
    }
    else
    {
        double d0 = this.posY - 0.30000001192092896D + (double)this.getEyeHeight();
        EntityItem entityitem = new EntityItem(this.world, this.posX, d0, this.posZ, droppedItem);
        entityitem.setPickupDelay(40);

        if (traceItem)
        {
            entityitem.setThrower(this.getName());
        }

        if (dropAround)
        {
            float f = this.rand.nextFloat() * 0.5F;
            float f1 = this.rand.nextFloat() * ((float)Math.PI * 2F);
            entityitem.motionX = (double)(-MathHelper.sin(f1) * f);
            entityitem.motionZ = (double)(MathHelper.cos(f1) * f);
            entityitem.motionY = 0.20000000298023224D;
        }
        else
        {
            float f2 = 0.3F;
            entityitem.motionX = (double)(-MathHelper.sin(this.rotationYaw * 0.017453292F) * MathHelper.cos(this.rotationPitch * 0.017453292F) * f2);
            entityitem.motionZ = (double)(MathHelper.cos(this.rotationYaw * 0.017453292F) * MathHelper.cos(this.rotationPitch * 0.017453292F) * f2);
            entityitem.motionY = (double)(-MathHelper.sin(this.rotationPitch * 0.017453292F) * f2 + 0.1F);
            float f3 = this.rand.nextFloat() * ((float)Math.PI * 2F);
            f2 = 0.02F * this.rand.nextFloat();
            entityitem.motionX += Math.cos((double)f3) * (double)f2;
            entityitem.motionY += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
            entityitem.motionZ += Math.sin((double)f3) * (double)f2;
        }

        ItemStack itemstack = this.dropItemAndGetStack(entityitem);

        if (traceItem)
        {
            if (!itemstack.func_190926_b())
            {
                this.addStat(StatList.getDroppedObjectStats(itemstack.getItem()), droppedItem.func_190916_E());
            }

            this.addStat(StatList.DROP);
        }

        return entityitem;
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:55,代码来源:EntityPlayer.java

示例3: dropItem

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
@Nullable
public EntityItem dropItem(@Nullable ItemStack droppedItem, boolean dropAround, boolean traceItem)
{
    if (droppedItem == null)
    {
        return null;
    }
    else if (droppedItem.stackSize == 0)
    {
        return null;
    }
    else
    {
        double d0 = this.posY - 0.30000001192092896D + (double)this.getEyeHeight();
        EntityItem entityitem = new EntityItem(this.worldObj, this.posX, d0, this.posZ, droppedItem);
        entityitem.setPickupDelay(40);

        if (traceItem)
        {
            entityitem.setThrower(this.getName());
        }

        if (dropAround)
        {
            float f = this.rand.nextFloat() * 0.5F;
            float f1 = this.rand.nextFloat() * ((float)Math.PI * 2F);
            entityitem.motionX = (double)(-MathHelper.sin(f1) * f);
            entityitem.motionZ = (double)(MathHelper.cos(f1) * f);
            entityitem.motionY = 0.20000000298023224D;
        }
        else
        {
            float f2 = 0.3F;
            entityitem.motionX = (double)(-MathHelper.sin(this.rotationYaw * 0.017453292F) * MathHelper.cos(this.rotationPitch * 0.017453292F) * f2);
            entityitem.motionZ = (double)(MathHelper.cos(this.rotationYaw * 0.017453292F) * MathHelper.cos(this.rotationPitch * 0.017453292F) * f2);
            entityitem.motionY = (double)(-MathHelper.sin(this.rotationPitch * 0.017453292F) * f2 + 0.1F);
            float f3 = this.rand.nextFloat() * ((float)Math.PI * 2F);
            f2 = 0.02F * this.rand.nextFloat();
            entityitem.motionX += Math.cos((double)f3) * (double)f2;
            entityitem.motionY += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
            entityitem.motionZ += Math.sin((double)f3) * (double)f2;
        }

        ItemStack itemstack = this.dropItemAndGetStack(entityitem);

        if (traceItem)
        {
            if (itemstack != null)
            {
                this.addStat(StatList.getDroppedObjectStats(itemstack.getItem()), droppedItem.stackSize);
            }

            this.addStat(StatList.DROP);
        }

        return entityitem;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:59,代码来源:EntityPlayer.java


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