net.minecraft.enchantment.Enchantments Java Examples
The following examples show how to use
net.minecraft.enchantment.Enchantments.
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: RenderBlockTileEntity.java From MiningGadgets with MIT License | 6 votes |
public void setBlockAllowed() { if (!UpgradeTools.containsActiveUpgradeFromList(gadgetUpgrades, Upgrade.VOID_JUNK)) { this.blockAllowed = true; return; } PlayerEntity player = world.getPlayerByUuid(playerUUID); if (player == null) return; int silk = 0; int fortune = 0; ItemStack tempTool = new ItemStack(ModItems.MININGGADGET.get()); // If silk is in the upgrades, apply it without a tier. if (UpgradeTools.containsActiveUpgradeFromList(gadgetUpgrades, Upgrade.SILK)) { tempTool.addEnchantment(Enchantments.SILK_TOUCH, 1); silk = 1; } // FORTUNE_1 is eval'd against the basename so this'll support all fortune upgrades if (UpgradeTools.containsActiveUpgradeFromList(gadgetUpgrades, Upgrade.FORTUNE_1)) { Optional<Upgrade> upgrade = UpgradeTools.getUpgradeFromList(gadgetUpgrades, Upgrade.FORTUNE_1); if (upgrade.isPresent()) { fortune = upgrade.get().getTier(); tempTool.addEnchantment(Enchantments.FORTUNE, fortune); } } List<ItemStack> drops = Block.getDrops(renderBlock, (ServerWorld) world, this.pos, null, player, tempTool); this.blockAllowed = blockAllowed(drops, getGadgetFilters(), isGadgetIsWhitelist()); }
Example #2
Source File: AutoFishHack.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
private int getRodValue(ItemStack stack) { if(stack.isEmpty() || !(stack.getItem() instanceof FishingRodItem)) return -1; int luckOTSLvl = EnchantmentHelper.getLevel(Enchantments.LUCK_OF_THE_SEA, stack); int lureLvl = EnchantmentHelper.getLevel(Enchantments.LURE, stack); int unbreakingLvl = EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack); int mendingBonus = EnchantmentHelper.getLevel(Enchantments.MENDING, stack); int noVanishBonus = EnchantmentHelper.hasVanishingCurse(stack) ? 0 : 1; return luckOTSLvl * 9 + lureLvl * 9 + unbreakingLvl * 2 + mendingBonus + noVanishBonus; }
Example #3
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 #4
Source File: CongealedBloodBlock.java From the-hallow with MIT License | 5 votes |
@Override public void afterBreak(World world, PlayerEntity player, BlockPos pos, BlockState state, BlockEntity be, ItemStack stack) { super.afterBreak(world, player, pos, state, be, stack); if (EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stack) == 0) { Material material = world.getBlockState(pos.down()).getMaterial(); if (material.blocksMovement() || material.isLiquid()) { world.setBlockState(pos, HallowedBlocks.BLOOD_BLOCK.getDefaultState()); } } }
Example #5
Source File: RenderBlockTileEntity.java From MiningGadgets with MIT License | 5 votes |
private void removeBlock() { if(world == null || world.isRemote) return; PlayerEntity player = world.getPlayerByUuid(playerUUID); if (player == null) return; int silk = 0; int fortune = 0; ItemStack tempTool = new ItemStack(ModItems.MININGGADGET.get()); // If silk is in the upgrades, apply it without a tier. if (UpgradeTools.containsActiveUpgradeFromList(gadgetUpgrades, Upgrade.SILK)) { tempTool.addEnchantment(Enchantments.SILK_TOUCH, 1); silk = 1; } // FORTUNE_1 is eval'd against the basename so this'll support all fortune upgrades if (UpgradeTools.containsActiveUpgradeFromList(gadgetUpgrades, Upgrade.FORTUNE_1)) { Optional<Upgrade> upgrade = UpgradeTools.getUpgradeFromList(gadgetUpgrades, Upgrade.FORTUNE_1); if (upgrade.isPresent()) { fortune = upgrade.get().getTier(); tempTool.addEnchantment(Enchantments.FORTUNE, fortune); } } List<ItemStack> drops = Block.getDrops(renderBlock, (ServerWorld) world, this.pos, null, player, tempTool); if ( blockAllowed ) { int exp = renderBlock.getExpDrop(world, pos, fortune, silk); boolean magnetMode = (UpgradeTools.containsActiveUpgradeFromList(gadgetUpgrades, Upgrade.MAGNET)); for (ItemStack drop : drops) { if (drop != null) { if (magnetMode) { int wasPickedUp = ForgeEventFactory.onItemPickup(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), drop), player); // 1 = someone allowed the event meaning it's handled, // -1 = someone blocked the event and thus we shouldn't drop it nor insert it // 0 = no body captured the event and we should handle it by hand. if( wasPickedUp == 0 ) { if (!player.addItemStackToInventory(drop)) Block.spawnAsEntity(world, pos, drop); } } else { Block.spawnAsEntity(world, pos, drop); } } } if (magnetMode) { if (exp > 0) player.giveExperiencePoints(exp); } else { if (exp > 0) renderBlock.getBlock().dropXpOnBlockBreak(world, pos, exp); } renderBlock.spawnAdditionalDrops(world, pos, tempTool); // Fixes silver fish basically... } world.removeTileEntity(this.pos); world.setBlockState(this.pos, Blocks.AIR.getDefaultState()); // Add to the break stats player.addStat(Stats.BLOCK_MINED.get(renderBlock.getBlock())); // Handle special cases if(SpecialBlockActions.getRegister().containsKey(renderBlock.getBlock())) SpecialBlockActions.getRegister().get(renderBlock.getBlock()).accept(world, pos, renderBlock); }
Example #6
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void drawItem(double x, double y, double z, double offX, double offY, double scale, ItemStack item) { glSetup(x, y, z); GL11.glScaled(0.4*scale, 0.4*scale, 0); GL11.glTranslated(offX, offY, 0); if (item.getItem() instanceof BlockItem) GL11.glRotatef(180F, 1F, 180F, 10F); mc.getItemRenderer().renderItem(new ItemStack( item.getItem()), Mode.GUI, 0, 0, new MatrixStack(), mc.getBufferBuilders().getEntityVertexConsumers()); if (item.getItem() instanceof BlockItem) GL11.glRotatef(-180F, -1F, -180F, -10F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glScalef(-0.05F, -0.05F, 0); if (item.getCount() > 0) { int w = mc.textRenderer.getStringWidth("x" + item.getCount()) / 2; mc.textRenderer.drawWithShadow("x" + item.getCount(), 7 - w, 5, 0xffffff); } GL11.glScalef(0.85F, 0.85F, 0.85F); int c = 0; for (Entry<Enchantment, Integer> m: EnchantmentHelper.getEnchantments(item).entrySet()) { int w1 = mc.textRenderer.getStringWidth(I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue()) / 2; mc.textRenderer.drawWithShadow( I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue(), -4 - w1, c*10-1, m.getKey() == Enchantments.VANISHING_CURSE || m.getKey() == Enchantments.BINDING_CURSE ? 0xff5050 : 0xffb0e0); c--; } GL11.glScalef(0.6F, 0.6F, 0.6F); String dur = item.getMaxDamage() - item.getDamage() + ""; int color = 0x000000; try{ color = MathHelper.hsvToRgb(((float) (item.getMaxDamage() - item.getDamage()) / item.getMaxDamage()) / 3.0F, 1.0F, 1.0F); } catch (Exception e) {} if (item.isDamageable()) mc.textRenderer.drawWithShadow(dur, -8 - dur.length() * 3, 15, new Color(color >> 16 & 255, color >> 8 & 255, color & 255).getRGB()); glCleanup(); }
Example #7
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void drawItem(double x, double y, double z, double offX, double offY, double scale, ItemStack item) { glSetup(x, y, z); GL11.glScaled(0.4*scale, 0.4*scale, 0); GL11.glTranslated(offX, offY, 0); if (item.getItem() instanceof BlockItem) GL11.glRotatef(180F, 1F, 180F, 10F); mc.getItemRenderer().renderItem(new ItemStack( item.getItem()), Mode.GUI, 0, 0, new MatrixStack(), mc.getBufferBuilders().getEntityVertexConsumers()); if (item.getItem() instanceof BlockItem) GL11.glRotatef(-180F, -1F, -180F, -10F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glScalef(-0.05F, -0.05F, 0); if (item.getCount() > 0) { int w = mc.textRenderer.getWidth("x" + item.getCount()) / 2; mc.textRenderer.drawWithShadow(new MatrixStack(), "x" + item.getCount(), 7 - w, 5, 0xffffff); } GL11.glScalef(0.85F, 0.85F, 0.85F); int c = 0; for (Entry<Enchantment, Integer> m: EnchantmentHelper.get(item).entrySet()) { int w1 = mc.textRenderer.getWidth(I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue()) / 2; mc.textRenderer.drawWithShadow(new MatrixStack(), I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue(), -4 - w1, c*10-1, m.getKey() == Enchantments.VANISHING_CURSE || m.getKey() == Enchantments.BINDING_CURSE ? 0xff5050 : 0xffb0e0); c--; } GL11.glScalef(0.6F, 0.6F, 0.6F); String dur = item.getMaxDamage() - item.getDamage() + ""; int color = 0x000000; try{ color = MathHelper.hsvToRgb(((float) (item.getMaxDamage() - item.getDamage()) / item.getMaxDamage()) / 3.0F, 1.0F, 1.0F); } catch (Exception e) {} if (item.isDamageable()) mc.textRenderer.drawWithShadow(new MatrixStack(), dur, -8 - dur.length() * 3, 15, new Color(color >> 16 & 255, color >> 8 & 255, color & 255).getRGB()); glCleanup(); }
Example #8
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void drawItem(double x, double y, double z, double offX, double offY, double scale, ItemStack item) { glSetup(x, y, z); GL11.glScaled(0.4*scale, 0.4*scale, 0); GL11.glTranslated(offX, offY, 0); if (item.getItem() instanceof BlockItem) GL11.glRotatef(180F, 1F, 180F, 10F); mc.getItemRenderer().renderItem(new ItemStack(item.getItem()), ItemCameraTransforms.TransformType.GUI); if (item.getItem() instanceof BlockItem) GL11.glRotatef(-180F, -1F, -180F, -10F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glScalef(-0.05F, -0.05F, 0); if (item.getCount() > 0) { int w = mc.fontRenderer.getStringWidth("x" + item.getCount()) / 2; mc.fontRenderer.drawStringWithShadow("x" + item.getCount(), 7 - w, 5, 0xffffff); } GL11.glScalef(0.85F, 0.85F, 0.85F); int c = 0; for (Entry<Enchantment, Integer> m: EnchantmentHelper.getEnchantments(item).entrySet()) { int w1 = mc.fontRenderer.getStringWidth(I18n.format(m.getKey().getName()).substring(0, 2) + m.getValue()) / 2; mc.fontRenderer.drawStringWithShadow( I18n.format(m.getKey().getName()).substring(0, 2) + m.getValue(), -4 - w1, c*10-1, m.getKey() == Enchantments.VANISHING_CURSE || m.getKey() == Enchantments.BINDING_CURSE ? 0xff5050 : 0xffb0e0); c--; } glCleanup(); }
Example #9
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void drawItem(double x, double y, double z, double offX, double offY, double scale, ItemStack item) { glSetup(x, y, z); GL11.glScaled(0.4*scale, 0.4*scale, 0); GL11.glTranslated(offX, offY, 0); if (item.getItem() instanceof BlockItem) GL11.glRotatef(180F, 1F, 180F, 10F); mc.getItemRenderer().renderItem(new ItemStack(item.getItem()), Type.GUI); if (item.getItem() instanceof BlockItem) GL11.glRotatef(-180F, -1F, -180F, -10F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glScalef(-0.05F, -0.05F, 0); if (item.getCount() > 0) { int w = mc.textRenderer.getStringWidth("x" + item.getCount()) / 2; mc.textRenderer.drawWithShadow("x" + item.getCount(), 7 - w, 5, 0xffffff); } GL11.glScalef(0.85F, 0.85F, 0.85F); int c = 0; for (Entry<Enchantment, Integer> m: EnchantmentHelper.getEnchantments(item).entrySet()) { int w1 = mc.textRenderer.getStringWidth(I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue()) / 2; mc.textRenderer.drawWithShadow( I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue(), -4 - w1, c*10-1, m.getKey() == Enchantments.VANISHING_CURSE || m.getKey() == Enchantments.BINDING_CURSE ? 0xff5050 : 0xffb0e0); c--; } GL11.glScalef(0.6F, 0.6F, 0.6F); String dur = item.getMaxDamage() - item.getDamage() + ""; int color = 0x000000; try{ color = MathHelper.hsvToRgb(((float) (item.getMaxDamage() - item.getDamage()) / item.getMaxDamage()) / 3.0F, 1.0F, 1.0F); } catch (Exception e) {} if (item.isDamageable()) mc.textRenderer.drawWithShadow(dur, -8 - dur.length() * 3, 15, new Color(color >> 16 & 255, color >> 8 & 255, color & 255).getRGB()); glCleanup(); }
Example #10
Source File: Shearables.java From patchwork-api with GNU Lesser General Public License v2.1 | 5 votes |
public static void shearEntity(ItemStack stack, IWorld world, BlockPos pos, IShearable target) { if (!(target instanceof Entity)) { throw new IllegalArgumentException("Tried to call shearEntity on something that was not an entity!"); } Entity entity = (Entity) target; List<ItemStack> drops = target.onSheared(stack, world, pos, EnchantmentHelper.getLevel(Enchantments.FORTUNE, stack)); Random rand = world.getRandom(); for (ItemStack drop : drops) { ItemEntity item = entity.dropStack(drop, 1.0F); if (item == null) { continue; } float accelerationX = (rand.nextFloat() - rand.nextFloat()) * 0.1F; float accelerationY = rand.nextFloat() * 0.05F; float accelerationZ = (rand.nextFloat() - rand.nextFloat()) * 0.1F; item.setVelocity(item.getVelocity().add(accelerationX, accelerationY, accelerationZ)); } if (stack.damage(1, world.getRandom(), null)) { stack.setCount(0); } }
Example #11
Source File: AutoArmorHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private int getArmorValue(ArmorItem item, ItemStack stack) { int armorPoints = item.getProtection(); int prtPoints = 0; int armorToughness = (int)((IArmorItem)item).getToughness(); int armorType = item.getMaterial().getProtectionAmount(EquipmentSlot.LEGS); if(useEnchantments.isChecked()) { Enchantment protection = Enchantments.PROTECTION; int prtLvl = EnchantmentHelper.getLevel(protection, stack); ClientPlayerEntity player = MC.player; DamageSource dmgSource = DamageSource.player(player); prtPoints = protection.getProtectionAmount(prtLvl, dmgSource); } return armorPoints * 5 + prtPoints * 3 + armorToughness + armorType; }
Example #12
Source File: AutoToolHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private float getMiningSpeed(ItemStack stack, BlockState state) { float speed = stack.getMiningSpeedMultiplier(state); if(speed > 1) { int efficiency = EnchantmentHelper.getLevel(Enchantments.EFFICIENCY, stack); if(efficiency > 0 && !stack.isEmpty()) speed += efficiency * efficiency + 1; } return speed; }
Example #13
Source File: HallowedInfestedBlock.java From the-hallow with MIT License | 5 votes |
@Override public void onStacksDropped(BlockState state, World world, BlockPos pos, ItemStack stack) { if (!world.isClient && world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS) && EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stack) == 0) { EndermiteEntity endermite = (EndermiteEntity) EntityType.ENDERMITE.create(world); endermite.updatePositionAndAngles(pos.getX() + 0.5D, pos.getY(), pos.getZ() + 0.5D, 0.0F, 0.0F); world.spawnEntity(endermite); endermite.playSpawnEffects(); } }
Example #14
Source File: Protocol_1_11.java From multiconnect with MIT License | 4 votes |
private void mutateEnchantmentRegistry(ISimpleRegistry<Enchantment> registry) { registry.purge(Enchantments.SWEEPING); }
Example #15
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 #16
Source File: Protocol_1_13_2.java From multiconnect with MIT License | 4 votes |
private void mutateEnchantmentRegistry(ISimpleRegistry<Enchantment> registry) { registry.unregister(Enchantments.QUICK_CHARGE); registry.unregister(Enchantments.MULTISHOT); registry.unregister(Enchantments.PIERCING); }
Example #17
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 #18
Source File: Protocol_1_10.java From multiconnect with MIT License | 4 votes |
private void mutateEnchantmentRegistry(ISimpleRegistry<Enchantment> registry) { registry.purge(Enchantments.BINDING_CURSE); registry.purge(Enchantments.VANISHING_CURSE); }
Example #19
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 #20
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); }
Example #21
Source File: ChoppingBlock.java From Survivalist with BSD 3-Clause "New" or "Revised" License | 4 votes |
private boolean interceptClick(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn) { TileEntity tileentity = worldIn.getTileEntity(pos); if (!(tileentity instanceof ChoppingBlockTileEntity)) return false; ChoppingBlockTileEntity chopper = (ChoppingBlockTileEntity) tileentity; if (chopper.getSlotInventory().getStackInSlot(0).getCount() <= 0) return false; if (worldIn.isRemote) return true; ItemStack heldItem = playerIn.getHeldItem(Hand.MAIN_HAND); int harvestLevel = heldItem.getItem().getHarvestLevel(heldItem, ToolType.AXE, playerIn, null); ActionResult<ItemStack> result = chopper.chop(playerIn, harvestLevel, EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, heldItem)); if (result.getType() == ActionResultType.SUCCESS) { if (worldIn.rand.nextFloat() < ConfigManager.SERVER.choppingDegradeChance.get()) { worldIn.setBlockState(pos, breaksInto.get()); } if (ConfigManager.SERVER.choppingExhaustion.get() > 0) playerIn.addExhaustion(ConfigManager.SERVER.choppingExhaustion.get().floatValue()); if (heldItem.getCount() > 0 && !playerIn.abilities.isCreativeMode) { heldItem.damageItem(1, playerIn, (stack) -> { stack.sendBreakAnimation(Hand.MAIN_HAND); }); } } if (result.getType() != ActionResultType.PASS) { ((ServerWorld) worldIn).spawnParticle(new ItemParticleData(ParticleTypes.ITEM, result.getResult()), pos.getX() + 0.5, pos.getY() + 0.6, pos.getZ() + 0.5, 8, 0, 0.1, 0, 0.02); } return true; }