Java Code Examples for net.minecraft.util.registry.Registry#ENCHANTMENT
The following examples show how to use
net.minecraft.util.registry.Registry#ENCHANTMENT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EnchantCmd.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
private void enchant(ItemStack stack) { for(Enchantment enchantment : Registry.ENCHANTMENT) { if(enchantment == Enchantments.SILK_TOUCH) continue; if(enchantment.isCursed()) continue; if(enchantment == Enchantments.QUICK_CHARGE) { stack.addEnchantment(enchantment, 5); continue; } stack.addEnchantment(enchantment, 127); } }
Example 2
Source File: CmdEnchant.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
@Override public void onCommand(String command, String[] args) throws Exception { if (args[0].equalsIgnoreCase("list")) { BleachLogger.infoMessage("§d[Aqua_Affinity/Aqua] §5[Arthropods] §d[Blast/Blast_Prot] " + "§5[Channeling] §d[Curse_Binding/Binding] §5[Curse_Vanish/Vanish] §d[Depth_Strider/Strider] " + "§5[Efficiency/Eff] §d[Feather_Falling/Fall] §5[Fire_Aspect] §d[Fire_Prot] " + "§5[Flame] §d[Fortune] §5[Frost_Walker/Frost] §d[Impaling] §5[Infinity] §d[Knockback/Knock] " + "§5[Looting/Loot] §d[Loyalty] §5[Luck_Of_The_Sea/Luck] §d[Lure] §5[Mending/Mend] §d[Multishot] " + "§5[Piercing] §d[Power] §5[Projectile_Prot/Proj_Prot] §d[Protection/Prot] " + "§5[Punch] §d[Quick_Charge/Charge] §5[Respiration/Resp] §d[Riptide] " + "§5[Sharpness/Sharp] §d[Silk_Touch/Silk] §5[Smite] §d[Sweeping_Edge/Sweep] §5[Thorns] §d[Unbreaking]"); return; } if (!mc.player.abilities.creativeMode) { BleachLogger.errorMessage("Not In Creative Mode!"); return; } int level = Integer.parseInt(args[1]); ItemStack item = mc.player.inventory.getMainHandStack(); if (args[0].equalsIgnoreCase("all")) { for (Enchantment e: Registry.ENCHANTMENT) { enchant(item, e, level); } } if (equals(args[0], "Aqua_Affinity", "Aqua")) enchant(item, Enchantments.AQUA_AFFINITY, level); if (equals(args[0], "Arthropods")) enchant(item, Enchantments.BANE_OF_ARTHROPODS, level); if (equals(args[0], "Blast", "Blast_Prot")) enchant(item, Enchantments.BLAST_PROTECTION, level); if (equals(args[0], "Channeling")) enchant(item, Enchantments.CHANNELING, level); if (equals(args[0], "Curse_Binding", "Binding")) enchant(item, Enchantments.BINDING_CURSE, level); if (equals(args[0], "Curse_Vanish", "Vanish")) enchant(item, Enchantments.VANISHING_CURSE, level); if (equals(args[0], "Depth_Strider", "Strider")) enchant(item, Enchantments.DEPTH_STRIDER, level); if (equals(args[0], "Efficiency", "Eff")) enchant(item, Enchantments.EFFICIENCY, level); if (equals(args[0], "Feather_Falling", "Fall")) enchant(item, Enchantments.FEATHER_FALLING, level); if (equals(args[0], "Fire_Aspect")) enchant(item, Enchantments.FIRE_ASPECT, level); if (equals(args[0], "Fire_Prot")) enchant(item, Enchantments.FIRE_PROTECTION, level); if (equals(args[0], "Flame")) enchant(item, Enchantments.FLAME, level); if (equals(args[0], "Fortune")) enchant(item, Enchantments.FORTUNE, level); if (equals(args[0], "Frost_Walker", "Frost")) enchant(item, Enchantments.FROST_WALKER, level); if (equals(args[0], "Impaling")) enchant(item, Enchantments.IMPALING, level); if (equals(args[0], "Infinity")) enchant(item, Enchantments.INFINITY, level); if (equals(args[0], "Knockback", "Knock")) enchant(item, Enchantments.KNOCKBACK, level); if (equals(args[0], "Looting", "Loot")) enchant(item, Enchantments.LOOTING, level); if (equals(args[0], "Loyalty")) enchant(item, Enchantments.LOYALTY, level); if (equals(args[0], "Luck_Of_The_Sea", "Luck")) enchant(item, Enchantments.LUCK_OF_THE_SEA, level); if (equals(args[0], "Lure")) enchant(item, Enchantments.LURE, level); if (equals(args[0], "Mending", "Mend")) enchant(item, Enchantments.MENDING, level); if (equals(args[0], "Multishot")) enchant(item, Enchantments.MULTISHOT, level); if (equals(args[0], "Piercing")) enchant(item, Enchantments.PIERCING, level); if (equals(args[0], "Power")) enchant(item, Enchantments.POWER, level); if (equals(args[0], "Projectile_Prot", "Proj_Prot")) enchant(item, Enchantments.PROJECTILE_PROTECTION, level); if (equals(args[0], "Protection", "Prot")) enchant(item, Enchantments.PROTECTION, level); if (equals(args[0], "Punch")) enchant(item, Enchantments.PUNCH, level); if (equals(args[0], "Quick_Charge", "Charge")) enchant(item, Enchantments.QUICK_CHARGE, level); if (equals(args[0], "Respiration", "Resp")) enchant(item, Enchantments.RESPIRATION, level); if (equals(args[0], "Riptide")) enchant(item, Enchantments.RIPTIDE, level); if (equals(args[0], "Sharpness", "Sharp")) enchant(item, Enchantments.SHARPNESS, level); if (equals(args[0], "Silk_Touch", "Silk")) enchant(item, Enchantments.SILK_TOUCH, level); if (equals(args[0], "Smite")) enchant(item, Enchantments.SMITE, level); if (equals(args[0], "Sweeping_Edge", "Sweep")) enchant(item, Enchantments.SWEEPING, level); if (equals(args[0], "Thorns")) enchant(item, Enchantments.THORNS, level); if (equals(args[0], "Unbreaking")) enchant(item, Enchantments.UNBREAKING, level); }
Example 3
Source File: CmdEnchant.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
@SuppressWarnings("deprecation") @Override public void onCommand(String command, String[] args) throws Exception { if (args[0].equalsIgnoreCase("list")) { BleachLogger.infoMessage("�d[Aqua_Affinity/Aqua] �5[Arthropods] �d[Blast/Blast_Prot] " + "�5[Channeling] �d[Curse_Binding/Binding] �5[Curse_Vanish/Vanish] �d[Depth_Strider/Strider] " + "�5[Efficiency/Eff] �d[Feather_Falling/Fall] �5[Fire_Aspect] �d[Fire_Prot] " + "�5[Flame] �d[Fortune] �5[Frost_Walker/Frost] �d[Impaling] �5[Infinity] �d[Knockback/Knock] " + "�5[Looting/Loot] �d[Loyalty] �5[Luck_Of_The_Sea/Luck] �d[Lure] �5[Mending/Mend] �d[Multishot] " + "�5[Piercing] �d[Power] �5[Projectile_Prot/Proj_Prot] �d[Protection/Prot] " + "�5[Punch] �d[Quick_Charge/Charge] �5[Respiration/Resp] �d[Riptide] " + "�5[Sharpness/Sharp] �d[Silk_Touch/Silk] �5[Smite] �d[Sweeping_Edge/Sweep] �5[Thorns] �d[Unbreaking]"); return; } if (!mc.player.abilities.isCreativeMode) { BleachLogger.errorMessage("Not In Creative Mode!"); return; } int level = Integer.parseInt(args[1]); ItemStack item = mc.player.inventory.getCurrentItem(); if (args[0].equalsIgnoreCase("all")) { for (Enchantment e: Registry.ENCHANTMENT) { enchant(item, e, level); } } if (equals(args[0], "Aqua_Affinity", "Aqua")) enchant(item, Enchantments.AQUA_AFFINITY, level); if (equals(args[0], "Arthropods")) enchant(item, Enchantments.BANE_OF_ARTHROPODS, level); if (equals(args[0], "Blast", "Blast_Prot")) enchant(item, Enchantments.BLAST_PROTECTION, level); if (equals(args[0], "Channeling")) enchant(item, Enchantments.CHANNELING, level); if (equals(args[0], "Curse_Binding", "Binding")) enchant(item, Enchantments.BINDING_CURSE, level); if (equals(args[0], "Curse_Vanish", "Vanish")) enchant(item, Enchantments.VANISHING_CURSE, level); if (equals(args[0], "Depth_Strider", "Strider")) enchant(item, Enchantments.DEPTH_STRIDER, level); if (equals(args[0], "Efficiency", "Eff")) enchant(item, Enchantments.EFFICIENCY, level); if (equals(args[0], "Feather_Falling", "Fall")) enchant(item, Enchantments.FEATHER_FALLING, level); if (equals(args[0], "Fire_Aspect")) enchant(item, Enchantments.FIRE_ASPECT, level); if (equals(args[0], "Fire_Prot")) enchant(item, Enchantments.FIRE_PROTECTION, level); if (equals(args[0], "Flame")) enchant(item, Enchantments.FLAME, level); if (equals(args[0], "Fortune")) enchant(item, Enchantments.FORTUNE, level); if (equals(args[0], "Frost_Walker", "Frost")) enchant(item, Enchantments.FROST_WALKER, level); if (equals(args[0], "Impaling")) enchant(item, Enchantments.IMPALING, level); if (equals(args[0], "Infinity")) enchant(item, Enchantments.INFINITY, level); if (equals(args[0], "Knockback", "Knock")) enchant(item, Enchantments.KNOCKBACK, level); if (equals(args[0], "Looting", "Loot")) enchant(item, Enchantments.LOOTING, level); if (equals(args[0], "Loyalty")) enchant(item, Enchantments.LOYALTY, level); if (equals(args[0], "Luck_Of_The_Sea", "Luck")) enchant(item, Enchantments.LUCK_OF_THE_SEA, level); if (equals(args[0], "Lure")) enchant(item, Enchantments.LURE, level); if (equals(args[0], "Mending", "Mend")) enchant(item, Enchantments.MENDING, level); if (equals(args[0], "Multishot")) enchant(item, Enchantments.MULTISHOT, level); if (equals(args[0], "Piercing")) enchant(item, Enchantments.PIERCING, level); if (equals(args[0], "Power")) enchant(item, Enchantments.POWER, level); if (equals(args[0], "Projectile_Prot", "Proj_Prot")) enchant(item, Enchantments.PROJECTILE_PROTECTION, level); if (equals(args[0], "Protection", "Prot")) enchant(item, Enchantments.PROTECTION, level); if (equals(args[0], "Punch")) enchant(item, Enchantments.PUNCH, level); if (equals(args[0], "Quick_Charge", "Charge")) enchant(item, Enchantments.QUICK_CHARGE, level); if (equals(args[0], "Respiration", "Resp")) enchant(item, Enchantments.RESPIRATION, level); if (equals(args[0], "Riptide")) enchant(item, Enchantments.RIPTIDE, level); if (equals(args[0], "Sharpness", "Sharp")) enchant(item, Enchantments.SHARPNESS, level); if (equals(args[0], "Silk_Touch", "Silk")) enchant(item, Enchantments.SILK_TOUCH, level); if (equals(args[0], "Smite")) enchant(item, Enchantments.SMITE, level); if (equals(args[0], "Sweeping_Edge", "Sweep")) enchant(item, Enchantments.SWEEPING, level); if (equals(args[0], "Thorns")) enchant(item, Enchantments.THORNS, level); if (equals(args[0], "Unbreaking")) enchant(item, Enchantments.UNBREAKING, level); }
Example 4
Source File: CmdEnchant.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
@Override public void onCommand(String command, String[] args) throws Exception { if (args[0].equalsIgnoreCase("list")) { BleachLogger.infoMessage("\u00a7d[Aqua_Affinity/Aqua] \u00a75[Arthropods] \u00a7d[Blast/Blast_Prot] " + "\u00a75[Channeling] \u00a7d[Curse_Binding/Binding] \u00a75[Curse_Vanish/Vanish] \u00a7d[Depth_Strider/Strider] " + "\u00a75[Efficiency/Eff] \u00a7d[Feather_Falling/Fall] \u00a75[Fire_Aspect] \u00a7d[Fire_Prot] " + "\u00a75[Flame] \u00a7d[Fortune] \u00a75[Frost_Walker/Frost] \u00a7d[Impaling] \u00a75[Infinity] \u00a7d[Knockback/Knock] " + "\u00a75[Looting/Loot] \u00a7d[Loyalty] \u00a75[Luck_Of_The_Sea/Luck] \u00a7d[Lure] \u00a75[Mending/Mend] \u00a7d[Multishot] " + "\u00a75[Piercing] \u00a7d[Power] \u00a75[Projectile_Prot/Proj_Prot] \u00a7d[Protection/Prot] " + "\u00a75[Punch] \u00a7d[Quick_Charge/Charge] \u00a75[Respiration/Resp] \u00a7d[Riptide] " + "\u00a75[Sharpness/Sharp] \u00a7d[Silk_Touch/Silk] \u00a75[Smite] \u00a7d[Sweeping_Edge/Sweep] \u00a75[Thorns] \u00a7d[Unbreaking]"); return; } if (!mc.player.abilities.creativeMode) { BleachLogger.errorMessage("Not In Creative Mode!"); return; } int level = Integer.parseInt(args[1]); ItemStack item = mc.player.inventory.getMainHandStack(); if (args[0].equalsIgnoreCase("all")) { for (Enchantment e: Registry.ENCHANTMENT) { enchant(item, e, level); } } if (doesEqual(args[0], "Aqua_Affinity", "Aqua")) enchant(item, Enchantments.AQUA_AFFINITY, level); if (doesEqual(args[0], "Arthropods")) enchant(item, Enchantments.BANE_OF_ARTHROPODS, level); if (doesEqual(args[0], "Blast", "Blast_Prot")) enchant(item, Enchantments.BLAST_PROTECTION, level); if (doesEqual(args[0], "Channeling")) enchant(item, Enchantments.CHANNELING, level); if (doesEqual(args[0], "Curse_Binding", "Binding")) enchant(item, Enchantments.BINDING_CURSE, level); if (doesEqual(args[0], "Curse_Vanish", "Vanish")) enchant(item, Enchantments.VANISHING_CURSE, level); if (doesEqual(args[0], "Depth_Strider", "Strider")) enchant(item, Enchantments.DEPTH_STRIDER, level); if (doesEqual(args[0], "Efficiency", "Eff")) enchant(item, Enchantments.EFFICIENCY, level); if (doesEqual(args[0], "Feather_Falling", "Fall")) enchant(item, Enchantments.FEATHER_FALLING, level); if (doesEqual(args[0], "Fire_Aspect")) enchant(item, Enchantments.FIRE_ASPECT, level); if (doesEqual(args[0], "Fire_Prot")) enchant(item, Enchantments.FIRE_PROTECTION, level); if (doesEqual(args[0], "Flame")) enchant(item, Enchantments.FLAME, level); if (doesEqual(args[0], "Fortune")) enchant(item, Enchantments.FORTUNE, level); if (doesEqual(args[0], "Frost_Walker", "Frost")) enchant(item, Enchantments.FROST_WALKER, level); if (doesEqual(args[0], "Impaling")) enchant(item, Enchantments.IMPALING, level); if (doesEqual(args[0], "Infinity")) enchant(item, Enchantments.INFINITY, level); if (doesEqual(args[0], "Knockback", "Knock")) enchant(item, Enchantments.KNOCKBACK, level); if (doesEqual(args[0], "Looting", "Loot")) enchant(item, Enchantments.LOOTING, level); if (doesEqual(args[0], "Loyalty")) enchant(item, Enchantments.LOYALTY, level); if (doesEqual(args[0], "Luck_Of_The_Sea", "Luck")) enchant(item, Enchantments.LUCK_OF_THE_SEA, level); if (doesEqual(args[0], "Lure")) enchant(item, Enchantments.LURE, level); if (doesEqual(args[0], "Mending", "Mend")) enchant(item, Enchantments.MENDING, level); if (doesEqual(args[0], "Multishot")) enchant(item, Enchantments.MULTISHOT, level); if (doesEqual(args[0], "Piercing")) enchant(item, Enchantments.PIERCING, level); if (doesEqual(args[0], "Power")) enchant(item, Enchantments.POWER, level); if (doesEqual(args[0], "Projectile_Prot", "Proj_Prot")) enchant(item, Enchantments.PROJECTILE_PROTECTION, level); if (doesEqual(args[0], "Protection", "Prot")) enchant(item, Enchantments.PROTECTION, level); if (doesEqual(args[0], "Punch")) enchant(item, Enchantments.PUNCH, level); if (doesEqual(args[0], "Quick_Charge", "Charge")) enchant(item, Enchantments.QUICK_CHARGE, level); if (doesEqual(args[0], "Respiration", "Resp")) enchant(item, Enchantments.RESPIRATION, level); if (doesEqual(args[0], "Riptide")) enchant(item, Enchantments.RIPTIDE, level); if (doesEqual(args[0], "Sharpness", "Sharp")) enchant(item, Enchantments.SHARPNESS, level); if (doesEqual(args[0], "Silk_Touch", "Silk")) enchant(item, Enchantments.SILK_TOUCH, level); if (doesEqual(args[0], "Smite")) enchant(item, Enchantments.SMITE, level); if (doesEqual(args[0], "Sweeping_Edge", "Sweep")) enchant(item, Enchantments.SWEEPING, level); if (doesEqual(args[0], "Thorns")) enchant(item, Enchantments.THORNS, level); if (doesEqual(args[0], "Unbreaking")) enchant(item, Enchantments.UNBREAKING, level); }
Example 5
Source File: CmdEnchant.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
@Override public void onCommand(String command, String[] args) throws Exception { if (args[0].equalsIgnoreCase("list")) { BleachLogger.infoMessage("§d[Aqua_Affinity/Aqua] §5[Arthropods] §d[Blast/Blast_Prot] " + "§5[Channeling] §d[Curse_Binding/Binding] §5[Curse_Vanish/Vanish] §d[Depth_Strider/Strider] " + "§5[Efficiency/Eff] §d[Feather_Falling/Fall] §5[Fire_Aspect] §d[Fire_Prot] " + "§5[Flame] §d[Fortune] §5[Frost_Walker/Frost] §d[Impaling] §5[Infinity] §d[Knockback/Knock] " + "§5[Looting/Loot] §d[Loyalty] §5[Luck_Of_The_Sea/Luck] §d[Lure] §5[Mending/Mend] §d[Multishot] " + "§5[Piercing] §d[Power] §5[Projectile_Prot/Proj_Prot] §d[Protection/Prot] " + "§5[Punch] §d[Quick_Charge/Charge] §5[Respiration/Resp] §d[Riptide] " + "§5[Sharpness/Sharp] §d[Silk_Touch/Silk] §5[Smite] §d[Sweeping_Edge/Sweep] §5[Thorns] §d[Unbreaking]"); return; } if (!mc.player.abilities.creativeMode) { BleachLogger.errorMessage("Not In Creative Mode!"); return; } int level = Integer.parseInt(args[1]); ItemStack item = mc.player.inventory.getMainHandStack(); if (args[0].equalsIgnoreCase("all")) { for (Enchantment e: Registry.ENCHANTMENT) { enchant(item, e, level); } } if (doesEqual(args[0], "Aqua_Affinity", "Aqua")) enchant(item, Enchantments.AQUA_AFFINITY, level); if (doesEqual(args[0], "Arthropods")) enchant(item, Enchantments.BANE_OF_ARTHROPODS, level); if (doesEqual(args[0], "Blast", "Blast_Prot")) enchant(item, Enchantments.BLAST_PROTECTION, level); if (doesEqual(args[0], "Channeling")) enchant(item, Enchantments.CHANNELING, level); if (doesEqual(args[0], "Curse_Binding", "Binding")) enchant(item, Enchantments.BINDING_CURSE, level); if (doesEqual(args[0], "Curse_Vanish", "Vanish")) enchant(item, Enchantments.VANISHING_CURSE, level); if (doesEqual(args[0], "Depth_Strider", "Strider")) enchant(item, Enchantments.DEPTH_STRIDER, level); if (doesEqual(args[0], "Efficiency", "Eff")) enchant(item, Enchantments.EFFICIENCY, level); if (doesEqual(args[0], "Feather_Falling", "Fall")) enchant(item, Enchantments.FEATHER_FALLING, level); if (doesEqual(args[0], "Fire_Aspect")) enchant(item, Enchantments.FIRE_ASPECT, level); if (doesEqual(args[0], "Fire_Prot")) enchant(item, Enchantments.FIRE_PROTECTION, level); if (doesEqual(args[0], "Flame")) enchant(item, Enchantments.FLAME, level); if (doesEqual(args[0], "Fortune")) enchant(item, Enchantments.FORTUNE, level); if (doesEqual(args[0], "Frost_Walker", "Frost")) enchant(item, Enchantments.FROST_WALKER, level); if (doesEqual(args[0], "Impaling")) enchant(item, Enchantments.IMPALING, level); if (doesEqual(args[0], "Infinity")) enchant(item, Enchantments.INFINITY, level); if (doesEqual(args[0], "Knockback", "Knock")) enchant(item, Enchantments.KNOCKBACK, level); if (doesEqual(args[0], "Looting", "Loot")) enchant(item, Enchantments.LOOTING, level); if (doesEqual(args[0], "Loyalty")) enchant(item, Enchantments.LOYALTY, level); if (doesEqual(args[0], "Luck_Of_The_Sea", "Luck")) enchant(item, Enchantments.LUCK_OF_THE_SEA, level); if (doesEqual(args[0], "Lure")) enchant(item, Enchantments.LURE, level); if (doesEqual(args[0], "Mending", "Mend")) enchant(item, Enchantments.MENDING, level); if (doesEqual(args[0], "Multishot")) enchant(item, Enchantments.MULTISHOT, level); if (doesEqual(args[0], "Piercing")) enchant(item, Enchantments.PIERCING, level); if (doesEqual(args[0], "Power")) enchant(item, Enchantments.POWER, level); if (doesEqual(args[0], "Projectile_Prot", "Proj_Prot")) enchant(item, Enchantments.PROJECTILE_PROTECTION, level); if (doesEqual(args[0], "Protection", "Prot")) enchant(item, Enchantments.PROTECTION, level); if (doesEqual(args[0], "Punch")) enchant(item, Enchantments.PUNCH, level); if (doesEqual(args[0], "Quick_Charge", "Charge")) enchant(item, Enchantments.QUICK_CHARGE, level); if (doesEqual(args[0], "Respiration", "Resp")) enchant(item, Enchantments.RESPIRATION, level); if (doesEqual(args[0], "Riptide")) enchant(item, Enchantments.RIPTIDE, level); if (doesEqual(args[0], "Sharpness", "Sharp")) enchant(item, Enchantments.SHARPNESS, level); if (doesEqual(args[0], "Silk_Touch", "Silk")) enchant(item, Enchantments.SILK_TOUCH, level); if (doesEqual(args[0], "Smite")) enchant(item, Enchantments.SMITE, level); if (doesEqual(args[0], "Sweeping_Edge", "Sweep")) enchant(item, Enchantments.SWEEPING, level); if (doesEqual(args[0], "Thorns")) enchant(item, Enchantments.THORNS, level); if (doesEqual(args[0], "Unbreaking")) enchant(item, Enchantments.UNBREAKING, level); }