Résolu [CreativeTab]
-
Bonjour, j’ai un petit problème avec ma CreativeTab, je n’arrive pas introduire des items/blocks a l’intérieur.
(Ma CreativeTab se nomme : “Ctab”.)
voici le code de mon items :
Wrench = new Wrench() .setUnlocalizedName("Wrench") .setMaxStackSize(1) .setCreativeTab(Ctab)
Le code de ma classe principale :
%(#333333)[public static CreativeTabs Ctab = new Ctab("Ctab");]
Le code de la classe de ma CreativeTab :
%(#333333)[import java.util.List; ] import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class Ctab extends CreativeTabs { public Ctab(String ctab) { super(ctab); } @Override public Item getTabIconItem() { return Item.getItemFromBlock(mod_mechanicalcraft.Crusher); } @Override public void displayAllReleventItems(List list) { } }
Pourtant j’ai bien suivi le tuto du forum, mais ça ne fonctionne pas.
Merci de bien vouloir me répondre.
-
Par convention ici :
public static CreativeTabs Ctab = new Ctab(“Ctab”);
Ctab devrait être en minuscule. Sinon il y a risque de confusion entre la classe et l’objet. Une nom de variable commence toujours pas une minuscule et un nom de classe par une majuscule.
Du-coup ici :Wrench = new Wrench() .setUnlocalizedName("Wrench") .setMaxStackSize(1) .setCreativeTab(Ctab)
Minuscule aussi.
-
J’ai modifié le nom de variable mais sans résultat.
-
Retires la fonction
@Override public void displayAllReleventItems(List list) { }
-
Quand j’ai ajouté cette fonction le Tab ne fonctionnait déjà pas. Y-a-t-il un GameRegistry pour les tabs ? ou autre chose? :huh:
-
Non, il n’y a pas besoin de l’enregistrer.
L’onglet est vide ou il est juste pas présent ?
-
Il est vide, j’ai beau mettre des items/blocs dedans avec setCreativeTab mais çà ne marche pas.
-
Tes items sont bien présent en jeu ?
Peux-tu envoyé ta classe principale complète ?
-
Oui, mes items sont présents dans le jeu
package com.google.SpyMan.Mechanicalcraft.common; import java.util.ArrayList; import java.util.List; import net.minecraft.creativetab.CreativeTabs; 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.ItemAxe; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.oredict.OreDictionary; import com.google.SpyMan.Mechanicalcraft.proxy.ClientProxy; import com.google.SpyMan.Mechanicalcraft.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.GameRegistry; @Mod(modid = "modmechanicalcraft", name = "MechanicalCraft_beta", version = "1.0.0") public class mod_mechanicalcraft { @Instance("modmechanicalcraft") public static mod_mechanicalcraft instance; @SidedProxy(clientSide = "com.google.SpyMan.Mechanicalcraft.proxy.ClientProxy", serverSide = "com.google.SpyMan.Mechanicalcraft.proxy.CommonProxy") public static CommonProxy proxy; // Item –--------------------------------------------- public static Item Wrench, Hammer, Pliers; public static Item SteelPickaxe, SteelAxe, SteelShovel, SteelSword, SteelHoe; public static Item steelIngot, copperIngot; public static Item ironPlate, steelPlate, copperPlate; public static Item ironGear, steelGear, copperGear; public static Item redstoneCrystal; public static Item steelDust, coalDust, ironDust, copperDust; public static Item Engine; public static Item crusherBlade; // Blocks ---------------------------------------------- public static Block Crusher; public static Block MachineBlock; // Other ------------------------------------------------- public static ToolMaterial SteelTools = EnumHelper.addToolMaterial( "SteelTools", 2, 649, 10.0F, 3.0F, 20); public static CreativeTabs creatab; @EventHandler public void preInit(FMLPreInitializationEvent event) { // Item --------------------------------------------- Wrench = new Wrench().setUnlocalizedName("Wrench").setMaxStackSize(1) .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:Wrench"); Hammer = new Hammer().setUnlocalizedName("Hammer").setMaxStackSize(1) .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:Hammer"); steelIngot = new steelIngot().setUnlocalizedName("steelIngot") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:steelingot"); coalDust = new coalDust().setUnlocalizedName("coalDust") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:coaldust"); ironPlate = new ironPlate().setUnlocalizedName("ironPlate") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:ironplate"); steelPlate = new steelPlate().setUnlocalizedName("steelPlate") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:steelplate"); ironGear = new ironGear().setUnlocalizedName("ironGear") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:irongear"); redstoneCrystal = new redstoneCrystal() .setUnlocalizedName("redstoneCrystal") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:redstonecrystal"); steelGear = new steelGear().setUnlocalizedName("steelGear") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:steelGear"); ironDust = new ironDust().setUnlocalizedName("ironDust") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:ironDust"); steelDust = new steelDust().setUnlocalizedName("steelDust") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:steelDust"); Pliers = new Pliers().setUnlocalizedName("Pliers").setMaxStackSize(1) .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:pliers"); Engine = new Engine().setUnlocalizedName("Engine") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:engine"); copperGear = new CopperGear().setUnlocalizedName("copperGear") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:copperGear"); copperIngot = new CopperIngot().setUnlocalizedName("copperIngot") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:copperIngot"); copperDust = new CopperDust().setUnlocalizedName("copperDust") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:copperDust"); copperPlate = new copperPlate().setUnlocalizedName("copperPlate") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:copperPlate"); crusherBlade = new crusherBlade().setUnlocalizedName("crusherBlade") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:crusherBlade"); SteelPickaxe = new SteelPickaxe(SteelTools) .setUnlocalizedName("SteelPickaxe") .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:steelpickaxe"); SteelAxe = new SteelAxe(SteelTools).setUnlocalizedName("SteelAxe") .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:steelaxe"); SteelShovel = new SteelShovel(SteelTools) .setUnlocalizedName("SteelShovel") .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:steelshovel"); SteelSword = new SteelSword(SteelTools) .setUnlocalizedName("SteelSword") .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:steelsword"); SteelHoe = new SteelHoe(SteelTools).setUnlocalizedName("SteelHoe") .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:steelhoe"); // Blocks ------------------------------------------------ Crusher = new Crusher(Material.iron).setBlockName("Crusher") .setCreativeTab(CreativeTabs.tabRedstone); MachineBlock = new MachineBlock(Material.iron) .setCreativeTab(CreativeTabs.tabMaterials) .setBlockName("MachineBlock") .setBlockTextureName("modmechanicalcraft:crusher_left_right"); // Other ------------------------------------------------------- creatab = new Ctab("Ctab"); // Item -------------------------------------------------- GameRegistry.registerItem(Wrench, "Wrench"); GameRegistry.registerItem(Hammer, "Hammer"); GameRegistry.registerItem(steelIngot, "steelIngot"); GameRegistry.registerItem(coalDust, "coalDust"); GameRegistry.registerItem(ironPlate, "ironPlate"); GameRegistry.registerItem(steelPlate, "steelPlate"); GameRegistry.registerItem(ironGear, "ironGear"); GameRegistry.registerItem(steelGear, "steelGear"); GameRegistry.registerItem(steelDust, "steelDust"); GameRegistry.registerItem(ironDust, "ironDust"); GameRegistry.registerItem(redstoneCrystal, "redstoneCrystal"); GameRegistry.registerItem(Engine, "Engine"); GameRegistry.registerItem(Pliers, "Pliers"); GameRegistry.registerItem(copperIngot, "copperIngot"); GameRegistry.registerItem(copperDust, "copperDust"); GameRegistry.registerItem(copperGear, "copperGear"); GameRegistry.registerItem(copperPlate, "copperPlate"); GameRegistry.registerItem(crusherBlade, "crusherBlade"); GameRegistry.registerItem(SteelPickaxe, "SteelPickaxe"); GameRegistry.registerItem(SteelAxe, "SteelAxe"); GameRegistry.registerItem(SteelShovel, "SteelShovel"); GameRegistry.registerItem(SteelSword, "SteelSword"); GameRegistry.registerItem(SteelHoe, "SteelHoe"); // Blocks --------------------------------------------- GameRegistry.registerBlock(Crusher, "Crusher"); GameRegistry.registerBlock(MachineBlock, "MachineBlock"); // TileEntity --------------------------------------------- GameRegistry.registerTileEntity(TileCrusher.class, "modmechanicalcraft:Crusher"); // Other----------------------------------------------------------------- // ----------------------------------------------------------------- // Recipe -------------------------------------------------------------- GameRegistry.addRecipe(new ItemStack(Wrench, 1, 0), new Object[]{"I I", " O ", " I ", 'I', new ItemStack(Items.iron_ingot, 1, 0), 'O', new ItemStack(Items.dye, 1, 14)}); GameRegistry.addRecipe(new ItemStack(Hammer, 1, 0), new Object[]{"III", "III", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(Items.iron_ingot, 1, 0)}); GameRegistry .addShapelessRecipe(new ItemStack(ironPlate, 2, 0), new Object[]{ new ItemStack(Items.iron_ingot, 1, 0), new ItemStack(Hammer, 1, OreDictionary.WILDCARD_VALUE)}); GameRegistry .addShapelessRecipe(new ItemStack(steelPlate, 2), new Object[]{ new ItemStack(steelIngot, 1, 0), new ItemStack(Hammer, 1, OreDictionary.WILDCARD_VALUE)}); GameRegistry.addRecipe(new ItemStack(ironGear, 1, 0), new Object[]{ " I ", "ICI", " I ", 'I', new ItemStack(Items.iron_ingot, 1, 0), 'C', new ItemStack(copperGear, 1, 0)}); GameRegistry.addRecipe(new ItemStack(steelGear, 1, 0), new Object[]{ " L ", "LIL", " L ", 'L', new ItemStack(steelIngot, 1, 0), 'I', new ItemStack(ironGear, 1, 0)}); GameRegistry.addRecipe(new ItemStack(crusherBlade, 1, 0), new Object[]{ " D ", "DID", " D ", 'I', new ItemStack(Items.iron_ingot, 1, 0), 'D', new ItemStack(Items.diamond, 1, 0)}); GameRegistry.addShapelessRecipe(new ItemStack(steelDust, 2), new Object[]{new ItemStack(ironDust, 1, 0), new ItemStack(ironDust, 1, 0), new ItemStack(coalDust, 1, 0), new ItemStack(coalDust, 1, 0)}); GameRegistry.addRecipe(new ItemStack(redstoneCrystal, 1, 0), new Object[]{"RRR", "RDR", "RRR", 'R', new ItemStack(Items.redstone, 1, 0), 'D', new ItemStack(Items.diamond, 1, 0)}); GameRegistry.addRecipe(new ItemStack(Pliers, 1, 0), new Object[]{"I I", " I ", "D D", 'I', new ItemStack(Items.iron_ingot, 1, 0), 'D', new ItemStack(Items.dye, 1, 6)}); GameRegistry.addRecipe(new ItemStack(Engine, 1, 0), new Object[]{"PGP", "PFP", "PGP", 'G', new ItemStack(ironGear, 1, 0), 'P', new ItemStack(ironPlate, 1, 0), 'F', new ItemStack(Blocks.furnace, 1, 0)}); GameRegistry.addRecipe(new ItemStack(copperGear, 2, 0), new Object[]{ " C ", "CCC", " C ", 'C', new ItemStack(copperIngot, 1, 0)}); GameRegistry .addShapelessRecipe(new ItemStack(copperPlate, 2, 0), new Object[]{ new ItemStack(copperIngot, 1, 0), new ItemStack(Hammer, 1, OreDictionary.WILDCARD_VALUE)}); GameRegistry.addRecipe(new ItemStack(MachineBlock, 2, 0), new Object[]{ "PPP", "P P", "PPP", 'P', new ItemStack(ironPlate, 1, 0)}); GameRegistry.addRecipe(new ItemStack(Crusher, 1, 0), new Object[]{ "PMP", "PEP", "PBP", 'P', new ItemStack(ironPlate), 'M', new ItemStack(MachineBlock), 'E', new ItemStack(Engine), 'B', new ItemStack(crusherBlade)}); GameRegistry.addRecipe(new ItemStack(SteelPickaxe, 1, 0), new Object[]{ "III", " S ", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelAxe, 1, 0), new Object[]{ " II", " SI", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelAxe, 1, 0), new Object[]{ "II ", "IS ", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelShovel, 1, 0), new Object[]{ " I ", " S ", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelShovel, 1, 0), new Object[]{ " I", " S", " S", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelShovel, 1, 0), new Object[]{ "I ", "S ", "S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelHoe, 1, 0), new Object[]{ " II", " S ", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelHoe, 1, 0), new Object[]{ "II ", " S ", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelSword, 1, 0), new Object[]{ " I ", " I ", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelSword, 1, 0), new Object[]{ "I ", "I ", "S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelSword, 1, 0), new Object[]{ " I", " I", " S", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); // Smelting Recipe ------------------------------- GameRegistry.addSmelting(new ItemStack(steelDust), new ItemStack( steelIngot), 30); GameRegistry.addSmelting(new ItemStack(copperDust), new ItemStack( copperIngot), 30); GameRegistry.addSmelting(new ItemStack(ironDust), new ItemStack( Items.iron_ingot), 30); // ========================================================================================================= } @EventHandler public void init(FMLInitializationEvent event) { proxy.registerRender(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } public static final String MODID = "modmechanicalcraft"; }
-
package com.google.SpyMan.Mechanicalcraft.common; import java.util.ArrayList; import java.util.List; import net.minecraft.creativetab.CreativeTabs; 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.ItemAxe; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.oredict.OreDictionary; import com.google.SpyMan.Mechanicalcraft.proxy.ClientProxy; import com.google.SpyMan.Mechanicalcraft.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.GameRegistry; @Mod(modid = "modmechanicalcraft", name = "MechanicalCraft_beta", version = "1.0.0") public class mod_mechanicalcraft { @Instance("modmechanicalcraft") public static mod_mechanicalcraft instance; @SidedProxy(clientSide = "com.google.SpyMan.Mechanicalcraft.proxy.ClientProxy", serverSide = "com.google.SpyMan.Mechanicalcraft.proxy.CommonProxy") public static CommonProxy proxy; // Item –--------------------------------------------- public static Item Wrench, Hammer, Pliers; public static Item SteelPickaxe, SteelAxe, SteelShovel, SteelSword, SteelHoe; public static Item steelIngot, copperIngot; public static Item ironPlate, steelPlate, copperPlate; public static Item ironGear, steelGear, copperGear; public static Item redstoneCrystal; public static Item steelDust, coalDust, ironDust, copperDust; public static Item Engine; public static Item crusherBlade; // Blocks ---------------------------------------------- public static Block Crusher; public static Block MachineBlock; // Other ------------------------------------------------- public static ToolMaterial SteelTools = EnumHelper.addToolMaterial( "SteelTools", 2, 649, 10.0F, 3.0F, 20); public static CreativeTabs creatab = new Ctab("Ctab"); @EventHandler public void preInit(FMLPreInitializationEvent event) { // Item --------------------------------------------- Wrench = new Wrench().setUnlocalizedName("Wrench").setMaxStackSize(1) .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:Wrench"); Hammer = new Hammer().setUnlocalizedName("Hammer").setMaxStackSize(1) .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:Hammer"); steelIngot = new steelIngot().setUnlocalizedName("steelIngot") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:steelingot"); coalDust = new coalDust().setUnlocalizedName("coalDust") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:coaldust"); ironPlate = new ironPlate().setUnlocalizedName("ironPlate") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:ironplate"); steelPlate = new steelPlate().setUnlocalizedName("steelPlate") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:steelplate"); ironGear = new ironGear().setUnlocalizedName("ironGear") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:irongear"); redstoneCrystal = new redstoneCrystal() .setUnlocalizedName("redstoneCrystal") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:redstonecrystal"); steelGear = new steelGear().setUnlocalizedName("steelGear") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:steelGear"); ironDust = new ironDust().setUnlocalizedName("ironDust") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:ironDust"); steelDust = new steelDust().setUnlocalizedName("steelDust") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:steelDust"); Pliers = new Pliers().setUnlocalizedName("Pliers").setMaxStackSize(1) .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:pliers"); Engine = new Engine().setUnlocalizedName("Engine") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:engine"); copperGear = new CopperGear().setUnlocalizedName("copperGear") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:copperGear"); copperIngot = new CopperIngot().setUnlocalizedName("copperIngot") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:copperIngot"); copperDust = new CopperDust().setUnlocalizedName("copperDust") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:copperDust"); copperPlate = new copperPlate().setUnlocalizedName("copperPlate") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:copperPlate"); crusherBlade = new crusherBlade().setUnlocalizedName("crusherBlade") .setCreativeTab(CreativeTabs.tabMaterials) .setTextureName("modmechanicalcraft:crusherBlade"); SteelPickaxe = new SteelPickaxe(SteelTools) .setUnlocalizedName("SteelPickaxe") .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:steelpickaxe"); SteelAxe = new SteelAxe(SteelTools).setUnlocalizedName("SteelAxe") .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:steelaxe"); SteelShovel = new SteelShovel(SteelTools) .setUnlocalizedName("SteelShovel") .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:steelshovel"); SteelSword = new SteelSword(SteelTools) .setUnlocalizedName("SteelSword") .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:steelsword"); SteelHoe = new SteelHoe(SteelTools).setUnlocalizedName("SteelHoe") .setCreativeTab(CreativeTabs.tabTools) .setTextureName("modmechanicalcraft:steelhoe"); // Blocks ------------------------------------------------ Crusher = new Crusher(Material.iron).setBlockName("Crusher") .setCreativeTab(CreativeTabs.tabRedstone); MachineBlock = new MachineBlock(Material.iron) .setCreativeTab(CreativeTabs.tabMaterials) .setBlockName("MachineBlock") .setBlockTextureName("modmechanicalcraft:crusher_left_right"); // Item -------------------------------------------------- GameRegistry.registerItem(Wrench, "Wrench"); GameRegistry.registerItem(Hammer, "Hammer"); GameRegistry.registerItem(steelIngot, "steelIngot"); GameRegistry.registerItem(coalDust, "coalDust"); GameRegistry.registerItem(ironPlate, "ironPlate"); GameRegistry.registerItem(steelPlate, "steelPlate"); GameRegistry.registerItem(ironGear, "ironGear"); GameRegistry.registerItem(steelGear, "steelGear"); GameRegistry.registerItem(steelDust, "steelDust"); GameRegistry.registerItem(ironDust, "ironDust"); GameRegistry.registerItem(redstoneCrystal, "redstoneCrystal"); GameRegistry.registerItem(Engine, "Engine"); GameRegistry.registerItem(Pliers, "Pliers"); GameRegistry.registerItem(copperIngot, "copperIngot"); GameRegistry.registerItem(copperDust, "copperDust"); GameRegistry.registerItem(copperGear, "copperGear"); GameRegistry.registerItem(copperPlate, "copperPlate"); GameRegistry.registerItem(crusherBlade, "crusherBlade"); GameRegistry.registerItem(SteelPickaxe, "SteelPickaxe"); GameRegistry.registerItem(SteelAxe, "SteelAxe"); GameRegistry.registerItem(SteelShovel, "SteelShovel"); GameRegistry.registerItem(SteelSword, "SteelSword"); GameRegistry.registerItem(SteelHoe, "SteelHoe"); // Blocks --------------------------------------------- GameRegistry.registerBlock(Crusher, "Crusher"); GameRegistry.registerBlock(MachineBlock, "MachineBlock"); // TileEntity --------------------------------------------- GameRegistry.registerTileEntity(TileCrusher.class, "modmechanicalcraft:Crusher"); // Other----------------------------------------------------------------- // ----------------------------------------------------------------- // Recipe -------------------------------------------------------------- GameRegistry.addRecipe(new ItemStack(Wrench, 1, 0), new Object[]{"I I", " O ", " I ", 'I', new ItemStack(Items.iron_ingot, 1, 0), 'O', new ItemStack(Items.dye, 1, 14)}); GameRegistry.addRecipe(new ItemStack(Hammer, 1, 0), new Object[]{"III", "III", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(Items.iron_ingot, 1, 0)}); GameRegistry .addShapelessRecipe(new ItemStack(ironPlate, 2, 0), new Object[]{ new ItemStack(Items.iron_ingot, 1, 0), new ItemStack(Hammer, 1, OreDictionary.WILDCARD_VALUE)}); GameRegistry .addShapelessRecipe(new ItemStack(steelPlate, 2), new Object[]{ new ItemStack(steelIngot, 1, 0), new ItemStack(Hammer, 1, OreDictionary.WILDCARD_VALUE)}); GameRegistry.addRecipe(new ItemStack(ironGear, 1, 0), new Object[]{ " I ", "ICI", " I ", 'I', new ItemStack(Items.iron_ingot, 1, 0), 'C', new ItemStack(copperGear, 1, 0)}); GameRegistry.addRecipe(new ItemStack(steelGear, 1, 0), new Object[]{ " L ", "LIL", " L ", 'L', new ItemStack(steelIngot, 1, 0), 'I', new ItemStack(ironGear, 1, 0)}); GameRegistry.addRecipe(new ItemStack(crusherBlade, 1, 0), new Object[]{ " D ", "DID", " D ", 'I', new ItemStack(Items.iron_ingot, 1, 0), 'D', new ItemStack(Items.diamond, 1, 0)}); GameRegistry.addShapelessRecipe(new ItemStack(steelDust, 2), new Object[]{new ItemStack(ironDust, 1, 0), new ItemStack(ironDust, 1, 0), new ItemStack(coalDust, 1, 0), new ItemStack(coalDust, 1, 0)}); GameRegistry.addRecipe(new ItemStack(redstoneCrystal, 1, 0), new Object[]{"RRR", "RDR", "RRR", 'R', new ItemStack(Items.redstone, 1, 0), 'D', new ItemStack(Items.diamond, 1, 0)}); GameRegistry.addRecipe(new ItemStack(Pliers, 1, 0), new Object[]{"I I", " I ", "D D", 'I', new ItemStack(Items.iron_ingot, 1, 0), 'D', new ItemStack(Items.dye, 1, 6)}); GameRegistry.addRecipe(new ItemStack(Engine, 1, 0), new Object[]{"PGP", "PFP", "PGP", 'G', new ItemStack(ironGear, 1, 0), 'P', new ItemStack(ironPlate, 1, 0), 'F', new ItemStack(Blocks.furnace, 1, 0)}); GameRegistry.addRecipe(new ItemStack(copperGear, 2, 0), new Object[]{ " C ", "CCC", " C ", 'C', new ItemStack(copperIngot, 1, 0)}); GameRegistry .addShapelessRecipe(new ItemStack(copperPlate, 2, 0), new Object[]{ new ItemStack(copperIngot, 1, 0), new ItemStack(Hammer, 1, OreDictionary.WILDCARD_VALUE)}); GameRegistry.addRecipe(new ItemStack(MachineBlock, 2, 0), new Object[]{ "PPP", "P P", "PPP", 'P', new ItemStack(ironPlate, 1, 0)}); GameRegistry.addRecipe(new ItemStack(Crusher, 1, 0), new Object[]{ "PMP", "PEP", "PBP", 'P', new ItemStack(ironPlate), 'M', new ItemStack(MachineBlock), 'E', new ItemStack(Engine), 'B', new ItemStack(crusherBlade)}); GameRegistry.addRecipe(new ItemStack(SteelPickaxe, 1, 0), new Object[]{ "III", " S ", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelAxe, 1, 0), new Object[]{ " II", " SI", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelAxe, 1, 0), new Object[]{ "II ", "IS ", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelShovel, 1, 0), new Object[]{ " I ", " S ", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelShovel, 1, 0), new Object[]{ " I", " S", " S", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelShovel, 1, 0), new Object[]{ "I ", "S ", "S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelHoe, 1, 0), new Object[]{ " II", " S ", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelHoe, 1, 0), new Object[]{ "II ", " S ", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelSword, 1, 0), new Object[]{ " I ", " I ", " S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelSword, 1, 0), new Object[]{ "I ", "I ", "S ", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); GameRegistry.addRecipe(new ItemStack(SteelSword, 1, 0), new Object[]{ " I", " I", " S", 'S', new ItemStack(Items.stick, 1, 0), 'I', new ItemStack(steelIngot, 1, 0)}); // Smelting Recipe ------------------------------- GameRegistry.addSmelting(new ItemStack(steelDust), new ItemStack( steelIngot), 30); GameRegistry.addSmelting(new ItemStack(copperDust), new ItemStack( copperIngot), 30); GameRegistry.addSmelting(new ItemStack(ironDust), new ItemStack( Items.iron_ingot), 30); // ========================================================================================================= } @EventHandler public void init(FMLInitializationEvent event) { proxy.registerRender(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } public static final String MODID = "modmechanicalcraft"; }
-
Quel est la différence ???
-
Quel est la différence ?
-
J’ai initialisé l’onglet créatif sur une ligne (et surtout avant les blocs) et j’ai ajouté Wrench dans ton onglet créatif.
-
Merci de ton aide maintenant ça marche. :shy: