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

Breeding an axolotl in creative replaces the bucket of tropical fish

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 21w20a, 1.17 Pre-release 1, 1.17, 1.17.1 Pre-release 3, 1.17.1, 21w44a, 1.18, 1.18.1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4
    • None
    • Confirmed
    • Creative
    • Items
    • Low

    Description

      The Bug

      When breeding an axolotl with a bucket of tropical fish it replaces the bucket of tropical fish with a water bucket

      Reproduce

      • Be in creative
      • Get a bucket of tropical fish
      • Get an axolotl
      • Use the bucket of tropical fish on the axolotl
        Notice the bucket of tropical fish is replaced

      Expected Result

      The bucket of tropical fish would stay and a new water bucket would be made similar to collecting fluids in creative

      Code Analysis

      Adding a check for if the player is in creative mode int userPlayerItem() method in the Axolotl class fixes this issue

      Current Code

      net/minecraft/world/entity/animal/axolotl/Axolotl.java
         protected void usePlayerItem(Player p_149124_, InteractionHand p_149125_, ItemStack p_149126_) {
            if (p_149126_.is(Items.TROPICAL_FISH_BUCKET)) {
               p_149124_.setItemInHand(p_149125_, new ItemStack(Items.WATER_BUCKET));
            } else {
               super.usePlayerItem(p_149124_, p_149125_, p_149126_);
            }
      

      Fixed Code

      net/minecraft/world/entity/animal/axolotl/Axolotl.java
         protected void usePlayerItem(Player p_149124_, InteractionHand p_149125_, ItemStack p_149126_) {
            //Adding a check for creative mode here fixes MC-225870
            if (p_149126_.is(Items.TROPICAL_FISH_BUCKET) && !p_149124_.isCreative()) {
               p_149124_.setItemInHand(p_149125_, new ItemStack(Items.WATER_BUCKET));
            } else {
               super.usePlayerItem(p_149124_, p_149125_, p_149126_);
            }
      
         }
      

      Attachments

        1. MC-225870.mp4
          1.88 MB
        2. MC-225870.png
          MC-225870.png
          501 kB

        Activity

          People

            Unassigned Unassigned
            Thumpbacker [Mod] Anthony Cicinelli
            Votes:
            12 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              CHK: