Cannot pick up arrow shot by dispenser in stairs / half slabs
The bug
When an arrow is shot by a dispenser facing a half slab or stairs, the arrow cannot be picked up as item by the player until the block in front of the dispenser is removed. This is different to the behaviour of all other blocks where the arrow can be picked up.
The reason
The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.
The reason for this is that the method net.minecraft.entity.projectile.EntityArrow.onHit(RayTraceResult) sets the position of the arrow to NaN, NaN, NaN because
- raytraceResultIn.hitVec.xCoord - this.posX = 0 (for y and z as well)
- MathHelper.sqrt_double(0, 0, 0) = 0 (= f2)
- this.motionX / (double)f2 * 0.05000000074505806D; = NaN
This causes the bounding box to be invalid as well. This cannot be seen in the NBT data because the method net.minecraft.world.World.updateEntityWithOptionalForce(Entity, boolean) sets the position to previous if it is either NaN or Infinite, however it does not correct the bounding box. Changing the onHit method which causes this first would probably be the better choice.
16w03a: Code deobfuscated by Mario Welzig
Linked Issues
Created Issue:
Cannot pick up arrow shot by dispenser in stairs / half slabs
Relates to:
The bug
When an arrow is shot by a dispenser facing a half slab or stairs, the arrow cannot be picked up as item by the player until the block in front of the dispenser is removed. This is different to the behaviour of all other blocks where the arrow can be picked up.
The NBT data of the arrows does not really show any reason for that:
Arrow in fence Arrow in stairs { Motion:[ -0.011044214409063668d, -2.4205819268896533E-4d, -0.4207500158548356d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-6136753389697420459L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -178.49637f, 6.7421746f ], life:111s, FallDistance:0.0f, inTile:"minecraft:fence", UUIDMost:6661502726318211985L, inData:0b, Pos:[ -819.5098528532272d, 56.544390455192314d, 491.4246371178569d ], zTile:491, Fire:0s, yTile:56 }{ Motion:[ 0.0d, -0.05000000074505806d, 0.0d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-7428158754473304535L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -142.86395f, 4.8334227f ], life:75s, FallDistance:0.0f, inTile:"minecraft:oak_stairs", UUIDMost:-904453678528705982L, inData:1b, Pos:[ -819.5d, 56.5d, 491.8d ], zTile:491, Fire:0s, yTile:56 }
Relates to:
The bug
When an arrow is shot by a dispenser facing a half slab or stairs, the arrow cannot be picked up as item by the player until the block in front of the dispenser is removed. This is different to the behaviour of all other blocks where the arrow can be picked up.
The NBT data of the arrows does not really show any reason for that:
Arrow in fence Arrow in stairs { Motion:[ -0.011044214409063668d, -2.4205819268896533E-4d, -0.4207500158548356d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-6136753389697420459L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -178.49637f, 6.7421746f ], life:111s, FallDistance:0.0f, inTile:"minecraft:fence", UUIDMost:6661502726318211985L, inData:0b, Pos:[ -819.5098528532272d, 56.544390455192314d, 491.4246371178569d ], zTile:491, Fire:0s, yTile:56 } { Motion:[ 0.0d, -0.05000000074505806d, 0.0d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-7428158754473304535L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -142.86395f, 4.8334227f ], life:75s, FallDistance:0.0f, inTile:"minecraft:oak_stairs", UUIDMost:-904453678528705982L, inData:1b, Pos:[ -819.5d, 56.5d, 491.8d ], zTile:491, Fire:0s, yTile:56 }
relates to
Alright, found the problem:
The OnGround tag of the stair-arrow is set to 0, which prevents the arrow from being picked up.
The bug
When an arrow is shot by a dispenser facing a half slab or stairs, the arrow cannot be picked up as item by the player until the block in front of the dispenser is removed. This is different to the behaviour of all other blocks where the arrow can be picked up.
The NBT data of the arrows does not really show any reason for that:
Arrow in fence Arrow in stairs { Motion:[ -0.011044214409063668d, -2.4205819268896533E-4d, -0.4207500158548356d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-6136753389697420459L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -178.49637f, 6.7421746f ], life:111s, FallDistance:0.0f, inTile:"minecraft:fence", UUIDMost:6661502726318211985L, inData:0b, Pos:[ -819.5098528532272d, 56.544390455192314d, 491.4246371178569d ], zTile:491, Fire:0s, yTile:56 } { Motion:[ 0.0d, -0.05000000074505806d, 0.0d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-7428158754473304535L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -142.86395f, 4.8334227f ], life:75s, FallDistance:0.0f, inTile:"minecraft:oak_stairs", UUIDMost:-904453678528705982L, inData:1b, Pos:[ -819.5d, 56.5d, 491.8d ], zTile:491, Fire:0s, yTile:56 }
The bug
When an arrow is shot by a dispenser facing a half slab or stairs, the arrow cannot be picked up as item by the player until the block in front of the dispenser is removed. This is different to the behaviour of all other blocks where the arrow can be picked up.
The NBT data of the arrows does not really show any reason for that:
Arrow in fence Arrow in stairs { Motion:[ -0.011044214409063668d, -2.4205819268896533E-4d, -0.4207500158548356d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-6136753389697420459L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -178.49637f, 6.7421746f ], life:111s, FallDistance:0.0f, inTile:"minecraft:fence", UUIDMost:6661502726318211985L, inData:0b, Pos:[ -819.5098528532272d, 56.544390455192314d, 491.4246371178569d ], zTile:491, Fire:0s, yTile:56 } { Motion:[ 0.0d, -0.05000000074505806d, 0.0d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-7428158754473304535L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -142.86395f, 4.8334227f ], life:75s, FallDistance:0.0f, inTile:"minecraft:oak_stairs", UUIDMost:-904453678528705982L, inData:1b, Pos:[ -819.5d, 56.5d, 491.8d ], zTile:491, Fire:0s, yTile:56 }Code deobfuscated by [~Mario+Welzig]
The bug
When an arrow is shot by a dispenser facing a half slab or stairs, the arrow cannot be picked up as item by the player until the block in front of the dispenser is removed. This is different to the behaviour of all other blocks where the arrow can be picked up.
The NBT data of the arrows does not really show any reason for that:
Arrow in fence Arrow in stairs { Motion:[ -0.011044214409063668d, -2.4205819268896533E-4d, -0.4207500158548356d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-6136753389697420459L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -178.49637f, 6.7421746f ], life:111s, FallDistance:0.0f, inTile:"minecraft:fence", UUIDMost:6661502726318211985L, inData:0b, Pos:[ -819.5098528532272d, 56.544390455192314d, 491.4246371178569d ], zTile:491, Fire:0s, yTile:56 } { Motion:[ 0.0d, -0.05000000074505806d, 0.0d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-7428158754473304535L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -142.86395f, 4.8334227f ], life:75s, FallDistance:0.0f, inTile:"minecraft:oak_stairs", UUIDMost:-904453678528705982L, inData:1b, Pos:[ -819.5d, 56.5d, 491.8d ], zTile:491, Fire:0s, yTile:56 }16w03a: Code deobfuscated by [~Mario+Welzig]
The bug
When an arrow is shot by a dispenser facing a half slab or stairs, the arrow cannot be picked up as item by the player until the block in front of the dispenser is removed. This is different to the behaviour of all other blocks where the arrow can be picked up.
The NBT data of the arrows does not really show any reason for that:
Arrow in fence Arrow in stairs { Motion:[ -0.011044214409063668d, -2.4205819268896533E-4d, -0.4207500158548356d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-6136753389697420459L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -178.49637f, 6.7421746f ], life:111s, FallDistance:0.0f, inTile:"minecraft:fence", UUIDMost:6661502726318211985L, inData:0b, Pos:[ -819.5098528532272d, 56.544390455192314d, 491.4246371178569d ], zTile:491, Fire:0s, yTile:56 } { Motion:[ 0.0d, -0.05000000074505806d, 0.0d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-7428158754473304535L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -142.86395f, 4.8334227f ], life:75s, FallDistance:0.0f, inTile:"minecraft:oak_stairs", UUIDMost:-904453678528705982L, inData:1b, Pos:[ -819.5d, 56.5d, 491.8d ], zTile:491, Fire:0s, yTile:56 }16w03a: Code deobfuscated by [~Mario+Welzig]
The bug
When an arrow is shot by a dispenser facing a half slab or stairs, the arrow cannot be picked up as item by the player until the block in front of the dispenser is removed. This is different to the behaviour of all other blocks where the arrow can be picked up.
The NBT data of the arrows does not really show any reason for that:
Arrow in fence Arrow in stairs { Motion:[ -0.011044214409063668d, -2.4205819268896533E-4d, -0.4207500158548356d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-6136753389697420459L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -178.49637f, 6.7421746f ], life:111s, FallDistance:0.0f, inTile:"minecraft:fence", UUIDMost:6661502726318211985L, inData:0b, Pos:[ -819.5098528532272d, 56.544390455192314d, 491.4246371178569d ], zTile:491, Fire:0s, yTile:56 } { Motion:[ 0.0d, -0.05000000074505806d, 0.0d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-7428158754473304535L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -142.86395f, 4.8334227f ], life:75s, FallDistance:0.0f, inTile:"minecraft:oak_stairs", UUIDMost:-904453678528705982L, inData:1b, Pos:[ -819.5d, 56.5d, 491.8d ], zTile:491, Fire:0s, yTile:56 }16w03a: Code deobfuscated by Mario Welzig
The bug
When an arrow is shot by a dispenser facing a half slab or stairs, the arrow cannot be picked up as item by the player until the block in front of the dispenser is removed. This is different to the behaviour of all other blocks where the arrow can be picked up.
The
NBT data of the arrows does not really show any reason for that:
Arrow in fence Arrow in stairs { Motion:[ -0.011044214409063668d, -2.4205819268896533E-4d, -0.4207500158548356d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-6136753389697420459L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -178.49637f, 6.7421746f ], life:111s, FallDistance:0.0f, inTile:"minecraft:fence", UUIDMost:6661502726318211985L, inData:0b, Pos:[ -819.5098528532272d, 56.544390455192314d, 491.4246371178569d ], zTile:491, Fire:0s, yTile:56 } { Motion:[ 0.0d, -0.05000000074505806d, 0.0d ], damage:2.0d, shake:0b, xTile:-820, UUIDLeast:-7428158754473304535L, inGround:1b, pickup:1b, Invulnerable:0b, Air:300s, OnGround:0b, Dimension:0, PortalCooldown:0, Rotation:[ -142.86395f, 4.8334227f ], life:75s, FallDistance:0.0f, inTile:"minecraft:oak_stairs", UUIDMost:-904453678528705982L, inData:1b, Pos:[ -819.5d, 56.5d, 491.8d ], zTile:491, Fire:0s, yTile:56 }16w03a: Code deobfuscated by Mario Welzig
The bug
When an arrow is shot by a dispenser facing a half slab or stairs, the arrow cannot be picked up as item by the player until the block in front of the dispenser is removed. This is different to the behaviour of all other blocks where the arrow can be picked up.
The reason
The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.
The reason for this is that the method net.minecraft.entity.projectile.EntityArrow.onHit(RayTraceResult) sets the position of the arrow to NaN, NaN, NaN because
- raytraceResultIn.hitVec.xCoord - this.posX = 0 (for y and z as well)
- MathHelper.sqrt_double(0, 0, 0) = 0 (= f2)
- this.motionX / (double)f2 * 0.05000000074505806D; = NaN
This causes the bounding box to be invalid as well. This cannot be seen in the NBT data because the method net.minecraft.world.World.updateEntityWithOptionalForce(Entity, boolean) sets the position to previous if it is either NaN or Infinite, however it does not correct the bounding box. Changing the onHit method which causes this first would probably be the better choice.
16w03a: Code deobfuscated by Mario Welzig
Confirmed for 15w51b, after reentering the world the arrow can be picked up again, so there is indeed no problem with the NBT data.
Ok, that's weird... For some reason the player collision is only registered by the client but not by the integrated server, which is responsible for handling the pickup.
It's because OnGround is set to 0b.
@No Name1 Both arrows have their OnGround tag set to 0 but the inGround tag is the important one
They both have inGround set to 1b.
Yes, as I said: No problem with the NBT data.
As you can see, inGround and arrowShake (which maps to the NBT tag 'shake') do have the right values, however the first condition (!this.worldObj.isRemote) is never met.
The onCollideWithPlayer method should be executed twice per tick; Once by each the client and the integrated server.
!this.worldObj.isRemote is true if the current execution is caused by the server, so because it always fails we can conclude that the server doesn't register the collision.
Mario Welzig the code very likely changed due to
MC-3330Marcono1234 You may be right, I'm referencing the 1.8.8 source.
Here's the updated source (deobfuscated manually, so some names might ne inacurate):
Is this still an issue in the latest snapshot 16w44a? If so please update the affected versions.
This is an automated comment on any open or reopened issue with out-of-date affected versions.
Cannot confirm for 1.11.2. Please re-check if this is still an issue for you in 1.11.2
It's fixed in 18w50a.