Invisible quantity when 1

Discussion in 'Plugin Development' started by TheDiamond06, Feb 26, 2015.

Thread Status:
Not open for further replies.
  1. Offline


    Here is what I have
                                                if(b.getType() == Material.GLOWSTONE)
                                                    Random rand = new Random();
                                                    int amount = rand.nextInt(4);
                                                    ItemStack one = new ItemStack(Material.GLOWSTONE_DUST);
                                                    int a = one.getAmount();
                                                    ItemStack two = new ItemStack(Material.GLOWSTONE_DUST, a + amount);
    This seems to be working fine but when the random integer chooses 1 a new ItemStack in my inventory appears that seems to be invisible. When I click or drop it it disappears. How would I fix this or make it so the lowest random is 2 instead?
  2. Offline

    Hoolean Retired Staff

    It's far more likely that the ItemStack is rendered invisible when the random value produced is zero. How to counter-act this issue? Simply add 1 to amount. :)
Thread Status:
Not open for further replies.

Share This Page