Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-249169

Paintings do not have their packet coordinates set on spawn

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 22w16a
    • 1.18.2
    • None
    • Plausible
    • Networking
    • Normal

      Paintings are the only entity that currently does not have their packet coordinates set when they are spawned on the client. This is unlike every other entity, including those with custom spawn packets.

       

      For example, Experience Orbs:

      public void handleAddExperienceOrb(ClientboundAddExperienceOrbPacket $$0) {
         PacketUtils.ensureRunningOnSameThread($$0, this, this.minecraft);
         double $$1 = $$0.getX();
         double $$2 = $$0.getY();
         double $$3 = $$0.getZ();
         Entity $$4 = new ExperienceOrb(this.level, $$1, $$2, $$3, $$0.getValue());
         $$4.setPacketCoordinates($$1, $$2, $$3);
         $$4.setYRot(0.0F);
         $$4.setXRot(0.0F);
         $$4.setId($$0.getId());
         this.level.putNonPlayerEntity($$0.getId(), $$4);
      }

      Calls the setPacketCoordinates method!

       

      Paintings:

       

      public void handleAddPainting(ClientboundAddPaintingPacket $$0) {
         PacketUtils.ensureRunningOnSameThread($$0, this, this.minecraft);
         Painting $$1 = new Painting(this.level, $$0.getPos(), $$0.getDirection(), $$0.getMotive());
         $$1.setId($$0.getId());
         $$1.setUUID($$0.getUUID());
         this.level.putNonPlayerEntity($$0.getId(), $$1);
      } 

       

      But nowhere is setPacketCoordinates called for Paintings. Because it's not set, it remains at the world origin, which causes a possibility for server desync if the painting is moved using the ClientboundMoveEntityPacket packet due to it using the packet coordinate value for teleporting.

       

      This can be reproduced by sending a painting via ClientboundAddPaintingPacket then moving the entity with ClientboundMoveEntityPacket.

       

            Unassigned Unassigned
            Owen1212055 Owen
            Votes:
            3 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: