Arrow is invisible to its shooter if it gets blocked and reflected by a shield
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
Created Issue:
Arrow is invisible for shooter if it's blocked with a shield
Hello there
After some playing with arrows and shield we discover that arrows are invisible for shooters if the arrow is blocked by another player with a shield.
Environment
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 8.0.6.10 - pxa6480sr6fp10-20200408_01(SR6 FP10))
IBM J9 VM (build 2.9, JRE 1.8.0 Linux amd64-64-Bit Compressed References 20200402_443261 (JIT enabled, AOT enabled)
OpenJ9 - 35ef566
OMR - 4bca4f4
IBM - 55acf4a)
JCL - 20200407_01 based on Oracle jdk8u251-b08
Hello there
After some playing with arrows and shields we discover that arrows are invisible for shooters if the arrow is blocked by another player with a shield.
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 8.0.6.10 - pxa6480sr6fp10-20200408_01(SR6 FP10))
IBM J9 VM (build 2.9, JRE 1.8.0 Linux amd64-64-Bit Compressed References 20200402_443261 (JIT enabled, AOT enabled)
OpenJ9 - 35ef566
OMR - 4bca4f4
IBM - 55acf4a)
JCL - 20200407_01 based on Oracle jdk8u251-b08
Arrow is invisible for shooter if it's blockedwitha shieldArrow is invisible for shooter if it gets blocked and reflected by a shield
Hello there
After some playing with arrows and shields we discover that arrows
are invisible for shootersif the arrow is blocked by another player with a shield.After some playing with arrows and shields we discover that arrows become invisible for the shooter if the arrow is blocked by another player with a shield.
Videos
- Player 1: Player 1.mp4
- Player 2: Player 2.mp4
Arrow is invisibleforshooter if it gets blocked and reflected by a shieldArrow is invisible to its shooter if it gets blocked and reflected by a shield
After some playing with arrows and shields we discover that arrows become invisible
for theshooterifthe arrow isblockedby another player with a shield.Videos
- Player 1: Player 1.mp4
- Player 2: Player 2.mp4
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
relates to
relates to
After s
ome playing with arrows andshields,we discoveredthatthe 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
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 Results:
The arrow will be blocked by Player 1 using the shield, and the arrow will only be visible to Player 1 afterwards.
Expected Results:
The arrow would be visible to all players.
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.
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 Results:
The arrow will be blocked by Player 1 using the shield, and the arrow will only be visible to Player 1 afterwards.
Expected Results:
The arrow would be visible to all players.
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.
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 Results:
The arrow will be blocked by Player 1 using the shield, and the arrow will only be visible to Player 1 afterwards.
Expected Results:
The arrow would be visible to all players.
Screenshots/Videos:
Player blocking:
Player 1.mp4![]()
Player firing: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.
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 Results:
The arrow will be blocked by Player 1 using the shield, and the arrow will only be visible to Player 1 afterwards.
Expected Results:
The arrow would be visible to all players.
Screenshots/Videos:
Player blocking:
Player 1.mp4![]()
Player firing: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.
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 Results:
The arrow will be blocked by Player 1 using the shield, and the arrow will only be visible to Player 1 afterwards.
Expected Results:
The arrow would be visible to all players.
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.
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 Results:
The arrow will be blocked by Player 1 using the shield, and the arrow will only be visible to Player 1 afterwards.
Expected Results:
The arrow would be visible to all players.
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.
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
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.
Relates to MC-194723
Can confirm.
Requesting ownership of this issue to maintain it seeing as this is the original poster's only issue, and they have not maintained it.