Advertisement
Guest User

MC1.10 Enchantments

a guest
Aug 26th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.57 KB | None | 0 0
  1. --[[
  2.  0  protection
  3.  1  fire_protection
  4.  2  feather_falling
  5.  3  blast_protection
  6.  4  projectile_protection
  7.  5  respiration
  8.  6  aqua_affinity
  9.  7  thorns
  10.  8  depth_strider
  11.  9  frost_walker
  12. 16  sharpness
  13. 17  smite
  14. 18  bane_of_arthropods
  15. 19  knockback
  16. 20  fire_aspect
  17. 21  looting
  18. 32  efficiency
  19. 33  silk_touch
  20. 34  unbreaking
  21. 35  fortune
  22. 48  power
  23. 49  punch
  24. 50  flame
  25. 51  infinity
  26. 61  luck_of_the_sea
  27. 62  lure
  28. 70  mending
  29. --]]
  30.  
  31. local _enchantment = {
  32.   {id="protection",            num= 0},
  33.   {id="fire_protection",       num= 1},
  34.   {id="feather_falling",       num= 2},
  35.   {id="blast_protection",      num= 3},
  36.   {id="projectile_protection", num= 4},
  37.   {id="respiration",           num= 5},
  38.   {id="aqua_affinity",         num= 6},
  39.   {id="thorns",                num= 7},
  40.   {id="depth_strider",         num= 8},
  41.   {id="frost_walker",          num= 9},
  42.   {id="sharpness",             num=16},
  43.   {id="smite",                 num=17},
  44.   {id="bane_of_arthropods",    num=18},
  45.   {id="knockback",             num=19},
  46.   {id="fire_aspect",           num=20},
  47.   {id="looting",               num=21},
  48.   {id="efficiency",            num=32},
  49.   {id="silk_touch",            num=33},
  50.   {id="unbreaking",            num=34},
  51.   {id="fortune",               num=35},
  52.   {id="power",                 num=48},
  53.   {id="punch",                 num=49},
  54.   {id="flame",                 num=50},
  55.   {id="infinity",              num=51},
  56.   {id="luck_of_the_sea",       num=61},
  57.   {id="lure",                  num=62},
  58.   {id="mending",               num=70},
  59. }
  60.  
  61. local _enchantmentByID = {
  62.   ["protection"]=             0,
  63.   ["fire_protection"]=        1,
  64.   ["feather_falling"]=        2,
  65.   ["blast_protection"]=       3,
  66.   ["projectile_protection"]=  4,
  67.   ["respiration"]=            5,
  68.   ["aqua_affinity"]=          6,
  69.   ["thorns"]=                 7,
  70.   ["depth_strider"]=          8,
  71.   ["frost_walker"]=           9,
  72.   ["sharpness"]=             16,
  73.   ["smite"]=                 17,
  74.   ["bane_of_arthropods"]=    18,
  75.   ["knockback"]=             19,
  76.   ["fire_aspect"]=           20,
  77.   ["looting"]=               21,
  78.   ["efficiency"]=            32,
  79.   ["silk_touch"]=            33,
  80.   ["unbreaking"]=            34,
  81.   ["fortune"]=               35,
  82.   ["power"]=                 48,
  83.   ["punch"]=                 49,
  84.   ["flame"]=                 50,
  85.   ["infinity"]=              51,
  86.   ["luck_of_the_sea"]=       61,
  87.   ["lure"]=                  62,
  88.   ["mending"]=               70,
  89. }
  90.  
  91. local _enchantmentByNum = {
  92.   [0] ="protection",
  93.   [1] ="fire_protection",
  94.   [2] ="feather_falling",
  95.   [3] ="blast_protection",
  96.   [4] ="projectile_protection",
  97.   [5] ="respiration",
  98.   [6] ="aqua_affinity",
  99.   [7] ="thorns",
  100.   [8] ="depth_strider",
  101.   [9] ="frost_walker",
  102.   [16]="sharpness",
  103.   [17]="smite",
  104.   [18]="bane_of_arthropods",
  105.   [19]="knockback",
  106.   [20]="fire_aspect",
  107.   [21]="looting",
  108.   [32]="efficiency",
  109.   [33]="silk_touch",
  110.   [34]="unbreaking",
  111.   [35]="fortune",
  112.   [48]="power",
  113.   [49]="punch",
  114.   [50]="flame",
  115.   [51]="infinity",
  116.   [61]="luck_of_the_sea",
  117.   [62]="lure",
  118.   [70]="mending",
  119. }
  120.  
  121. function getEnchantementList()
  122.   return _enchantment
  123. end
  124.  
  125. function getEnchantementNum(id)
  126.   if type(_enchantmentByID[id])=="nil" then
  127.     error(string.format([[Enchantment ID "%s" does not exists]],tostring(id)),2)
  128.     return false
  129.   end
  130.   return _enchantmentByID[id]
  131. end
  132.  
  133. function getEnchantementID(num)
  134.   if type(_enchantmentByNum[num])=="nil" then
  135.     error(string.format([[Enchantment number "%s" does not exists]],tostring(num)),2)
  136.     return false
  137.   end
  138.   return _enchantmentByNum[num]
  139. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement