Advertisement
Guest User

Untitled

a guest
May 23rd, 2021
1,298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.36 KB | None | 0 0
  1. //  ITEMS ALGORITHM START
  2.  
  3. Random rand = new Random();
  4. int num = rand.nextInt(14);
  5. ItemStack is = null;
  6.  
  7. if (num == 0) {      //helmet
  8.     num = rand.nextInt(3);
  9.     if(num == 0) {
  10.         is = new ItemStack(Material.IRON_HELMET,1);
  11.     }else if(num == 1) {
  12.         is = new ItemStack(Material.DIAMOND_HELMET,1);
  13.     }else {
  14.         is = new ItemStack(Material.NETHERITE_HELMET,1);
  15.     }
  16.    
  17.     num = rand.nextInt(4);
  18.     if(num == 0) {
  19.         is.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
  20.     }else if(num == 1) {
  21.         is.addEnchantment(Enchantment.PROTECTION_FIRE, 1);
  22.     }else if(num == 2) {
  23.         is.addEnchantment(Enchantment.DURABILITY, 1);
  24.     }else {
  25.         is.addEnchantment(Enchantment.OXYGEN, 1);
  26.     }
  27.    
  28. }else if (num == 1) {//chest
  29.     num = rand.nextInt(3);
  30.     if(num == 0) {
  31.         is = new ItemStack(Material.IRON_CHESTPLATE,1);
  32.     }else if(num == 1) {
  33.         is = new ItemStack(Material.DIAMOND_CHESTPLATE,1);
  34.     }else {
  35.         is = new ItemStack(Material.NETHERITE_CHESTPLATE,1);
  36.     }
  37.    
  38.     num = rand.nextInt(4);
  39.     if(num == 0) {
  40.         is.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
  41.     }else if(num == 1) {
  42.         is.addEnchantment(Enchantment.PROTECTION_FIRE, 1);
  43.     }else if(num == 2) {
  44.         is.addEnchantment(Enchantment.DURABILITY, 1);
  45.     }else {
  46.         is.addEnchantment(Enchantment.THORNS, 1);
  47.     }
  48.    
  49. }else if (num == 2) {//pants
  50.     num = rand.nextInt(3);
  51.     if(num == 0) {
  52.         is = new ItemStack(Material.IRON_LEGGINGS,1);
  53.     }else if(num == 1) {
  54.         is = new ItemStack(Material.DIAMOND_LEGGINGS,1);
  55.     }else {
  56.         is = new ItemStack(Material.NETHERITE_LEGGINGS,1);
  57.     }
  58.    
  59.     num = rand.nextInt(4);
  60.     if(num == 0) {
  61.         is.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
  62.     }else if(num == 1) {
  63.         is.addEnchantment(Enchantment.PROTECTION_FIRE, 1);
  64.     }else if(num == 2) {
  65.         is.addEnchantment(Enchantment.DURABILITY, 1);
  66.     }else {
  67.         is.addEnchantment(Enchantment.THORNS, 1);
  68.     }
  69.    
  70. }else if (num == 3) {//boots
  71.     num = rand.nextInt(3);
  72.     if(num == 0) {
  73.         is = new ItemStack(Material.IRON_BOOTS,1);
  74.     }else if(num == 1) {
  75.         is = new ItemStack(Material.DIAMOND_BOOTS,1);
  76.     }else {
  77.         is = new ItemStack(Material.NETHERITE_BOOTS,1);
  78.     }
  79.    
  80.     num = rand.nextInt(8);
  81.     if(num == 0) {
  82.         is.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
  83.     }else if(num == 1) {
  84.         is.addEnchantment(Enchantment.PROTECTION_FIRE, 1);
  85.     }else if(num == 2) {
  86.         is.addEnchantment(Enchantment.DURABILITY, 1);
  87.     }else if(num == 3) {
  88.         is.addEnchantment(Enchantment.WATER_WORKER, 1);
  89.     }else if(num == 4) {
  90.         is.addEnchantment(Enchantment.SOUL_SPEED, 1);
  91.     }else if(num == 5) {
  92.         is.addEnchantment(Enchantment.FROST_WALKER, 1);
  93.     }else if(num == 6) {
  94.         is.addEnchantment(Enchantment.DEPTH_STRIDER, 1);
  95.     }else {
  96.         is.addEnchantment(Enchantment.PROTECTION_FALL, 1);
  97.     }
  98.    
  99. }else if (num == 4) {//pickaxe
  100.     num = rand.nextInt(3);
  101.     if(num == 0) {
  102.         is = new ItemStack(Material.IRON_PICKAXE,1);
  103.     }else if(num == 1) {
  104.         is = new ItemStack(Material.DIAMOND_PICKAXE,1);
  105.     }else {
  106.         is = new ItemStack(Material.NETHERITE_PICKAXE,1);
  107.     }
  108.    
  109.     num = rand.nextInt(4);
  110.     if(num == 0) {
  111.         is.addEnchantment(Enchantment.DIG_SPEED, 1);
  112.     }else if(num == 1) {
  113.         is.addEnchantment(Enchantment.SILK_TOUCH, 1);
  114.     }else if(num == 2) {
  115.         is.addEnchantment(Enchantment.DURABILITY, 1);
  116.     }else {
  117.         is.addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 1);
  118.     }
  119.    
  120. }else if (num == 5) {//sword
  121.     num = rand.nextInt(3);
  122.     if(num == 0) {
  123.         is = new ItemStack(Material.IRON_SWORD,1);
  124.     }else if(num == 1) {
  125.         is = new ItemStack(Material.DIAMOND_SWORD,1);
  126.     }else {
  127.         is = new ItemStack(Material.NETHERITE_SWORD,1);
  128.     }
  129.    
  130.     num = rand.nextInt(4);
  131.     if(num == 0) {
  132.         is.addEnchantment(Enchantment.DAMAGE_ALL, 1);
  133.     }else if(num == 1) {
  134.         is.addEnchantment(Enchantment.FIRE_ASPECT, 1);
  135.     }else if(num == 2) {
  136.         is.addEnchantment(Enchantment.DURABILITY, 1);
  137.     }else {
  138.         is.addEnchantment(Enchantment.MENDING, 1);
  139.     }
  140.    
  141. }else if (num == 6) {//shovel
  142.     num = rand.nextInt(3);
  143.     if(num == 0) {
  144.         is = new ItemStack(Material.IRON_SHOVEL,1);
  145.     }else if(num == 1) {
  146.         is = new ItemStack(Material.DIAMOND_SHOVEL,1);
  147.     }else {
  148.         is = new ItemStack(Material.NETHERITE_SHOVEL,1);
  149.     }
  150.    
  151.     num = rand.nextInt(4);
  152.     if(num == 0) {
  153.         is.addEnchantment(Enchantment.DIG_SPEED, 1);
  154.     }else if(num == 1) {
  155.         is.addEnchantment(Enchantment.SILK_TOUCH, 1);
  156.     }else if(num == 2) {
  157.         is.addEnchantment(Enchantment.DURABILITY, 1);
  158.     }else {
  159.         is.addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 1);
  160.     }
  161.    
  162. }else if (num == 7) {//axe
  163.     num = rand.nextInt(3);
  164.     if(num == 0) {
  165.         is = new ItemStack(Material.IRON_AXE,1);
  166.     }else if(num == 1) {
  167.         is = new ItemStack(Material.DIAMOND_AXE,1);
  168.     }else {
  169.         is = new ItemStack(Material.NETHERITE_AXE,1);
  170.     }
  171.    
  172.     num = rand.nextInt(4);
  173.     if(num == 0) {
  174.         is.addEnchantment(Enchantment.DAMAGE_ALL, 1);
  175.     }else if(num == 1) {
  176.         is.addEnchantment(Enchantment.FIRE_ASPECT, 1);
  177.     }else if(num == 2) {
  178.         is.addEnchantment(Enchantment.DURABILITY, 1);
  179.     }else {
  180.         is.addEnchantment(Enchantment.MENDING, 1);
  181.     }
  182.    
  183. }else if (num == 8) {//shield
  184.     is = new ItemStack(Material.SHIELD,1);
  185. }else if (num == 9) {//totem
  186.     is = new ItemStack(Material.TOTEM_OF_UNDYING,1);
  187. }else if (num == 10) {//diamond
  188.     is = new ItemStack(Material.DIAMOND,2);
  189. }else if (num == 11) {//iron
  190.     is = new ItemStack(Material.IRON_INGOT,10);
  191. }else if (num == 12) {//gold
  192.     is = new ItemStack(Material.GOLD_INGOT,10);
  193. }else {              //golden apple
  194.     is = new ItemStack(Material.ENCHANTED_GOLDEN_APPLE,1);
  195. }
  196.  
  197. // ITEMS ALGORITHM END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement