Résolu [Error Gui]
-
Bonjour
%(#333333)[J’ai créer une Graphical User Interface (GUI) mais elle ne veut pas s’ouvrir, ]
pourtant j’ai suivi le tuto du forum.
Que puis-je faire pour remédier a ce problème? :huh:Mon code :
Class principale :
%(#333333)[package com.google.SpyMan.Mechanicalcraft.common; ] import net.minecraft.block.Block; import net.minecraft.block.material.Material; 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.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.oredict.OreDictionary; import com.google.SpyMan.Mechanicalcraft.common.BlockAlloyer.Alloyer; import com.google.SpyMan.Mechanicalcraft.common.BlockAlloyer.TileEntityAlloyer; import com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.Crusher; import com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileCrusher; import com.google.SpyMan.Mechanicalcraft.common.BlockFurnace.Furnace; import com.google.SpyMan.Mechanicalcraft.common.BlockFurnace.TileFurnace; import com.google.SpyMan.Mechanicalcraft.common.BronzeTools.BronzeAxe; import com.google.SpyMan.Mechanicalcraft.common.BronzeTools.BronzeHoe; import com.google.SpyMan.Mechanicalcraft.common.BronzeTools.BronzePickaxe; import com.google.SpyMan.Mechanicalcraft.common.BronzeTools.BronzeShovel; import com.google.SpyMan.Mechanicalcraft.common.BronzeTools.BronzeSword; import com.google.SpyMan.Mechanicalcraft.common.Event.BlockEventDeleter; import com.google.SpyMan.Mechanicalcraft.common.Event.BlockEventHandler; import com.google.SpyMan.Mechanicalcraft.proxy.CommonProxy; 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, ToolBox; public static Item SteelPickaxe, SteelAxe, SteelShovel, SteelSword, SteelHoe, RedstoneDrill; public static Item BronzePickaxe, BronzeAxe, BronzeShovel, BronzeHoe, BronzeSword; public static Item steelIngot, copperIngot, tinIngot, BronzeIngot; public static Item ironPlate, steelPlate, copperPlate, tinPlate, goldPlate; public static Item ironGear, steelGear, copperGear, tinGear; public static Item redstoneCrystal; public static Item steelDust, coalDust, ironDust, copperDust, tinDust, BronzeDust, goldDust; public static Item Engine, ElectricalEngine; public static Item crusherBlade; public static Item tinCable, copperCable; public static Item electronicChipset, ElectronicGoldChipset, Coil, ElectricMotor; public static Item BrokenTinOre, BrokenCopperOre, BrokenIronOre, BrokenCoalOre, BrokenGoldOre, BrokenRedstoneOre, BrokenDiamondOre, BrokenEmeraldOre, BrokenLapisOre; // Other –----------------------------------------------- public static CreativeTabs creatab = new Ctab("Ctab"); // Blocks –-------------------------------------------- public static Block Crusher, Furnace, Alloyer; public static Block MachineBlock; public static Block TinOre, CopperOre; // Tools/Armor // –------------------------------------------------------------- public static ToolMaterial SteelTools = EnumHelper.addToolMaterial( "SteelTools", 2, 649, 10.0F, 3.0F, 20); public static ToolMaterial BronzeTools = EnumHelper.addToolMaterial( "BronzeTools", 2, 315, 9.0F, 2.0F, 18); public static ToolMaterial RedTools = EnumHelper.addToolMaterial("pickaxe", 5, 4999, 14.0F, 6.0F, 0); @EventHandler public void preInit(FMLPreInitializationEvent event) { // Event // –------------------------------------------------------------------- MinecraftForge.EVENT_BUS.register(new BlockEventDeleter()); // Item –------------------------------------------- Wrench = new Wrench().setUnlocalizedName("Wrench").setMaxStackSize(1) .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:Wrench"); Hammer = new Hammer().setUnlocalizedName("Hammer").setMaxStackSize(1) .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:Hammer"); steelIngot = new steelIngot().setUnlocalizedName("steelIngot") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:steelingot"); coalDust = new coalDust().setUnlocalizedName("coalDust") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:coaldust"); ironPlate = new ironPlate().setUnlocalizedName("ironPlate") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:ironplate"); steelPlate = new steelPlate().setUnlocalizedName("steelPlate") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:steelplate"); ironGear = new ironGear().setUnlocalizedName("ironGear") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:irongear"); redstoneCrystal = new redstoneCrystal() .setUnlocalizedName("redstoneCrystal").setCreativeTab(creatab) .setTextureName("modmechanicalcraft:redstonecrystal"); steelGear = new steelGear().setUnlocalizedName("steelGear") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:steelGear"); ironDust = new ironDust().setUnlocalizedName("ironDust") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:ironDust"); steelDust = new steelDust().setUnlocalizedName("steelDust") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:steelDust"); Pliers = new Pliers().setUnlocalizedName("Pliers").setMaxStackSize(1) .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:pliers"); Engine = new Engine().setUnlocalizedName("Engine") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:engine"); copperGear = new CopperGear().setUnlocalizedName("copperGear") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:copperGear"); copperIngot = new CopperIngot().setUnlocalizedName("copperIngot") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:copperIngot"); copperDust = new CopperDust().setUnlocalizedName("copperDust") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:copperDust"); copperPlate = new copperPlate().setUnlocalizedName("copperPlate") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:copperPlate"); crusherBlade = new crusherBlade().setUnlocalizedName("crusherBlade") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:crusherBlade"); SteelPickaxe = new SteelPickaxe(SteelTools) .setUnlocalizedName("SteelPickaxe").setCreativeTab(creatab) .setTextureName("modmechanicalcraft:steelpickaxe"); SteelAxe = new SteelAxe(SteelTools).setUnlocalizedName("SteelAxe") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:steelaxe"); SteelShovel = new SteelShovel(SteelTools) .setUnlocalizedName("SteelShovel").setCreativeTab(creatab) .setTextureName("modmechanicalcraft:steelshovel"); SteelSword = new SteelSword(SteelTools) .setUnlocalizedName("SteelSword").setCreativeTab(creatab) .setTextureName("modmechanicalcraft:steelsword"); SteelHoe = new SteelHoe(SteelTools).setUnlocalizedName("SteelHoe") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:steelhoe"); tinDust = new tinDust().setUnlocalizedName("tinDust") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:tinDust"); tinIngot = new tinIngot().setUnlocalizedName("tinIngot") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:tiningot"); tinPlate = new tinPlate().setUnlocalizedName("tinPlate") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:tinplate"); tinGear = new tinGear().setUnlocalizedName("tinGear") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:tinGear"); tinCable = new tinCable().setUnlocalizedName("tinCable") .setCreativeTab(creatab).setTextureName(MODID + ":tinCable"); copperCable = new copperCable().setUnlocalizedName("copperCable") .setCreativeTab(creatab).setTextureName(MODID + ":copperCable"); goldDust = new goldDust().setUnlocalizedName("goldDust") .setCreativeTab(creatab).setTextureName(MODID + ":goldDust"); goldPlate = new goldPlate().setUnlocalizedName("goldPlate") .setCreativeTab(creatab).setTextureName(MODID + ":goldPlate"); electronicChipset = new electronicChipset() .setUnlocalizedName("electronicChipset") .setCreativeTab(creatab).setTextureName(MODID + ":chipset"); RedstoneDrill = new RedstoneDrill(RedTools) .setUnlocalizedName("RedstoneDrill").setCreativeTab(creatab) .setTextureName("modmechanicalcraft:redstoneDrill"); ElectricalEngine = new ElectricalEngine() .setUnlocalizedName("ElectricalEngine").setCreativeTab(creatab) .setTextureName("modmechanicalcraft:electricalEngine"); ElectricMotor = new ElectricMotor().setUnlocalizedName("ElectricMotor") .setCreativeTab(creatab) .setTextureName("modmechanicalcraft:electricMotor"); Coil = new Coil().setUnlocalizedName("Coil").setCreativeTab(creatab) .setTextureName("modmechanicalcraft:coil"); ToolBox = new ToolBox().setUnlocalizedName("ToolBox") .setCreativeTab(creatab).setTextureName(MODID + (":toolBox")); ElectronicGoldChipset = new ElectronicGoldChipset() .setUnlocalizedName("ElectronicGoldChipset") .setCreativeTab(creatab).setTextureName(MODID + ":goldChipset"); BrokenCopperOre = new BrokenCopperOre() .setUnlocalizedName("BrokenCopperOre").setCreativeTab(creatab) .setTextureName(MODID + ":BrokenCopperOre"); BrokenTinOre = new BrokenTinOre().setUnlocalizedName("BrokenTinOre") .setCreativeTab(creatab) .setTextureName(MODID + ":BrokenTinOre"); BrokenIronOre = new BrokenIronOre().setUnlocalizedName("BrokenIronOre") .setCreativeTab(creatab) .setTextureName(MODID + ":BrokenIronOre"); BrokenCoalOre = new BrokenCoalOre().setUnlocalizedName("BrokenCoalOre") .setCreativeTab(creatab) .setTextureName(MODID + ":BrokenCoalOre"); BrokenGoldOre = new BrokenGoldOre().setUnlocalizedName("BrokenGoldOre") .setCreativeTab(creatab) .setTextureName(MODID + ":BrokenGoldOre"); BrokenRedstoneOre = new BrokenRedstoneOre() .setUnlocalizedName("BrokenRedstoneOre") .setCreativeTab(creatab) .setTextureName(MODID + ":BrokenRedstoneOre"); BrokenDiamondOre = new BrokenDiamondOre() .setUnlocalizedName("BrokenDiamondOre").setCreativeTab(creatab) .setTextureName(MODID + ":BrokenDiamondOre"); BrokenEmeraldOre = new BrokenEmeraldOre() .setUnlocalizedName("BrokenEmeraldOre").setCreativeTab(creatab) .setTextureName(MODID + ":BrokenEmeraldOre"); BrokenLapisOre = new BrokenLapisOre() .setUnlocalizedName("BrokenLapisOre").setCreativeTab(creatab) .setTextureName(MODID + ":BrokenLapisOre"); BronzeIngot = new BronzeIngot().setUnlocalizedName("BronzeIngot") .setCreativeTab(creatab).setTextureName(MODID + ":BronzeIngot"); BronzeDust = new BronzeDust().setUnlocalizedName("BronzeDust") .setCreativeTab(creatab).setTextureName(MODID + ":BronzeDust"); BronzePickaxe = new BronzePickaxe(BronzeTools) .setUnlocalizedName("BronzePickaxe").setCreativeTab(creatab) .setTextureName(MODID + ":BronzePickaxe"); BronzeAxe = new BronzeAxe(BronzeTools).setUnlocalizedName("BronzeAxe") .setCreativeTab(creatab).setTextureName(MODID + ":BronzeAxe"); BronzeShovel = new BronzeShovel(BronzeTools) .setUnlocalizedName("BronzeShovel").setCreativeTab(creatab) .setTextureName(MODID + ":BronzeShovel"); BronzeHoe = new BronzeHoe(BronzeTools).setUnlocalizedName("BronzeHoe") .setCreativeTab(creatab).setTextureName(MODID + ":BronzeHoe"); BronzeSword = new BronzeSword(BronzeTools) .setUnlocalizedName("BronzeSword").setCreativeTab(creatab) .setTextureName(MODID + ":BronzeSword"); // Blocks –---------------------------------------------- Crusher = new Crusher(Material.iron).setBlockName("Crusher") .setCreativeTab(creatab); Furnace = new Furnace(Material.iron).setBlockName("Furnace") .setCreativeTab(creatab); MachineBlock = new MachineBlock(Material.iron).setCreativeTab(creatab) .setBlockName("MachineBlock") .setBlockTextureName("modmechanicalcraft:crusher_left_right"); CopperOre = new CopperOre(Material.rock).setBlockName("CopperOre") .setCreativeTab(creatab) .setBlockTextureName(MODID + ":CopperOre"); TinOre = new TinOre(Material.rock).setBlockName("TinOre") .setCreativeTab(creatab).setBlockTextureName(MODID + ":TinOre"); Alloyer = new Alloyer(Material.iron).setBlockName("Alloyer") .setCreativeTab(creatab); // Other –----------------------------------------------------- // 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"); GameRegistry.registerItem(copperCable, "copperCable"); GameRegistry.registerItem(tinCable, "tinCable"); GameRegistry.registerItem(tinGear, "tinGear"); GameRegistry.registerItem(tinDust, "tinDust"); GameRegistry.registerItem(tinIngot, "tinIngot"); GameRegistry.registerItem(tinPlate, "tinPlate"); GameRegistry.registerItem(goldDust, "goldDust"); GameRegistry.registerItem(goldPlate, "goldPlate"); GameRegistry.registerItem(electronicChipset, "electronicChipset"); GameRegistry.registerItem(RedstoneDrill, "RedstoneDrill"); GameRegistry.registerItem(ElectricalEngine, "ElectricalEngine"); GameRegistry.registerItem(ElectricMotor, "ElectricMotor"); GameRegistry.registerItem(Coil, "Coil"); GameRegistry.registerItem(ToolBox, "ToolBox"); GameRegistry.registerItem(ElectronicGoldChipset, "ElectronicGoldChipset"); GameRegistry.registerItem(BrokenLapisOre, "BrokenLapisOre"); GameRegistry.registerItem(BrokenIronOre, "BrokenIronOre"); GameRegistry.registerItem(BrokenCoalOre, "BrokenCoalOre"); GameRegistry.registerItem(BrokenRedstoneOre, "BrokenRedstoneOre"); GameRegistry.registerItem(BrokenCopperOre, "BrokenCopperOre"); GameRegistry.registerItem(BrokenTinOre, "BrokenTinOre"); GameRegistry.registerItem(BrokenDiamondOre, "BrokenDiamondOre"); GameRegistry.registerItem(BrokenEmeraldOre, "BrokenEmeraldOre"); GameRegistry.registerItem(BrokenGoldOre, "BrokenGoldOre"); GameRegistry.registerItem(BronzeIngot, "BronzeIngot"); GameRegistry.registerItem(BronzeDust, "BronzeDust"); GameRegistry.registerItem(BronzeAxe, "BronzeAxe"); GameRegistry.registerItem(BronzePickaxe, "BronzePickaxe"); GameRegistry.registerItem(BronzeShovel, "BronzeShovel"); GameRegistry.registerItem(BronzeHoe, "BronzeHoe"); GameRegistry.registerItem(BronzeSword, "BronzeSword"); // Blocks –------------------------------------------- GameRegistry.registerBlock(Crusher, "Crusher"); GameRegistry.registerBlock(MachineBlock, "MachineBlock"); GameRegistry.registerBlock(Furnace, "Furnace"); GameRegistry.registerBlock(CopperOre, "CopperOre"); GameRegistry.registerBlock(TinOre, "TinOre"); GameRegistry.registerBlock(Alloyer, "Alloyer"); // TileEntity –------------------------------------------- GameRegistry.registerTileEntity(TileCrusher.class, "modmechanicalcraft:Crusher"); GameRegistry.registerTileEntity(TileFurnace.class, "modmechanicalcraft:Furnace"); GameRegistry.registerTileEntity(TileEntityAlloyer.class, "modmechanicalcraft:Alloyer"); // 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(tinPlate, 2, 0), new Object[{] new ItemStack(tinIngot, 1, 0), new ItemStack(Hammer, 1, OreDictionary.WILDCARD_VALUE)}); GameRegistry .addShapelessRecipe(new ItemStack(goldPlate, 2, 0), new Object[{] new ItemStack(Items.gold_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.addRecipe(new ItemStack(tinGear, 2, 0), new Object[{] " T ", "TTT", " T ", 'T', new ItemStack(tinIngot, 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(Alloyer, 1, 0), new Object[{] "PMP", "PEP", "PGP", 'P', new ItemStack(ironPlate), 'M', new ItemStack(MachineBlock), 'E', new ItemStack(Engine), 'G', new ItemStack(ironGear)}); 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)}); GameRegistry .addShapelessRecipe(new ItemStack(copperCable, 3), new Object[{] new ItemStack(copperIngot, 1, 0), new ItemStack(Pliers, 1, OreDictionary.WILDCARD_VALUE)}); GameRegistry .addShapelessRecipe(new ItemStack(tinCable, 3), new Object[{] new ItemStack(tinIngot, 1, 0), new ItemStack(Pliers, 1, OreDictionary.WILDCARD_VALUE)}); GameRegistry.addRecipe(new ItemStack(electronicChipset, 1, 0), new Object[{"CPC", "CRC", "CPC", 'P',] new ItemStack(tinPlate, 1, 0), 'R', new ItemStack(redstoneCrystal, 1, 0), 'C', new ItemStack(copperCable, 1, 0)}); GameRegistry.addRecipe(new ItemStack(Furnace, 1, 0), new Object[{] "PMP", "PEP", "PBP", 'P', new ItemStack(ironPlate), 'M', new ItemStack(MachineBlock), 'E', new ItemStack(Engine), 'B', new ItemStack(Blocks.furnace)}); GameRegistry.addRecipe(new ItemStack(ElectricalEngine, 1, 0), new Object[{"PGP", "PMP", "PGP", 'G',] new ItemStack(steelGear, 1, 0), 'M', new ItemStack(ElectricMotor, 1, 0), 'P', new ItemStack(steelPlate, 1, 0)}); GameRegistry.addRecipe(new ItemStack(ElectricMotor, 1, 0), new Object[{"CPP", "PBP", "CPP", 'B',] new ItemStack(Coil, 1, 0), 'P', new ItemStack(tinPlate, 1, 0), 'C', new ItemStack(copperCable, 1, 0)}); GameRegistry.addRecipe(new ItemStack(RedstoneDrill, 1, 0), new Object[{"PCC", "PGC", "EPP", 'E',] new ItemStack(ElectronicGoldChipset, 1, 0), 'C', new ItemStack(redstoneCrystal, 1, 0), 'P', new ItemStack(steelPlate, 1, 0), 'G', new ItemStack(ElectricalEngine, 1, 0)}); GameRegistry.addRecipe(new ItemStack(ElectronicGoldChipset, 1, 0), new Object[{"CSC", "CPC", "CSC", 'P',] new ItemStack(goldPlate, 1, 0), 'S', new ItemStack(electronicChipset, 1, 0), 'C', new ItemStack(copperCable, 1, 0)}); GameRegistry.addShapelessRecipe(new ItemStack(BronzeDust, 2), new Object[{new ItemStack(tinDust, 1, 0),] new ItemStack(tinDust, 1, 0), new ItemStack(copperDust, 1, 0), new ItemStack(copperDust, 1, 0)}); // Smelt 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); GameRegistry.addSmelting(new ItemStack(tinDust), new ItemStack(tinIngot), 30); GameRegistry.addSmelting(new ItemStack(goldDust), new ItemStack( Items.gold_ingot), 30); GameRegistry.addSmelting(new ItemStack(BronzeDust), new ItemStack( BronzeIngot), 30); GameRegistry.addSmelting(new ItemStack(BrokenIronOre), new ItemStack( Items.iron_ingot), 30); GameRegistry.addSmelting(new ItemStack(BrokenGoldOre), new ItemStack( Items.gold_ingot), 30); GameRegistry.addSmelting(new ItemStack(BrokenTinOre), new ItemStack( tinIngot), 30); GameRegistry.addSmelting(new ItemStack(BrokenCopperOre), new ItemStack( copperIngot), 30); GameRegistry.addSmelting(new ItemStack(TinOre), new ItemStack(tinIngot), 30); GameRegistry.addSmelting(new ItemStack(CopperOre), new ItemStack( copperIngot), 30); GameRegistry.addSmelting(new ItemStack(BrokenRedstoneOre), new ItemStack(Items.redstone), 30); GameRegistry.addSmelting(new ItemStack(BrokenLapisOre), new ItemStack( Items.dye, 1, 4), 30); GameRegistry.addSmelting(new ItemStack(BrokenDiamondOre), new ItemStack(Items.diamond), 30); GameRegistry.addSmelting(new ItemStack(BrokenEmeraldOre), new ItemStack(Items.emerald), 30); GameRegistry.addSmelting(new ItemStack(BrokenCoalOre), new ItemStack( Items.coal), 30); GameRegistry.addSmelting(new ItemStack(BronzeDust), new ItemStack( BronzeIngot), 30); // ========================================================================================================= } @EventHandler public void init(FMLInitializationEvent event) { proxy.registerRender(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new BlockEventHandler()); } public static final String MODID = "modmechanicalcraft"; }
Class de mon bloc :
package com.google.SpyMan.Mechanicalcraft.common.BlockAlloyer; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import com.google.SpyMan.Mechanicalcraft.common.mod_mechanicalcraft; public class Alloyer extends BlockContainer { public Alloyer(Material material) { super(material); setResistance(30); setHardness(3); } private IIcon top, bottom, left, right, back; public void registerBlockIcons(IIconRegister iiconRegister) { this.blockIcon = iiconRegister .registerIcon("modmechanicalcraft:AlloyerFront"); this.top = iiconRegister.registerIcon("modmechanicalcraft:crusher_top"); this.bottom = iiconRegister .registerIcon("modmechanicalcraft:crusher_bottom"); this.left = iiconRegister .registerIcon("modmechanicalcraft:crusher_left_right"); this.right = iiconRegister .registerIcon("modmechanicalcraft:crusher_left_right"); this.back = iiconRegister .registerIcon("modmechanicalcraft:crusher_left_right"); } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack) { int direction = MathHelper .floor_double((double) (living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, direction, 2); } public IIcon getIcon(int side, int metadata) { if (side == 0) return this.bottom; else if (side == 1) return this.top; { if ((side == 3 && metadata == 0) || (side == 4 && metadata == 1) || (side == 2 && metadata == 2) || (side == 5 && metadata == 3)) { return this.blockIcon; } return this.left; } } public TileEntity createNewTileEntity(World world, int metadata) { return new TileEntityAlloyer(); } @Override public boolean hasTileEntity(int metadata) { return true; } public void breakBlock(World world, int x, int y, int z, Block block, int metadata) { TileEntity tileentity = world.getTileEntity(x, y, z); if (tileentity instanceof IInventory) { IInventory inv = (IInventory)tileentity; for (int i1 = 0; i1 < inv.getSizeInventory(); ++i1) { ItemStack itemstack = inv.getStackInSlot(i1); if (itemstack != null) { float f = world.rand.nextFloat() * 0.8F + 0.1F; float f1 = world.rand.nextFloat() * 0.8F + 0.1F; EntityItem entityitem; for (float f2 = world.rand.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; world.spawnEntityInWorld(entityitem)) { int j1 = world.rand.nextInt(21) + 10; if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); float f3 = 0.05F; entityitem.motionX = (double)((float)world.rand.nextGaussian() * f3); entityitem.motionY = (double)((float)world.rand.nextGaussian() * f3 + 0.2F); entityitem.motionZ = (double)((float)world.rand.nextGaussian() * f3); if (itemstack.hasTagCompound()) { entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); } } } } world.func_147453_f(x, y, z, block); } super.breakBlock(world, x, y, z, block, metadata); } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitx, float hity, float hitz) { if (world.isRemote) { return true; } else { player.openGui(mod_mechanicalcraft.Alloyer, 2, world, x, y, z); return true; } } }
Class TileEntity :
package com.google.SpyMan.Mechanicalcraft.common.BlockAlloyer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; public class TileEntityAlloyer extends TileEntity { private byte direction; public byte getDirection() { return direction; } public void setDirection(byte direction) { this.direction = direction; this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); } private ItemStack[] contents = new ItemStack[4]; private int workingTime = 0; private int workingTimeNeeded = 0; @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); NBTTagList nbttaglist = new NBTTagList(); compound.setByte("Direction", this.direction); for(int i = 0; i < this.contents.length; ++i) { if(this.contents* != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte)i); this.contents*.writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } compound.setTag("Items", nbttaglist); compound.setShort("workingTime", (short)this.workingTime); compound.setShort("workingTimeNeeded", (short)this.workingTimeNeeded); } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this.direction = compound.getByte("Direction"); NBTTagList nbttaglist = compound.getTagList("Items", 10); this.contents = new ItemStack[this.getSizeInventory()]; for(int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound1.getByte("Slot") & 255; if(j >= 0 && j < this.contents.length) { this.contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } this.workingTime = compound.getShort("workingTime"); this.workingTimeNeeded = compound.getShort("workingTimeNeeded"); } public int getSizeInventory() { return this.contents.length; } public ItemStack getStackInSlot(int slotIndex) { return this.contents[slotIndex]; } public ItemStack decrStackSize(int slotIndex, int amount) { if(this.contents[slotIndex] != null) { ItemStack itemstack; if(this.contents[slotIndex].stackSize <= amount) { itemstack = this.contents[slotIndex]; this.contents[slotIndex] = null; this.markDirty(); return itemstack; } else { itemstack = this.contents[slotIndex].splitStack(amount); if(this.contents[slotIndex].stackSize == 0) { this.contents[slotIndex] = null; } this.markDirty(); return itemstack; } } else { return null; } } public ItemStack getStackInSlotOnClosing(int slotIndex) { if(this.contents[slotIndex] != null) { ItemStack itemstack = this.contents[slotIndex]; this.contents[slotIndex] = null; return itemstack; } else { return null; } } public void setInventorySlotContents(int slotIndex, ItemStack stack) { this.contents[slotIndex] = stack; if(stack != null && stack.stackSize > this.getInventoryStackLimit()) { stack.stackSize = this.getInventoryStackLimit(); } this.markDirty(); } public String getInventoryName() { return "tile.Alloyer"; } public boolean hasCustomInventoryName() { return false; } public int getInventoryStackLimit() { return 64; } public boolean isUseableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; } public void openInventory() { } public void closeInventory() { } public boolean isItemValidForSlot(int slot, ItemStack stack) { return slot == 3 ? false : true; } public boolean isBurning() { return this.workingTime > 0; } private boolean canSmelt() { if(this.contents[0] == null || this.contents[1] == null || this.contents[2] == null) { return false; } else { ItemStack itemstack = AlloyerRecipes.smelting().getSmeltingResult(new ItemStack[] {this.contents[0], this.contents[1], this.contents[2]}); if(itemstack == null) return false; if(this.contents[3] == null) return true; if(!this.contents[3].isItemEqual(itemstack)) return false; int result = contents[3].stackSize + itemstack.stackSize; return result <= getInventoryStackLimit() && result <= this.contents[3].getMaxStackSize(); } } public void updateEntity() { if(this.isBurning() && this.canSmelt()) { ++this.workingTime; } if(this.canSmelt() && !this.isBurning()) { this.workingTime = 1; } if(this.canSmelt() && this.workingTime == this.workingTimeNeeded) { this.smeltItem(); this.workingTime = 0; } if(!this.canSmelt()) { this.workingTime = 0; } } public void smeltItem() { if(this.canSmelt()) { ItemStack itemstack = AlloyerRecipes.smelting().getSmeltingResult(new ItemStack[] {this.contents[0], this.contents[1], this.contents[2]}); if(this.contents[3] == null) { this.contents[3] = itemstack.copy(); } else if(this.contents[3].getItem() == itemstack.getItem()) { this.contents[3].stackSize += itemstack.stackSize; } –this.contents[0].stackSize; –this.contents[1].stackSize; –this.contents[2].stackSize; if(this.contents[0].stackSize <= 0) { this.contents[0] = null; } if(this.contents[1].stackSize <= 0) { this.contents[1] = null; } if(this.contents[2].stackSize <= 0) { this.contents[2] = null; } } } }
Class Container :
package com.google.SpyMan.Mechanicalcraft.common.BlockAlloyer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import com.google.SpyMan.Mechanicalcraft.common.*; public class ContainerAlloyer extends Container { private TileEntityAlloyer tileAlloyer; public ContainerAlloyer(TileEntityAlloyer tile, InventoryPlayer inventory) { this.tileAlloyer = tile; this.addSlotToContainer(new Slot((IInventory)tile, 0, 49, 75)); this.addSlotToContainer(new Slot((IInventory)tile, 1, 89, 75)); this.addSlotToContainer(new Slot((IInventory)tile, 2, 129, 75)); this.addSlotToContainer(new SlotResult(tile, 3, 89, 135)); this.bindPlayerInventory(inventory); } @Override public boolean canInteractWith(EntityPlayer player) { return this.tileAlloyer.isUseableByPlayer(player); } private void bindPlayerInventory(InventoryPlayer inventory) { int i; for (i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 17 + j * 18, 171 + i * 18)); } } for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(inventory, i, 17 + i * 18, 229)); } } public ItemStack transferStackInSlot(EntityPlayer player, int quantity) { ItemStack itemstack = null; Slot slot = (Slot)this.inventorySlots.get(quantity); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (quantity < this.tileAlloyer.getSizeInventory()) { if (!this.mergeItemStack(itemstack1, this.tileAlloyer.getSizeInventory(), this.inventorySlots.size(), true)) { return null; } } else if (!this.mergeItemStack(itemstack1, 0, this.tileAlloyer.getSizeInventory(), false)) { return null; } if (itemstack1.stackSize == 0) { slot.putStack((ItemStack)null); } else { slot.onSlotChanged(); } } return itemstack; } public void onContainerClosed(EntityPlayer player) { super.onContainerClosed(player); this.tileAlloyer.closeInventory(); } }
Class Gui :
package com.google.SpyMan.Mechanicalcraft.common.BlockAlloyer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.util.ResourceLocation; import com.google.SpyMan.Mechanicalcraft.common.*; import org.lwjgl.opengl.GL11; public class GuiAlloyer extends GuiContainer { private static final ResourceLocation texture = new ResourceLocation(mod_mechanicalcraft.MODID,"textures/gui/container/GuiAlloyer.png"); private TileEntityAlloyer tileAlloyer; private IInventory playerInv; public GuiAlloyer(TileEntityAlloyer tile, InventoryPlayer inventory) { super(new ContainerAlloyer(tile, inventory)); this.tileAlloyer = tile; this.playerInv = inventory; this.allowUserInput = false; this.ySize = 256; this.xSize = 256; } @Override protected void drawGuiContainerBackgroundLayer(float partialRenderTick, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(texture); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); this.drawTexturedModalRect(0, 0, 176, 14, 100 + 1, 16); } protected void drawGuiContainerForegroundLayer(int x, int y) { this.fontRendererObj.drawString(this.playerInv.hasCustomInventoryName() ? this.playerInv.getInventoryName() : I18n.format(this.playerInv.getInventoryName()), 10, this.ySize - 98, 4210752); } }
Class SlotResult :
package com.google.SpyMan.Mechanicalcraft.common.BlockAlloyer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class SlotResult extends Slot { public SlotResult(TileEntityAlloyer tile, int id, int x, int y) { super((IInventory)tile, id, x, y); } @Override public boolean isItemValid(ItemStack stack) { return false; } public ItemStack decrStackSize(int amount) { return super.decrStackSize(amount); } public void onPickupFromSlot(EntityPlayer player, ItemStack stack) { super.onCrafting(stack); super.onPickupFromSlot(player, stack); } }
-
Et le GuiHandler ?
-
player.openGui(mod_mechanicalcraft.Alloyer, 2, world, x, y, z);
???
Tu es sensé mettre l’instance ici en plus du gui handler qui est visiblement manquant. -
Ok je comprend mieux maintenant ce dis-fonctionnement, merci de votre aide. :shy: