MFF

    Minecraft Forge France
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    Book editer

    Planifier Épinglé Verrouillé Déplacé Sans suite
    1.6.4
    33 Messages 5 Publieurs 7.7k Vues 1 Watching
    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.
    • isadorI Hors-ligne
      isador Moddeurs confirmés Modérateurs
      dernière édition par

      comme la dit gugu tu devrait passer par un tesselator et un bind de texture

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

        je n’ai jamais utiliser cela pourriez vous m’aider pour le coder ou pas

        1 réponse Dernière réponse Répondre Citer 0
        • isadorI Hors-ligne
          isador Moddeurs confirmés Modérateurs
          dernière édition par

          il faut faire en sorte que ton livre sois compter comme une entité.

          je ne sais pas comment faire par contre.

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

            genre itementity

            1 réponse Dernière réponse Répondre Citer 0
            • isadorI Hors-ligne
              isador Moddeurs confirmés Modérateurs
              dernière édition par

              je crois

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

                je vais essayer alors 😕

                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

                  Tu veux faire apparaître ou le .png ? Sur un livre normal ou un livre custom ?

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

                    livre custom
                    avec plusieur page

                    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

                      Rien à voir avec l’entity item alors.
                      Il faut être précis des le débuts de vos postes d’aide, sinon on comprend mal ce que vous souhaités faire u_U.

                      Il suffit de reprendre le code du livre (il faut quand même modifier le code d’ouverture du gui), sauf que dans le gui tu change l’image de font, et c’est bon.

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

                        ou esque je peut le trouver le code du livre custom


                        jai trouver ceci esque se code conviendrait

                        01.pages.appendTag(new NBTTagString(“0”, “texture/item/monimage”));
                        02.
                        03. pages.appendTag(new NBTTagString(“1”, “texture/item/monimage1”));
                        04.
                        05. pages.appendTag(new NBTTagString(“2”, “texture/item/monimage2”));
                        06.
                        07. pages.appendTag(new NBTTagString(“3”, “texture/item/monimage3”));

                        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

                          Non, ça c’est pour le texte des pages. Il faut faire des resources location et les draw en fond.

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

                            package net.minecraft.item;
                            
                            import cpw.mods.fml.relauncher.Side;
                            import cpw.mods.fml.relauncher.SideOnly;
                            import java.util.List;
                            import net.minecraft.entity.player.EntityPlayer;
                            import net.minecraft.nbt.NBTTagCompound;
                            import net.minecraft.nbt.NBTTagString;
                            import net.minecraft.util.EnumChatFormatting;
                            import net.minecraft.util.StatCollector;
                            import net.minecraft.world.World;
                            
                            public class ItemEditableBook extends Item
                            {
                            public ItemEditableBook(int par1)
                            {
                            super(par1);
                            this.setMaxStackSize(1);
                            }
                            
                            public static boolean validBookTagContents(NBTTagCompound par0NBTTagCompound)
                            {
                            if (!ItemWritableBook.validBookTagPages(par0NBTTagCompound))
                            {
                            return false;
                            }
                            else if (!par0NBTTagCompound.hasKey("title"))
                            {
                            return false;
                            }
                            else
                            {
                            String s = par0NBTTagCompound.getString("title");
                            return s != null && s.length() <= 16 ? par0NBTTagCompound.hasKey("author") : false;
                            }
                            }
                            
                            public String getItemDisplayName(ItemStack par1ItemStack)
                            {
                            if (par1ItemStack.hasTagCompound())
                            {
                            NBTTagCompound nbttagcompound = par1ItemStack.getTagCompound();
                            NBTTagString nbttagstring = (NBTTagString)nbttagcompound.getTag("title");
                            
                            if (nbttagstring != null)
                            {
                            return nbttagstring.toString();
                            }
                            }
                            
                            return super.getItemDisplayName(par1ItemStack);
                            }
                            
                            @SideOnly(Side.CLIENT)
                            
                            /**
                            * allows items to add custom lines of information to the mouseover description
                            */
                            public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
                            {
                            if (par1ItemStack.hasTagCompound())
                            {
                            NBTTagCompound nbttagcompound = par1ItemStack.getTagCompound();
                            NBTTagString nbttagstring = (NBTTagString)nbttagcompound.getTag("author");
                            
                            if (nbttagstring != null)
                            {
                            par3List.add(EnumChatFormatting.GRAY + String.format(StatCollector.translateToLocalFormatted("book.byAuthor", new Object[] {nbttagstring.data}), new Object[0]));
                            }
                            }
                            }
                            
                            /**
                            * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
                            */
                            public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
                            {
                            par3EntityPlayer.displayGUIBook(par1ItemStack);
                            return par1ItemStack;
                            }
                            
                            /**
                            * If this function returns true (or the item is damageable), the ItemStack's NBT tag will be sent to the client.
                            */
                            public boolean getShareTag()
                            {
                            return true;
                            }
                            
                            @SideOnly(Side.CLIENT)
                            public boolean hasEffect(ItemStack par1ItemStack)
                            {
                            return true;
                            }
                            }
                            

                            faut que je m’inspire de sa ?
                            en modifiant aussi le gui

                            1 réponse Dernière réponse Répondre Citer 0
                            • Superloup10S Hors-ligne
                              Superloup10 Modérateurs
                              dernière édition par

                              UTILISEZ les balises [java*][/java*], BON SANG, c’est pas difficile, c’est la tasse de café lorsque vous créez un nouveau sujet.

                              Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                              Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                                desoler je savait pas pour les balise

                                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

                                  Oui, c’est surtout du côté du gui qu’il faudra changer le code.

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

                                    ok donc jai créer la classe de mon livre apres je créer un gui pour mon livre et je modifie se code alors

                                    
                                    package net.minecraft.client.gui;
                                    
                                    import cpw.mods.fml.relauncher.Side;
                                    import cpw.mods.fml.relauncher.SideOnly;
                                    import java.io.ByteArrayOutputStream;
                                    import java.io.DataOutputStream;
                                    import net.minecraft.client.resources.I18n;
                                    import net.minecraft.entity.player.EntityPlayer;
                                    import net.minecraft.item.Item;
                                    import net.minecraft.item.ItemStack;
                                    import net.minecraft.nbt.NBTTagCompound;
                                    import net.minecraft.nbt.NBTTagList;
                                    import net.minecraft.nbt.NBTTagString;
                                    import net.minecraft.network.packet.Packet;
                                    import net.minecraft.network.packet.Packet250CustomPayload;
                                    import net.minecraft.util.ChatAllowedCharacters;
                                    import net.minecraft.util.EnumChatFormatting;
                                    import net.minecraft.util.ResourceLocation;
                                    import org.lwjgl.input.Keyboard;
                                    import org.lwjgl.opengl.GL11;
                                    
                                    @SideOnly(Side.CLIENT)
                                    public class GuiScreenBook extends GuiScreen
                                    {
                                    private static final ResourceLocation bookGuiTextures = new ResourceLocation("textures/gui/book.png");
                                    
                                    /** The player editing the book */
                                    private final EntityPlayer editingPlayer;
                                    private final ItemStack itemstackBook;
                                    
                                    /** Whether the book is signed or can still be edited */
                                    private final boolean bookIsUnsigned;
                                    private boolean bookModified;
                                    private boolean editingTitle;
                                    
                                    /** Update ticks since the gui was opened */
                                    private int updateCount;
                                    private int bookImageWidth = 192;
                                    private int bookImageHeight = 192;
                                    private int bookTotalPages = 1;
                                    private int currPage;
                                    private NBTTagList bookPages;
                                    private String bookTitle = "";
                                    private GuiButtonNextPage buttonNextPage;
                                    private GuiButtonNextPage buttonPreviousPage;
                                    private GuiButton buttonDone;
                                    
                                    /** The GuiButton to sign this book. */
                                    private GuiButton buttonSign;
                                    private GuiButton buttonFinalize;
                                    private GuiButton buttonCancel;
                                    
                                    public GuiScreenBook(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack, boolean par3)
                                    {
                                    this.editingPlayer = par1EntityPlayer;
                                    this.itemstackBook = par2ItemStack;
                                    this.bookIsUnsigned = par3;
                                    
                                    if (par2ItemStack.hasTagCompound())
                                    {
                                    NBTTagCompound nbttagcompound = par2ItemStack.getTagCompound();
                                    this.bookPages = nbttagcompound.getTagList("pages");
                                    
                                    if (this.bookPages != null)
                                    {
                                    this.bookPages = (NBTTagList)this.bookPages.copy();
                                    this.bookTotalPages = this.bookPages.tagCount();
                                    
                                    if (this.bookTotalPages < 1)
                                    {
                                    this.bookTotalPages = 1;
                                    }
                                    }
                                    }
                                    
                                    if (this.bookPages == null && par3)
                                    {
                                    this.bookPages = new NBTTagList("pages");
                                    this.bookPages.appendTag(new NBTTagString("1", ""));
                                    this.bookTotalPages = 1;
                                    }
                                    }
                                    
                                    /**
                                    * Called from the main game loop to update the screen.
                                    */
                                    public void updateScreen()
                                    {
                                    super.updateScreen();
                                    ++this.updateCount;
                                    }
                                    
                                    /**
                                    * Adds the buttons (and other controls) to the screen in question.
                                    */
                                    public void initGui()
                                    {
                                    this.buttonList.clear();
                                    Keyboard.enableRepeatEvents(true);
                                    
                                    if (this.bookIsUnsigned)
                                    {
                                    this.buttonList.add(this.buttonSign = new GuiButton(3, this.width / 2 - 100, 4 + this.bookImageHeight, 98, 20, I18n.getString("book.signButton")));
                                    this.buttonList.add(this.buttonDone = new GuiButton(0, this.width / 2 + 2, 4 + this.bookImageHeight, 98, 20, I18n.getString("gui.done")));
                                    this.buttonList.add(this.buttonFinalize = new GuiButton(5, this.width / 2 - 100, 4 + this.bookImageHeight, 98, 20, I18n.getString("book.finalizeButton")));
                                    this.buttonList.add(this.buttonCancel = new GuiButton(4, this.width / 2 + 2, 4 + this.bookImageHeight, 98, 20, I18n.getString("gui.cancel")));
                                    }
                                    else
                                    {
                                    this.buttonList.add(this.buttonDone = new GuiButton(0, this.width / 2 - 100, 4 + this.bookImageHeight, 200, 20, I18n.getString("gui.done")));
                                    }
                                    
                                    int i = (this.width - this.bookImageWidth) / 2;
                                    byte b0 = 2;
                                    this.buttonList.add(this.buttonNextPage = new GuiButtonNextPage(1, i + 120, b0 + 154, true));
                                    this.buttonList.add(this.buttonPreviousPage = new GuiButtonNextPage(2, i + 38, b0 + 154, false));
                                    this.updateButtons();
                                    }
                                    
                                    /**
                                    * Called when the screen is unloaded. Used to disable keyboard repeat events
                                    */
                                    public void onGuiClosed()
                                    {
                                    Keyboard.enableRepeatEvents(false);
                                    }
                                    
                                    private void updateButtons()
                                    {
                                    this.buttonNextPage.drawButton = !this.editingTitle && (this.currPage < this.bookTotalPages - 1 || this.bookIsUnsigned);
                                    this.buttonPreviousPage.drawButton = !this.editingTitle && this.currPage > 0;
                                    this.buttonDone.drawButton = !this.bookIsUnsigned || !this.editingTitle;
                                    
                                    if (this.bookIsUnsigned)
                                    {
                                    this.buttonSign.drawButton = !this.editingTitle;
                                    this.buttonCancel.drawButton = this.editingTitle;
                                    this.buttonFinalize.drawButton = this.editingTitle;
                                    this.buttonFinalize.enabled = this.bookTitle.trim().length() > 0;
                                    }
                                    }
                                    
                                    private void sendBookToServer(boolean par1)
                                    {
                                    if (this.bookIsUnsigned && this.bookModified)
                                    {
                                    if (this.bookPages != null)
                                    {
                                    while (this.bookPages.tagCount() > 1)
                                    {
                                    NBTTagString nbttagstring = (NBTTagString)this.bookPages.tagAt(this.bookPages.tagCount() - 1);
                                    
                                    if (nbttagstring.data != null && nbttagstring.data.length() != 0)
                                    {
                                    break;
                                    }
                                    
                                    this.bookPages.removeTag(this.bookPages.tagCount() - 1);
                                    }
                                    
                                    if (this.itemstackBook.hasTagCompound())
                                    {
                                    NBTTagCompound nbttagcompound = this.itemstackBook.getTagCompound();
                                    nbttagcompound.setTag("pages", this.bookPages);
                                    }
                                    else
                                    {
                                    this.itemstackBook.setTagInfo("pages", this.bookPages);
                                    }
                                    
                                    String s = "MC|BEdit";
                                    
                                    if (par1)
                                    {
                                    s = "MC|BSign";
                                    this.itemstackBook.setTagInfo("author", new NBTTagString("author", this.editingPlayer.getCommandSenderName()));
                                    this.itemstackBook.setTagInfo("title", new NBTTagString("title", this.bookTitle.trim()));
                                    this.itemstackBook.itemID = Item.writtenBook.itemID;
                                    }
                                    
                                    ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
                                    DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
                                    
                                    try
                                    {
                                    Packet.writeItemStack(this.itemstackBook, dataoutputstream);
                                    this.mc.getNetHandler().addToSendQueue(new Packet250CustomPayload(s, bytearrayoutputstream.toByteArray()));
                                    }
                                    catch (Exception exception)
                                    {
                                    exception.printStackTrace();
                                    }
                                    }
                                    }
                                    }
                                    
                                    /**
                                    * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
                                    */
                                    protected void actionPerformed(GuiButton par1GuiButton)
                                    {
                                    if (par1GuiButton.enabled)
                                    {
                                    if (par1GuiButton.id == 0)
                                    {
                                    this.mc.displayGuiScreen((GuiScreen)null);
                                    this.sendBookToServer(false);
                                    }
                                    else if (par1GuiButton.id == 3 && this.bookIsUnsigned)
                                    {
                                    this.editingTitle = true;
                                    }
                                    else if (par1GuiButton.id == 1)
                                    {
                                    if (this.currPage < this.bookTotalPages - 1)
                                    {
                                    ++this.currPage;
                                    }
                                    else if (this.bookIsUnsigned)
                                    {
                                    this.addNewPage();
                                    
                                    if (this.currPage < this.bookTotalPages - 1)
                                    {
                                    ++this.currPage;
                                    }
                                    }
                                    }
                                    else if (par1GuiButton.id == 2)
                                    {
                                    if (this.currPage > 0)
                                    {
                                    –this.currPage;
                                    }
                                    }
                                    else if (par1GuiButton.id == 5 && this.editingTitle)
                                    {
                                    this.sendBookToServer(true);
                                    this.mc.displayGuiScreen((GuiScreen)null);
                                    }
                                    else if (par1GuiButton.id == 4 && this.editingTitle)
                                    {
                                    this.editingTitle = false;
                                    }
                                    
                                    this.updateButtons();
                                    }
                                    }
                                    
                                    private void addNewPage()
                                    {
                                    if (this.bookPages != null && this.bookPages.tagCount() < 50)
                                    {
                                    this.bookPages.appendTag(new NBTTagString("" + (this.bookTotalPages + 1), ""));
                                    ++this.bookTotalPages;
                                    this.bookModified = true;
                                    }
                                    }
                                    
                                    /**
                                    * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
                                    */
                                    protected void keyTyped(char par1, int par2)
                                    {
                                    super.keyTyped(par1, par2);
                                    
                                    if (this.bookIsUnsigned)
                                    {
                                    if (this.editingTitle)
                                    {
                                    this.func_74162_c(par1, par2);
                                    }
                                    else
                                    {
                                    this.keyTypedInBook(par1, par2);
                                    }
                                    }
                                    }
                                    
                                    /**
                                    * Processes keystrokes when editing the text of a book
                                    */
                                    private void keyTypedInBook(char par1, int par2)
                                    {
                                    switch (par1)
                                    {
                                    case 22:
                                    this.func_74160_b(GuiScreen.getClipboardString());
                                    return;
                                    default:
                                    switch (par2)
                                    {
                                    case 14:
                                    String s = this.func_74158_i();
                                    
                                    if (s.length() > 0)
                                    {
                                    this.func_74159_a(s.substring(0, s.length() - 1));
                                    }
                                    
                                    return;
                                    case 28:
                                    case 156:
                                    this.func_74160_b("\n");
                                    return;
                                    default:
                                    if (ChatAllowedCharacters.isAllowedCharacter(par1))
                                    {
                                    this.func_74160_b(Character.toString(par1));
                                    }
                                    }
                                    }
                                    }
                                    
                                    private void func_74162_c(char par1, int par2)
                                    {
                                    switch (par2)
                                    {
                                    case 14:
                                    if (!this.bookTitle.isEmpty())
                                    {
                                    this.bookTitle = this.bookTitle.substring(0, this.bookTitle.length() - 1);
                                    this.updateButtons();
                                    }
                                    
                                    return;
                                    case 28:
                                    case 156:
                                    if (!this.bookTitle.isEmpty())
                                    {
                                    this.sendBookToServer(true);
                                    this.mc.displayGuiScreen((GuiScreen)null);
                                    }
                                    
                                    return;
                                    default:
                                    if (this.bookTitle.length() < 16 && ChatAllowedCharacters.isAllowedCharacter(par1))
                                    {
                                    this.bookTitle = this.bookTitle + Character.toString(par1);
                                    this.updateButtons();
                                    this.bookModified = true;
                                    }
                                    }
                                    }
                                    
                                    private String func_74158_i()
                                    {
                                    if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount())
                                    {
                                    NBTTagString nbttagstring = (NBTTagString)this.bookPages.tagAt(this.currPage);
                                    return nbttagstring.toString();
                                    }
                                    else
                                    {
                                    return "";
                                    }
                                    }
                                    
                                    private void func_74159_a(String par1Str)
                                    {
                                    if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount())
                                    {
                                    NBTTagString nbttagstring = (NBTTagString)this.bookPages.tagAt(this.currPage);
                                    nbttagstring.data = par1Str;
                                    this.bookModified = true;
                                    }
                                    }
                                    
                                    private void func_74160_b(String par1Str)
                                    {
                                    String s1 = this.func_74158_i();
                                    String s2 = s1 + par1Str;
                                    int i = this.fontRenderer.splitStringWidth(s2 + "" + EnumChatFormatting.BLACK + "_", 118);
                                    
                                    if (i <= 118 && s2.length() < 256)
                                    {
                                    this.func_74159_a(s2);
                                    }
                                    }
                                    
                                    /**
                                    * Draws the screen and all the components in it.
                                    */
                                    public void drawScreen(int par1, int par2, float par3)
                                    {
                                    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                                    this.mc.getTextureManager().bindTexture(bookGuiTextures);
                                    int k = (this.width - this.bookImageWidth) / 2;
                                    byte b0 = 2;
                                    this.drawTexturedModalRect(k, b0, 0, 0, this.bookImageWidth, this.bookImageHeight);
                                    String s;
                                    String s1;
                                    int l;
                                    
                                    if (this.editingTitle)
                                    {
                                    s = this.bookTitle;
                                    
                                    if (this.bookIsUnsigned)
                                    {
                                    if (this.updateCount / 6 % 2 == 0)
                                    {
                                    s = s + "" + EnumChatFormatting.BLACK + "_";
                                    }
                                    else
                                    {
                                    s = s + "" + EnumChatFormatting.GRAY + "_";
                                    }
                                    }
                                    
                                    s1 = I18n.getString("book.editTitle");
                                    l = this.fontRenderer.getStringWidth(s1);
                                    this.fontRenderer.drawString(s1, k + 36 + (116 - l) / 2, b0 + 16 + 16, 0);
                                    int i1 = this.fontRenderer.getStringWidth(s);
                                    this.fontRenderer.drawString(s, k + 36 + (116 - i1) / 2, b0 + 48, 0);
                                    String s2 = String.format(I18n.getString("book.byAuthor"), new Object[] {this.editingPlayer.getCommandSenderName()});
                                    int j1 = this.fontRenderer.getStringWidth(s2);
                                    this.fontRenderer.drawString(EnumChatFormatting.DARK_GRAY + s2, k + 36 + (116 - j1) / 2, b0 + 48 + 10, 0);
                                    String s3 = I18n.getString("book.finalizeWarning");
                                    this.fontRenderer.drawSplitString(s3, k + 36, b0 + 80, 116, 0);
                                    }
                                    else
                                    {
                                    s = String.format(I18n.getString("book.pageIndicator"), new Object[] {Integer.valueOf(this.currPage + 1), Integer.valueOf(this.bookTotalPages)});
                                    s1 = "";
                                    
                                    if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount())
                                    {
                                    NBTTagString nbttagstring = (NBTTagString)this.bookPages.tagAt(this.currPage);
                                    s1 = nbttagstring.toString();
                                    }
                                    
                                    if (this.bookIsUnsigned)
                                    {
                                    if (this.fontRenderer.getBidiFlag())
                                    {
                                    s1 = s1 + "_";
                                    }
                                    else if (this.updateCount / 6 % 2 == 0)
                                    {
                                    s1 = s1 + "" + EnumChatFormatting.BLACK + "_";
                                    }
                                    else
                                    {
                                    s1 = s1 + "" + EnumChatFormatting.GRAY + "_";
                                    }
                                    }
                                    
                                    l = this.fontRenderer.getStringWidth(s);
                                    this.fontRenderer.drawString(s, k - l + this.bookImageWidth - 44, b0 + 16, 0);
                                    this.fontRenderer.drawSplitString(s1, k + 36, b0 + 16 + 16, 116, 0);
                                    }
                                    
                                    super.drawScreen(par1, par2, par3);
                                    }
                                    
                                    static ResourceLocation func_110404_g()
                                    {
                                    return bookGuiTextures;
                                    }
                                    }
                                    
                                    ```___
                                    je suis desoler de demander autant de chose mais j'aidu mal encore avec les gui
                                    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

                                      public void drawScreen(int par1, int par2, float par3)
                                      {
                                      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                                      this.mc.getTextureManager().bindTexture(bookGuiTextures);
                                      […]
                                      

                                      Il suffit juste de faire une condition ici.

                                      public void drawScreen(int par1, int par2, float par3)
                                      {
                                      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                                      if(this.currPage == 0)
                                      {
                                      this.mc.getTextureManager().bindTexture(bookGuiTextures);
                                      }
                                      else if(this.currPage == 1)
                                      {
                                      this.mc.getTextureManager().bindTexture(new ResourceLocation("modid", "textures/gui/image1.png"));
                                      }
                                      else if(this.currPage == 1)
                                      {
                                      this.mc.getTextureManager().bindTexture(new ResourceLocation("modid", "textures/gui/image2.png"));
                                      }
                                      etc …
                                      
                                      1 réponse Dernière réponse Répondre Citer 0
                                      • M Hors-ligne
                                        mrkevin77
                                        dernière édition par

                                        dans la classe de mon livre il me propose pas de créer un nouveau gui il reprend direct celui de base

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

                                          esque l classe de mon item book et correct ?

                                          
                                          package pixelmonfr;
                                          
                                          import java.util.List;
                                          
                                          import net.minecraft.entity.player.EntityPlayer;
                                          import net.minecraft.item.Item;
                                          import net.minecraft.item.ItemStack;
                                          import net.minecraft.item.ItemWritableBook;
                                          import net.minecraft.nbt.NBTTagCompound;
                                          import net.minecraft.nbt.NBTTagString;
                                          import net.minecraft.util.EnumChatFormatting;
                                          import net.minecraft.util.StatCollector;
                                          import net.minecraft.world.World;
                                          import cpw.mods.fml.relauncher.Side;
                                          import cpw.mods.fml.relauncher.SideOnly;
                                          
                                          public class bd1 extends Item
                                          
                                          {
                                          
                                          public bd1(int par1)
                                          
                                          {
                                          
                                          super(par1);
                                          
                                          this.setMaxStackSize(1);
                                          
                                          }
                                          
                                          public static boolean validBookTagContents(NBTTagCompound par0NBTTagCompound)
                                          
                                          {
                                          
                                          if (!ItemWritableBook.validBookTagPages(par0NBTTagCompound))
                                          
                                          {
                                          
                                          return false;
                                          
                                          }
                                          
                                          else if (!par0NBTTagCompound.hasKey("title"))
                                          
                                          {
                                          
                                          return false;
                                          
                                          }
                                          
                                          else
                                          
                                          {
                                          
                                          String s = par0NBTTagCompound.getString("title");
                                          
                                          return s != null && s.length() <= 16 ? par0NBTTagCompound.hasKey("author") : false;
                                          
                                          }
                                          
                                          }
                                          
                                          public String getItemDisplayName(ItemStack par1ItemStack)
                                          
                                          {
                                          
                                          if (par1ItemStack.hasTagCompound())
                                          
                                          {
                                          
                                          NBTTagCompound nbttagcompound = par1ItemStack.getTagCompound();
                                          
                                          NBTTagString nbttagstring = (NBTTagString)nbttagcompound.getTag("title");
                                          
                                          if (nbttagstring != null)
                                          
                                          {
                                          
                                          return nbttagstring.toString();
                                          
                                          }
                                          
                                          }
                                          
                                          return super.getItemDisplayName(par1ItemStack);
                                          
                                          }
                                          
                                          @SideOnly(Side.CLIENT)
                                          
                                          /**
                                          
                                          * allows items to add custom lines of information to the mouseover description
                                          
                                          */
                                          
                                          public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
                                          
                                          {
                                          
                                          if (par1ItemStack.hasTagCompound())
                                          
                                          {
                                          
                                          NBTTagCompound nbttagcompound = par1ItemStack.getTagCompound();
                                          
                                          NBTTagString nbttagstring = (NBTTagString)nbttagcompound.getTag("author");
                                          
                                          if (nbttagstring != null)
                                          
                                          {
                                          
                                          par3List.add(EnumChatFormatting.GRAY + String.format(StatCollector.translateToLocalFormatted("book.byAuthor", new Object[] {nbttagstring.data}), new Object[0]));
                                          
                                          }
                                          
                                          }
                                          
                                          }
                                          
                                          /**
                                          
                                          * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
                                          
                                          75\. */
                                          
                                          public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
                                          
                                          {
                                          
                                          par3EntityPlayer.displayGUIBook(par1ItemStack);
                                          
                                          return par1ItemStack;
                                          
                                          }
                                          
                                          /**
                                          
                                          * If this function returns true (or the item is damageable), the ItemStack's NBT tag will be sent to the client.
                                          
                                          */
                                          
                                          public boolean getShareTag()
                                          
                                          {
                                          
                                          return true;
                                          
                                          }
                                          
                                          @SideOnly(Side.CLIENT)
                                          
                                          public boolean hasEffect(ItemStack par1ItemStack)
                                          
                                          {
                                          
                                          return true;
                                          
                                          }
                                          
                                          }
                                          
                                          
                                          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

                                            public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
                                            {
                                            par3EntityPlayer.displayGUIBook(par1ItemStack);
                                            return par1ItemStack;
                                            }
                                            

                                            Il faut changer ce code pour ouvrir ton gui custom. Avec forge il faut un gui handler et utiliser la fonction player.openGui. Tu peux aller voir le tutoriel pour faire un coffre, j’en parle dedans.

                                            1 réponse Dernière réponse Répondre Citer 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB