package net.mcreator.winxclub.item; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.client.extensions.common.IClientItemExtensions; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.Dist; import net.minecraft.world.level.Level; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Item; import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ArmorItem; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.Entity; import net.minecraft.sounds.SoundEvent; import net.minecraft.resources.ResourceLocation; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.Minecraft; import net.mcreator.winxclub.procedures.BloomMagicWinxBodyTickEventProcedure; import net.mcreator.winxclub.client.model.Modelbloom_magic_winx; import java.util.function.Consumer; import java.util.Map; import java.util.Collections; public abstract class BloomMagicWinxItem extends ArmorItem { public BloomMagicWinxItem(EquipmentSlot slot, Item.Properties properties) { super(new ArmorMaterial() { @Override public int getDurabilityForSlot(EquipmentSlot slot) { return new int[]{13, 15, 16, 11}[slot.getIndex()] * 0; } @Override public int getDefenseForSlot(EquipmentSlot slot) { return new int[]{0, 0, 0, 0}[slot.getIndex()]; } @Override public int getEnchantmentValue() { return 0; } @Override public SoundEvent getEquipSound() { return ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("")); } @Override public Ingredient getRepairIngredient() { return Ingredient.EMPTY; } @Override public String getName() { return "bloom_magic_winx"; } @Override public float getToughness() { return 0f; } @Override public float getKnockbackResistance() { return 0f; } }, slot, properties); } public static class Helmet extends BloomMagicWinxItem { public Helmet() { super(EquipmentSlot.HEAD, new Item.Properties().tab(null).fireResistant()); } @Override public void initializeClient(Consumer consumer) { consumer.accept(new IClientItemExtensions() { @Override public HumanoidModel getHumanoidArmorModel(LivingEntity living, ItemStack stack, EquipmentSlot slot, HumanoidModel defaultModel) { HumanoidModel armorModel = new HumanoidModel(new ModelPart(Collections.emptyList(), Map.of("head", new Modelbloom_magic_winx( Minecraft.getInstance().getEntityModels().bakeLayer(Modelbloom_magic_winx.LAYER_LOCATION)).Crown, "hat", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "body", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "right_arm", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "left_arm", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "right_leg", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "left_leg", new ModelPart(Collections.emptyList(), Collections.emptyMap())))); armorModel.crouching = living.isShiftKeyDown(); armorModel.riding = defaultModel.riding; armorModel.young = living.isBaby(); return armorModel; } }); } @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { return "winxclub:textures/entities/bloom_magic_winx.png"; } } public static class Chestplate extends BloomMagicWinxItem { public Chestplate() { super(EquipmentSlot.CHEST, new Item.Properties().tab(null).fireResistant()); } @Override public void initializeClient(Consumer consumer) { consumer.accept(new IClientItemExtensions() { @Override @OnlyIn(Dist.CLIENT) public HumanoidModel getHumanoidArmorModel(LivingEntity living, ItemStack stack, EquipmentSlot slot, HumanoidModel defaultModel) { HumanoidModel armorModel = new HumanoidModel(new ModelPart(Collections.emptyList(), Map.of("body", new Modelbloom_magic_winx( Minecraft.getInstance().getEntityModels().bakeLayer(Modelbloom_magic_winx.LAYER_LOCATION)).Torso, "left_arm", new Modelbloom_magic_winx( Minecraft.getInstance().getEntityModels().bakeLayer(Modelbloom_magic_winx.LAYER_LOCATION)).LetftArm, "right_arm", new Modelbloom_magic_winx( Minecraft.getInstance().getEntityModels().bakeLayer(Modelbloom_magic_winx.LAYER_LOCATION)).RightArm, "head", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "hat", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "right_leg", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "left_leg", new ModelPart(Collections.emptyList(), Collections.emptyMap())))); armorModel.crouching = living.isShiftKeyDown(); armorModel.riding = defaultModel.riding; armorModel.young = living.isBaby(); return armorModel; } }); } @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { return "winxclub:textures/entities/bloom_magic_winx.png"; } @Override public void onArmorTick(ItemStack itemstack, Level world, Player entity) { BloomMagicWinxBodyTickEventProcedure.execute(world, entity.getX(), entity.getZ(), entity); } } public static class Leggings extends BloomMagicWinxItem { public Leggings() { super(EquipmentSlot.LEGS, new Item.Properties().tab(null).fireResistant()); } @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { return "winxclub:textures/models/armor/bloommagicwinx__layer_2.png"; } } public static class Boots extends BloomMagicWinxItem { public Boots() { super(EquipmentSlot.FEET, new Item.Properties().tab(null).fireResistant()); } @Override public void initializeClient(Consumer consumer) { consumer.accept(new IClientItemExtensions() { @Override @OnlyIn(Dist.CLIENT) public HumanoidModel getHumanoidArmorModel(LivingEntity living, ItemStack stack, EquipmentSlot slot, HumanoidModel defaultModel) { HumanoidModel armorModel = new HumanoidModel(new ModelPart(Collections.emptyList(), Map.of("left_leg", new Modelbloom_magic_winx( Minecraft.getInstance().getEntityModels().bakeLayer(Modelbloom_magic_winx.LAYER_LOCATION)).LeftBoot, "right_leg", new Modelbloom_magic_winx( Minecraft.getInstance().getEntityModels().bakeLayer(Modelbloom_magic_winx.LAYER_LOCATION)).RightBoot, "head", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "hat", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "body", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "right_arm", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "left_arm", new ModelPart(Collections.emptyList(), Collections.emptyMap())))); armorModel.crouching = living.isShiftKeyDown(); armorModel.riding = defaultModel.riding; armorModel.young = living.isBaby(); return armorModel; } }); } @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { return "winxclub:textures/entities/bloom_magic_winx.png"; } } }