tubelius

ItemStack.setAmount() changing material

Jun 30th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. Why does sandstone change into air when I use ItemStack.setAmount()?
  2.  
  3. ItemStack I = null;
  4. Integer Qty = ToInt(args[2]);
  5.  
  6. I = P.getItemInHand().clone();
  7. I.setAmount(Qty);
  8.  
  9. Integer MaxQty = GetAPItem(I.getTypeId()).TransactionMaxQty;
  10. if (MaxQty==null) { MaxQty=1; }
  11. if (I.getAmount() > MaxQty) {
  12. Qty = MaxQty;
  13. MsgP(P,"ItamStack check before: "+I.getType().name());
  14. I.setAmount(MaxQty);
  15. MsgP(P,"ItamStack check after: "+I.getType().name());
  16. }
Advertisement
Add Comment
Please, Sign In to add comment