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 17

Avoma

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

user-f2760

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.

bugsbugsbugs

I can confirm that the issue reappeared for barriers.

Avoma

Can confirm in 21w14a.

Avoma

Can confirm in 21w15a.

7 more comments
Avoma

Can confirm in 1.19.

[media]
Avoma

Can confirm in 1.19.2.

user-f2760

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;
   }

BeetMacol

(Unassigned)

Confirmed

Platform

Normal

Particles

barrier, light

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

Retrieved