Advertisement
Guest User

Chnage Item Code

a guest
Jun 2nd, 2021
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. public void changeItem() {
  2. int heat = this.getSlot(0).getStack().getItemDamage();
  3. if(this.buttonPressed != -1) {
  4. if(this.inputSlot.getStackInSlot(0).isItemEqualIgnoreDurability(new ItemStack(ItemInit.HOT_TOOL_HEAD))) {
  5. int weapon = this.buttonPressed;
  6. if(weapon == 1) {
  7. ItemStack stack = new ItemStack(ItemInit.DAGGER_HOT_TOOL_HEAD);
  8. stack.setItemDamage(heat);
  9. this.inputSlot.decrStackSize(0, 1);
  10. player.addItemStackToInventory(stack);
  11. //this.outputSlot.setInventorySlotContents(1, stack);
  12. //this.outputSlot.getStackInSlot(1).setItemDamage(heat);
  13. }else if(weapon == 2) {
  14. ItemStack stack = new ItemStack(ItemInit.KABUTOWARI_HOT_TOOL_HEAD);
  15. stack.setItemDamage(heat);
  16. this.inputSlot.decrStackSize(0, 1);
  17. player.addItemStackToInventory(stack);
  18. }else if(weapon == 3) {
  19. ItemStack stack = new ItemStack(ItemInit.TALWAR_HOT_TOOL_HEAD);
  20. stack.setItemDamage(heat);
  21. this.inputSlot.decrStackSize(0, 1);
  22. player.addItemStackToInventory(stack);
  23. }else if(weapon == 4) {
  24. ItemStack stack = new ItemStack(ItemInit.RAPIER_HOT_TOOL_HEAD);
  25. stack.setItemDamage(heat);
  26. this.inputSlot.decrStackSize(0, 1);
  27. player.addItemStackToInventory(stack);
  28. }else {
  29. ItemStack result = AnvilRecipes.getInstance().getForgingResult(this.inputSlot.getStackInSlot(0));
  30. this.outputStack = result;
  31. System.out.print("RESULT IS: " + result.getDisplayName());
  32. this.inputSlot.clear();
  33. this.outputSlot.setInventorySlotContents(1, result);
  34. }
  35. this.buttonPressed = -1;
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement