Nouvelle table d'enchantement



  • Salut j'ai crée une nouvelle table d'enchantement niquel mais lorsque j'pen le GUi j'ai  une erreur :  A fatal Error hac occured… et un crash report mais le jeu ne se ferme pas 😃

    [14:44:35] [Client thread/ERROR] [FML]: OpenGuiHandler exception
    java.lang.ClassCastException: fr.Mosca421.Arthania.EnchantementTable.ContainerEnchantment cannot be cast to net.minecraft.client.gui.GuiScreen
    at cpw.mods.fml.client.FMLClientHandler.showGuiScreen(FMLClientHandler.java:471) ~[FMLClientHandler.class:?]
    at cpw.mods.fml.common.FMLCommonHandler.showGuiScreen(FMLCommonHandler.java:303) ~[FMLCommonHandler.class:?]
    at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:94) ~[FMLNetworkHandler.class:?]
    at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501) ~[EntityPlayer.class:?]
    at cpw.mods.fml.common.network.internal.OpenGuiHandler.channelRead0(OpenGuiHandler.java:16) ~[OpenGuiHandler.class:?]
    at cpw.mods.fml.common.network.internal.OpenGuiHandler.channelRead0(OpenGuiHandler.java:11) ~[OpenGuiHandler.class:?]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:101) [SimpleChannelInboundHandler.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?]
    at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]
    at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]
    at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]
    at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?]
    at net.minecraft.client.multiplayer.PlayerControllerMP.updateController(PlayerControllerMP.java:317) [PlayerControllerMP.class:?]
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1693) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:962) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_65]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_65]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_65]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_65]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
    at GradleStart.main(Unknown Source) [start/:?]
    [14:44:35] [Client thread/ERROR] [FML]: HandshakeCompletionHandler exception
    java.lang.ClassCastException: fr.Mosca421.Arthania.EnchantementTable.ContainerEnchantment cannot be cast to net.minecraft.client.gui.GuiScreen
    at cpw.mods.fml.client.FMLClientHandler.showGuiScreen(FMLClientHandler.java:471) ~[FMLClientHandler.class:?]
    at cpw.mods.fml.common.FMLCommonHandler.showGuiScreen(FMLCommonHandler.java:303) ~[FMLCommonHandler.class:?]
    at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:94) ~[FMLNetworkHandler.class:?]
    at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501) ~[EntityPlayer.class:?]
    at cpw.mods.fml.common.network.internal.OpenGuiHandler.channelRead0(OpenGuiHandler.java:16) ~[OpenGuiHandler.class:?]
    at cpw.mods.fml.common.network.internal.OpenGuiHandler.channelRead0(OpenGuiHandler.java:11) ~[OpenGuiHandler.class:?]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:101) [SimpleChannelInboundHandler.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?]
    at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]
    at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]
    at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]
    at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?]
    at net.minecraft.client.multiplayer.PlayerControllerMP.updateController(PlayerControllerMP.java:317) [PlayerControllerMP.class:?]
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1693) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:962) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_65]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_65]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_65]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_65]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
    at GradleStart.main(Unknown Source) [start/:?]
    [14:44:35] [Client thread/ERROR] [FML]: There was a critical exception handling a packet on channel FML
    java.lang.ClassCastException: fr.Mosca421.Arthania.EnchantementTable.ContainerEnchantment cannot be cast to net.minecraft.client.gui.GuiScreen
    at cpw.mods.fml.client.FMLClientHandler.showGuiScreen(FMLClientHandler.java:471) ~[FMLClientHandler.class:?]
    at cpw.mods.fml.common.FMLCommonHandler.showGuiScreen(FMLCommonHandler.java:303) ~[FMLCommonHandler.class:?]
    at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:94) ~[FMLNetworkHandler.class:?]
    at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501) ~[EntityPlayer.class:?]
    at cpw.mods.fml.common.network.internal.OpenGuiHandler.channelRead0(OpenGuiHandler.java:16) ~[OpenGuiHandler.class:?]
    at cpw.mods.fml.common.network.internal.OpenGuiHandler.channelRead0(OpenGuiHandler.java:11) ~[OpenGuiHandler.class:?]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:101) ~[SimpleChannelInboundHandler.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[MessageToMessageDecoder.class:?]
    at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:?]
    at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:?]
    at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]
    at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?]
    at net.minecraft.client.multiplayer.PlayerControllerMP.updateController(PlayerControllerMP.java:317) [PlayerControllerMP.class:?]
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1693) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:962) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_65]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_65]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_65]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_65]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
    at GradleStart.main(Unknown Source) [start/:?]
    


  • Envoi ton Gui Handler, j'ai l'impression que tu a inversé le gui avec le Container.



  • package fr.Mosca421.Arthania.EnchantementTable;
    
    import cpw.mods.fml.common.network.IGuiHandler;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.world.World;
    
    public class GuiHandlerTable implements IGuiHandler{
    
    @Override
    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
         return new ContainerEnchantment(player.inventory, world, x, y, z);
    
    }
    
    @Override
    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
         return new ContainerEnchantment(player.inventory, world, x, y, z);
    
    }
    
    }
    
    


  • Dans getClientGuiElement tu doit retourner un Gui et non pas un container.



  • J'ai rien dis enfaite j'ai une erreur si je fais ça 😃
    The constructor GuiEnchantment(InventoryPlayer, World, int, int, int) is undefined

    package fr.Mosca421.Arthania.EnchantementTable;
    
    import com.google.common.collect.Lists;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import java.util.ArrayList;
    import java.util.Random;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.entity.EntityClientPlayerMP;
    import net.minecraft.client.gui.FontRenderer;
    import net.minecraft.client.gui.ScaledResolution;
    import net.minecraft.client.gui.inventory.GuiContainer;
    import net.minecraft.client.model.ModelBook;
    import net.minecraft.client.multiplayer.PlayerControllerMP;
    import net.minecraft.client.renderer.RenderHelper;
    import net.minecraft.client.renderer.texture.TextureManager;
    import net.minecraft.client.resources.I18n;
    import net.minecraft.enchantment.Enchantment;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.player.InventoryPlayer;
    import net.minecraft.entity.player.PlayerCapabilities;
    import net.minecraft.inventory.Container;
    import net.minecraft.inventory.Slot;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.EnchantmentNameParts;
    import net.minecraft.util.EnumChatFormatting;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.World;
    import org.lwjgl.util.glu.Project;
    
    @SideOnly(Side.CLIENT)
    public class GuiEnchantment
      extends GuiContainer
    {
      private static final ResourceLocation field_147078_C = new ResourceLocation("Arthania:textures/gui/container/enchanting_table.png");
      private static final ResourceLocation field_147070_D = new ResourceLocation("textures/entity/enchanting_table_book.png");
      private static final ModelBook field_147072_E = new ModelBook();
      private final InventoryPlayer field_175379_F;
      private final Random field_147074_F = new Random();
      private final ContainerEnchantment field_147075_G;
      public int field_147073_u;
      public float field_147071_v;
      public float field_147069_w;
      public float field_147082_x;
      public float field_147081_y;
      public float field_147080_z;
      public float field_147076_A;
      ItemStack field_147077_B;
      private final String field_175380_I;
    
      public GuiEnchantment(InventoryPlayer inventory, World world, String p_i45502_3_)
      {
        super(new ContainerEnchantment(inventory, world, 0, 0, 0));
        this.field_175379_F = inventory;
        this.field_147075_G = ((ContainerEnchantment)this.inventorySlots);
        this.field_175380_I = p_i45502_3_;
      }
    
    protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
      {
        this.fontRendererObj.drawString(this.field_175380_I == null ? I18n.format("container.enchant", new Object[0]) : this.field_175380_I, 12, 5, 4210752);
        this.fontRendererObj.drawString(I18n.format(this.field_175379_F.getInventoryName(), new Object[0]), 8, this.ySize - 96 + 2, 4210752);
      }
    
      public void updateScreen()
      {
        super.updateScreen();
        func_147068_g();
      }
    
      protected void mouseClicked(int mouseX, int mouseY, int mouseButton)
      {
        super.mouseClicked(mouseX, mouseY, mouseButton);
        int var4 = (this.width - this.xSize) / 2;
        int var5 = (this.height - this.ySize) / 2;
        for (int var6 = 0; var6 < 3; var6++)
        {
          int var7 = mouseX - (var4 + 60);
          int var8 = mouseY - (var5 + 14 + 19 * var6);
          if ((var7 >= 0) && (var8 >= 0) && (var7 < 108) && (var8 < 19) && (this.field_147075_G.enchantItem(this.mc.thePlayer, var6))) {
            this.mc.playerController.sendEnchantPacket(this.field_147075_G.windowId, var6);
          }
        }
      }
    
      protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
      {
        OpenGLHelper.colour(1.0F, 1.0F, 1.0F);
        this.mc.getTextureManager().bindTexture(field_147078_C);
        int k = (this.width - this.xSize) / 2;
        int l = (this.height - this.ySize) / 2;
        drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
        OpenGLHelper.pushMatrix();
        OpenGLHelper.matrixMode(5889);
        OpenGLHelper.pushMatrix();
        OpenGLHelper.loadIdentity();
        ScaledResolution var6 = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
        OpenGLHelper.viewport((var6.getScaledWidth() - 320) / 2 * var6.getScaleFactor(), (var6.getScaledHeight() - 240) / 2 * var6.getScaleFactor(), 320 * var6.getScaleFactor(), 240 * var6.getScaleFactor());
        OpenGLHelper.translate(-0.34F, 0.23F, 0.0F);
        Project.gluPerspective(90.0F, 1.3333334F, 9.0F, 80.0F);
        float var7 = 1.0F;
        OpenGLHelper.matrixMode(5888);
        OpenGLHelper.loadIdentity();
        RenderHelper.enableStandardItemLighting();
        OpenGLHelper.translate(0.0F, 3.3F, -16.0F);
        OpenGLHelper.scale(var7, var7, var7);
        float var8 = 5.0F;
        OpenGLHelper.scale(var8, var8, var8);
        OpenGLHelper.rotate(180.0F, 0.0F, 0.0F, 1.0F);
        this.mc.getTextureManager().bindTexture(field_147070_D);
        OpenGLHelper.rotate(20.0F, 1.0F, 0.0F, 0.0F);
        float var9 = this.field_147076_A + (this.field_147080_z - this.field_147076_A) * partialTicks;
        OpenGLHelper.translate((1.0F - var9) * 0.2F, (1.0F - var9) * 0.1F, (1.0F - var9) * 0.25F);
        OpenGLHelper.rotate(-(1.0F - var9) * 90.0F - 90.0F, 0.0F, 1.0F, 0.0F);
        OpenGLHelper.rotate(180.0F, 1.0F, 0.0F, 0.0F);
        float var10 = this.field_147069_w + (this.field_147071_v - this.field_147069_w) * partialTicks + 0.25F;
        float var11 = this.field_147069_w + (this.field_147071_v - this.field_147069_w) * partialTicks + 0.75F;
        var10 = (var10 - MathHelper.truncateDoubleToInt(var10)) * 1.6F - 0.3F;
        var11 = (var11 - MathHelper.truncateDoubleToInt(var11)) * 1.6F - 0.3F;
        if (var10 < 0.0F) {
          var10 = 0.0F;
        }
        if (var11 < 0.0F) {
          var11 = 0.0F;
        }
        if (var10 > 1.0F) {
          var10 = 1.0F;
        }
        if (var11 > 1.0F) {
          var11 = 1.0F;
        }
        OpenGLHelper.enableRescaleNormal();
        field_147072_E.render((Entity)null, 0.0F, var10, var11, var9, 0.0F, 0.0625F);
        OpenGLHelper.disableRescaleNormal();
        RenderHelper.disableStandardItemLighting();
        OpenGLHelper.matrixMode(5889);
        OpenGLHelper.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
        OpenGLHelper.popMatrix();
        OpenGLHelper.matrixMode(5888);
        OpenGLHelper.popMatrix();
        RenderHelper.disableStandardItemLighting();
        OpenGLHelper.colour(1.0F, 1.0F, 1.0F);
        EnchantmentNameParts.instance.reseedRandomGenerator(this.field_147075_G.enchantmentSeed);
        int var12 = this.field_147075_G.func_178147_e();
        for (int i1 = 0; i1 < 3; i1++)
        {
          int var14 = k + 60;
          int var15 = var14 + 20;
          byte var16 = 86;
          String s = EnchantmentNameParts.instance.generateNewRandomName();
          this.zLevel = 0.0F;
          this.mc.getTextureManager().bindTexture(field_147078_C);
          int j1 = this.field_147075_G.enchantLevels[i1];
          OpenGLHelper.colour(1.0F, 1.0F, 1.0F);
          if (j1 == 0)
          {
            drawTexturedModalRect(var14, l + 14 + 19 * i1, 0, 185, 108, 19);
          }
          else
          {
            String s1 = "" + j1;
            FontRenderer fontrenderer = this.mc.standardGalacticFontRenderer;
            int k1 = 6839882;
            if (((var12 < i1 + 1) || (this.mc.thePlayer.experienceLevel < j1)) && (!this.mc.thePlayer.capabilities.isCreativeMode))
            {
              drawTexturedModalRect(var14, l + 14 + 19 * i1, 0, 185, 108, 19);
              drawTexturedModalRect(var14 + 1, l + 15 + 19 * i1, 16 * i1, 239, 16, 16);
              fontrenderer.drawSplitString(s, var15, l + 16 + 19 * i1, var16, (k1 & 0xFEFEFE) >> 1);
              k1 = 4226832;
            }
            else
            {
              int l1 = mouseX - (k + 60);
              int i2 = mouseY - (l + 14 + 19 * i1);
              if ((l1 >= 0) && (i2 >= 0) && (l1 < 108) && (i2 < 19))
              {
                drawTexturedModalRect(var14, l + 14 + 19 * i1, 0, 204, 108, 19);
                k1 = 16777088;
              }
              else
              {
                drawTexturedModalRect(var14, l + 14 + 19 * i1, 0, 166, 108, 19);
              }
              drawTexturedModalRect(var14 + 1, l + 15 + 19 * i1, 16 * i1, 223, 16, 16);
              fontrenderer.drawSplitString(s, var15, l + 16 + 19 * i1, var16, k1);
              k1 = 8453920;
            }
            fontrenderer = this.mc.fontRenderer;
            fontrenderer.drawStringWithShadow(s1, var15 + 86 - fontrenderer.getStringWidth(s1), l + 16 + 19 * i1 + 7, k1);
            OpenGLHelper.colour(1.0F, 1.0F, 1.0F);
          }
        }
      }
    
      public void drawScreen(int mouseX, int mouseY, float partialTicks)
      {
        super.drawScreen(mouseX, mouseY, partialTicks);
        boolean var4 = this.mc.thePlayer.capabilities.isCreativeMode;
        int var5 = this.field_147075_G.func_178147_e();
        for (int var6 = 0; var6 < 3; var6++)
        {
          int var7 = this.field_147075_G.enchantLevels[var6];
          int var8 = this.field_147075_G.field_178151_h[var6];
          int var9 = var6 + 1;
          if ((func_146978_c(60, 14 + 19 * var6, 108, 17, mouseX, mouseY)) && (var7 > 0) && (var8 >= 0))
          {
            ArrayList <object>var10 = Lists.newArrayList();
            if ((var8 >= 0) && (Enchantment.enchantmentsList[(var8 & 0xFF)] != null))
            {
              String var11 = Enchantment.enchantmentsList[(var8 & 0xFF)].getTranslatedName((var8 & 0xFF00) >> 8);
              var10.add(EnumChatFormatting.WHITE.toString() + EnumChatFormatting.ITALIC.toString() + I18n.format("container.enchant.clue", new Object[] { var11 }));
            }
            if (!var4)
            {
              if (var8 >= 0) {
                var10.add("");
              }
              if (this.mc.thePlayer.experienceLevel < var7)
              {
                var10.add(EnumChatFormatting.RED.toString() + "Level Requirement: " + this.field_147075_G.enchantLevels[var6]);
              }
              else
              {
                String var11 = "";
                if (var9 == 1) {
                  var11 = I18n.format("container.enchant.lapis.one", new Object[0]);
                } else {
                  var11 = I18n.format("container.enchant.lapis.many", new Object[] { Integer.valueOf(var9) });
                }
                if (var5 >= var9) {
                  var10.add(EnumChatFormatting.GRAY.toString() + "" + var11);
                } else {
                  var10.add(EnumChatFormatting.RED.toString() + "" + var11);
                }
                if (var9 == 1) {
                  var11 = I18n.format("container.enchant.level.one", new Object[0]);
                } else {
                  var11 = I18n.format("container.enchant.level.many", new Object[] { Integer.valueOf(var9) });
                }
                var10.add(EnumChatFormatting.GRAY.toString() + "" + var11);
              }
            }
            drawHoveringText(var10, mouseX, mouseY, this.fontRendererObj);
            break;
          }
        }
      }
    
      public void func_147068_g()
      {
        ItemStack var1 = this.inventorySlots.getSlot(0).getStack();
        if (!ItemStack.areItemStacksEqual(var1, this.field_147077_B))
        {
          this.field_147077_B = var1;
          do
          {
            this.field_147082_x += this.field_147074_F.nextInt(4) - this.field_147074_F.nextInt(4);
          } while ((this.field_147071_v <= this.field_147082_x + 1.0F) && (this.field_147071_v >= this.field_147082_x - 1.0F));
        }
        this.field_147073_u += 1;
        this.field_147069_w = this.field_147071_v;
        this.field_147076_A = this.field_147080_z;
        boolean var2 = false;
        for (int var3 = 0; var3 < 3; var3++) {
          if (this.field_147075_G.enchantLevels[var3] != 0) {
            var2 = true;
          }
        }
        if (var2) {
          this.field_147080_z += 0.2F;
        } else {
          this.field_147080_z -= 0.2F;
        }
        this.field_147080_z = MathHelper.clamp_float(this.field_147080_z, 0.0F, 1.0F);
        float var5 = (this.field_147082_x - this.field_147071_v) * 0.4F;
        float var4 = 0.2F;
        var5 = MathHelper.clamp_float(var5, -var4, var4);
        this.field_147081_y += (var5 - this.field_147081_y) * 0.9F;
        this.field_147071_v += this.field_147081_y;
      }
    }
    
    ```</object>


  • Dans le constructeur de ton gui, tu ne demandes pas les positions, pourquoi tu les donnes quand tu l'appelles dans l'handler ?
    Remplace ça : java new GuiEnchantment(player.inventory, world, x, y, z); par ça : ```java
    new GuiEnchantment(player.inventory, world, null);//Le null correspont au nom de la table (avec null ça utilisera celui par défaut qui est dans drawGuiContainerForegroundLayer



  • Ouaip j'arrive a l'open bon j'ai pas mis la texture encore mais je n'ai rien qui gère l'enchantement en gros j'ai juste un gui de base =/
    Meme pas l'inventaire c'est la dèche



  • Salut je remonte un peu mon sujet car je bloque encore sur le probleme de mon gui : http://prntscr.com/aw6ojo

    Je vous montre le code on ne sait jamais :

    
    package fr.Mosca421.Arthania.EnchantementTable;
    
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    import java.util.Random;
    import java.util.UUID;
    
    import fr.Mosca421.Arthania.Arthania;
    import net.minecraft.enchantment.Enchantment;
    import net.minecraft.enchantment.EnchantmentData;
    import net.minecraft.enchantment.EnchantmentHelper;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.player.InventoryPlayer;
    import net.minecraft.entity.player.PlayerCapabilities;
    import net.minecraft.init.Items;
    import net.minecraft.inventory.Container;
    import net.minecraft.inventory.ICrafting;
    import net.minecraft.inventory.IInventory;
    import net.minecraft.inventory.InventoryBasic;
    import net.minecraft.inventory.Slot;
    import net.minecraft.item.ItemEnchantedBook;
    import net.minecraft.item.ItemStack;
    import net.minecraft.world.World;
    import net.minecraftforge.common.ForgeHooks;
    
    public class ContainerEnchantment extends Container {
    public static final Map <string, integer="">seeds = new HashMap();
    public IInventory tableInventory;
    private World world;
    private Random rand;
    public int enchantmentSeed;
    private int posX;
    private int posY;
    private int posZ;
    public int[] enchantLevels;
    public int[] field_178151_h;
    
    public ContainerEnchantment(InventoryPlayer inventory, World world, int x, int y, int z) {
    this.tableInventory = new InventoryBasic("Enchant", true, 2) {
    public int getInventoryStackLimit() {
    return 64;
    }
    
    public void markDirty() {
    super.markDirty();
    ContainerEnchantment.this.onCraftMatrixChanged(this);
    }
    };
    this.posX = x;
    this.posY = y;
    this.posZ = z;
    this.rand = new Random();
    this.enchantLevels = new int[3];
    this.field_178151_h = new int[] { -1, -1, -1 };
    this.world = world;
    this.enchantmentSeed = getEnchantSeed(inventory.player);
    addSlotToContainer(new Slot(this.tableInventory, 0, 15, 47) {
    public boolean isItemValid(ItemStack stack) {
    return true;
    }
    
    public int getSlotStackLimit() {
    return 1;
    }
    });
    addSlotToContainer(new Slot(this.tableInventory, 1, 35, 47) {
    public boolean isItemValid(ItemStack stack) {
    return (stack.getItem() == Items.dye) && (stack.getItemDamage() == 4);
    }
    });
    for (int var4 = 0; var4 < 3; var4++) {
    for (int var5 = 0; var5 < 9; var5++) {
    addSlotToContainer(new Slot(inventory, var5 + var4 * 9 + 9, 8 + var5 * 18, 84 + var4 * 18));
    }
    }
    for (int var4 = 0; var4 < 9; var4++) {
    addSlotToContainer(new Slot(inventory, var4, 8 + var4 * 18, 142));
    }
    }
    
    private static void setEnchantSeed(EntityPlayer player, int seed) {
    seeds.put(player.getUniqueID().toString(), Integer.valueOf(seed));
    }
    
    private static int getEnchantSeed(EntityPlayer player) {
    Integer seed = (Integer) seeds.get(player.getUniqueID().toString());
    if (seed == null) {
    seed = Integer.valueOf(player.worldObj.rand.nextInt());
    setEnchantSeed(player, seed.intValue());
    }
    return seed.intValue();
    }
    
    private static void chargeForEnchant(EntityPlayer player, Random rand, int amount) {
    player.addExperienceLevel(-amount);
    
    setEnchantSeed(player, rand.nextInt());
    }
    
    public void addCraftingToCrafters(ICrafting p_75132_1_) {
    super.addCraftingToCrafters(p_75132_1_);
    p_75132_1_.sendProgressBarUpdate(this, 0, this.enchantLevels[0]);
    p_75132_1_.sendProgressBarUpdate(this, 1, this.enchantLevels[1]);
    p_75132_1_.sendProgressBarUpdate(this, 2, this.enchantLevels[2]);
    p_75132_1_.sendProgressBarUpdate(this, 3, this.enchantmentSeed & 0xFFFFFFF0);
    p_75132_1_.sendProgressBarUpdate(this, 4, this.field_178151_h[0]);
    p_75132_1_.sendProgressBarUpdate(this, 5, this.field_178151_h[1]);
    p_75132_1_.sendProgressBarUpdate(this, 6, this.field_178151_h[2]);
    }
    
    public void detectAndSendChanges() {
    super.detectAndSendChanges();
    for (int var1 = 0; var1 < this.crafters.size(); var1++) {
    ICrafting var2 = (ICrafting) this.crafters.get(var1);
    var2.sendProgressBarUpdate(this, 0, this.enchantLevels[0]);
    var2.sendProgressBarUpdate(this, 1, this.enchantLevels[1]);
    var2.sendProgressBarUpdate(this, 2, this.enchantLevels[2]);
    var2.sendProgressBarUpdate(this, 3, this.enchantmentSeed & 0xFFFFFFF0);
    var2.sendProgressBarUpdate(this, 4, this.field_178151_h[0]);
    var2.sendProgressBarUpdate(this, 5, this.field_178151_h[1]);
    var2.sendProgressBarUpdate(this, 6, this.field_178151_h[2]);
    }
    }
    
    public void updateProgressBar(int p_75137_1_, int p_75137_2_) {
    if ((p_75137_1_ >= 0) && (p_75137_1_ <= 2)) {
    this.enchantLevels[p_75137_1_] = p_75137_2_;
    } else if (p_75137_1_ == 3) {
    this.enchantmentSeed = p_75137_2_;
    } else if ((p_75137_1_ >= 4) && (p_75137_1_ <= 6)) {
    this.field_178151_h[(p_75137_1_ - 4)] = p_75137_2_;
    } else {
    super.updateProgressBar(p_75137_1_, p_75137_2_);
    }
    }
    
    public void onCraftMatrixChanged(IInventory p_75130_1_) {
    if (p_75130_1_ == this.tableInventory) {
    ItemStack var2 = p_75130_1_.getStackInSlot(0);
    if ((var2 != null) && (var2.isItemEnchantable())) {
    if (!this.world.isRemote) {
    int power = 0;
    for (int j = -1; j <= 1; j++) {
    for (int k = -1; k <= 1; k++) {
    if (((j != 0) || (k != 0))
    && (this.world.isAirBlock(this.posX + k, this.posY, this.posZ + j))
    && (this.world.isAirBlock(this.posX + k, this.posY + 1, this.posZ + j))) {
    power = (int) (power + ForgeHooks.getEnchantPower(this.world, this.posX + k * 2,
    this.posY, this.posZ + j * 2));
    power = (int) (power + ForgeHooks.getEnchantPower(this.world, this.posX + k * 2,
    this.posY + 1, this.posZ + j * 2));
    if ((k != 0) && (j != 0)) {
    power = (int) (power + ForgeHooks.getEnchantPower(this.world, this.posX + k * 2,
    this.posY, this.posZ + j));
    power = (int) (power + ForgeHooks.getEnchantPower(this.world, this.posX + k * 2,
    this.posY + 1, this.posZ + j));
    power = (int) (power + ForgeHooks.getEnchantPower(this.world, this.posX + k,
    this.posY, this.posZ + j * 2));
    power = (int) (power + ForgeHooks.getEnchantPower(this.world, this.posX + k,
    this.posY + 1, this.posZ + j * 2));
    }
    }
    }
    }
    this.rand.setSeed(this.enchantmentSeed);
    for (int j = 0; j < 3; j++) {
    this.enchantLevels[j] = EnchantmentHelper.calcItemStackEnchantability(this.rand, j, power,
    var2);
    this.field_178151_h[j] = -1;
    if (this.enchantLevels[j] < j + 1) {
    this.enchantLevels[j] = 0;
    }
    }
    for (int j = 0; j < 3; j++) {
    if (this.enchantLevels[j] > 0) {
    List <enchantmentdata>var7 = func_178148_a(var2, j, this.enchantLevels[j]);
    if ((var7 != null) && (!var7.isEmpty())) {
    EnchantmentData var6 = (EnchantmentData) var7.get(this.rand.nextInt(var7.size()));
    this.field_178151_h[j] = (var6.enchantmentobj.effectId | var6.enchantmentLevel << 8);
    }
    }
    }
    detectAndSendChanges();
    }
    } else {
    for (int power = 0; power < 3; power++) {
    this.enchantLevels[power] = 0;
    this.field_178151_h[power] = -1;
    }
    }
    }
    }
    
    public boolean enchantItem(EntityPlayer player, int id) {
    ItemStack var3 = this.tableInventory.getStackInSlot(0);
    ItemStack var4 = this.tableInventory.getStackInSlot(1);
    int var5 = id + 1;
    if (((var4 == null) || (var4.stackSize < var5)) && (!player.capabilities.isCreativeMode)) {
    return false;
    }
    if ((this.enchantLevels[id] > 0) && (var3 != null)
    && (((player.experienceLevel >= var5) && (player.experienceLevel >= this.enchantLevels[id]))
    || (player.capabilities.isCreativeMode))) {
    if (!this.world.isRemote) {
    List <enchantmentdata>var6 = func_178148_a(var3, id, this.enchantLevels[id]);
    boolean var7 = var3.getItem() == Items.book;
    if (var6 != null) {
    chargeForEnchant(player, this.rand, var5);
    if (var7) {
    var3.func_150996_a(Items.enchanted_book);
    }
    for (int var8 = 0; var8 < var6.size(); var8++) {
    EnchantmentData var9 = (EnchantmentData) var6.get(var8);
    if (var7) {
    Items.enchanted_book.addEnchantment(var3, var9);
    } else {
    var3.addEnchantment(var9.enchantmentobj, var9.enchantmentLevel);
    }
    }
    if (!player.capabilities.isCreativeMode) {
    var4.stackSize -= var5;
    if (var4.stackSize <= 0) {
    this.tableInventory.setInventorySlotContents(1, (ItemStack) null);
    }
    }
    this.tableInventory.markDirty();
    this.enchantmentSeed = this.rand.nextInt();
    onCraftMatrixChanged(this.tableInventory);
    }
    }
    return true;
    }
    return false;
    }
    
    private List <enchantmentdata>func_178148_a(ItemStack stack, int seed, int level) {
    this.rand.setSeed(this.enchantmentSeed + seed);
    List <enchantmentdata>list = EnchantmentHelper.buildEnchantmentList(this.rand, stack, level);
    if ((stack.getItem() == Items.book) && (list != null) && (list.size() > 1)) {
    list.remove(this.rand.nextInt(list.size()));
    }
    return list;
    }
    
    public int func_178147_e() {
    ItemStack var1 = this.tableInventory.getStackInSlot(1);
    return var1 == null ? 0 : var1.stackSize;
    }
    
    public void onContainerClosed(EntityPlayer player) {
    super.onContainerClosed(player);
    if (!this.world.isRemote) {
    for (int i = 0; i < this.tableInventory.getSizeInventory(); i++) {
    ItemStack stack = this.tableInventory.getStackInSlotOnClosing(i);
    if (stack != null) {
    player.dropPlayerItemWithRandomChoice(stack, false);
    }
    }
    }
    }
    
    public boolean canInteractWith(EntityPlayer player) {
    return this.world.getBlock(this.posX, this.posY, this.posZ) == Arthania.enchantment_table;
    }
    
    public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
    ItemStack var3 = null;
    Slot var4 = (Slot) this.inventorySlots.get(index);
    if ((var4 != null) && (var4.getHasStack())) {
    ItemStack var5 = var4.getStack();
    var3 = var5.copy();
    if (index == 0) {
    if (!mergeItemStack(var5, 2, 38, true)) {
    return null;
    }
    } else if (index == 1) {
    if (!mergeItemStack(var5, 2, 38, true)) {
    return null;
    }
    } else if ((var5.getItem() == Items.dye) && (var5.getItemDamage() == 4)) {
    if (!mergeItemStack(var5, 1, 2, true)) {
    return null;
    }
    } else {
    if ((((Slot) this.inventorySlots.get(0)).getHasStack())
    || (!((Slot) this.inventorySlots.get(0)).isItemValid(var5))) {
    return null;
    }
    if ((var5.hasTagCompound()) && (var5.stackSize == 1)) {
    ((Slot) this.inventorySlots.get(0)).putStack(var5.copy());
    var5.stackSize = 0;
    } else if (var5.stackSize >= 1) {
    ((Slot) this.inventorySlots.get(0))
    .putStack(new ItemStack(var5.getItem(), 1, var5.getItemDamage()));
    var5.stackSize -= 1;
    }
    }
    if (var5.stackSize == 0) {
    var4.putStack((ItemStack) null);
    } else {
    var4.onSlotChanged();
    }
    if (var5.stackSize == var3.stackSize) {
    return null;
    }
    var4.onPickupFromSlot(playerIn, var5);
    }
    return var3;
    }
    }
    
    
    
    package fr.Mosca421.Arthania.EnchantementTable;
    
    import com.google.common.collect.Lists;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import java.util.ArrayList;
    import java.util.Random;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.entity.EntityClientPlayerMP;
    import net.minecraft.client.gui.FontRenderer;
    import net.minecraft.client.gui.ScaledResolution;
    import net.minecraft.client.gui.inventory.GuiContainer;
    import net.minecraft.client.model.ModelBook;
    import net.minecraft.client.multiplayer.PlayerControllerMP;
    import net.minecraft.client.renderer.RenderHelper;
    import net.minecraft.client.renderer.texture.TextureManager;
    import net.minecraft.client.resources.I18n;
    import net.minecraft.enchantment.Enchantment;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.player.InventoryPlayer;
    import net.minecraft.entity.player.PlayerCapabilities;
    import net.minecraft.inventory.Container;
    import net.minecraft.inventory.Slot;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.EnchantmentNameParts;
    import net.minecraft.util.EnumChatFormatting;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.World;
    import org.lwjgl.util.glu.Project;
    
    @SideOnly(Side.CLIENT)
    public class GuiEnchantment extends GuiContainer {
    private static final ResourceLocation field_147078_C = new ResourceLocation(
    "Arthania:textures/gui/container/enchanting_table.png");
    private static final ResourceLocation field_147070_D = new ResourceLocation(
    "textures/entity/enchanting_table_book.png");
    private static final ModelBook field_147072_E = new ModelBook();
    private final InventoryPlayer field_175379_F;
    private final Random field_147074_F = new Random();
    private final ContainerEnchantment field_147075_G;
    public int field_147073_u;
    public float field_147071_v;
    public float field_147069_w;
    public float field_147082_x;
    public float field_147081_y;
    public float field_147080_z;
    public float field_147076_A;
    ItemStack field_147077_B;
    private final String field_175380_I;
    
    public GuiEnchantment(InventoryPlayer inventory, World world, String p_i45502_3_) {
    super(new ContainerEnchantment(inventory, world, 0,0,0));
    this.field_175379_F = inventory;
    this.field_147075_G = ((ContainerEnchantment) this.inventorySlots);
    this.field_175380_I = p_i45502_3_;
    }
    
    protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    this.fontRendererObj.drawString(
    this.field_175380_I == null ? I18n.format("container.enchant", new Object[0]) : this.field_175380_I, 12,
    5, 4210752);
    this.fontRendererObj.drawString(I18n.format(this.field_175379_F.getInventoryName(), new Object[0]), 8,
    this.ySize - 96 + 2, 4210752);
    }
    
    public void updateScreen() {
    super.updateScreen();
    func_147068_g();
    }
    
    protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
    super.mouseClicked(mouseX, mouseY, mouseButton);
    int var4 = (this.width - this.xSize) / 2;
    int var5 = (this.height - this.ySize) / 2;
    for (int var6 = 0; var6 < 3; var6++) {
    int var7 = mouseX - (var4 + 60);
    int var8 = mouseY - (var5 + 14 + 19 * var6);
    if ((var7 >= 0) && (var8 >= 0) && (var7 < 108) && (var8 < 19)
    && (this.field_147075_G.enchantItem(this.mc.thePlayer, var6))) {
    this.mc.playerController.sendEnchantPacket(this.field_147075_G.windowId, var6);
    }
    }
    }
    
    protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
    OpenGLHelper.colour(1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(field_147078_C);
    int k = (this.width - this.xSize) / 2;
    int l = (this.height - this.ySize) / 2;
    drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
    OpenGLHelper.pushMatrix();
    OpenGLHelper.matrixMode(5889);
    OpenGLHelper.pushMatrix();
    OpenGLHelper.loadIdentity();
    ScaledResolution var6 = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
    OpenGLHelper.viewport((var6.getScaledWidth() - 320) / 2 * var6.getScaleFactor(),
    (var6.getScaledHeight() - 240) / 2 * var6.getScaleFactor(), 320 * var6.getScaleFactor(),
    240 * var6.getScaleFactor());
    OpenGLHelper.translate(-0.34F, 0.23F, 0.0F);
    Project.gluPerspective(90.0F, 1.3333334F, 9.0F, 80.0F);
    float var7 = 1.0F;
    OpenGLHelper.matrixMode(5888);
    OpenGLHelper.loadIdentity();
    RenderHelper.enableStandardItemLighting();
    OpenGLHelper.translate(0.0F, 3.3F, -16.0F);
    OpenGLHelper.scale(var7, var7, var7);
    float var8 = 5.0F;
    OpenGLHelper.scale(var8, var8, var8);
    OpenGLHelper.rotate(180.0F, 0.0F, 0.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(field_147070_D);
    OpenGLHelper.rotate(20.0F, 1.0F, 0.0F, 0.0F);
    float var9 = this.field_147076_A + (this.field_147080_z - this.field_147076_A) * partialTicks;
    OpenGLHelper.translate((1.0F - var9) * 0.2F, (1.0F - var9) * 0.1F, (1.0F - var9) * 0.25F);
    OpenGLHelper.rotate(-(1.0F - var9) * 90.0F - 90.0F, 0.0F, 1.0F, 0.0F);
    OpenGLHelper.rotate(180.0F, 1.0F, 0.0F, 0.0F);
    float var10 = this.field_147069_w + (this.field_147071_v - this.field_147069_w) * partialTicks + 0.25F;
    float var11 = this.field_147069_w + (this.field_147071_v - this.field_147069_w) * partialTicks + 0.75F;
    var10 = (var10 - MathHelper.truncateDoubleToInt(var10)) * 1.6F - 0.3F;
    var11 = (var11 - MathHelper.truncateDoubleToInt(var11)) * 1.6F - 0.3F;
    if (var10 < 0.0F) {
    var10 = 0.0F;
    }
    if (var11 < 0.0F) {
    var11 = 0.0F;
    }
    if (var10 > 1.0F) {
    var10 = 1.0F;
    }
    if (var11 > 1.0F) {
    var11 = 1.0F;
    }
    OpenGLHelper.enableRescaleNormal();
    field_147072_E.render((Entity) null, 0.0F, var10, var11, var9, 0.0F, 0.0625F);
    OpenGLHelper.disableRescaleNormal();
    RenderHelper.disableStandardItemLighting();
    OpenGLHelper.matrixMode(5889);
    OpenGLHelper.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
    OpenGLHelper.popMatrix();
    OpenGLHelper.matrixMode(5888);
    OpenGLHelper.popMatrix();
    RenderHelper.disableStandardItemLighting();
    OpenGLHelper.colour(1.0F, 1.0F, 1.0F);
    EnchantmentNameParts.instance.reseedRandomGenerator(this.field_147075_G.enchantmentSeed);
    int var12 = this.field_147075_G.func_178147_e();
    for (int i1 = 0; i1 < 3; i1++) {
    int var14 = k + 60;
    int var15 = var14 + 20;
    byte var16 = 86;
    String s = EnchantmentNameParts.instance.generateNewRandomName();
    this.zLevel = 0.0F;
    this.mc.getTextureManager().bindTexture(field_147078_C);
    int j1 = this.field_147075_G.enchantLevels[i1];
    OpenGLHelper.colour(1.0F, 1.0F, 1.0F);
    if (j1 == 0) {
    drawTexturedModalRect(var14, l + 14 + 19 * i1, 0, 185, 108, 19);
    } else {
    String s1 = "" + j1;
    FontRenderer fontrenderer = this.mc.standardGalacticFontRenderer;
    int k1 = 6839882;
    if (((var12 < i1 + 1) || (this.mc.thePlayer.experienceLevel < j1))
    && (!this.mc.thePlayer.capabilities.isCreativeMode)) {
    drawTexturedModalRect(var14, l + 14 + 19 * i1, 0, 185, 108, 19);
    drawTexturedModalRect(var14 + 1, l + 15 + 19 * i1, 16 * i1, 239, 16, 16);
    fontrenderer.drawSplitString(s, var15, l + 16 + 19 * i1, var16, (k1 & 0xFEFEFE) >> 1);
    k1 = 4226832;
    } else {
    int l1 = mouseX - (k + 60);
    int i2 = mouseY - (l + 14 + 19 * i1);
    if ((l1 >= 0) && (i2 >= 0) && (l1 < 108) && (i2 < 19)) {
    drawTexturedModalRect(var14, l + 14 + 19 * i1, 0, 204, 108, 19);
    k1 = 16777088;
    } else {
    drawTexturedModalRect(var14, l + 14 + 19 * i1, 0, 166, 108, 19);
    }
    drawTexturedModalRect(var14 + 1, l + 15 + 19 * i1, 16 * i1, 223, 16, 16);
    fontrenderer.drawSplitString(s, var15, l + 16 + 19 * i1, var16, k1);
    k1 = 8453920;
    }
    fontrenderer = this.mc.fontRenderer;
    fontrenderer.drawStringWithShadow(s1, var15 + 86 - fontrenderer.getStringWidth(s1),
    l + 16 + 19 * i1 + 7, k1);
    OpenGLHelper.colour(1.0F, 1.0F, 1.0F);
    }
    }
    }
    
    public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    super.drawScreen(mouseX, mouseY, partialTicks);
    boolean var4 = this.mc.thePlayer.capabilities.isCreativeMode;
    int var5 = this.field_147075_G.func_178147_e();
    for (int var6 = 0; var6 < 3; var6++) {
    int var7 = this.field_147075_G.enchantLevels[var6];
    int var8 = this.field_147075_G.field_178151_h[var6];
    int var9 = var6 + 1;
    if ((func_146978_c(60, 14 + 19 * var6, 108, 17, mouseX, mouseY)) && (var7 > 0) && (var8 >= 0)) {
    ArrayList <object>var10 = Lists.newArrayList();
    if ((var8 >= 0) && (Enchantment.enchantmentsList[(var8 & 0xFF)] != null)) {
    String var11 = Enchantment.enchantmentsList[(var8 & 0xFF)].getTranslatedName((var8 & 0xFF00) >> 8);
    var10.add(EnumChatFormatting.WHITE.toString() + EnumChatFormatting.ITALIC.toString()
    + I18n.format("container.enchant.clue", new Object[] { var11 }));
    }
    if (!var4) {
    if (var8 >= 0) {
    var10.add("");
    }
    if (this.mc.thePlayer.experienceLevel < var7) {
    var10.add(EnumChatFormatting.RED.toString() + "Level Requirement: "
    + this.field_147075_G.enchantLevels[var6]);
    } else {
    String var11 = "";
    if (var9 == 1) {
    var11 = I18n.format("container.enchant.lapis.one", new Object[0]);
    } else {
    var11 = I18n.format("container.enchant.lapis.many", new Object[] { Integer.valueOf(var9) });
    }
    if (var5 >= var9) {
    var10.add(EnumChatFormatting.GRAY.toString() + "" + var11);
    } else {
    var10.add(EnumChatFormatting.RED.toString() + "" + var11);
    }
    if (var9 == 1) {
    var11 = I18n.format("container.enchant.level.one", new Object[0]);
    } else {
    var11 = I18n.format("container.enchant.level.many", new Object[] { Integer.valueOf(var9) });
    }
    var10.add(EnumChatFormatting.GRAY.toString() + "" + var11);
    }
    }
    drawHoveringText(var10, mouseX, mouseY, this.fontRendererObj);
    break;
    }
    }
    }
    
    public void func_147068_g() {
    ItemStack var1 = this.inventorySlots.getSlot(0).getStack();
    if (!ItemStack.areItemStacksEqual(var1, this.field_147077_B)) {
    this.field_147077_B = var1;
    do {
    this.field_147082_x += this.field_147074_F.nextInt(4) - this.field_147074_F.nextInt(4);
    } while ((this.field_147071_v <= this.field_147082_x + 1.0F)
    && (this.field_147071_v >= this.field_147082_x - 1.0F));
    }
    this.field_147073_u += 1;
    this.field_147069_w = this.field_147071_v;
    this.field_147076_A = this.field_147080_z;
    boolean var2 = false;
    for (int var3 = 0; var3 < 3; var3++) {
    if (this.field_147075_G.enchantLevels[var3] != 0) {
    var2 = true;
    }
    }
    if (var2) {
    this.field_147080_z += 0.2F;
    } else {
    this.field_147080_z -= 0.2F;
    }
    this.field_147080_z = MathHelper.clamp_float(this.field_147080_z, 0.0F, 1.0F);
    float var5 = (this.field_147082_x - this.field_147071_v) * 0.4F;
    float var4 = 0.2F;
    var5 = MathHelper.clamp_float(var5, -var4, var4);
    this.field_147081_y += (var5 - this.field_147081_y) * 0.9F;
    this.field_147071_v += this.field_147081_y;
    }
    }
    
    
    
    package fr.Mosca421.Arthania.EnchantementTable;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import fr.Mosca421.Arthania.Arthania;
    
    import java.util.Random;
    import net.minecraft.block.BlockEnchantmentTable;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.init.Blocks;
    import net.minecraft.item.Item;
    import net.minecraft.world.World;
    
    public class NewEnchantmentTable extends BlockEnchantmentTable
    
    {
    public NewEnchantmentTable() {
    setHardness(5.0F);
    setCreativeTab(CreativeTabs.tabDecorations);
    setResistance(2000.0F);
    setBlockTextureName("enchanting_table");
    setBlockName(("Arthania:enchantment_table"));
    }
    
    public Item getItemDropped(int meta, Random rand, int fortune) {
    return Item.getItemFromBlock(Blocks.enchanting_table);
    }
    
    @SideOnly(Side.CLIENT)
    public Item getItem(World world, int x, int y, int z) {
    return Item.getItemFromBlock(Blocks.enchanting_table);
    }
    
    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;
    }
    player.openGui(Arthania.instance, 0, world, x, y, z);
    return true;
    }
    
    }
    
    
    
    package fr.Mosca421.Arthania.EnchantementTable;
    
    import cpw.mods.fml.common.network.IGuiHandler;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.world.World;
    
    public class GuiHandlerTable implements IGuiHandler {
    
    @Override
    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
       switch (ID)
       {
       case 0:
    return new ContainerEnchantment(player.inventory, world, x, y, z);
       }
        return null;
    }
    
    @Override
    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    
       switch (ID)
       {
       case 0:
    return new GuiEnchantment(player.inventory, world, null);
       }
       return null;
    }
    
    }
    
    
    
    //classe principal dans init et preinit
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandlerTable());
    
    ```</object></enchantmentdata></enchantmentdata></enchantmentdata></enchantmentdata></string,>


  • private static final ResourceLocation field_147078_C = new ResourceLocation(
    "Arthania:textures/gui/container/enchanting_table.png");
    

    Le modid doit être en minuscules, ça doit être marqué dans les logs



  • rien a voir je veux dir que je n'ai pas de slot n'y rien pardon oublier de préciser
    Avec texture : http://prntscr.com/aw6vmp
    Meme l'inventaire est a la dèche



  • Etrange, regarde si les fonctions addSlotToContainer sont appelées



  • Y'en a dans le container et le container est appler ici das le gui

    public GuiEnchantment(InventoryPlayer inventory, World world, String p_i45502_3_) {
    super(new ContainerEnchantment(inventory, world, 0,0,0));
    this.field_175379_F = inventory;
    this.field_147075_G = ((ContainerEnchantment) this.inventorySlots);
    this.field_175380_I = p_i45502_3_;
    }



  • Oui mais rajoute "System.out.println("quelque chose")" lorsque tu ajoutes le slot pour voir si la fonction est bien appelée



  • [15:40:25] [Client thread/INFO] [STDOUT]: [fr.Mosca421.Arthania.EnchantementTable.ContainerEnchantment:<init>:76]: slot
    [15:40:25] [Client thread/INFO] [STDOUT]: [fr.Mosca421.Arthania.EnchantementTable.ContainerEnchantment:<init>:76]: slot
    [15:40:25] [Client thread/INFO] [STDOUT]: [fr.Mosca421.Arthania.EnchantementTable.ContainerEnchantment:<init>:76]: slot
    [15:40:25] [Client thread/INFO] [STDOUT]: [fr.Mosca421.Arthania.EnchantementTable.ContainerEnchantment:<init>:76]: slot
    [15:40:25] [Client thread/INFO] [STDOUT]: [fr.Mosca421.Arthania.EnchantementTable.GuiEnchantment:<init>:57]: GUI
    Il y a encore des slots avant

    public GuiEnchantment(InventoryPlayer inventory, World world, String p_i45502_3_) {
    super(new ContainerEnchantment(inventory, world, 0,0,0));
    this.field_175379_F = inventory;
    this.field_147075_G = ((ContainerEnchantment) this.inventorySlots);
    this.field_175380_I = p_i45502_3_;
    System.out.println("GUI");
    }

    for (int var4 = 0; var4 < 3; var4++) {
    for (int var5 = 0; var5 < 9; var5++) {
    addSlotToContainer(new Slot(inventory, var5 + var4 * 9 + 9, 8 + var5 * 18, 84 + var4 * 18));
    System.out.println("slot");
    }
    }</init></init></init></init></init>



  • Ce qui est étrange c'est que le code n'est pas appelé côté serveur, rajoute un System.out.println dans la fonction getServerGuiElement pour voir si le code est appelé.

    PS : pense à respecter la convention java.
    PS 2 : il y a un GuiHandler par mod et non par block



  • switch (ID)
       {
       case 0:
    System.out.println("pris");
    return new ContainerEnchantment(player.inventory, world, x, y, z);
       }

    [15:52:14] [Server thread/INFO] [STDOUT]: [fr.Mosca421.Arthania.EnchantementTable.GuiHandlerTable:getServerGuiElement:14]: pris
    [15:52:14] [Server thread/INFO] [STDOUT]: [fr.Mosca421.Arthania.EnchantementTable.ContainerEnchantment:<init>:76]: slot
    Merci pour le GuiHandler
    Convention je suis franglais xD</init>



  • Aucune idée alors

    PS : pour la convention, je parlais pas du franglais, parce que à la limite même si c'est pas de l'anglais correct c'est bon, mais il faut tout mettre en minuscule pour les noms de package



  • @'SCAREX':

    Ce qui est étrange c'est que le code n'est pas appelé côté serveur, rajoute un System.out.println dans la fonction getServerGuiElement pour voir si le code est appelé.

    PS : pense à respecter la convention java.
    PS 2 : il y a un GuiHandler par mod et non par block

    Je pense que si, il a dit dans son message "Il y a encore des slots avant", c'est un autre problème… Mais comme je te l'ai dis en mp, essaye de faire un gui tout simple, sans système d'enchant avec juste l'inventaire du joueur, après rajoutes-y tes 2 slots puis le système d'enchant complet.