Search in sources :

Example 1 with ElytraItem

use of net.minecraft.item.ElytraItem in project BleachHack by BleachDrinker420.

the class AutoArmor method onTick.

@BleachSubscribe
public void onTick(EventTick event) {
    if (mc.player.playerScreenHandler != mc.player.currentScreenHandler || !BleachQueue.isEmpty("autoarmor_equip"))
        return;
    if (tickDelay > 0) {
        tickDelay--;
        return;
    }
    tickDelay = (getSetting(2).asToggle().getState() ? getSetting(2).asToggle().getChild(0).asSlider().getValueInt() : 0);
    /* [Slot type, [Armor slot, Armor prot, New armor slot, New armor prot]] */
    Map<EquipmentSlot, int[]> armorMap = new HashMap<>(4);
    armorMap.put(EquipmentSlot.FEET, new int[] { 36, getProtection(mc.player.getInventory().getStack(36)), -1, -1 });
    armorMap.put(EquipmentSlot.LEGS, new int[] { 37, getProtection(mc.player.getInventory().getStack(37)), -1, -1 });
    armorMap.put(EquipmentSlot.CHEST, new int[] { 38, getProtection(mc.player.getInventory().getStack(38)), -1, -1 });
    armorMap.put(EquipmentSlot.HEAD, new int[] { 39, getProtection(mc.player.getInventory().getStack(39)), -1, -1 });
    /* Anti Break */
    if (getSetting(0).asToggle().getState()) {
        for (Entry<EquipmentSlot, int[]> e : armorMap.entrySet()) {
            ItemStack is = mc.player.getInventory().getStack(e.getValue()[0]);
            int armorSlot = (e.getValue()[0] - 34) + (39 - e.getValue()[0]) * 2;
            if (is.isDamageable() && is.getMaxDamage() - is.getDamage() < 7) {
                /* Look for an empty slot to quick move to */
                int forceMoveSlot = -1;
                for (int s = 0; s < 36; s++) {
                    if (mc.player.getInventory().getStack(s).isEmpty()) {
                        mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, armorSlot, 1, SlotActionType.QUICK_MOVE, mc.player);
                        return;
                    } else if (!(mc.player.getInventory().getStack(s).getItem() instanceof ToolItem) && !(mc.player.getInventory().getStack(s).getItem() instanceof ArmorItem) && !(mc.player.getInventory().getStack(s).getItem() instanceof ElytraItem) && mc.player.getInventory().getStack(s).getItem() != Items.TOTEM_OF_UNDYING && forceMoveSlot == -1) {
                        forceMoveSlot = s;
                    }
                }
                /* Bruh no empty spots, then force move to a non-totem/tool/armor item */
                if (forceMoveSlot != -1) {
                    // System.out.println(forceMoveSlot);
                    mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, forceMoveSlot < 9 ? 36 + forceMoveSlot : forceMoveSlot, 1, SlotActionType.THROW, mc.player);
                    mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, armorSlot, 1, SlotActionType.QUICK_MOVE, mc.player);
                    return;
                }
                /* No spots to move to, yeet the armor to not cause any bruh moments */
                mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, armorSlot, 1, SlotActionType.THROW, mc.player);
                return;
            }
        }
    }
    for (int s = 0; s < 36; s++) {
        int prot = getProtection(mc.player.getInventory().getStack(s));
        if (prot > 0) {
            EquipmentSlot slot = (mc.player.getInventory().getStack(s).getItem() instanceof ElytraItem ? EquipmentSlot.CHEST : ((ArmorItem) mc.player.getInventory().getStack(s).getItem()).getSlotType());
            for (Entry<EquipmentSlot, int[]> e : armorMap.entrySet()) {
                if (e.getKey() == slot) {
                    if (prot > e.getValue()[1] && prot > e.getValue()[3]) {
                        e.getValue()[2] = s;
                        e.getValue()[3] = prot;
                    }
                }
            }
        }
    }
    for (Entry<EquipmentSlot, int[]> e : armorMap.entrySet()) {
        if (e.getValue()[2] != -1) {
            if (e.getValue()[1] == -1 && e.getValue()[2] < 9) {
                if (e.getValue()[2] != mc.player.getInventory().selectedSlot) {
                    mc.player.getInventory().selectedSlot = e.getValue()[2];
                    mc.player.networkHandler.sendPacket(new UpdateSelectedSlotC2SPacket(e.getValue()[2]));
                }
                mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, 36 + e.getValue()[2], 1, SlotActionType.QUICK_MOVE, mc.player);
            } else if (mc.player.playerScreenHandler == mc.player.currentScreenHandler) {
                /* Convert inventory slots to container slots */
                int armorSlot = (e.getValue()[0] - 34) + (39 - e.getValue()[0]) * 2;
                int newArmorslot = e.getValue()[2] < 9 ? 36 + e.getValue()[2] : e.getValue()[2];
                mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, newArmorslot, 0, SlotActionType.PICKUP, mc.player);
                mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, armorSlot, 0, SlotActionType.PICKUP, mc.player);
                if (e.getValue()[1] != -1)
                    mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, newArmorslot, 0, SlotActionType.PICKUP, mc.player);
            }
            return;
        }
    }
}
Also used : ArmorItem(net.minecraft.item.ArmorItem) HashMap(java.util.HashMap) UpdateSelectedSlotC2SPacket(net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket) EquipmentSlot(net.minecraft.entity.EquipmentSlot) ElytraItem(net.minecraft.item.ElytraItem) ItemStack(net.minecraft.item.ItemStack) ToolItem(net.minecraft.item.ToolItem) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Example 2 with ElytraItem

use of net.minecraft.item.ElytraItem in project icaruswings_mod by LocusAzzurro.

the class EnchantmentPyrotechnicAffinity method fireworkExtender.

@SubscribeEvent
public static void fireworkExtender(EntityJoinWorldEvent e) {
    Entity entity = e.getEntity();
    if (entity instanceof FireworkRocketEntity) {
        FireworkRocketEntity firework = (FireworkRocketEntity) entity;
        if (firework.isAttachedToEntity() && firework.attachedToEntity.getItemBySlot(EquipmentSlotType.CHEST).getItem() instanceof ElytraItem) {
            int enchLvl = EnchantmentHelper.getEnchantmentLevel(EnchantmentRegistry.pyrotechnicAffinity.get(), firework.attachedToEntity);
            firework.lifetime *= 1 + enchLvl * 0.1;
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) FireworkRocketEntity(net.minecraft.entity.projectile.FireworkRocketEntity) ElytraItem(net.minecraft.item.ElytraItem) FireworkRocketEntity(net.minecraft.entity.projectile.FireworkRocketEntity) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 3 with ElytraItem

use of net.minecraft.item.ElytraItem in project BleachHack by BleachDrinker420.

the class ElytraReplace method onTick.

@BleachSubscribe
public void onTick(EventTick event) {
    if (mc.player.playerScreenHandler != mc.player.currentScreenHandler)
        return;
    int chestSlot = 38;
    ItemStack chest = mc.player.getInventory().getStack(chestSlot);
    if (chest.getItem() instanceof ElytraItem && chest.getDamage() == (Items.ELYTRA.getMaxDamage() - 1)) {
        // search inventory for elytra
        Integer elytraSlot = null;
        for (int slot = 0; slot < 36; slot++) {
            ItemStack stack = mc.player.getInventory().getStack(slot);
            if (stack.getItem() instanceof ElytraItem && stack.getDamage() != (Items.ELYTRA.getMaxDamage() - 1)) {
                elytraSlot = slot;
                break;
            }
        }
        if (elytraSlot == null) {
            return;
        }
        mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, 6, 0, SlotActionType.PICKUP, mc.player);
        mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, elytraSlot < 9 ? (elytraSlot + 36) : (elytraSlot), 0, SlotActionType.PICKUP, mc.player);
        mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, 6, 0, SlotActionType.PICKUP, mc.player);
        // Make them fly again
        mc.options.keyJump.setPressed(true);
        jump = true;
    } else if (jump) {
        // Make them fly again
        mc.options.keyJump.setPressed(false);
        jump = false;
    }
}
Also used : ElytraItem(net.minecraft.item.ElytraItem) ItemStack(net.minecraft.item.ItemStack) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Example 4 with ElytraItem

use of net.minecraft.item.ElytraItem in project LevelZ by Globox1997.

the class ItemStackClientMixin method getTooltipMixin.

@Inject(method = "getTooltip", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;appendTooltip(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Ljava/util/List;Lnet/minecraft/client/item/TooltipContext;)V"), locals = LocalCapture.CAPTURE_FAILSOFT)
private void getTooltipMixin(@Nullable PlayerEntity player, TooltipContext context, CallbackInfoReturnable<List<Text>> info, List<Text> list, int i) {
    if (player != null) {
        ItemStack stack = (ItemStack) (Object) this;
        ArrayList<Object> levelList = new ArrayList<Object>();
        // Block
        if (stack.getItem() instanceof BlockItem) {
            Block block = ((BlockItem) stack.getItem()).getBlock();
            // Alchemy check
            if (PlayerStatsManager.listContainsItemOrBlock(player, Registry.ITEM.getRawId(stack.getItem()), false)) {
                list.add(new TranslatableText("item.levelz.alchemy.tooltip", PlayerStatsManager.getUnlockLevel(Registry.ITEM.getRawId(stack.getItem()), false)).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
            if (block instanceof AnvilBlock) {
                levelList = LevelLists.anvilList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (block == Blocks.BEEHIVE) {
                levelList = LevelLists.beehiveList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (block == Blocks.BREWING_STAND) {
                levelList = LevelLists.brewingStandList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (block == Blocks.ENCHANTING_TABLE) {
                levelList = LevelLists.enchantingTableList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (block == Blocks.CAULDRON) {
                levelList = LevelLists.cauldronList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (block == Blocks.BARREL) {
                levelList = LevelLists.barrelList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (block == Blocks.BLAST_FURNACE) {
                levelList = LevelLists.blastFurnaceList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (block == Blocks.CARTOGRAPHY_TABLE) {
                levelList = LevelLists.cartographyList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (block == Blocks.COMPOSTER) {
                levelList = LevelLists.composterList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (block == Blocks.GRINDSTONE) {
                levelList = LevelLists.grindstoneList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (block == Blocks.LECTERN) {
                levelList = LevelLists.lecternList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (block == Blocks.LOOM) {
                levelList = LevelLists.loomList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (block == Blocks.SMITHING_TABLE) {
                levelList = LevelLists.smithingTableList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (block == Blocks.SMOKER) {
                levelList = LevelLists.smokerList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (block == Blocks.STONECUTTER) {
                levelList = LevelLists.stonecutterList;
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } else if (PlayerStatsManager.listContainsItemOrBlock(player, Registry.BLOCK.getRawId(block), true)) {
                list.add(new TranslatableText("item.levelz.mining.tooltip", PlayerStatsManager.getUnlockLevel(Registry.BLOCK.getRawId(block), true)).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else // Item
        if (stack.isIn(FabricToolTags.SHEARS)) {
            levelList = LevelLists.sheepList;
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (stack.isIn(FabricToolTags.PICKAXES) || stack.isIn(FabricToolTags.SHOVELS)) {
            levelList = LevelLists.toolList;
            String material = ((ToolItem) stack.getItem()).getMaterial().toString().toLowerCase();
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, material, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(levelList.indexOf(material) + 1).toString() + ".tooltip", levelList.get(levelList.indexOf(material) + 2).toString()).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (stack.isIn(FabricToolTags.AXES)) {
            levelList = LevelLists.axeList;
            String material = ((ToolItem) stack.getItem()).getMaterial().toString().toLowerCase();
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, material, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(levelList.indexOf(material) + 1).toString() + ".tooltip", levelList.get(levelList.indexOf(material) + 2).toString()).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (stack.isIn(FabricToolTags.HOES)) {
            levelList = LevelLists.hoeList;
            String material = ((ToolItem) stack.getItem()).getMaterial().toString().toLowerCase();
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, material, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(levelList.indexOf(material) + 1).toString() + ".tooltip", levelList.get(levelList.indexOf(material) + 2).toString()).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (stack.isIn(FabricToolTags.SWORDS)) {
            levelList = LevelLists.swordList;
            String material = ((ToolItem) stack.getItem()).getMaterial().toString().toLowerCase();
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, material, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(levelList.indexOf(material) + 1).toString() + ".tooltip", levelList.get(levelList.indexOf(material) + 2).toString()).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (stack.getItem() == Items.FLINT_AND_STEEL) {
            levelList = LevelLists.flintAndSteelList;
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (stack.getItem() == Items.GLASS_BOTTLE) {
            levelList = LevelLists.dragonBreathList;
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (stack.getItem() == Items.TOTEM_OF_UNDYING) {
            levelList = LevelLists.totemList;
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (stack.getItem() instanceof BowItem) {
            levelList = LevelLists.bowList;
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (stack.getItem() instanceof TridentItem) {
            levelList = LevelLists.tridentList;
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (stack.getItem() instanceof CrossbowItem) {
            levelList = LevelLists.crossbowList;
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (stack.getItem() instanceof ArmorItem) {
            try {
                levelList = LevelLists.armorList;
                String material = ((ArmorItem) stack.getItem()).getMaterial().getName().toLowerCase();
                if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, material, false)) {
                    list.add(new TranslatableText("item.levelz." + levelList.get(levelList.indexOf(material) + 1).toString() + ".tooltip", levelList.get(levelList.indexOf(material) + 2).toString()).formatted(Formatting.GRAY));
                    list.add(new TranslatableText("item.levelz.locked.tooltip"));
                }
            } catch (AbstractMethodError ignored) {
            }
        } else if (stack.getItem() instanceof ShieldItem) {
            levelList = LevelLists.shieldList;
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (stack.getItem() instanceof ElytraItem) {
            levelList = LevelLists.elytraList;
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (stack.getItem() instanceof BucketItem) {
            levelList = LevelLists.bucketList;
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (stack.getItem() instanceof FishingRodItem) {
            levelList = LevelLists.fishingList;
            if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, false)) {
                list.add(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)).formatted(Formatting.GRAY));
                list.add(new TranslatableText("item.levelz.locked.tooltip"));
            }
        } else if (PlayerStatsManager.listContainsItemOrBlock(player, Registry.ITEM.getRawId(stack.getItem()), false)) {
            list.add(new TranslatableText("item.levelz.alchemy.tooltip", PlayerStatsManager.getUnlockLevel(Registry.ITEM.getRawId(stack.getItem()), false)).formatted(Formatting.GRAY));
            list.add(new TranslatableText("item.levelz.locked.tooltip"));
        }
    }
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) ShieldItem(net.minecraft.item.ShieldItem) AnvilBlock(net.minecraft.block.AnvilBlock) ArrayList(java.util.ArrayList) BowItem(net.minecraft.item.BowItem) ElytraItem(net.minecraft.item.ElytraItem) BlockItem(net.minecraft.item.BlockItem) CrossbowItem(net.minecraft.item.CrossbowItem) ArmorItem(net.minecraft.item.ArmorItem) TridentItem(net.minecraft.item.TridentItem) FishingRodItem(net.minecraft.item.FishingRodItem) Block(net.minecraft.block.Block) AnvilBlock(net.minecraft.block.AnvilBlock) BucketItem(net.minecraft.item.BucketItem) ItemStack(net.minecraft.item.ItemStack) ToolItem(net.minecraft.item.ToolItem) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 5 with ElytraItem

use of net.minecraft.item.ElytraItem in project icaruswings_mod by LocusAzzurro.

the class EnchantmentBlessingOfTheSky method onEntityHurt.

@SubscribeEvent
public static void onEntityHurt(LivingHurtEvent e) {
    if (e.getEntity() instanceof LivingEntity) {
        LivingEntity livingEntity = (LivingEntity) e.getEntity();
        ItemStack armor = livingEntity.getItemBySlot(EquipmentSlotType.CHEST);
        if (livingEntity.isFallFlying() && armor.getItem() instanceof ElytraItem && EnchantmentHelper.getEnchantmentLevel(EnchantmentRegistry.blessingOfTheSky.get(), livingEntity) > 0 && isValidDamageType(e.getSource())) {
            e.setAmount(e.getAmount() / 2);
        }
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) ElytraItem(net.minecraft.item.ElytraItem) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Aggregations

ElytraItem (net.minecraft.item.ElytraItem)5 ItemStack (net.minecraft.item.ItemStack)4 ArmorItem (net.minecraft.item.ArmorItem)2 ToolItem (net.minecraft.item.ToolItem)2 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)2 BleachSubscribe (org.bleachhack.eventbus.BleachSubscribe)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 AnvilBlock (net.minecraft.block.AnvilBlock)1 Block (net.minecraft.block.Block)1 Entity (net.minecraft.entity.Entity)1 EquipmentSlot (net.minecraft.entity.EquipmentSlot)1 LivingEntity (net.minecraft.entity.LivingEntity)1 FireworkRocketEntity (net.minecraft.entity.projectile.FireworkRocketEntity)1 BlockItem (net.minecraft.item.BlockItem)1 BowItem (net.minecraft.item.BowItem)1 BucketItem (net.minecraft.item.BucketItem)1 CrossbowItem (net.minecraft.item.CrossbowItem)1 FishingRodItem (net.minecraft.item.FishingRodItem)1 ShieldItem (net.minecraft.item.ShieldItem)1