Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.getCommandSenderName());
- }
- 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;
- float yaw = this.rotationYaw;
- float pitch = this.rotationYaw;
- if(this == Minecraft.getMinecraft().thePlayer) {
- yaw = PlayerHandler.yaw;
- pitch = PlayerHandler.pitch;
- }
- entityitem.motionX = (double) (-MathHelper.sin(yaw / 180.0F * (float) Math.PI) * MathHelper.cos(pitch / 180.0F * (float) Math.PI) * f2);
- entityitem.motionZ = (double) (MathHelper.cos(yaw / 180.0F * (float) Math.PI) * MathHelper.cos(pitch / 180.0F * (float) Math.PI) * f2);
- entityitem.motionY = (double) (-MathHelper.sin(pitch / 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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement