本文整理匯總了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;
}
}
示例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;
}
}
示例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;
}
}