Guest User

Untitled

a guest
Jan 22nd, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. // remove 4 torches, either off or on
  2. int remainingTorches = 4;
  3. if (numRedstoneTorchOn >= remainingTorches) {
  4. // they have enough torches, go ahead and take some
  5. player.getInventory().removeItem(new ItemStack(Material.REDSTONE_TORCH_ON, remainingTorches));
  6. } else {
  7. // not enough torches, subtract out how many they have, then get the rest in the other kind of torches
  8. player.getInventory().removeItem(new ItemStack(Material.REDSTONE_TORCH_ON, numRedstoneTorchOn));
  9. remainingTorches = remainingTorches - numRedstoneTorchOn;
  10. player.getInventory().removeItem(new ItemStack(Material.REDSTONE_TORCH_OFF, remainingTorches));
  11. }
  12.  
  13. // remove 8 redstone wire/dust
  14. int remainingRedstone = 8;
  15. if (numRedstoneDust >= remainingTorches) {
  16. // they have enough dust, go ahead and take whats needed
  17. player.getInventory().removeItem(new ItemStack(Material.REDSTONE, remainingRedstone));
  18. } else {
  19. // not enough dust, subtract out what they have, then take the rest on wire
  20. player.getInventory().removeItem(new ItemStack(Material.REDSTONE, numRedstoneDust));
  21. remainingRedstone = remainingRedstone - numRedstoneDust;
  22. player.sendMessage("remaing redstone: " + remainingRedstone);
  23. player.getInventory().removeItem(new ItemStack(Material.REDSTONE_WIRE, remainingRedstone));
  24. }
Add Comment
Please, Sign In to add comment