Résolu Enchantements sur items
-
bonjour je souhaiterai savoir comment ajouter knockback7 sur une épée par exemple et skiltouch 3 sur une pioche
et tout cela avec les items que l’on a créer avant
pour vous cela doit etre rien mais pour moi c’est introuvable et j’ai chercher avant et rien j’ai juste trouver pour les potions
Cordialement -
Salut,
ça ira mieux avec çahttp://www.minecraftforgefrance.fr/showthread.php?tid=183&pid=1926#pid1926
-
merci beaucoup et comment on l’ajoute a la creative tab car sa me prend l’épée sans l’effet mais le craft marche svp ?
-
@‘Libra’:
merci beaucoup et comment on l’ajoute a la creative tab car sa me prend l’épée sans l’effet mais le craft marche svp ?
Donne tes codes je vais regarder ce qui cloche pour l’enchantement
Pour l’ajouter tu ajoutes la méthode setCreativeTab(CreativeTabs.tabCombat) soit à la suite de l’initialisation de l’item soit dans son constructeur si il a une classe. -
voila la classe principale tout ce passe ici car sur l’épée je n’ai rien touché
:::package com.google.libra.modtest.common; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.Entity; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper; import com.google.libra.modtest.common.blocks.BlockOreTutoriel; import com.google.libra.modtest.common.blocks.BlockTutorialStairs; import com.google.libra.modtest.common.blocks.BlockTutoriel; import com.google.libra.modtest.common.blocks.BlockTutorielMetadata; import com.google.libra.modtest.common.blocks.FantasyBlock; import com.google.libra.modtest.common.blocks.FenceBlock; import com.google.libra.modtest.common.blocks.GreenWall; import com.google.libra.modtest.common.blocks.WallBlock; import com.google.libra.modtest.common.entity.Aznching; import com.google.libra.modtest.common.entity.Darkheaven; import com.google.libra.modtest.common.entity.EntityMonMob; import com.google.libra.modtest.common.entity.Oxilac; import com.google.monpetitflocon.modtest.common.items.FantasyNugget; import com.google.libra.modtest.common.items.FufuAple; import com.google.libra.modtest.common.items.HautEpee; import com.google.libra.modtest.common.items.ItemTutoArmor; import com.google.libra.modtest.common.items.ItemTutoAxe; import com.google.libra.modtest.common.items.ItemTutoHoe; import com.google.libra.modtest.common.items.ItemTutoPickaxe; import com.google.libra.modtest.common.items.ItemTutoShovel; import com.google.libra.modtest.common.items.ItemTutoSword; import com.google.libra.modtest.common.items.Letest; import com.google.libra.modtest.common.items.MancheEpee; import com.google.libra.modtest.common.items.MilieuEpee; import com.google.libra.modtest.proxy.CommonProxy; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = "ModTest.MODID", name = "Fantasy Mod", version = "1.0.0") public class ModTest { public static final String MODID = "modtest"; @Instance("MODID") public static ModTest instance; @SidedProxy(clientSide = "com.google.libra.modtest.proxy.ClientProxy", serverSide ="com.google.libra.modtest.proxy.CommonProxy") public static CommonProxy proxy; public static Item letest, fufuaple, helmetTuto, chestPlateTuto, leggingsTuto, bootsTuto, swordTuto, pickaxeTuto, axeTuto, shovelTuto, hoeTuto, MancheEpee, MilieuEpee, HautEpee,FantasyNugget; public static Block blockTutoriel, blockTutoriel2, blockMetadataTuto, blockTutoriel3, blocktutorialstairs,Wallblock, FantasyBlock,GreenFence,GreenStair,GreenWall,RedFence,RedStair,RedWall,PinkFence,PinkStair,PinkWall,OrangeFence,OrangeStair,OrangeWall; public static ArmorMaterial armorTuto = EnumHelper.addArmorMaterial("armorTuto", 45, new int[] {4, 9, 7, 4}, 30); public static ToolMaterial toolTuto = EnumHelper.addToolMaterial("toolTuto", 3, 1000, 12.0F, 4.0F, 20); public static ToolMaterial toolsword = EnumHelper.addToolMaterial("toolTuto", 3, 1000, 12.0F, 14.0F, 20); public static CreativeTabs FantasyBlockCreativeTabs = new FantasyBlockCreativeTabs("fantasy_block_creative_tabs"); public static CreativeTabs tutorialCreativeTabs = new TutorialCreativeTabs("tutorial_creative_tabs"); WorldGeneration worldgeneration = new WorldGeneration(); @EventHandler public void preInit(FMLPreInitializationEvent event) { letest = new Letest().setUnlocalizedName("letest").setTextureName(MODID + ":Item_letest"); fufuaple = new FufuAple(5, 1.5F, false).setAlwaysEdible().setUnlocalizedName("fufuaple").setTextureName(MODID + ":Item_fufuaple"); helmetTuto = new ItemTutoArmor(armorTuto, 0).setUnlocalizedName("helmetTuto").setTextureName(MODID + ":helmet_tutoriel"); chestPlateTuto = new ItemTutoArmor(armorTuto, 1).setUnlocalizedName("chestPlateTuto").setTextureName(MODID + ":chestplate_tutoriel"); leggingsTuto = new ItemTutoArmor(armorTuto, 2).setUnlocalizedName("leggingsTuto").setTextureName(MODID + ":leggings_tutoriel"); bootsTuto = new ItemTutoArmor(armorTuto, 3).setUnlocalizedName("bootsTuto").setTextureName(MODID + ":boots_tutoriel"); swordTuto = new ItemTutoSword(toolsword).setUnlocalizedName("swordTuto").setTextureName(MODID + ":sword_tutoriel"); pickaxeTuto = new ItemTutoPickaxe(toolTuto).setUnlocalizedName("pickaxeTuto").setTextureName(MODID + ":pickaxe_tutoriel"); axeTuto = new ItemTutoAxe(toolTuto).setUnlocalizedName("axeTuto").setTextureName(MODID + ":axe_tutoriel"); shovelTuto = new ItemTutoShovel(toolTuto).setUnlocalizedName("shovelTuto").setTextureName(MODID + ":shovel_tutoriel"); hoeTuto = new ItemTutoHoe(toolTuto).setUnlocalizedName("hoeTuto").setTextureName(MODID + ":hoe_tutoriel"); MancheEpee = new MancheEpee().setUnlocalizedName("MancheEpee").setTextureName(MODID + ":manche_epee"); MilieuEpee = new MilieuEpee().setUnlocalizedName("MilieuEpee").setTextureName(MODID + ":milieu_epee"); HautEpee = new HautEpee().setUnlocalizedName("HautEpee").setTextureName(MODID + ":haut_epee"); FantasyNugget = new FantasyNugget().setUnlocalizedName("FantasyNugget").setTextureName(MODID + ":fantasy_nugget"); GameRegistry.registerItem(letest, "item_letest"); GameRegistry.registerItem(fufuaple, "item_fufuaple"); GameRegistry.registerItem(helmetTuto, "item_tuto_helmet"); GameRegistry.registerItem(chestPlateTuto, "item_tuto_chestplate"); GameRegistry.registerItem(leggingsTuto, "item_tuto_leggings"); GameRegistry.registerItem(bootsTuto, "item_tuto_boots"); GameRegistry.registerItem(swordTuto, "item_tuto_sword"); GameRegistry.registerItem(pickaxeTuto, "item_tuto_pickaxe"); GameRegistry.registerItem(axeTuto, "item_tuto_axe"); GameRegistry.registerItem(shovelTuto, "item_tuto_shovel"); GameRegistry.registerItem(hoeTuto, "item_tuto_hoe"); GameRegistry.registerItem(MancheEpee, "manche_epee"); GameRegistry.registerItem(MilieuEpee, "milieu_epee"); GameRegistry.registerItem(HautEpee, "haut_epee"); GameRegistry.registerItem(FantasyNugget, "fantasy_nugget"); blockTutoriel = new BlockOreTutoriel(Material.rock).setHardness(15.0F).setResistance(10.0F).setBlockName("tutoriel").setBlockTextureName(MODID + ":block_tutoriel"); blockTutoriel2 = new BlockTutoriel(Material.wood).setHardness(1.5F).setResistance(10.0F).setBlockName("tutoriel2").setBlockTextureName(MODID + ":block_tutoriel2"); blockMetadataTuto = new BlockTutorielMetadata().setBlockName("metadataTuto").setHardness(1.5F).setResistance(10.0F).setCreativeTab(ModTest.FantasyBlockCreativeTabs); blockTutoriel3 = new FenceBlock(MODID +":fantasy_block", Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("tutoriel3"); blocktutorialstairs = new BlockTutorialStairs(ModTest.blockTutoriel3, 0, Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("TutorialStairs").setBlockTextureName(MODID + ":fantasy_block"); Wallblock = new WallBlock(blockTutoriel3).setBlockName("WallBlock"); FantasyBlock = new FantasyBlock(Material.rock).setHardness(5.0F).setResistance(10.0F).setBlockName("FantasyBlock").setBlockTextureName(MODID + ":fantasy_block"); GreenFence = new FenceBlock(MODID +":block4", Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("green_fence"); GreenStair = new BlockTutorialStairs(ModTest.GreenFence, 0, Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("green_stair").setBlockTextureName(MODID + ":block4"); GreenWall = new GreenWall(ModTest.GreenFence).setBlockName("GreenWall"); RedFence = new FenceBlock(MODID +":block1", Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("red_fence"); RedStair = new BlockTutorialStairs(ModTest.RedFence, 0, Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("red_stair").setBlockTextureName(MODID + ":block1"); RedWall = new com.google.libra.modtest.common.blocks.RedWall(ModTest.RedFence).setBlockName("RedWall"); PinkFence = new FenceBlock(MODID +":block2", Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("pink_fence"); PinkStair = new BlockTutorialStairs(ModTest.PinkFence, 0, Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("pink_stair").setBlockTextureName(MODID + ":block2"); PinkWall = new com.google.libra.modtest.common.blocks.PinkWall(ModTest.PinkFence).setBlockName("PinkWall"); OrangeFence = new FenceBlock(MODID +":block3", Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("orange_fence"); OrangeStair = new BlockTutorialStairs(ModTest.OrangeFence, 0, Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("orange_stair").setBlockTextureName(MODID + ":block3"); OrangeWall = new com.google.libra.modtest.common.blocks.OrangeWall(ModTest.OrangeFence).setBlockName("OrangeWall"); GameRegistry.registerBlock(blockTutoriel, "block_tutoriel"); GameRegistry.registerBlock(blockTutoriel2, "block_tutoriel2"); GameRegistry.registerBlock(blockMetadataTuto, ItemBlockMetadataTutoriel.class, "block_tuto_metadata", new Object[]{BlockTutorielMetadata.subBlock}); GameRegistry.registerBlock(blockTutoriel3, "block_tutoriel3"); GameRegistry.registerBlock(blocktutorialstairs, "TutorialStairs"); GameRegistry.registerBlock(Wallblock, "Wall_block"); GameRegistry.registerBlock(FantasyBlock, "Fantasy_block"); GameRegistry.registerBlock(GreenFence, "green_fence"); GameRegistry.registerBlock(GreenStair, "green_stair"); GameRegistry.registerBlock(GreenWall, "green_wall"); GameRegistry.registerBlock(RedFence, "red_fence"); GameRegistry.registerBlock(RedStair, "red_stair"); GameRegistry.registerBlock(RedWall, "red_wall"); GameRegistry.registerBlock(PinkFence, "pink_fence"); GameRegistry.registerBlock(PinkStair, "pink_stair"); GameRegistry.registerBlock(PinkWall, "pink_wall"); GameRegistry.registerBlock(OrangeFence, "orange_fence"); GameRegistry.registerBlock(OrangeStair, "orange_stair"); GameRegistry.registerBlock(OrangeWall, "orange_wall"); GameRegistry.registerWorldGenerator(worldgeneration, 0); } @EventHandler public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new LivingEventHandler()); FMLCommonHandler.instance().bus().register(new PlayerEventHandler()); MinecraftForge.EVENT_BUS.register(new PlayerEventHandler()); addEntity(EntityMonMob.class, "MobTuto", 125, 255, 100); addEntity(Darkheaven.class, "Darkheaven", 126, 255, 100); addEntity(Aznching.class, "Aznching", 127, 255, 100); addEntity(Oxilac.class, "Oxilac", 128, 255, 100); EntityRegistry.addSpawn(EntityMonMob.class, 100, 4, 4, EnumCreatureType.creature, BiomeGenBase.plains); proxy.registerRender(); ItemStack itemenchante = new ItemStack(swordTuto, 1, 0); itemenchante.addEnchantment(Enchantment.knockback, 5); itemenchante.addEnchantment(Enchantment.looting, 2); itemenchante.addEnchantment(Enchantment.baneOfArthropods, 2); itemenchante.addEnchantment(Enchantment.sharpness, 5); itemenchante.addEnchantment(Enchantment.smite, 4); //Recipes GameRegistry.addRecipe(new ItemStack(helmetTuto), new Object[]{"XXX", "X X", " ", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(chestPlateTuto), new Object[]{"X X", "XXX", "XXX", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(leggingsTuto), new Object[]{"XXX", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(bootsTuto), new Object[]{" ", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(itemenchante, new Object[]{"X ", " Y ", " Z", 'X', ModTest.HautEpee, 'Y', new ItemStack(ModTest.MilieuEpee), 'Z', new ItemStack(ModTest.MancheEpee),}); GameRegistry.addRecipe(new ItemStack(pickaxeTuto), new Object[]{"XXX", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(axeTuto), new Object[]{" XX", " YX", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(shovelTuto), new Object[]{" X ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(hoeTuto), new Object[]{"XX ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(blockTutoriel2), new Object[]{"XY ", "ZA ", " ", 'X', ModTest.fufuaple, 'Y', new ItemStack(Items.cooked_porkchop), 'Z', new ItemStack(Blocks.wool), 'A', new ItemStack(Blocks.wool, 1, 15),}); GameRegistry.addRecipe(new ItemStack(fufuaple), new Object[]{"XXX", "XYX", "XXX", 'X',ModTest.letest, 'Y', new ItemStack(Items.golden_apple),}); GameRegistry.addRecipe(new ItemStack(FantasyBlock), new Object[]{"XXX", "XXX", "XXX", 'X',ModTest.letest, }); GameRegistry.addRecipe(new ItemStack(letest, 9), new Object[]{"X ", " ", " ", 'X',ModTest.FantasyBlock, }); GameRegistry.addRecipe(new ItemStack(FantasyNugget , 9), new Object[]{"X ", " ", " ", 'X',ModTest.letest, }); GameRegistry.addRecipe(new ItemStack(letest), new Object[]{"XXX", "XXX", "XXX", 'X',ModTest.FantasyNugget, }); GameRegistry.addRecipe(new ItemStack(blockTutoriel3, 3), new Object[]{" ", "XYX", "XYX", 'X',ModTest.FantasyNugget, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(Wallblock, 6), new Object[]{" ", "XXX", "XXX", 'X',ModTest.FantasyNugget, }); GameRegistry.addRecipe(new ItemStack(blocktutorialstairs, 4), new Object[]{" X", " XX", "XXX", 'X',ModTest.FantasyNugget, }); GameRegistry.addRecipe(new ItemStack(blockMetadataTuto, 1, 0), new Object[]{"XY ", " ", " ", 'X',ModTest.FantasyBlock, 'Y', new ItemStack(Items.dye, 1, 1),}); GameRegistry.addRecipe(new ItemStack(blockMetadataTuto, 1, 1), new Object[]{"XY ", " ", " ", 'X',ModTest.FantasyBlock, 'Y', new ItemStack(Items.dye, 1, 9),}); GameRegistry.addRecipe(new ItemStack(blockMetadataTuto, 1, 2), new Object[]{"XY ", " ", " ", 'X',ModTest.FantasyBlock, 'Y', new ItemStack(Items.dye, 1, 14),}); GameRegistry.addRecipe(new ItemStack(blockMetadataTuto, 1, 3), new Object[]{"XY ", " ", " ", 'X',ModTest.FantasyBlock, 'Y', new ItemStack(Items.dye, 1, 10),}); GameRegistry.addRecipe(new ItemStack(GreenWall, 3), new Object[]{"XY ", " ", " ", 'X',ModTest.Wallblock, 'Y', new ItemStack(Items.dye, 3, 10),}); GameRegistry.addRecipe(new ItemStack(RedWall, 3), new Object[]{"XY ", " ", " ", 'X',ModTest.Wallblock, 'Y', new ItemStack(Items.dye, 3, 1),}); GameRegistry.addRecipe(new ItemStack(PinkWall, 3), new Object[]{"XY ", " ", " ", 'X',ModTest.Wallblock, 'Y', new ItemStack(Items.dye, 3, 9),}); GameRegistry.addRecipe(new ItemStack(OrangeWall, 3), new Object[]{"XY ", " ", " ", 'X',ModTest.Wallblock, 'Y', new ItemStack(Items.dye, 3, 14),}); GameRegistry.addRecipe(new ItemStack(GreenFence, 3), new Object[]{"XY ", " ", " ", 'X',ModTest.blockTutoriel3, 'Y', new ItemStack(Items.dye, 3, 10),}); GameRegistry.addRecipe(new ItemStack(RedFence, 3), new Object[]{"XY ", " ", " ", 'X',ModTest.blockTutoriel3, 'Y', new ItemStack(Items.dye, 3, 1),}); GameRegistry.addRecipe(new ItemStack(PinkFence, 3), new Object[]{"XY ", " ", " ", 'X',ModTest.blockTutoriel3, 'Y', new ItemStack(Items.dye, 3, 9),}); GameRegistry.addRecipe(new ItemStack(OrangeFence, 3), new Object[]{"XY ", " ", " ", 'X',ModTest.blockTutoriel3, 'Y', new ItemStack(Items.dye, 3, 14),}); GameRegistry.addRecipe(new ItemStack(GreenStair, 3), new Object[]{"XY ", " ", " ", 'X',ModTest.blocktutorialstairs, 'Y', new ItemStack(Items.dye, 3, 10),}); GameRegistry.addRecipe(new ItemStack(RedStair, 3), new Object[]{"XY ", " ", " ", 'X',ModTest.blocktutorialstairs, 'Y', new ItemStack(Items.dye, 3, 1),}); GameRegistry.addRecipe(new ItemStack(PinkStair, 3), new Object[]{"XY ", " ", " ", 'X',ModTest.blocktutorialstairs, 'Y', new ItemStack(Items.dye, 3, 9),}); GameRegistry.addRecipe(new ItemStack(OrangeStair, 3), new Object[]{"XY ", " ", " ", 'X',ModTest.blocktutorialstairs, 'Y', new ItemStack(Items.dye, 3, 14),}); //Oeufs de mobs GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 51), new Object[]{"XY ", " ", " ", 'X',Items.bone, 'Y', new ItemStack(Items.egg),}); //Squelette GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 50), new Object[]{"XY ", " ", " ", 'X',Items.gunpowder, 'Y', new ItemStack(Items.egg),}); //Creeper GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 52), new Object[]{"XY ", " ", " ", 'X',Items.spider_eye, 'Y', new ItemStack(Items.egg),}); //Araignée GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 54), new Object[]{"XY ", " ", " ", 'X',Items.rotten_flesh, 'Y', new ItemStack(Items.egg),}); //Zombie GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 55), new Object[]{"XY ", " ", " ", 'X',Items.slime_ball, 'Y', new ItemStack(Items.egg),}); GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 56), new Object[]{"XY ", " ", " ", 'X',Items.ghast_tear, 'Y', new ItemStack(Items.egg),}); //Ghast GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 57), new Object[]{"XY ", " ", " ", 'X',Items.golden_sword, 'Y', new ItemStack(Items.egg),}); //Cochon Zombie GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 58), new Object[]{"XY ", " ", " ", 'X',Items.ender_pearl, 'Y', new ItemStack(Items.egg),}); //Enderman GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 59), new Object[]{"XY ", " ", " ", 'X',Items.fermented_spider_eye, 'Y', new ItemStack(Items.egg),}); //Cave Spider GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 61), new Object[]{"XY ", " ", " ", 'X',Items.blaze_rod, 'Y', new ItemStack(Items.egg),}); //Blaze GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 62), new Object[]{"XY ", " ", " ", 'X',Items.magma_cream, 'Y', new ItemStack(Items.egg),}); // Cube de Magma GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 66), new Object[]{"XY ", " ", " ", 'X',Items.glass_bottle, 'Y', new ItemStack(Items.egg),}); // Sorcière //Oeufs D'animaux GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 90), new Object[]{"XY ", " ", " ", 'X',Items.porkchop, 'Y', new ItemStack(Items.egg),}); // Cochon GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 91), new Object[]{"XY ", " ", " ", 'X',Blocks.wool, 'Y', new ItemStack(Items.egg),}); // Mouton GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 92), new Object[]{"XY ", " ", " ", 'X',Items.beef, 'Y', new ItemStack(Items.egg),}); // Vache GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 93), new Object[]{"XY ", " ", " ", 'X',Items.feather, 'Y', new ItemStack(Items.egg),}); // Poule GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 94), new Object[]{"XY ", " ", " ", 'X',Items.dye, 'Y', new ItemStack(Items.egg),}); // Poulpe GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 95), new Object[]{"XY ", " ", " ", 'X',Items.cooked_beef, 'Y', new ItemStack(Items.egg),}); // Loup GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 96), new Object[]{"XY ", " ", " ", 'X',Items.mushroom_stew, 'Y', new ItemStack(Items.egg),}); // Champimeuh GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 98), new Object[]{"XY ", " ", " ", 'X',Items.fish, 'Y', new ItemStack(Items.egg),}); // Ocelot GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 100), new Object[]{"XY ", " ", " ", 'X',Items.leather, 'Y', new ItemStack(Items.egg),}); // Cheval GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 120), new Object[]{"XY ", " ", " ", 'X',Items.emerald, 'Y', new ItemStack(Items.egg),}); // Villager //Parts GameRegistry.addRecipe(new ItemStack(ModTest.MancheEpee), new Object[]{" Y", " Y ", "X ", 'X',ModTest.letest, 'Y', new ItemStack(Items.stick),}); // Manche Epee GameRegistry.addRecipe(new ItemStack(ModTest.MilieuEpee), new Object[]{"X X", " X ", " ", 'X',ModTest.letest,}); // Milieu Epee GameRegistry.addRecipe(new ItemStack(ModTest.HautEpee), new Object[]{" X ", "XYX", "XYX", 'X',ModTest.letest, 'Y', new ItemStack(Items.diamond),}); // Haut Epee } @EventHandler public void postInit(FMLPostInitializationEvent event) { } public void addEntity(Class entityClass, String name, int id, int backgroundEggColour,int foregroundEggColour) { EntityRegistry.registerGlobalEntityID(entityClass, name, EntityRegistry.findGlobalUniqueEntityId(), backgroundEggColour, foregroundEggColour); EntityRegistry.registerModEntity(entityClass, name, id, this, 40, 1, true); } }
:::
oui c’est chelou mais c’est pour test surtout au niveau des crafts
sinon l.170 -
Tu veux que l’épée apparaisse enchanté dans l’onglet créatif ?
-
oui c’est cela
-
Dans la classe de ton épée ajoute :
public void getSubItems(Item item, CreativeTabs tab, List list) { ItemStack itemenchante = new ItemStack(swordTuto, 1, 0); itemenchante.addEnchantment(Enchantment.knockback, 5); itemenchante.addEnchantment(Enchantment.looting, 2); itemenchante.addEnchantment(Enchantment.baneOfArthropods, 2); itemenchante.addEnchantment(Enchantment.sharpness, 5); itemenchante.addEnchantment(Enchantment.smite, 4); list.add(itemenchante); }
-
merci mais list en haut est souligné en rouge et il me dit d’ajouter “… VariableDeclaratorId”
je ne vois pas a quoi sa sert -
Essaies comme ceci
public void getSubItems(Item item, CreativeTabs tab, List list) { ItemStack itemenchante = new ItemStack(swordTuto, 1, 0); itemenchante.addEnchantment(Enchantment.knockback, 5); itemenchante.addEnchantment(Enchantment.looting, 2); itemenchante.addEnchantment(Enchantment.baneOfArthropods, 2); itemenchante.addEnchantment(Enchantment.sharpness, 5); itemenchante.addEnchantment(Enchantment.smite, 4); list.add(itemenchante); }
-
Merci beaucoup cela fonctionne le code était donc
public void getSubItems(Item item, CreativeTabs tab, List list) { ItemStack itemenchante = new ItemStack(ModTest.swordTuto, 1, 0); itemenchante.addEnchantment(Enchantment.knockback, 5); itemenchante.addEnchantment(Enchantment.looting, 2); itemenchante.addEnchantment(Enchantment.baneOfArthropods, 2); itemenchante.addEnchantment(Enchantment.sharpness, 5); itemenchante.addEnchantment(Enchantment.smite, 4); list.add(itemenchante); }
il falait ajouter la classe principale sinon sa ne marche pas