Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // remove 4 torches, either off or on
- int remainingTorches = 4;
- if (numRedstoneTorchOn >= remainingTorches) {
- // they have enough torches, go ahead and take some
- player.getInventory().removeItem(new ItemStack(Material.REDSTONE_TORCH_ON, remainingTorches));
- } else {
- // not enough torches, subtract out how many they have, then get the rest in the other kind of torches
- player.getInventory().removeItem(new ItemStack(Material.REDSTONE_TORCH_ON, numRedstoneTorchOn));
- remainingTorches = remainingTorches - numRedstoneTorchOn;
- player.getInventory().removeItem(new ItemStack(Material.REDSTONE_TORCH_OFF, remainingTorches));
- }
- // remove 8 redstone wire/dust
- int remainingRedstone = 8;
- if (numRedstoneDust >= remainingTorches) {
- // they have enough dust, go ahead and take whats needed
- player.getInventory().removeItem(new ItemStack(Material.REDSTONE, remainingRedstone));
- } else {
- // not enough dust, subtract out what they have, then take the rest on wire
- player.getInventory().removeItem(new ItemStack(Material.REDSTONE, numRedstoneDust));
- remainingRedstone = remainingRedstone - numRedstoneDust;
- player.sendMessage("remaing redstone: " + remainingRedstone);
- player.getInventory().removeItem(new ItemStack(Material.REDSTONE_WIRE, remainingRedstone));
- }
Add Comment
Please, Sign In to add comment