toItemStack() method in Dye is confusing/misleading

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None

      Sample code:

      ItemStack stack = new Dye(DyeColor.LIME).toItemStack()

      Trying to give this stack to the player or dropping it into the world leads to nothing happening. It took me a while to figure out why it wasn't working, but it's because toItemStack() creates a stack with an amount of 0.

       

      Changing the code to use the method which takes an amount fixed my problem:

      ItemStack stack = new Dye(DyeColor.LIME).toItemStack(1)

       

      This might not be a bug, but I expected the first method to create a stack of 1, which I feel is a reasonable thing to expect. Even if this can't be changed, I feel like it should at least be mentioned in the Javadoc as a caution to it being a stack of 0 and not 1.

            Assignee:
            Unassigned
            Reporter:
            Linus Närkling
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: