Advertisement
Guest User

CustomEnchantmentType.class

a guest
Jun 15th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. package com.doggie.raremetalsrevised.enchantments;
  2.  
  3. import net.minecraft.enchantment.EnchantmentType;
  4. import net.minecraft.item.AxeItem;
  5. import net.minecraft.item.Item;
  6. import net.minecraft.item.PickaxeItem;
  7. import net.minecraft.item.ShootableItem;
  8.  
  9. import java.util.function.Predicate;
  10.  
  11. public class CustomEnchantmentType {
  12. public static final EnchantmentType PICKAXE = addEnchantment("pickaxe", PickaxeItem.class::isInstance);
  13.  
  14. public static final EnchantmentType AXE = addEnchantment("axe", AxeItem.class::isInstance);
  15.  
  16. public static final EnchantmentType WEAPON_DIGGER;
  17.  
  18. static {
  19. WEAPON_DIGGER = addEnchantment("weapon_digger", item -> (item instanceof net.minecraft.item.SwordItem || item instanceof net.minecraft.item.ToolItem));
  20. }
  21.  
  22. public static final EnchantmentType SHOOTABLE = addEnchantment("shootable", ShootableItem.class::isInstance);
  23.  
  24. private static EnchantmentType addEnchantment(String name, Predicate<Item> condition) {
  25. return EnchantmentType.create(name, condition);
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement