[Help] Random Bytes?

Discussion in 'Plugin Development' started by Iron_Crystal, Feb 23, 2012.

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


    Ok. I am making a plugin that needs to drop a random color of wool. I can't compile this because I keep getting errors, but I was wondering how to do it.

    public void onPlayerSheerSheepEvent (PlayerShearEntityEvent event)
            Entity sheep = event.getEntity();
            final Random rg = new Random();
            Player player = event.getPlayer();
            if (sheep instanceof Sheep)
                Location entityLocation = event.getPlayer().getLocation();
                double y = entityLocation.getBlockY();
                double x = entityLocation.getBlockX();
                double z = entityLocation.getBlockZ();
                World currentWorld = event.getPlayer().getWorld();
                Location playerLocation = new Location(currentWorld, x - 1, y, z);
    /*            player.sendMessage(WoolColor + "");
                byte WoolColor[];
                ItemStack droppedItem = new ItemStack(Material.WOOL, 1, rg.nextBytes(WoolColor[15]));
                currentWorld.dropItem(event.getEntity().getLocation(), droppedItem);
    Basicly, I am trying to get a Random Byte so that the color of the wool will be random, but I can't compile it because there are errors. Does anyone know the correct syntax?
  2. Offline


    ItemStack itemStack = new ItemStack(Material.WOOL, amount, (short)random.nextInt(16));
Thread Status:
Not open for further replies.

Share This Page