mojira.dev
MC-221824

Barrier/light particles are not visible if barrier/light item is in offhand

The Bug

Barriers and light don't display particles when the item is held in the second hand.

Steps to Reproduce

  • Place down a barrier/light and hold another one in your offhand.

  • Make sure particles are set to anything other than "minimal" in your video settings as a result of MC-47607/MC-221558.

  • Take note as to whether or not barrier particles are visible when holding barriers in your offhand.

Observed Behavior

Barrier/light particles aren't visible when holding barrier/light in your offhand.

Expected Behavior

Barrier/light particles would be visible when holding barrier/light in your offhand.

Code Analysis

Code analysis by @unknown can be found in this comment.

Linked issues

Attachments

Comments

Avoma

The issue with the light block is MC-221555 and the barrier is MC-83003.

migrated

As the barrier one is a recursion, I suggest reducing this to only the barrier, and linking it as "clones" instead.
Mojira mods won't reopen it and will request a new report be made anyways.

migrated

I can confirm that the issue reappeared for barriers.

Avoma

Can confirm in 21w14a.

Avoma

Can confirm in 21w15a.

Avoma

Can confirm in 21w16a.

Avoma

Can confirm in 21w17a.

migrated

Can confirm for 1.17 pre-release 3

Can see why you count this as a bug, as in previous versions barrier particles do appear when there is a barrier in your offhand.

Avoma

Can confirm in 1.17.

migrated

Can confirm in 1.17.1.

Avoma

I am able to confirm this behavior in 21w43a. Here are some extra details regarding this problem.

The Bug:

Barrier particles aren't visible when holding barriers in your offhand.

Steps to Reproduce:

  • Place down a barrier and hold another one in your offhand.

  • Make sure particles are set to anything other than "minimal" in your video settings as a result of MC-47607.

  • Take note as to whether or not barrier particles are visible when holding barriers in your offhand.

Observed Behavior:

Barrier particles aren't visible when holding barriers in your offhand.

Expected Behavior:

Barrier particles would be visible when holding barriers in your offhand.

Avoma

Can confirm in 1.18.1.

Avoma

Can confirm in 1.19.

[media]
Avoma

Can confirm in 1.19.2.

migrated

Also affects light blocks.

[Mod] Jingy

Affects 1.20.2

[Mod] Jingy

Code analysis:

Here inside getMarkerParticleTargets(), a 'Block' object is returned to check elsewhere for if the player for holding it. If the player is holding it, the barrier/particle is rendered. This check however only accounts for the mainhand due to "getMainHandItem()" being used.

Class: net\minecraft\client\multiplayer\ClientLevel.java - Method: getMarkerParticleTargets()
@Nullable
   private Block getMarkerParticleTarget() {
      if (this.minecraft.gameMode.getPlayerMode() == GameType.CREATIVE) {
         ItemStack itemstack = this.minecraft.player.getMainHandItem();
         Item item = itemstack.getItem();
         if (MARKER_PARTICLE_ITEMS.contains(item) && item instanceof BlockItem blockItem) {
            return blockItem.getBlock();
         }
      }
      return null;
   }

migrated

(Unassigned)

Confirmed

Platform

Normal

Particles

barrier, light

21w13a, 21w14a, 21w15a, 21w16a, 21w17a, ..., 1.20.2, 1.20.4, 24w07a, 24w13a, 1.21.1

Retrieved