MFF

    Minecraft Forge France
    • Récent
    • Populaire
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    Problème de gui

    Planifié Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    17 Messages 4 Publieurs 3.5k Vues 1 Abonné
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • T Hors-ligne
      thecraft38
      dernière édition par

      oui cette ligne est présente dans ma class ewifaction a la fin de init

      1 réponse Dernière réponse Répondre Citer 0
      • AxaurusA Hors-ligne
        Axaurus
        dernière édition par

        Et tu n’as rien dans les logs quand tu met System.out.println(“test”) dans la condition dans le GuiHandler?

        Si ça met rien, c’est que ta condition n’est pas vérifiée. Donc ça serait sans doute un problème de TileEntity. Mais si c’est ça, je suis désolé je ne pourrais pas t’aider d’avantage, je ne connaît pas les TileEntity  je n’en ai jamais fait.

        1 réponse Dernière réponse Répondre Citer 0
        • SpyManS Hors-ligne
          SpyMan
          dernière édition par

          Renvoi tout tont code stp, tout le block, gui , guihandler , block, class principale , proxy client et common
          et tu sais tu peut utilisé les balise java dans ton message pour le code c’est plus simple

          1 réponse Dernière réponse Répondre Citer 0
          • T Hors-ligne
            thecraft38
            dernière édition par

            oui ,

            ma class principale :
            
            package thecraft.mod.common;
            
            import java.awt.Color;
            
            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.network.NetworkRegistry;
            import cpw.mods.fml.common.registry.EntityRegistry;
            import cpw.mods.fml.common.registry.GameRegistry;
            import net.minecraft.block.Block;
            import net.minecraft.block.material.Material;
            import net.minecraft.creativetab.CreativeTabs;
            import net.minecraft.entity.Entity;
            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.minecraftforge.common.util.EnumHelper;
            import thecraft.mod.proxy.commonproxy;
            
            @Mod(modid = ewifaction.MODID, name = "ewifaction" , version = "1.0.0")
            
            public class ewifaction
            {
            public static CreativeTabs exonorCreativeTabs = new exonorCreativeTabs("ewifaction_creative_tabs");
            public static final String MODID = "ewifaction";
            @Instance(MODID)
            public static ewifaction instance;
            
            @SidedProxy(clientSide = "thecraft.mod.proxy.clientproxy", serverSide = "thecraft.mod.proxy.commonproxy" )
            public static commonproxy proxy;
            
            public static Item itemExonite, itemMaxencite, HelmetExonite, ChestPlateExonite, LegginsExonite, BootsExonite, exonitesworld, exnoitpichaxe, exoniteaxe, exonitchovel, exonithoe, HelmetMaxencite, ChestplateMaxencite, leggingsMaxencite, BootsMaxencite, maxencitesworld, maxencitepickaxe, maxenciteaxe, maxencitechovel, maxencitehoe, itemewilite, helmetewilite, chestplateewilite, leggingsewilite, bootsewilite, ewilitesworld;
            public static Block oreExonite, exoniteblock, oreMaxencite, blockmaxencite, oreEwilite, blockewilite, ewilitechest;
            
            public static ArmorMaterial exonitarmor = EnumHelper.addArmorMaterial("exonitarmor", 1999, new int[]{3, 7, 5, 2}, 32);
            public static ToolMaterial exoniteTool = EnumHelper.addToolMaterial("exonitetool", 15, 2444, 13.0F, 6, 40);
            public static ArmorMaterial maxenciteArmor = EnumHelper.addArmorMaterial("maxencitearmor", 999, new int []{3, 7, 4, 2}, 20);
            public static ToolMaterial maxenciteTool = EnumHelper.addToolMaterial("maxencitetool", 8, 1199, 10.0F, 4, 25);
            public static ArmorMaterial ewilitearmor = EnumHelper.addArmorMaterial("ewilitearmor", 3999, new int []{5, 10, 8, 5}, 40);
            public static ToolMaterial ewilitetool = EnumHelper.addToolMaterial("ewilitetool", 15, 1499, 15.0F, 13, 40);
            
            @EventHandler
            public void preInit(FMLPreInitializationEvent test)
            {
            itemExonite = new ItemExonite().setUnlocalizedName("exonit").setTextureName(MODID + ":itemexonittex");
            HelmetExonite = new ItemExonitArmor(exonitarmor, 0).setUnlocalizedName("helmetexonit").setTextureName(MODID + ":exonithelmettex");
            ChestPlateExonite = new ItemExonitArmor(exonitarmor, 1).setUnlocalizedName("chestplateexonite").setTextureName(MODID + ":exonitechestplatetex");
            LegginsExonite = new ItemExonitArmor(exonitarmor, 2).setUnlocalizedName("leggingsexonit").setTextureName(MODID + ":exoniteleggingstex");
            BootsExonite = new ItemExonitArmor(exonitarmor, 3).setUnlocalizedName("bootsexonit").setTextureName(MODID + ":exonitbootstex");
            exonitesworld = new ItemExoniteSworld(exoniteTool).setUnlocalizedName("sworldexonite").setTextureName(MODID + ":exonitesworldtex");
            exnoitpichaxe = new ItemExonitePichaxe(exoniteTool).setUnlocalizedName("exonitepickaxe").setTextureName(MODID + ":exonitepickaxetex");
            exoniteaxe = new ItemExoniteAxe(exoniteTool).setUnlocalizedName("exoniteaxe").setTextureName(MODID +":exoniteaxetex");
            exonitchovel = new ItemExoniteChovel(exoniteTool).setUnlocalizedName("exonitechovel").setTextureName(MODID + ":exonitechoveltex");
            exonithoe = new ItemExoniteHoe(exoniteTool).setUnlocalizedName("exonitehoe").setTextureName(MODID + ":exonitehoetex");
            itemMaxencite = new ItemMaxencite().setUnlocalizedName("itemmaxencite").setTextureName(MODID + ":itemmaxencitetex");
            HelmetMaxencite = new ItemMaxenciteArmor(maxenciteArmor, 0).setUnlocalizedName("helmetmaxencite").setTextureName(MODID + ":helmetmaxencitetex");
            ChestplateMaxencite = new ItemMaxenciteArmor(maxenciteArmor, 1).setUnlocalizedName("chestplatemaxencite").setTextureName(MODID + ":chestplatemaxencitetex");
            leggingsMaxencite = new ItemMaxenciteArmor(maxenciteArmor, 2).setUnlocalizedName("leggingsmaxencite").setTextureName(MODID + ":leggingsmaxencitetex");
            BootsMaxencite = new ItemMaxenciteArmor(maxenciteArmor, 3).setUnlocalizedName("bootsmaxencite").setTextureName(MODID + ":bootsmaxencitetex");
            maxencitesworld = new ItemMaxenciteSworld(maxenciteTool).setUnlocalizedName("sworldmaxencite").setTextureName(MODID +":maxencitesworldtex");
            maxencitepickaxe = new ItemMaxencitePickaxe(maxenciteTool).setUnlocalizedName("pickaxemaxencite").setTextureName(MODID + ":maxencitepickaxetex");
            maxenciteaxe = new ItemMaxenciteAxe(maxenciteTool).setUnlocalizedName("axemaxencite").setTextureName(MODID + ":maxenciteaxetex");
            maxencitechovel = new ItemMaxenciteChovel(maxenciteTool).setUnlocalizedName("chovelmaxencite").setTextureName(MODID + ":maxencitechoveltex");
            maxencitehoe = new ItemMaxenciteHoe(maxenciteTool).setUnlocalizedName("hoemaxencite").setTextureName(MODID + ":maxencitehoetex");
            itemewilite = new ItemEwilite().setUnlocalizedName("itemewilite").setTextureName(MODID + ":ewiliteitemtex");
            helmetewilite = new ItemEwiliteArmor(ewilitearmor, 0).setUnlocalizedName("helmetewilite").setTextureName(MODID + ":helmetewilitetex");
            chestplateewilite = new ItemEwiliteArmor(ewilitearmor, 1).setUnlocalizedName("chestplateewilite").setTextureName(MODID + ":chestplateewilitetex");
            leggingsewilite = new ItemEwiliteArmor(ewilitearmor, 2).setUnlocalizedName("leggingsewilite").setTextureName(MODID + ":leggingsewilitetex");
            bootsewilite = new ItemEwiliteArmor(ewilitearmor, 3).setUnlocalizedName("bootsewilite").setTextureName(MODID + ":bootsewilitetex");
            ewilitesworld = new ItemEwiliteSworld(ewilitetool).setUnlocalizedName("sworldewilite").setTextureName(MODID + ":sworldewilitetex");
            
            GameRegistry.registerItem(itemExonite, "exonit");
            GameRegistry.registerItem(itemMaxencite, "maxencite");
            GameRegistry.registerItem(HelmetExonite, "exonite_helmet");
            GameRegistry.registerItem(ChestPlateExonite, "exonite_chestplate");
            GameRegistry.registerItem(LegginsExonite, "exonite_leggings");
            GameRegistry.registerItem(BootsExonite, "exonite_boots");
            GameRegistry.registerItem(exonitesworld, "exonite_sworld");
            GameRegistry.registerItem(exnoitpichaxe, "exnoit_pichaxe");
            GameRegistry.registerItem(exoniteaxe, "exonite_axe");
            GameRegistry.registerItem(exonitchovel, "exonit_chovel");
            GameRegistry.registerItem(exonithoe, "exonit_hoe");
            GameRegistry.registerItem(HelmetMaxencite, "maxencite_helmet");
            GameRegistry.registerItem(ChestplateMaxencite, "maxencite_chestplate");
            GameRegistry.registerItem(leggingsMaxencite, "maxencite_leggings");
            GameRegistry.registerItem(BootsMaxencite, "maxencite_boots");
            GameRegistry.registerItem(maxencitesworld, "maxencite_sworld");
            GameRegistry.registerItem(maxencitepickaxe, "maxencite_pickaxe");
            GameRegistry.registerItem(maxenciteaxe, "maxencite_axe");
            GameRegistry.registerItem(maxencitechovel, "maxencite_chovel");
            GameRegistry.registerItem(maxencitehoe, "maxencite_hoe");
            GameRegistry.registerItem(itemewilite, "item_ewilite");
            GameRegistry.registerItem(helmetewilite, "helmet_ewilite");
            GameRegistry.registerItem(chestplateewilite, "chestplate_ewilite");
            GameRegistry.registerItem(leggingsewilite, "leggings_ewilite");
            GameRegistry.registerItem(bootsewilite, "boots_ewilite");
            GameRegistry.registerItem(ewilitesworld, "ewilite_sworld");
            
            oreExonite = new OreExonite(Material.iron).setBlockName("oreexonite").setBlockTextureName(MODID + ":oreexonitetex").setHardness(15.0F).setResistance(4);
            exoniteblock = new ExoniteBlock(Material.iron).setBlockName("exoniteblock").setBlockTextureName(MODID + ":exoniteblocktex").setHardness(15.0F).setResistance(4);
            oreMaxencite = new OreMaxencite(Material.iron).setBlockName("oremaxencite").setBlockTextureName(MODID + ":oremaxencitetex").setHardness(7.0F).setResistance(4);
            blockmaxencite = new BlockMaxencite(Material.iron).setBlockName("blockmaxencite").setBlockTextureName(MODID + ":blockmaxencitetex").setHardness(7.0F).setResistance(4);
            oreEwilite = new OreEwilite(Material.iron).setBlockName("oreexilite").setBlockTextureName(MODID + ":oreewilitetex").setHardness(15.0F).setResistance(4);
            blockewilite = new BlockEwilite(Material.iron).setBlockName("blockewilite").setBlockTextureName(MODID + ":blockewilitetex").setHardness(15.0F).setResistance(4);
            ewilitechest = new Ewilitechest(Material.iron).setBlockName("ewilitechest").setBlockTextureName(MODID + ":ewilitechesttex").setHardness(25.0F).setResistance(10);
            
            GameRegistry.registerBlock(oreExonite, "ore_exonite");
            GameRegistry.registerBlock(exoniteblock, "exonite_block");
            GameRegistry.registerBlock(oreMaxencite, "ore_maxencite");
            GameRegistry.registerBlock(blockmaxencite, "block_maxencite");
            GameRegistry.registerBlock(blockewilite, "block_ewilite");
            GameRegistry.registerBlock(oreEwilite, "ore_ewilite");
            GameRegistry.registerBlock(ewilitechest, "ewilite_chest");
            
            GameRegistry.registerWorldGenerator(new ExonitGeneration(), 0);
            GameRegistry.registerWorldGenerator(new MaxenciteGeneration(), 0);
            GameRegistry.registerWorldGenerator(new EwiliteGeneration(), 0);
            }
            @EventHandler
            public void init(FMLInitializationEvent test)
            {
            GameRegistry.addRecipe(new ItemStack(exoniteblock), new Object[]{"SSS", "SSS", "SSS", 'S', ewifaction.itemExonite});
            GameRegistry.addRecipe(new ItemStack(HelmetExonite), new Object[]{"SSS", "S S", "   ", 'S', ewifaction.itemExonite});
            GameRegistry.addRecipe(new ItemStack(ChestPlateExonite), new Object[]{"S S", "SSS", "SSS", 'S', ewifaction.itemExonite});
            GameRegistry.addRecipe(new ItemStack(LegginsExonite), new Object[]{"SSS", "S S", "S S", 'S', ewifaction.itemExonite});
            GameRegistry.addRecipe(new ItemStack(BootsExonite), new Object[]{"   ", "S S", "S S", 'S', ewifaction.itemExonite});
            GameRegistry.addRecipe(new ItemStack(BootsExonite, 1), new Object[]{"S S", "S S", "   ", 'S', ewifaction.itemMaxencite});
            GameRegistry.addRecipe(new ItemStack(exonitesworld), new Object[]{"S", "S",  "A", 'S', ewifaction.itemExonite, 'A', Items.stick});
            GameRegistry.addRecipe(new ItemStack(exnoitpichaxe), new Object[]{"SSS", " A ", " A ", 'S', ewifaction.itemExonite, 'A', Items.stick});
            GameRegistry.addRecipe(new ItemStack(exoniteaxe), new Object[]{"SS ", "SA ", " A ", 'S', ewifaction.itemExonite, 'A', Items.stick});
            GameRegistry.addRecipe(new ItemStack(exonitchovel), new Object[]{"S", "A", "A", 'S', ewifaction.itemExonite, 'A', Items.stick});
            GameRegistry.addRecipe(new ItemStack(exonithoe), new Object[]{"SS", "A ", "A ", 'S', ewifaction.itemExonite, 'A', Items.stick});
            GameRegistry.addRecipe(new ItemStack(itemExonite, 9), new Object[]{" ", "S", " ", 'S', ewifaction.exoniteblock});
            GameRegistry.addRecipe(new ItemStack(itemExonite, 9), new Object[]{"S", " ", " ", 'S', ewifaction.exoniteblock});
            GameRegistry.addRecipe(new ItemStack(itemExonite, 9), new Object[]{" ", " ", "S", 'S', ewifaction.exoniteblock});
            GameRegistry.addRecipe(new ItemStack(blockmaxencite, 9), new Object[]{"SSS", "SSS", "SSS", 'S', ewifaction.itemMaxencite});
            GameRegistry.addRecipe(new ItemStack(HelmetMaxencite, 1), new Object[]{"SSS", "S S", "   ", 'S', ewifaction.itemMaxencite});
            GameRegistry.addRecipe(new ItemStack(ChestplateMaxencite, 1), new Object[]{"S S", "SSS", "SSS", 'S', ewifaction.itemMaxencite});
            GameRegistry.addRecipe(new ItemStack(leggingsMaxencite, 1), new Object[]{"SSS", "S S", "S S", 'S', ewifaction.itemMaxencite});
            GameRegistry.addRecipe(new ItemStack(BootsMaxencite, 1), new Object[]{"S S", "S S", "   ", 'S', ewifaction.itemMaxencite});
            GameRegistry.addRecipe(new ItemStack(BootsMaxencite, 1), new Object[]{"   ", "S S", "S S", 'S', ewifaction.itemMaxencite});
            GameRegistry.addRecipe(new ItemStack(maxencitesworld), new Object[]{"S", "S",  "A", 'S', ewifaction.itemMaxencite, 'A', Items.stick});
            GameRegistry.addRecipe(new ItemStack(maxencitepickaxe), new Object[]{"SSS", " A ", " A ", 'S', ewifaction.itemMaxencite, 'A', Items.stick});
            GameRegistry.addRecipe(new ItemStack(maxencitechovel), new Object[]{"S", "A", "A", 'S', ewifaction.itemMaxencite, 'A', Items.stick});
            GameRegistry.addRecipe(new ItemStack(maxenciteaxe), new Object[]{"SS ", "SA ", " A ", 'S', ewifaction.itemMaxencite, 'A', Items.stick});
            GameRegistry.addRecipe(new ItemStack(maxencitehoe), new Object[]{"SS", "A ", "A ", 'S', ewifaction.itemMaxencite, 'A', Items.stick});
            GameRegistry.addRecipe(new ItemStack(itemMaxencite, 9), new Object[]{" ", "S", " ", 'S', ewifaction.blockmaxencite});
            GameRegistry.addRecipe(new ItemStack(itemMaxencite, 9), new Object[]{"S", " ", " ", 'S', ewifaction.blockmaxencite});
            GameRegistry.addRecipe(new ItemStack(itemMaxencite, 9), new Object[]{" ", " ", "S", 'S', ewifaction.blockmaxencite});
            GameRegistry.addRecipe(new ItemStack(itemewilite, 9), new Object[]{"S", " ", " ", 'S', ewifaction.blockewilite});
            GameRegistry.addRecipe(new ItemStack(itemewilite, 9), new Object[]{" ", "S", " ", 'S', ewifaction.blockewilite});
            GameRegistry.addRecipe(new ItemStack(itemewilite, 9), new Object[]{" ", " ", "S", 'S', ewifaction.blockewilite});
            GameRegistry.addRecipe(new ItemStack(blockewilite, 1), new Object[]{"SSS", "SSS", "SSS", 'S', ewifaction.itemewilite});
            
            GameRegistry.addSmelting(ewifaction.oreExonite, new ItemStack(ewifaction.itemExonite), 1);
            GameRegistry.addSmelting(ewifaction.oreMaxencite, new ItemStack(ewifaction.itemMaxencite), 1);
            GameRegistry.addSmelting(ewifaction.oreEwilite, new ItemStack(ewifaction.itemewilite), 1);
            
            GameRegistry.registerTileEntity(TileEntityEwiliteChest.class, "MODID:ewilitechest");
            NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuihandlerEwifaction());
            }
            @EventHandler
            public void postInit(FMLPostInitializationEvent test)
            {
            }
            }
            
            mon block :
            
            package thecraft.mod.common;
            
            import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
            import net.minecraft.block.Block;
            import net.minecraft.block.material.Material;
            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.tileentity.TileEntityChest;
            import net.minecraft.world.World;
            
            public class Ewilitechest extends Block
            {
            public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitx, float hity, float hitz)
            {
            FMLNetworkHandler.openGui(player, ewifaction.instance, 0, world, x, y, z);
            return true;
            }
            protected Ewilitechest(Material material)
            {
            super(material);
            }
            public TileEntity createTileEntity(World world)
            {
            return new TileEntityEwiliteChest();
            }
            
            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 void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
              {
                  TileEntity tile = world.getTileEntity(x, y, z);
                  if(tile instanceof TileEntityEwiliteChest)
                  {
                      if(stack.hasDisplayName())
                      {
                          ((TileEntityEwiliteChest)tile).setCustomName(stack.getDisplayName(), textureName);
                      }
                  }
              }
            
            }
            
            ma gui :
            
            package thecraft.mod.common;
            
            import org.lwjgl.opengl.GL11;
            
            import net.minecraft.client.gui.inventory.GuiContainer;
            import net.minecraft.client.resources.I18n;
            import net.minecraft.entity.player.InventoryPlayer;
            import net.minecraft.inventory.Container;
            import net.minecraft.inventory.IInventory;
            import net.minecraft.util.ResourceLocation;
            
            public class GuiEwiliteChest extends GuiContainer
            {
            private static final ResourceLocation textures = new ResourceLocation(ewifaction.MODID, "textures/gui/container/cupboard.png");
              private TileEntityEwiliteChest tileewilite;
              private IInventory playerInv;
            
              public GuiEwiliteChest(TileEntityEwiliteChest tile, InventoryPlayer inventory)
              {
                  super(new ContainerEwiliteChest(tile, inventory));
                  this.tileewilite = tile;
                  this.playerInv = inventory;
                  this.allowUserInput = false;
                  this.ySize = 170;
              }
            
              @Override
              protected void drawGuiContainerBackgroundLayer(float partialRenderTick, int x, int y)
              {
              String tileName = this.tileewilite.hasCustomInventoryName() ? this.tileewilite.getInventoryName() : I18n.format(this.tileewilite.getInventoryName());
                  this.fontRendererObj.drawString(tileName, (this.xSize - this.fontRendererObj.getStringWidth(tileName)) / 2, 6, 0);
                  String invName = this.playerInv.hasCustomInventoryName() ? this.playerInv.getInventoryName() : I18n.format(this.playerInv.getInventoryName());
                  this.fontRendererObj.drawString(invName, (this.xSize - this.fontRendererObj.getStringWidth(invName)) / 2, this.ySize - 96, 0);
                  GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                  this.mc.getTextureManager().bindTexture(textures);
                  int k = (this.width - this.xSize) / 2;
                  int l = (this.height - this.ySize) / 2;
                  this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
              }
            }
            
            mon guihandler :
            
            package thecraft.mod.common;
            
            import cpw.mods.fml.common.network.IGuiHandler;
            import net.minecraft.entity.player.EntityPlayer;
            import net.minecraft.tileentity.TileEntity;
            import net.minecraft.world.World;
            import thecraft.mod.client.GuiEwiliteChest;
            
            public class GuihandlerEwifaction implements IGuiHandler
            {
            @Override
            public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
            {
            TileEntity tile = world.getTileEntity(x, y, z);
                  if(tile instanceof TileEntityEwiliteChest)
                  {
                      return new ContainerEwiliteChest((TileEntityEwiliteChest)tile, player.inventory);
                  }
                  return null;
            }
            
            @Override
            public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
            {
            TileEntity tile = world.getTileEntity(x, y, z);
                  if(tile instanceof TileEntityEwiliteChest)
                  {
                      return new GuiEwiliteChest((TileEntityEwiliteChest)tile, player.inventory);
                  }
                  return null;
            }
            
            }
            
            mon title entity :
            package thecraft.mod.common;
            
            import ibxm.Player;
            import net.minecraft.entity.player.EntityPlayer;
            import net.minecraft.inventory.IInventory;
            import net.minecraft.item.ItemStack;
            import net.minecraft.nbt.NBTTagCompound;
            import net.minecraft.nbt.NBTTagList;
            import net.minecraft.tileentity.TileEntity;
            import net.minecraft.world.World;
            import net.minecraftforge.common.util.Constants;
            
            public class TileEntityEwiliteChest extends TileEntity implements IInventory
            {
            private ItemStack[] contents = new ItemStack[27];
              private String customName;
              @Override
               public void readFromNBT(NBTTagCompound compound)
               {
                   super.readFromNBT(compound);
                   if(compound.hasKey("CustomName", Constants.NBT.TAG_STRING))
                   {
                       this.customName = compound.getString("CustomName"); // on le lit
                   }
            
                   NBTTagList nbttaglist = compound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
                   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);
                       }
                   }
               }
            
               @Override
               public void writeToNBT(NBTTagCompound compound)
               {
                   super.writeToNBT(compound);
                   if(this.hasCustomInventoryName())
                   {
                       compound.setString("CustomName", this.customName);
                   }
            
                   NBTTagList nbttaglist = new NBTTagList();
                   for(int i = 0; i < this.contents.length; ++i)
                   {
                       if(this.contents[ i] != null)
                       {
                           NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                           nbttagcompound1.setByte("Slot", (byte)i);
                           this.contents[ i].writeToNBT(nbttagcompound1);
                           nbttaglist.appendTag(nbttagcompound1);
                       }
                   }
                   compound.setTag("Items", nbttaglist); //
               }
            @Override
            public int getSizeInventory()
            {
            return this.contents.length;
            }
            
            @Override
            public ItemStack getStackInSlot(int slotIndex)
            {
            return this.contents[slotIndex];
            }
            
            @Override
            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;
                  }
            }
            
            @Override
            public ItemStack getStackInSlotOnClosing(int slotIndex)
            {
            if(this.contents[slotIndex] != null)
                  {
                      ItemStack itemstack = this.contents[slotIndex];
                      this.contents[slotIndex] = null;
                      return itemstack;
                  }
                  else
                  {
                      return null;
                  }
            }
            
            @Override
            public void setInventorySlotContents(int slotIndex, ItemStack stack)
            {
            this.contents[slotIndex] = stack;
            
                  if(stack != null && stack.stackSize > this.getInventoryStackLimit())
                  {
                      stack.stackSize = this.getInventoryStackLimit();
                  }
            
                  this.markDirty();
            }
            
            @Override
            public String getInventoryName()
            {
            return this.hasCustomInventoryName() ? this.customName : "tile.cupboard";
            }
            
            @Override
            public boolean hasCustomInventoryName()
            {
            return false;
            }
            
            @Override
            public int getInventoryStackLimit()
            {
            return 64;
            }
            
            @Override
            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;
            }
            
            @Override
            public void openInventory()
            {
            
            }
            
            @Override
            public void closeInventory()
            {
            
            }
            
            @Override
            public boolean isItemValidForSlot(int slotIndex, ItemStack stack)
            {
            return true;
            }
            
            public void setCustomName(String displayName, String customName)
            {
            this.customName = customName;
            }
            }
            
            mon client proxy :
            
            package thecraft.mod.proxy;
            
            public class clientproxy extends commonproxy
            {
            
            }
            
            mon common proxy :
            package thecraft.mod.proxy;
            
            public class commonproxy
            {
            public void registerRender()
            {
            
            }
            }
            
            je vien de le remarquer mais ma class GuiEwiliteChest ce trouve dans thecraft.mod.client et dans thecraft.mod.common , je pense qu'un des problèmes vien de la pouvez-vous m'indiquez la qu'elle je dois enlever ?
            (celle que je vous ai mise est celle de thecraft.mod.common)
            
            1 réponse Dernière réponse Répondre Citer 0
            • AxaurusA Hors-ligne
              Axaurus
              dernière édition par

              Déjà dans ta fonction onBlockActivated, remplace java FMLNetworkHandler.openGui(player, ewifaction.instance, 0, world, x, y, z);          return true; par ```java
              if(world.isRemote)
                    {
                        return true;
                    }
                    else
                    {
                        player.openGui(ewifaction.instance, 0, world, x, y, z);
                        return true;
                    }

              Ca ne marchera pas forcément, mais y'aura quand même plus de chance que si
              
              Pour répondre à ta question, est-ce que ces deux classes sont complètement égaux ? Si oui, même si tu peux enlever n'importe lequel, je te conseille d'enlever celle qui est dans common. En effet, le gui étant uniquement client, tu t'y retrouvera plus facilement
              1 réponse Dernière réponse Répondre Citer 0
              • SpyManS Hors-ligne
                SpyMan
                dernière édition par

                connait tu la convention java ? car les nom de class doivent etre en MAJUSCULE
                et puis sil te plait envoi moi ton projet en entier dans un zip en pièce jointe car y a des truc que je ne comprend dedans tes class

                1 réponse Dernière réponse Répondre Citer 0
                • T Hors-ligne
                  thecraft38
                  dernière édition par

                  je ne connais pas vraiment les convention java j’apprends , faire des mods etc m’as toujours intéressé et je m’y essaye.
                  J’ai fait la modification proposer et sa ne fonctionne toujours pas , je vous fait un zip de mon fichier pour le qu’elle je met mon chemin d’access quand j’ouvre éclipse :
                  http://www.mediafire.com/file/0zlmzein9k6yd90/ewifaction.zip

                  1 réponse Dernière réponse Répondre Citer 0
                  • SpyManS Hors-ligne
                    SpyMan
                    dernière édition par robin4002

                    Traduction please : “sworld”, “chovel” ???

                    http://www.anglaisfacile.com/
                    http://www.anglaisfacile.com/
                    http://www.anglaisfacile.com/

                    Mes yeux saignent…

                    J’ai trouvé le problème : dans la class de ton Block apprend ovveride tes fonctions car sinon tu vois pas les erreur car dans la class de ton block la fonction createTileEntity était mal écrite ce qui faisait que ton gui handler ne trouvait pas ton tileentity de ton coffre
                    je me suis permis de mettre un peut d’ordre aussi, car STP reprend ton code du début (nom de class et de variables) car cela est vraiment moche quand y  a des noms de variables en minuscule et majuscule ou des nom de class en minuscule, bref j’en passe quoi.
                    ET AUSSI l’anglais par pitié tout mais pas ça!

                    et quand pont dit envoi le projet c’est juste le dossier src pas le tout !

                    Là je te renvoi le dossier src tu le remplace juste par le mien

                    src.zip

                    1 réponse Dernière réponse Répondre Citer 1
                    • T Hors-ligne
                      thecraft38
                      dernière édition par

                      Merci je vais essayer et je vais remettre tous sa en ordre , je vais essayer le nouveau dossier et je signale si sa fonctionne.
                      La prochaine fois je ne métrai que le src mais espérons que je n’ai pas a le faire
                      il y a une erreur mais je ne parviens pas a localisé d’ou elle viens : 

                      encore désolé de vous dérangez.

                      1 réponse Dernière réponse Répondre Citer 0
                      • SpyManS Hors-ligne
                        SpyMan
                        dernière édition par

                        Precise…
                         EDIT : c’est un probleme d’eclipse car il enregistre tes packages dans un fichier refait un gradlew eclipse sur ton projets ça corrigé le probleme de memoire

                        1 réponse Dernière réponse Répondre Citer 0
                        • T Hors-ligne
                          thecraft38
                          dernière édition par

                          merci beaucoup sa fonctionne !

                          1 réponse Dernière réponse Répondre Citer 0
                          • robin4002R Hors-ligne
                            robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                            dernière édition par

                            @‘SpyMan’:

                            connait tu la convention java ? car les nom de class doivent etre en MAJUSCULE

                            doivent commencer par une majuscule*

                            Par contre ne retournes pas voir les anciens tutoriels du site (1.6.4 et avant), en terme de convention c’est vraiment pas ça x)
                            (j’étais vraiment mauvais à l’époque sur ce point).

                            1 réponse Dernière réponse Répondre Citer 0

                            Bonjour ! Vous semblez intéressé par cette conversation, mais vous n’avez pas encore de compte.

                            Marre de refaire défiler les mêmes messages ? Créez un compte pour retrouver votre position, recevoir des notifications des nouvelles réponses, sauvegarder vos favoris et voter pour les messages que vous appréciez.

                            Grâce à votre participation, ce message peut devenir encore meilleur 💗

                            S'inscrire Se connecter
                            • 1 / 1
                            • Premier message
                              Dernier message
                            Design by Woryk
                            ContactMentions Légales

                            MINECRAFT FORGE FRANCE © 2024

                            Powered by NodeBB