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

Comparators cannot determine if a container is empty

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Snapshot 13w02a
    • Snapshot 13w01b
    • None
    • Confirmed

      What I expected to happen was:
      As comparators can now be used to guage the contents of containers, I expected a single item to be adequate to output a signal, allowing us to determine when a container has become empty

      What actually happened was:
      The container must be over 6.666...% full before any output is created. For chests, this means 116 items must be inside before a signal is produced. For hoppers, this means 22 items must be inside.

      This essentially makes it impossible to check for emptiness, restricting us to a fullness test. The fix would be simple enough: output floor( (contents/capacity) * 14) + ceil((contents/capacity)), instead of floor( (contents/capacity) * 15). This would still allow checking if a container is at its capacity, while also allowing you to check if it's completely empty.

      Steps to reproduce:
      1. Place a comparator, with a container as its input, and a 15-long wire of redstone dust as its output.
      2. Insert an item into the container. If it does not exceed 6.666...% of the container's capacity, there will be no output.
      3. Bring the container to above 6.666...% of its capacity. Observe an output of 1.
      4. Bring the container to near full capacity. Observe that its output is 14.
      5. Bring the container to full capacity. Observe that its output is 15.

      I don't see this as a feature request, but rather a bug in the newly added system (remember, the snapshot came out just today). It seems unreasonable (and likely accidental) to have no way of determining a container is completely empty, when you can determine the container is completely full. Both of these features are far more useful than determining a container's percent content in increments of 6.666...% instead of 7.142857...%.

      In fact, this change would have an added benefit (unintentional by my equation, but still): an output of 8 would indicate a container is precisely at 50% or higher. In the current system, 7 indicates you're 3.333% higher or lower than 50%, which is again a failure to provide a useful threshold for calculations.

      Finally, an example usage case of why you would want to determine a container is empty: you could have an automated storage minecart unloading station, using a hopper to unload the carts. When the hopper contains zero items, you know the cart is empty, and you can send it on its way.

            dinnerbone [Mojang] Nathan Adams
            wolfiemario WolfieMario
            Votes:
            16 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: