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

Unnecessary method override for dispenser behaviors

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.17.1, 1.18 Pre-release 1, 1.18.2, 1.19 Release Candidate 2, 1.19, 1.19.3, 1.19.4 Pre-release 1, 1.19.4 Pre-release 3, 1.20.1, 1.20.2 Pre-release 1, 1.20.2 Pre-Release 4, 1.21 Pre-Release 1
    • None
    • Plausible
    • (Unassigned)

      Using Yarn mappings, the following method exists in the BoatDispenserBehavior class:

      @Override
      protected void playSound(BlockPointer pointer) {
      	pointer.world().syncWorldEvent(WorldEvents.DISPENSER_DISPENSES, pointer.pos(), 0);
      }
      

      The immediate superclass, ItemDispenserBehavior, implements the method in the same way, though through invoking a static method:

      protected void playSound(BlockPointer pointer) {
      	syncDispensesEvent(pointer);
      }
      
      private static void syncDispensesEvent(BlockPointer pointer) {
      	pointer.world().syncWorldEvent(WorldEvents.DISPENSER_DISPENSES, pointer.pos(), 0);
      }
      

      Since the two implementations have the same effect, the BoatDispenserBehavior#playSound override is unnecessary.

            Unassigned Unassigned
            haykam haykam
            Votes:
            4 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              CHK: