Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. public void addEnchantment(Enchantment ench, int level)
  2. {
  3. if (this.stackTagCompound == null)
  4. {
  5. this.setTagCompound(new NBTTagCompound());
  6. }
  7.  
  8. if (!this.stackTagCompound.hasKey("ench", 9))
  9. {
  10. this.stackTagCompound.setTag("ench", new NBTTagList());
  11. }
  12.  
  13. NBTTagList var3 = this.stackTagCompound.getTagList("ench", 10);
  14. NBTTagCompound var4 = new NBTTagCompound();
  15. var4.setShort("id", (short)ench.effectId);
  16. var4.setShort("lvl", (short)level);
  17. var3.appendTag(var4);
  18.  
  19. System.out.println("Applied enchant " + ench.effectId + ", level: " + (short) (byte) level);
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement