Enchant fait une seule fois



  • Bonjour, j'ai crée un enchantement autosmelt et il cuit l'item qu'une seule fois

    package com.extremium.mod.enchantements;
    
    import cpw.mods.fml.common.eventhandler.SubscribeEvent;
    import net.minecraft.item.ItemStack;
    import net.minecraft.item.crafting.FurnaceRecipes;
    import net.minecraftforge.event.world.BlockEvent;
    
    public class EnchantMod2
    {
        @SubscribeEvent
        public void onOreDestroyed(BlockEvent.HarvestDropsEvent event)
        {
            for(ItemStack drop : event.drops)
                {
                    ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(drop);
                    if(result != null)
                    {
                        event.drops.remove(drop);
                        event.drops.add(result);
                }
                
            }
        }
        
        public boolean hasEnchantment(ItemStack stack, int id) {
            boolean flag = false;
            if (stack.getEnchantmentTagList() != null) {
                for (int i = 0; i < stack.getEnchantmentTagList().tagCount(); i++) {
                    if (stack.getEnchantmentTagList().getCompoundTagAt(i).getShort("id") == id) {
                        flag = true;
                    } else {
                        flag = false;
                    }
                }
            }
            return flag;
        }
    
    }
    


  • This post is deleted!

Log in to reply