Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7244

Unable to open Shulker Inventory when more than 8 blocks away

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • Server: Linux mpc 5.10.0-20-amd64 #1 SMP Debian 5.10.158-2 (2022-12-13) x86_64 GNU/Linux, java-1.17.0-openjdk-amd64

      Client: 1.19.3 (Native/Vanilla Minecraft)

       

    • CraftBukkit version 3641-Spigot-19641c7-ab8ace6 (MC: 1.19.3) (Implementing API version 1.19.3-R0.1-SNAPSHOT)
    • Openshulkerbox
    • Yes

      What happens:
      When the player is >8 blocks distance from Shulker Box location, Shulker Box inventory opens and instantly closes.

      What I expect to happen:
      Shulker Box inventory opens and stays open until player presses the inventory button (e).

      No crash or exception is raised.

      How to replicate:

      I've made a plugin to replicate, see attached. Source code for plugin, also attached. Alternatively, you can see the code snippet responsible for the behaviour here:

      if (shulkerLocation.getBlock().getState() instanceof ShulkerBox) {
          ShulkerBox shulker = (ShulkerBox)shulkerLocation.getBlock().getState();
          event.getPlayer().openInventory(shulker.getInventory());
      }

       

      Steps:

      1. Run a spigot server with the attached plugin.
      2. Change gamemode to creative. "gamemode playername creative" in console.
      3. Give yourself a "Shulker box" (NOT a dyed/colored shulker box), "Grass Block", "Barrel", "Stone".
      4. Place a Shulker Box.
      5. Place a Grass Block when the player is within 8 blocks of the original shulker box. This will try to open that shulker box inventory.
      6. Next place a grass block when you are further than 8 blocks from the shulker box. The Shulker box inventory opens and instantly closes.
      7. You can see the behaviour I expect by placing a Barrel and then placing a Stone block (which opens the barrel inventory from any distance).

       

      Notable things that may be helpful

      Vanilla minecraft container behaviour:
      If a player opens a container, then moves further than ~8 blocks from that container, the container inventory UI closes. The easiest way to replicate this is by opening a container while falling.

      I do not know that 8 blocks is the exact distance that causes this issue, it is an estimate. Seems to be a radial distance.

      The expected behaviour of being able to access the inventory from further than 8 blocks away works fine with these other containers tested: Furnaces, Brewing stands, Hoppers, Droppers, Barrels, Chests.

      Animations (The animation is how the container block looks when opened, for example the shulker box top raises when opened, the texture of the barrel is changed to look open)
      Shulker:
          - Within 8 blocks, the Shulker animation is always correct.
          - Further than 8 blocks, the Shulker box always opens and then closes straight away.
      Barrel:
          - Within 8 blocks, the barrel animation is initially correct.
          - Further than 8 blocks, the Barrel animation opens and instantly closes the first occasion. Subsequent occasions the animation never plays. Even if interacted within 8 blocks by a player right clicking.
       
      The animations are probably a bug report of their own, but I thought I would mention it here in case it is helpful for debugging the original issue.

       

      This is my first bug report, if I've missed anything or you need additional information, let me know.

      Thanks

       

            Unassigned Unassigned
            vdfgdx vdfgdx
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: