Arrows bouncing off creative players can only be seen by the player they bounce off
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground.
Steps to Reproduce:
(requres two players to test)
- Get two players to join into either an LAN, or multiplayer world
- Put Player 1 in creative mode
- Have Player 2 fire at Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Code Analysis / MCP-Reborn 1.20.2
This issue comes from inside the onHitEntity() method of AbstractArrow. Inside this method, there are numerous checks done to see if and when an arrow should be discarded, but the noteworthy one is the check done near the bottom of this method-- "this.getPierceLevel()". This check specifically sees what the arrow's piercing level is before discarding the arrow, but does not account for any other factors that should allow the arrow to remain visible to the player who fired it. This leads to the described behavior of the issue where when an arrow hits a player in creative mode, it is simply discarded for the local player.
Class net.minecraft.world.entity.projectile/AbstractArrow.java / Method onHitEntity(EntityHitResult entityHitResult)
. . . if (entity.hurt(damagesource, (float)i)) { if (flag) { return; } if (entity instanceof LivingEntity) { LivingEntity livingentity = (LivingEntity)entity; if (!this.level().isClientSide && this.getPierceLevel() <= 0) { livingentity.setArrowCount(livingentity.getArrowCount() + 1); } if (this.knockback > 0) { double d0 = Math.max(0.0D, 1.0D - livingentity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); Vec3 vec3 = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double)this.knockback * 0.6D * d0); if (vec3.lengthSqr() > 0.0D) { livingentity.push(vec3.x, 0.1D, vec3.z); } } if (!this.level().isClientSide && entity1 instanceof LivingEntity) { EnchantmentHelper.doPostHurtEffects(livingentity, entity1); EnchantmentHelper.doPostDamageEffects((LivingEntity)entity1, livingentity); } this.doPostHurtEffects(livingentity); if (entity1 != null && livingentity != entity1 && livingentity instanceof Player && entity1 instanceof ServerPlayer && !this.isSilent()) { ((ServerPlayer)entity1).connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.ARROW_HIT_PLAYER, 0.0F)); } if (!entity.isAlive() && this.piercedAndKilledEntities != null) { this.piercedAndKilledEntities.add(livingentity); } if (!this.level().isClientSide && entity1 instanceof ServerPlayer) { ServerPlayer serverplayer = (ServerPlayer)entity1; if (this.piercedAndKilledEntities != null && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, this.piercedAndKilledEntities); } else if (!entity.isAlive() && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, Arrays.asList(entity)); } } } this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); Issue Start if (this.getPierceLevel() <= 0) { this.discard(); } Issue End } . . .
Code Fix
Note: this fix also accounts for other very similar issues such as MC-194723 and MC-101723. While this issue can be fixed on it's own, it is highly recommended to solve all the issues at once.
So, what's the solution? Well, first before the arrow is discarded, we also need to verify that the target that has been hit is not in creative mode. To do this, we first check and see if the instance of the hit entity is a ServerPlayer (this is very important, as simply using the "Player.java" class does not provide the expected results) and if that is true, we then check their gamemode and see if it is creative. (My solution is a bit of an "if" statement mess, but it showcases what checks need to be made)
This fix provides the following behavior:
2023-10-06_21-27-40.mp4
if (!entity.isInvulnerable()) {
if (entity instanceof ServerPlayer serverPlayer) {
if (!serverPlayer.isCreative()) {
if (!serverPlayer.isBlocking()) {
if (this.getPierceLevel() <= 0) {
this.discard();
}
}
}
}
}
Notes:
- The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
- This applies to arrows being fired from any source, not just bows.
- Even using F3 + B will not show the arrow.
Linked Issues
is duplicated by3
Created Issue:
Arrows bouncing off creative players can only be seen by the player they bounce off
Shoot a creative player and you won't see the arrow after it bounces off of them but you will hear the sound of it landing and will be able to pick it up. Get a player to shoot you while in creative and you'll be able to see the bounced arrow.
relates to
is duplicated by
Shoot a creative player and you won't see the arrow after it bounces off of them but you will hear the sound of it landing and will be able to pick it up. Get a player to shoot you while in creative and you'll be able to see the bounced arrow.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
requres two players to test
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Notes:
The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
Shoot a creative player and you won't see the arrow after it bounces off of them but you will hear the sound of it landing and will be able to pick it up. Get a player to shoot you while in creative and you'll be able to see the bounced arrow.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
requres two players to test
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
[^2023-08-23_18-56-07.mp4]
Notes:
The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
Shoot a creative player and you won't see the arrow after it bounces off of them but you will hear the sound of it landing and will be able to pick it up. Get a player to shoot you while in creative and you'll be able to see the bounced arrow.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
requres two players to test
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
[^2023-08-23_18-56-07.mp4]
Notes:
The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
Shoot a creative player and you won't see the arrow after it bounces off of them but you will hear the sound of it landing and will be able to pick it up. Get a player to shoot you while in creative and you'll be able to see the bounced arrow.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
requres two players to test
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Notes:
The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
Shoot a creative player and you won't see the arrow after it bounces off of them but you will hear the sound of it landing and will be able to pick it up. Get a player to shoot you while in creative and you'll be able to see the bounced arrow.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
requres two players to test
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Notes:
The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
Shoot a creative player and you won't see the arrow after it bounces off of them but you will hear the sound of it landing and will be able to pick it up. Get a player to shoot you while in creative and you'll be able to see the bounced arrow.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
requres two players to test
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Notes:
- The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
- This applies to both crossbows, and regular bows.
- This does not apply to tridents.
Shoot a creative player and you won't see the arrow after it bounces off of them but you will hear the sound of it landing and will be able to pick it up. Get a player to shoot you while in creative and you'll be able to see the bounced arrow.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
requres two players to test
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Notes:
- The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
- This applies to both crossbows, and regular bows.
- This does not apply to tridents.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
(requres two players to test)
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Notes:
- The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
- This applies to both crossbows, and regular bows.
- This does not apply to tridents.
relates to
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
(requres two players to test)
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Notes:
- The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
- Th
is applies to both crossbows, and regular bows.- This
does notapplytotridents.The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
(requres two players to test)
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Code Analysis / MCP-Reborn 1.20.2
This issue comes from inside the onHitEntity() method of AbstractArrow. Inside this method, there are numerous checks done to see if and when an arrow should be discarded, but the noteworthy one is the check done near the bottom of this method-- "this.getPierceLevel()". This check specifically sees what the arrow's piercing level is before discarding the arrow, but does not account for any other factors that should allow the arrow to remain visible to the player who fired it. This leads to the described behavior of the issue where when an arrow hits a player in creative mode, it is simply discarded for the local player.
Class net.minecraft.world.entity.projectile/AbstractArrow.java / Method onHitEntity(EntityHitResult entityHitResult). . . if (entity.hurt(damagesource, (float)i)) { if (flag) { return; } if (entity instanceof LivingEntity) { LivingEntity livingentity = (LivingEntity)entity; if (!this.level().isClientSide && this.getPierceLevel() <= 0) { livingentity.setArrowCount(livingentity.getArrowCount() + 1); } if (this.knockback > 0) { double d0 = Math.max(0.0D, 1.0D - livingentity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); Vec3 vec3 = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double)this.knockback * 0.6D * d0); if (vec3.lengthSqr() > 0.0D) { livingentity.push(vec3.x, 0.1D, vec3.z); } } if (!this.level().isClientSide && entity1 instanceof LivingEntity) { EnchantmentHelper.doPostHurtEffects(livingentity, entity1); EnchantmentHelper.doPostDamageEffects((LivingEntity)entity1, livingentity); } this.doPostHurtEffects(livingentity); if (entity1 != null && livingentity != entity1 && livingentity instanceof Player && entity1 instanceof ServerPlayer && !this.isSilent()) { ((ServerPlayer)entity1).connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.ARROW_HIT_PLAYER, 0.0F)); } if (!entity.isAlive() && this.piercedAndKilledEntities != null) { this.piercedAndKilledEntities.add(livingentity); } if (!this.level().isClientSide && entity1 instanceof ServerPlayer) { ServerPlayer serverplayer = (ServerPlayer)entity1; if (this.piercedAndKilledEntities != null && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, this.piercedAndKilledEntities); } else if (!entity.isAlive() && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, Arrays.asList(entity)); } } } this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); Issue Start if (this.getPierceLevel() <= 0) { this.discard(); } Issue End } . . .Code Fix
Note: this fix also accounts for other very similar issues such as MC-194723 and MC-101723.
So, what's the solution? Well, first before the arrow is discarded, we also need to verify that the target that has been hit is not in creative mode. To do this, we first check and see if the instance of the hit entity is a ServerPlayer (this is very important, as simply using the "Player.java" class does not provide the expected results) and if that is true, we then check their gamemode and see if it is creative.This fix provides the following behavior:
if (this.getPierceLevel() <= 0) { Fix Start if (entity instanceof ServerPlayer serverPlayer) { if ((!serverPlayer.isBlocking() || !serverPlayer.isCreative()) || entity.isInvulnerable()) { this.discard(); } } Fix End }Notes:
- The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
- This applies to both crossbows, and regular bows.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
(requres two players to test)
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Code Analysis / MCP-Reborn 1.20.2
This issue comes from inside the onHitEntity() method of AbstractArrow. Inside this method, there are numerous checks done to see if and when an arrow should be discarded, but the noteworthy one is the check done near the bottom of this method-- "this.getPierceLevel()". This check specifically sees what the arrow's piercing level is before discarding the arrow, but does not account for any other factors that should allow the arrow to remain visible to the player who fired it. This leads to the described behavior of the issue where when an arrow hits a player in creative mode, it is simply discarded for the local player.
Class net.minecraft.world.entity.projectile/AbstractArrow.java / Method onHitEntity(EntityHitResult entityHitResult). . . if (entity.hurt(damagesource, (float)i)) { if (flag) { return; } if (entity instanceof LivingEntity) { LivingEntity livingentity = (LivingEntity)entity; if (!this.level().isClientSide && this.getPierceLevel() <= 0) { livingentity.setArrowCount(livingentity.getArrowCount() + 1); } if (this.knockback > 0) { double d0 = Math.max(0.0D, 1.0D - livingentity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); Vec3 vec3 = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double)this.knockback * 0.6D * d0); if (vec3.lengthSqr() > 0.0D) { livingentity.push(vec3.x, 0.1D, vec3.z); } } if (!this.level().isClientSide && entity1 instanceof LivingEntity) { EnchantmentHelper.doPostHurtEffects(livingentity, entity1); EnchantmentHelper.doPostDamageEffects((LivingEntity)entity1, livingentity); } this.doPostHurtEffects(livingentity); if (entity1 != null && livingentity != entity1 && livingentity instanceof Player && entity1 instanceof ServerPlayer && !this.isSilent()) { ((ServerPlayer)entity1).connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.ARROW_HIT_PLAYER, 0.0F)); } if (!entity.isAlive() && this.piercedAndKilledEntities != null) { this.piercedAndKilledEntities.add(livingentity); } if (!this.level().isClientSide && entity1 instanceof ServerPlayer) { ServerPlayer serverplayer = (ServerPlayer)entity1; if (this.piercedAndKilledEntities != null && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, this.piercedAndKilledEntities); } else if (!entity.isAlive() && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, Arrays.asList(entity)); } } } this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); Issue Start if (this.getPierceLevel() <= 0) { this.discard(); } Issue End } . . .Code Fix
Note: this fix also accounts for other very similar issues such as MC-194723 and MC-101723.
So, what's the solution? Well, first before the arrow is discarded, we also need to verify that the target that has been hit is not in creative mode. To do this, we first check and see if the instance of the hit entity is a ServerPlayer (this is very important, as simply using the "Player.java" class does not provide the expected results) and if that is true, we then check their gamemode and see if it is creative.This fix provides the following behavior:
if (this.getPierceLevel() <= 0) { Fix Start if (entity instanceof ServerPlayer serverPlayer) { if ((!serverPlayer.isBlocking() || !serverPlayer.isCreative()) || entity.isInvulnerable()) { this.discard(); } } Fix End }Notes:
- The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
- This applies to both crossbows, and regular bows.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
(requres two players to test)
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Code Analysis / MCP-Reborn 1.20.2
This issue comes from inside the onHitEntity() method of AbstractArrow. Inside this method, there are numerous checks done to see if and when an arrow should be discarded, but the noteworthy one is the check done near the bottom of this method-- "this.getPierceLevel()". This check specifically sees what the arrow's piercing level is before discarding the arrow, but does not account for any other factors that should allow the arrow to remain visible to the player who fired it. This leads to the described behavior of the issue where when an arrow hits a player in creative mode, it is simply discarded for the local player.
Class net.minecraft.world.entity.projectile/AbstractArrow.java / Method onHitEntity(EntityHitResult entityHitResult). . . if (entity.hurt(damagesource, (float)i)) { if (flag) { return; } if (entity instanceof LivingEntity) { LivingEntity livingentity = (LivingEntity)entity; if (!this.level().isClientSide && this.getPierceLevel() <= 0) { livingentity.setArrowCount(livingentity.getArrowCount() + 1); } if (this.knockback > 0) { double d0 = Math.max(0.0D, 1.0D - livingentity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); Vec3 vec3 = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double)this.knockback * 0.6D * d0); if (vec3.lengthSqr() > 0.0D) { livingentity.push(vec3.x, 0.1D, vec3.z); } } if (!this.level().isClientSide && entity1 instanceof LivingEntity) { EnchantmentHelper.doPostHurtEffects(livingentity, entity1); EnchantmentHelper.doPostDamageEffects((LivingEntity)entity1, livingentity); } this.doPostHurtEffects(livingentity); if (entity1 != null && livingentity != entity1 && livingentity instanceof Player && entity1 instanceof ServerPlayer && !this.isSilent()) { ((ServerPlayer)entity1).connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.ARROW_HIT_PLAYER, 0.0F)); } if (!entity.isAlive() && this.piercedAndKilledEntities != null) { this.piercedAndKilledEntities.add(livingentity); } if (!this.level().isClientSide && entity1 instanceof ServerPlayer) { ServerPlayer serverplayer = (ServerPlayer)entity1; if (this.piercedAndKilledEntities != null && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, this.piercedAndKilledEntities); } else if (!entity.isAlive() && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, Arrays.asList(entity)); } } } this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); Issue Start if (this.getPierceLevel() <= 0) { this.discard(); } Issue End } . . .Code Fix
Note: this fix also accounts for other very similar issues such as MC-194723 and MC-101723.
So, what's the solution? Well, first before the arrow is discarded, we also need to verify that the target that has been hit is not in creative mode. To do this, we first check and see if the instance of the hit entity is a ServerPlayer (this is very important, as simply using the "Player.java" class does not provide the expected results) and if that is true, we then check their gamemode and see if it is creative.This fix provides the following behavior:
2023-10-06_21-27-40.mp4![]()
if (this.getPierceLevel() <= 0) { Fix Start if (entity instanceof ServerPlayer serverPlayer) { if ((!serverPlayer.isBlocking() || !serverPlayer.isCreative()) || entity.isInvulnerable()) { this.discard(); } } Fix End }Notes:
- The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
- This applies to both crossbows, and regular bows.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
(requres two players to test)
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Code Analysis / MCP-Reborn 1.20.2
This issue comes from inside the onHitEntity() method of AbstractArrow. Inside this method, there are numerous checks done to see if and when an arrow should be discarded, but the noteworthy one is the check done near the bottom of this method-- "this.getPierceLevel()". This check specifically sees what the arrow's piercing level is before discarding the arrow, but does not account for any other factors that should allow the arrow to remain visible to the player who fired it. This leads to the described behavior of the issue where when an arrow hits a player in creative mode, it is simply discarded for the local player.
Class net.minecraft.world.entity.projectile/AbstractArrow.java / Method onHitEntity(EntityHitResult entityHitResult). . . if (entity.hurt(damagesource, (float)i)) { if (flag) { return; } if (entity instanceof LivingEntity) { LivingEntity livingentity = (LivingEntity)entity; if (!this.level().isClientSide && this.getPierceLevel() <= 0) { livingentity.setArrowCount(livingentity.getArrowCount() + 1); } if (this.knockback > 0) { double d0 = Math.max(0.0D, 1.0D - livingentity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); Vec3 vec3 = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double)this.knockback * 0.6D * d0); if (vec3.lengthSqr() > 0.0D) { livingentity.push(vec3.x, 0.1D, vec3.z); } } if (!this.level().isClientSide && entity1 instanceof LivingEntity) { EnchantmentHelper.doPostHurtEffects(livingentity, entity1); EnchantmentHelper.doPostDamageEffects((LivingEntity)entity1, livingentity); } this.doPostHurtEffects(livingentity); if (entity1 != null && livingentity != entity1 && livingentity instanceof Player && entity1 instanceof ServerPlayer && !this.isSilent()) { ((ServerPlayer)entity1).connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.ARROW_HIT_PLAYER, 0.0F)); } if (!entity.isAlive() && this.piercedAndKilledEntities != null) { this.piercedAndKilledEntities.add(livingentity); } if (!this.level().isClientSide && entity1 instanceof ServerPlayer) { ServerPlayer serverplayer = (ServerPlayer)entity1; if (this.piercedAndKilledEntities != null && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, this.piercedAndKilledEntities); } else if (!entity.isAlive() && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, Arrays.asList(entity)); } } } this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); Issue Start if (this.getPierceLevel() <= 0) { this.discard(); } Issue End } . . .Code Fix
Note: this fix also accounts for other very similar issues such as MC-194723 and MC-101723.
So, what's the solution? Well, first before the arrow is discarded, we also need to verify that the target that has been hit is not in creative mode. To do this, we first check and see if the instance of the hit entity is a ServerPlayer (this is very important, as simply using the "Player.java" class does not provide the expected results) and if that is true, we then check their gamemode and see if it is creative.This fix provides the following behavior:
2023-10-06_21-27-40.mp4![]()
if (this.getPierceLevel() <= 0) { Fix Start if (entity instanceof ServerPlayer serverPlayer) { if ((!serverPlayer.isBlocking() || !serverPlayer.isCreative()) || entity.isInvulnerable()) { this.discard(); } }Fix End }Notes:
- The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
- This applies to both crossbows, and regular bows.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
(requres two players to test)
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Code Analysis / MCP-Reborn 1.20.2
This issue comes from inside the onHitEntity() method of AbstractArrow. Inside this method, there are numerous checks done to see if and when an arrow should be discarded, but the noteworthy one is the check done near the bottom of this method-- "this.getPierceLevel()". This check specifically sees what the arrow's piercing level is before discarding the arrow, but does not account for any other factors that should allow the arrow to remain visible to the player who fired it. This leads to the described behavior of the issue where when an arrow hits a player in creative mode, it is simply discarded for the local player.
Class net.minecraft.world.entity.projectile/AbstractArrow.java / Method onHitEntity(EntityHitResult entityHitResult). . . if (entity.hurt(damagesource, (float)i)) { if (flag) { return; } if (entity instanceof LivingEntity) { LivingEntity livingentity = (LivingEntity)entity; if (!this.level().isClientSide && this.getPierceLevel() <= 0) { livingentity.setArrowCount(livingentity.getArrowCount() + 1); } if (this.knockback > 0) { double d0 = Math.max(0.0D, 1.0D - livingentity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); Vec3 vec3 = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double)this.knockback * 0.6D * d0); if (vec3.lengthSqr() > 0.0D) { livingentity.push(vec3.x, 0.1D, vec3.z); } } if (!this.level().isClientSide && entity1 instanceof LivingEntity) { EnchantmentHelper.doPostHurtEffects(livingentity, entity1); EnchantmentHelper.doPostDamageEffects((LivingEntity)entity1, livingentity); } this.doPostHurtEffects(livingentity); if (entity1 != null && livingentity != entity1 && livingentity instanceof Player && entity1 instanceof ServerPlayer && !this.isSilent()) { ((ServerPlayer)entity1).connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.ARROW_HIT_PLAYER, 0.0F)); } if (!entity.isAlive() && this.piercedAndKilledEntities != null) { this.piercedAndKilledEntities.add(livingentity); } if (!this.level().isClientSide && entity1 instanceof ServerPlayer) { ServerPlayer serverplayer = (ServerPlayer)entity1; if (this.piercedAndKilledEntities != null && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, this.piercedAndKilledEntities); } else if (!entity.isAlive() && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, Arrays.asList(entity)); } } } this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); Issue Start if (this.getPierceLevel() <= 0) { this.discard(); } Issue End } . . .Code Fix
Note: this fix also accounts for other very similar issues such as MC-194723 and MC-101723.
So, what's the solution? Well, first before the arrow is discarded, we also need to verify that the target that has been hit is not in creative mode. To do this, we first check and see if the instance of the hit entity is a ServerPlayer (this is very important, as simply using the "Player.java" class does not provide the expected results) and if that is true, we then check their gamemode and see if it is creative.This fix provides the following behavior:
2023-10-06_21-27-40.mp4![]()
if (this.getPierceLevel() <= 0) { Fix Start if (entity instanceof ServerPlayer serverPlayer) { if ((!serverPlayer.isBlocking() || !serverPlayer.isCreative()) || entity.isInvulnerable()) { this.discard(); } } else { this.discard(); } Fix End }Notes:
- The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
- This applies to both crossbows, and regular bows.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
(requres two players to test)
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Code Analysis / MCP-Reborn 1.20.2
This issue comes from inside the onHitEntity() method of AbstractArrow. Inside this method, there are numerous checks done to see if and when an arrow should be discarded, but the noteworthy one is the check done near the bottom of this method-- "this.getPierceLevel()". This check specifically sees what the arrow's piercing level is before discarding the arrow, but does not account for any other factors that should allow the arrow to remain visible to the player who fired it. This leads to the described behavior of the issue where when an arrow hits a player in creative mode, it is simply discarded for the local player.
Class net.minecraft.world.entity.projectile/AbstractArrow.java / Method onHitEntity(EntityHitResult entityHitResult). . . if (entity.hurt(damagesource, (float)i)) { if (flag) { return; } if (entity instanceof LivingEntity) { LivingEntity livingentity = (LivingEntity)entity; if (!this.level().isClientSide && this.getPierceLevel() <= 0) { livingentity.setArrowCount(livingentity.getArrowCount() + 1); } if (this.knockback > 0) { double d0 = Math.max(0.0D, 1.0D - livingentity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); Vec3 vec3 = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double)this.knockback * 0.6D * d0); if (vec3.lengthSqr() > 0.0D) { livingentity.push(vec3.x, 0.1D, vec3.z); } } if (!this.level().isClientSide && entity1 instanceof LivingEntity) { EnchantmentHelper.doPostHurtEffects(livingentity, entity1); EnchantmentHelper.doPostDamageEffects((LivingEntity)entity1, livingentity); } this.doPostHurtEffects(livingentity); if (entity1 != null && livingentity != entity1 && livingentity instanceof Player && entity1 instanceof ServerPlayer && !this.isSilent()) { ((ServerPlayer)entity1).connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.ARROW_HIT_PLAYER, 0.0F)); } if (!entity.isAlive() && this.piercedAndKilledEntities != null) { this.piercedAndKilledEntities.add(livingentity); } if (!this.level().isClientSide && entity1 instanceof ServerPlayer) { ServerPlayer serverplayer = (ServerPlayer)entity1; if (this.piercedAndKilledEntities != null && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, this.piercedAndKilledEntities); } else if (!entity.isAlive() && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, Arrays.asList(entity)); } } } this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); Issue Start if (this.getPierceLevel() <= 0) { this.discard(); } Issue End } . . .Code Fix
Note: this fix also accounts for other very similar issues such as MC-194723 and MC-101723.
So, what's the solution? Well, first before the arrow is discarded, we also need to verify that the target that has been hit is not in creative mode. To do this, we first check and see if the instance of the hit entity is a ServerPlayer (this is very important, as simply using the "Player.java" class does not provide the expected results) and if that is true, we then check their gamemode and see if it is creative.This fix provides the following behavior:
2023-10-06_21-27-40.mp4![]()
if (this.getPierceLevel() <= 0) { Fix Startif (entity instanceof ServerPlayer serverPlayer) { if ((!serverPlayer.isBlocking() || !serverPlayer.isCreative()) || entity.isInvulnerable()) {this.discard(); }}else{this.discard();} Fix End}Notes:
- The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
- This applies to both crossbows, and regular bows.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground. Even using F3 + B will not display the arrow entitie's hitbox.
Steps to Reproduce:
(requres two players to test)
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Code Analysis / MCP-Reborn 1.20.2
This issue comes from inside the onHitEntity() method of AbstractArrow. Inside this method, there are numerous checks done to see if and when an arrow should be discarded, but the noteworthy one is the check done near the bottom of this method-- "this.getPierceLevel()". This check specifically sees what the arrow's piercing level is before discarding the arrow, but does not account for any other factors that should allow the arrow to remain visible to the player who fired it. This leads to the described behavior of the issue where when an arrow hits a player in creative mode, it is simply discarded for the local player.
Class net.minecraft.world.entity.projectile/AbstractArrow.java / Method onHitEntity(EntityHitResult entityHitResult). . . if (entity.hurt(damagesource, (float)i)) { if (flag) { return; } if (entity instanceof LivingEntity) { LivingEntity livingentity = (LivingEntity)entity; if (!this.level().isClientSide && this.getPierceLevel() <= 0) { livingentity.setArrowCount(livingentity.getArrowCount() + 1); } if (this.knockback > 0) { double d0 = Math.max(0.0D, 1.0D - livingentity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); Vec3 vec3 = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double)this.knockback * 0.6D * d0); if (vec3.lengthSqr() > 0.0D) { livingentity.push(vec3.x, 0.1D, vec3.z); } } if (!this.level().isClientSide && entity1 instanceof LivingEntity) { EnchantmentHelper.doPostHurtEffects(livingentity, entity1); EnchantmentHelper.doPostDamageEffects((LivingEntity)entity1, livingentity); } this.doPostHurtEffects(livingentity); if (entity1 != null && livingentity != entity1 && livingentity instanceof Player && entity1 instanceof ServerPlayer && !this.isSilent()) { ((ServerPlayer)entity1).connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.ARROW_HIT_PLAYER, 0.0F)); } if (!entity.isAlive() && this.piercedAndKilledEntities != null) { this.piercedAndKilledEntities.add(livingentity); } if (!this.level().isClientSide && entity1 instanceof ServerPlayer) { ServerPlayer serverplayer = (ServerPlayer)entity1; if (this.piercedAndKilledEntities != null && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, this.piercedAndKilledEntities); } else if (!entity.isAlive() && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, Arrays.asList(entity)); } } } this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); Issue Start if (this.getPierceLevel() <= 0) { this.discard(); } Issue End } . . .Code Fix
Note: this fix also accounts for other very similar issues such as MC-194723 and MC-101723. While this issue can be fixed on it's own, it is highly recommended to solve all the issues at once.
So, what's the solution? Well, first before the arrow is discarded, we also need to verify that the target that has been hit is not in creative mode. To do this, we first check and see if the instance of the hit entity is a ServerPlayer (this is very important, as simply using the "Player.java" class does not provide the expected results) and if that is true, we then check their gamemode and see if it is creative. (My solution is a bit of an "if" statement mess, but it showcases what checks need to be made)This fix provides the following behavior:
2023-10-06_21-27-40.mp4![]()
if (!entity.isInvulnerable()) { if (entity instanceof ServerPlayer serverPlayer) { if (!serverPlayer.isCreative()) { if (!serverPlayer.isBlocking()) { if (this.getPierceLevel() <= 0) { this.discard(); } } } } }Notes:
- The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
- This applies to both crossbows, and regular bows.
The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground.
Even using F3 + B will not display the arrow entitie's hitbox.Steps to Reproduce:
(requres two players to test)
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (This can be achieved currently by using the shield, and reloading the games assets with F3 + T. You can now continue to use it after tabbing out)
HavePlayer2 shoot Player 1Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Code Analysis / MCP-Reborn 1.20.2
This issue comes from inside the onHitEntity() method of AbstractArrow. Inside this method, there are numerous checks done to see if and when an arrow should be discarded, but the noteworthy one is the check done near the bottom of this method-- "this.getPierceLevel()". This check specifically sees what the arrow's piercing level is before discarding the arrow, but does not account for any other factors that should allow the arrow to remain visible to the player who fired it. This leads to the described behavior of the issue where when an arrow hits a player in creative mode, it is simply discarded for the local player.
Class net.minecraft.world.entity.projectile/AbstractArrow.java / Method onHitEntity(EntityHitResult entityHitResult). . . if (entity.hurt(damagesource, (float)i)) { if (flag) { return; } if (entity instanceof LivingEntity) { LivingEntity livingentity = (LivingEntity)entity; if (!this.level().isClientSide && this.getPierceLevel() <= 0) { livingentity.setArrowCount(livingentity.getArrowCount() + 1); } if (this.knockback > 0) { double d0 = Math.max(0.0D, 1.0D - livingentity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); Vec3 vec3 = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double)this.knockback * 0.6D * d0); if (vec3.lengthSqr() > 0.0D) { livingentity.push(vec3.x, 0.1D, vec3.z); } } if (!this.level().isClientSide && entity1 instanceof LivingEntity) { EnchantmentHelper.doPostHurtEffects(livingentity, entity1); EnchantmentHelper.doPostDamageEffects((LivingEntity)entity1, livingentity); } this.doPostHurtEffects(livingentity); if (entity1 != null && livingentity != entity1 && livingentity instanceof Player && entity1 instanceof ServerPlayer && !this.isSilent()) { ((ServerPlayer)entity1).connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.ARROW_HIT_PLAYER, 0.0F)); } if (!entity.isAlive() && this.piercedAndKilledEntities != null) { this.piercedAndKilledEntities.add(livingentity); } if (!this.level().isClientSide && entity1 instanceof ServerPlayer) { ServerPlayer serverplayer = (ServerPlayer)entity1; if (this.piercedAndKilledEntities != null && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, this.piercedAndKilledEntities); } else if (!entity.isAlive() && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, Arrays.asList(entity)); } } } this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); Issue Start if (this.getPierceLevel() <= 0) { this.discard(); } Issue End } . . .Code Fix
Note: this fix also accounts for other very similar issues such as MC-194723 and MC-101723. While this issue can be fixed on it's own, it is highly recommended to solve all the issues at once.
So, what's the solution? Well, first before the arrow is discarded, we also need to verify that the target that has been hit is not in creative mode. To do this, we first check and see if the instance of the hit entity is a ServerPlayer (this is very important, as simply using the "Player.java" class does not provide the expected results) and if that is true, we then check their gamemode and see if it is creative. (My solution is a bit of an "if" statement mess, but it showcases what checks need to be made)This fix provides the following behavior:
2023-10-06_21-27-40.mp4![]()
if (!entity.isInvulnerable()) { if (entity instanceof ServerPlayer serverPlayer) { if (!serverPlayer.isCreative()) { if (!serverPlayer.isBlocking()) { if (this.getPierceLevel() <= 0) { this.discard(); } } } } }Notes:
- Th
e arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.This applies to both crossbows, and regular bows.The Bug:
After shooting another creative mode player with an arrow, only the person who had been fired at will be able to see the arrow after it reflects off and lands on the ground.
Steps to Reproduce:
(requres two players to test)
- Get two players to join into either an LAN, or multiplayer world
- Put Player 1 in creative mode
- Have Player 2 fire at Player 1
Observed Results:
The arrow will reflect off of Player 1, and only be visible to Player 1.
Expected Results:
The arrow would be visible to all players
Screenshots/Videos:
Code Analysis / MCP-Reborn 1.20.2
This issue comes from inside the onHitEntity() method of AbstractArrow. Inside this method, there are numerous checks done to see if and when an arrow should be discarded, but the noteworthy one is the check done near the bottom of this method-- "this.getPierceLevel()". This check specifically sees what the arrow's piercing level is before discarding the arrow, but does not account for any other factors that should allow the arrow to remain visible to the player who fired it. This leads to the described behavior of the issue where when an arrow hits a player in creative mode, it is simply discarded for the local player.
Class net.minecraft.world.entity.projectile/AbstractArrow.java / Method onHitEntity(EntityHitResult entityHitResult). . . if (entity.hurt(damagesource, (float)i)) { if (flag) { return; } if (entity instanceof LivingEntity) { LivingEntity livingentity = (LivingEntity)entity; if (!this.level().isClientSide && this.getPierceLevel() <= 0) { livingentity.setArrowCount(livingentity.getArrowCount() + 1); } if (this.knockback > 0) { double d0 = Math.max(0.0D, 1.0D - livingentity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); Vec3 vec3 = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double)this.knockback * 0.6D * d0); if (vec3.lengthSqr() > 0.0D) { livingentity.push(vec3.x, 0.1D, vec3.z); } } if (!this.level().isClientSide && entity1 instanceof LivingEntity) { EnchantmentHelper.doPostHurtEffects(livingentity, entity1); EnchantmentHelper.doPostDamageEffects((LivingEntity)entity1, livingentity); } this.doPostHurtEffects(livingentity); if (entity1 != null && livingentity != entity1 && livingentity instanceof Player && entity1 instanceof ServerPlayer && !this.isSilent()) { ((ServerPlayer)entity1).connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.ARROW_HIT_PLAYER, 0.0F)); } if (!entity.isAlive() && this.piercedAndKilledEntities != null) { this.piercedAndKilledEntities.add(livingentity); } if (!this.level().isClientSide && entity1 instanceof ServerPlayer) { ServerPlayer serverplayer = (ServerPlayer)entity1; if (this.piercedAndKilledEntities != null && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, this.piercedAndKilledEntities); } else if (!entity.isAlive() && this.shotFromCrossbow()) { CriteriaTriggers.KILLED_BY_CROSSBOW.trigger(serverplayer, Arrays.asList(entity)); } } } this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); Issue Start if (this.getPierceLevel() <= 0) { this.discard(); } Issue End } . . .Code Fix
Note: this fix also accounts for other very similar issues such as MC-194723 and MC-101723. While this issue can be fixed on it's own, it is highly recommended to solve all the issues at once.
So, what's the solution? Well, first before the arrow is discarded, we also need to verify that the target that has been hit is not in creative mode. To do this, we first check and see if the instance of the hit entity is a ServerPlayer (this is very important, as simply using the "Player.java" class does not provide the expected results) and if that is true, we then check their gamemode and see if it is creative. (My solution is a bit of an "if" statement mess, but it showcases what checks need to be made)This fix provides the following behavior:
2023-10-06_21-27-40.mp4![]()
if (!entity.isInvulnerable()) { if (entity instanceof ServerPlayer serverPlayer) { if (!serverPlayer.isCreative()) { if (!serverPlayer.isBlocking()) { if (this.getPierceLevel() <= 0) { this.discard(); } } } } }Notes:
- The arrow still exists for both players, and can be retrieved by both. This is purely a visual issue.
- This applies to arrows being fired from any source, not just bows.
- Even using F3 + B will not show the arrow.
is duplicated by
is duplicated by
The Bug:
After shooting an arrow at another player blocking with a shield, only the person who had been fired at will be able to see the arrow deflecting and landing on the ground.
Steps to Reproduce:
(requres two players to test)
- Get two players to join into either an LAN, or multiplayer world
- Have Player 1 hold and use a shield (If testing alone: hold the 'use' key, then press F3 + T. You can now continue to use it after tabbing out)
- Have Player 2 shoot Player 1
Observed & Expected Results:
- The arrow will be blocked by Player 1 using the shield, and the arrow will only be visible to Player 1 afterwards.
- The arrow would be visible to all players, regardless of who was shot, and who fired the arrow.
Screenshots/Videos:
- Player blocking:
Player 1.mp4
- Player firing:
Player 2.mp4
Notes
Even using F3 + B will not display the arrow entity's hitbox.
Code Analysis:
An in-depth code analysis covering this issue, and the issues related it can be found in MC-129934.
Original Description:
(by Timo Taubmann)
After some playing with arrows and shields, we discovered that the arrows become invisible to its shooter when the arrow is fended off by another player with a shield.
Videos
- Player 1: Player 1.mp4
- Player 2: Player 2.mp4
Thank you for your report!
We're tracking this issue in MC-129934, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
As a note to this issue, I've left a very detailed and thurough code analysis and possible fix for this issue in MC-129934
It provides the following behavior:
MC-101723 FIX.mp4
This is already tracked in MC-129934 ![]()
As I am the owner of that ticket, I have added the latest snapshot version as an affected version.
Thank you for your report!
We're tracking this issue in MC-129934, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
– I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.
Thank you for your report!
We're tracking this issue in MC-129934, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Affects 21w37a
Requesting ownership of this issue to update and maintain it
Relates to MC-194723