MFF

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

    Update d'une texture sur un GUI

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.2
    20 Messages 4 Publieurs 4.0k 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.
    • mindany2M Hors-ligne
      mindany2
      dernière édition par

      Il faut utiliser la fonction updateGui dans ce cas ^^

      ^^

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

        updateGui ? et où est cette fonction ? comment et où je l’appelle ?

        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

          Regarde le four.

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

            J’ai regardé ces 4 classes :

            • GuiFurnace
            • ContainerFurnace
            • BlockFurnace
            • TileEntityFurnace
              et je n’ai toujours pas trouvé la méthode. C’est moi qui doit être mauvais, ou alors je n’ai pas regardé au bon endroit ? Il y aurait d’autres classes pour update le four ?
            1 réponse Dernière réponse Répondre Citer 0
            • mindany2M Hors-ligne
              mindany2
              dernière édition par

              updateGui() tu peux l’appelé de tout ce qui est extends de GuiScreen (si je dis pas de bétise), va dans GuiScreen et recherche updateGui() si tu veux ^^

              PS. J’suis rapide pour répondre 😮

              ^^

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

                Merci de cette réponse rapide, mais cette méthode n’existe toujours pas dans la class GuiScreen 
                :::

                ​package net.minecraft.client.gui;
                
                import cpw.mods.fml.relauncher.Side;
                import cpw.mods.fml.relauncher.SideOnly;
                import java.awt.Toolkit;
                import java.awt.datatransfer.ClipboardOwner;
                import java.awt.datatransfer.DataFlavor;
                import java.awt.datatransfer.StringSelection;
                import java.awt.datatransfer.Transferable;
                import java.util.ArrayList;
                import java.util.Arrays;
                import java.util.Iterator;
                import java.util.List;
                import net.minecraft.client.Minecraft;
                import net.minecraft.client.renderer.RenderHelper;
                import net.minecraft.client.renderer.Tessellator;
                import net.minecraft.client.renderer.entity.RenderItem;
                import net.minecraft.item.ItemStack;
                import net.minecraft.util.EnumChatFormatting;
                import net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent;
                import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
                import net.minecraftforge.common.MinecraftForge;
                
                import org.lwjgl.input.Keyboard;
                import org.lwjgl.input.Mouse;
                import org.lwjgl.opengl.GL11;
                import org.lwjgl.opengl.GL12;
                
                @SideOnly(Side.CLIENT)
                public class GuiScreen extends Gui
                {
                    /**
                     * Holds a instance of RenderItem, used to draw the achievement icons on screen (is based on ItemStack)
                     */
                    protected static RenderItem itemRender = new RenderItem();
                    /** Reference to the Minecraft object. */
                    public Minecraft mc;
                    /** The width of the screen object. */
                    public int width;
                    /** The height of the screen object. */
                    public int height;
                    /** A list of all the buttons in this container. */
                    protected List buttonList = new ArrayList();
                    /** A list of all the labels in this container. */
                    protected List labelList = new ArrayList();
                    public boolean allowUserInput;
                    /** The FontRenderer used by GuiScreen */
                    protected FontRenderer fontRendererObj;
                    /** The button that was just pressed. */
                    private GuiButton selectedButton;
                    private int eventButton;
                    private long lastMouseEvent;
                    private int field_146298_h;
                    private static final String __OBFID = "CL_00000710";
                
                    /**
                     * Draws the screen and all the components in it.
                     */
                    public void drawScreen(int par1, int par2, float par3)
                    {
                        int k;
                
                        for (k = 0; k < this.buttonList.size(); ++k)
                        {
                            ((GuiButton)this.buttonList.get(k)).drawButton(this.mc, par1, par2);
                        }
                
                        for (k = 0; k < this.labelList.size(); ++k)
                        {
                            ((GuiLabel)this.labelList.get(k)).func_146159_a(this.mc, par1, par2);
                        }
                    }
                
                    /**
                     * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
                     */
                    protected void keyTyped(char par1, int par2)
                    {
                        if (par2 == 1)
                        {
                            this.mc.displayGuiScreen((GuiScreen)null);
                            this.mc.setIngameFocus();
                        }
                    }
                
                    /**
                     * Returns a string stored in the system clipboard.
                     */
                    public static String getClipboardString()
                    {
                        try
                        {
                            Transferable transferable = Toolkit.getDefaultToolkit().getSystemClipboard().getContents((Object)null);
                
                            if (transferable != null && transferable.isDataFlavorSupported(DataFlavor.stringFlavor))
                            {
                                return (String)transferable.getTransferData(DataFlavor.stringFlavor);
                            }
                        }
                        catch (Exception exception)
                        {
                            ;
                        }
                
                        return "";
                    }
                
                    /**
                     * Stores the given string in the system clipboard
                     */
                    public static void setClipboardString(String p_146275_0_)
                    {
                        try
                        {
                            StringSelection stringselection = new StringSelection(p_146275_0_);
                            Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringselection, (ClipboardOwner)null);
                        }
                        catch (Exception exception)
                        {
                            ;
                        }
                    }
                
                    protected void renderToolTip(ItemStack p_146285_1_, int p_146285_2_, int p_146285_3_)
                    {
                        List list = p_146285_1_.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
                
                        for (int k = 0; k < list.size(); ++k)
                        {
                            if (k == 0)
                            {
                                list.set(k, p_146285_1_.getRarity().rarityColor + (String)list.get(k));
                            }
                            else
                            {
                                list.set(k, EnumChatFormatting.GRAY + (String)list.get(k));
                            }
                        }
                
                        FontRenderer font = p_146285_1_.getItem().getFontRenderer(p_146285_1_);
                        drawHoveringText(list, p_146285_2_, p_146285_3_, (font == null ? fontRendererObj : font));
                    }
                
                    /**
                     * Draws the text when mouse is over creative inventory tab. Params: current creative tab to be checked, current
                     * mouse x position, current mouse y position.
                     */
                    protected void drawCreativeTabHoveringText(String p_146279_1_, int p_146279_2_, int p_146279_3_)
                    {
                        this.func_146283_a(Arrays.asList(new String[] {p_146279_1_}), p_146279_2_, p_146279_3_);
                    }
                
                    protected void func_146283_a(List p_146283_1_, int p_146283_2_, int p_146283_3_)
                    {
                        drawHoveringText(p_146283_1_, p_146283_2_, p_146283_3_, fontRendererObj);   
                    }
                
                    protected void drawHoveringText(List p_146283_1_, int p_146283_2_, int p_146283_3_, FontRenderer font)
                    {
                        if (!p_146283_1_.isEmpty())
                        {
                            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
                            RenderHelper.disableStandardItemLighting();
                            GL11.glDisable(GL11.GL_LIGHTING);
                            GL11.glDisable(GL11.GL_DEPTH_TEST);
                            int k = 0;
                            Iterator iterator = p_146283_1_.iterator();
                
                            while (iterator.hasNext())
                            {
                                String s = (String)iterator.next();
                                int l = font.getStringWidth(s);
                
                                if (l > k)
                                {
                                    k = l;
                                }
                            }
                
                            int j2 = p_146283_2_ + 12;
                            int k2 = p_146283_3_ - 12;
                            int i1 = 8;
                
                            if (p_146283_1_.size() > 1)
                            {
                                i1 += 2 + (p_146283_1_.size() - 1) * 10;
                            }
                
                            if (j2 + k > this.width)
                            {
                                j2 -= 28 + k;
                            }
                
                            if (k2 + i1 + 6 > this.height)
                            {
                                k2 = this.height - i1 - 6;
                            }
                
                            this.zLevel = 300.0F;
                            itemRender.zLevel = 300.0F;
                            int j1 = -267386864;
                            this.drawGradientRect(j2 - 3, k2 - 4, j2 + k + 3, k2 - 3, j1, j1);
                            this.drawGradientRect(j2 - 3, k2 + i1 + 3, j2 + k + 3, k2 + i1 + 4, j1, j1);
                            this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 + i1 + 3, j1, j1);
                            this.drawGradientRect(j2 - 4, k2 - 3, j2 - 3, k2 + i1 + 3, j1, j1);
                            this.drawGradientRect(j2 + k + 3, k2 - 3, j2 + k + 4, k2 + i1 + 3, j1, j1);
                            int k1 = 1347420415;
                            int l1 = (k1 & 16711422) >> 1 | k1 & -16777216;
                            this.drawGradientRect(j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + i1 + 3 - 1, k1, l1);
                            this.drawGradientRect(j2 + k + 2, k2 - 3 + 1, j2 + k + 3, k2 + i1 + 3 - 1, k1, l1);
                            this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 - 3 + 1, k1, k1);
                            this.drawGradientRect(j2 - 3, k2 + i1 + 2, j2 + k + 3, k2 + i1 + 3, l1, l1);
                
                            for (int i2 = 0; i2 < p_146283_1_.size(); ++i2)
                            {
                                String s1 = (String)p_146283_1_.get(i2);
                                font.drawStringWithShadow(s1, j2, k2, -1);
                
                                if (i2 == 0)
                                {
                                    k2 += 2;
                                }
                
                                k2 += 10;
                            }
                
                            this.zLevel = 0.0F;
                            itemRender.zLevel = 0.0F;
                            GL11.glEnable(GL11.GL_LIGHTING);
                            GL11.glEnable(GL11.GL_DEPTH_TEST);
                            RenderHelper.enableStandardItemLighting();
                            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
                        }
                    }
                
                    /**
                     * Called when the mouse is clicked.
                     */
                    protected void mouseClicked(int par1, int par2, int par3)
                    {
                        if (par3 == 0)
                        {
                            for (int l = 0; l < this.buttonList.size(); ++l)
                            {
                                GuiButton guibutton = (GuiButton)this.buttonList.get(l);
                
                                if (guibutton.mousePressed(this.mc, par1, par2))
                                {
                                    ActionPerformedEvent.Pre event = new ActionPerformedEvent.Pre(this, guibutton, this.buttonList);
                                    if (MinecraftForge.EVENT_BUS.post(event))
                                        break;
                                    this.selectedButton = event.button;
                                    event.button.func_146113_a(this.mc.getSoundHandler());
                                    this.actionPerformed(event.button);
                                    if (this.equals(this.mc.currentScreen))
                                        MinecraftForge.EVENT_BUS.post(new ActionPerformedEvent.Post(this, event.button, this.buttonList));
                                }
                            }
                        }
                    }
                
                    /**
                     * Called when the mouse is moved or a mouse button is released.  Signature: (mouseX, mouseY, which) which==-1 is
                     * mouseMove, which==0 or which==1 is mouseUp
                     */
                    protected void mouseMovedOrUp(int p_146286_1_, int p_146286_2_, int p_146286_3_)
                    {
                        if (this.selectedButton != null && p_146286_3_ == 0)
                        {
                            this.selectedButton.mouseReleased(p_146286_1_, p_146286_2_);
                            this.selectedButton = null;
                        }
                    }
                
                    /**
                     * Called when a mouse button is pressed and the mouse is moved around. Parameters are : mouseX, mouseY,
                     * lastButtonClicked & timeSinceMouseClick.
                     */
                    protected void mouseClickMove(int p_146273_1_, int p_146273_2_, int p_146273_3_, long p_146273_4_) {}
                
                    protected void actionPerformed(GuiButton p_146284_1_) {}
                
                    /**
                     * Causes the screen to lay out its subcomponents again. This is the equivalent of the Java call
                     * Container.validate()
                     */
                    public void setWorldAndResolution(Minecraft p_146280_1_, int p_146280_2_, int p_146280_3_)
                    {
                        this.mc = p_146280_1_;
                        this.fontRendererObj = p_146280_1_.fontRenderer;
                        this.width = p_146280_2_;
                        this.height = p_146280_3_;
                        if (!MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Pre(this, this.buttonList)))
                        {
                            this.buttonList.clear();
                            this.initGui();
                        }
                        MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Post(this, this.buttonList));
                    }
                
                    /**
                     * Adds the buttons (and other controls) to the screen in question.
                     */
                    public void initGui() {}
                
                    /**
                     * Delegates mouse and keyboard input.
                     */
                    public void handleInput()
                    {
                        if (Mouse.isCreated())
                        {
                            while (Mouse.next())
                            {
                                this.handleMouseInput();
                            }
                        }
                
                        if (Keyboard.isCreated())
                        {
                            while (Keyboard.next())
                            {
                                this.handleKeyboardInput();
                            }
                        }
                    }
                
                    /**
                     * Handles mouse input.
                     */
                    public void handleMouseInput()
                    {
                        int i = Mouse.getEventX() * this.width / this.mc.displayWidth;
                        int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
                        int k = Mouse.getEventButton();
                
                        if (Minecraft.isRunningOnMac && k == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157)))
                        {
                            k = 1;
                        }
                
                        if (Mouse.getEventButtonState())
                        {
                            if (this.mc.gameSettings.touchscreen && this.field_146298_h++ > 0)
                            {
                                return;
                            }
                
                            this.eventButton = k;
                            this.lastMouseEvent = Minecraft.getSystemTime();
                            this.mouseClicked(i, j, this.eventButton);
                        }
                        else if (k != -1)
                        {
                            if (this.mc.gameSettings.touchscreen && –this.field_146298_h > 0)
                            {
                                return;
                            }
                
                            this.eventButton = -1;
                            this.mouseMovedOrUp(i, j, k);
                        }
                        else if (this.eventButton != -1 && this.lastMouseEvent > 0L)
                        {
                            long l = Minecraft.getSystemTime() - this.lastMouseEvent;
                            this.mouseClickMove(i, j, this.eventButton, l);
                        }
                    }
                
                    /**
                     * Handles keyboard input.
                     */
                    public void handleKeyboardInput()
                    {
                        if (Keyboard.getEventKeyState())
                        {
                            int i = Keyboard.getEventKey();
                            char c0 = Keyboard.getEventCharacter();
                
                            if (i == 87)
                            {
                                this.mc.toggleFullscreen();
                                return;
                            }
                
                            this.keyTyped(c0, i);
                        }
                    }
                
                    /**
                     * Called from the main game loop to update the screen.
                     */
                    public void updateScreen() {}
                
                    /**
                     * Called when the screen is unloaded. Used to disable keyboard repeat events
                     */
                    public void onGuiClosed() {}
                
                    /**
                     * Draws either a gradient over the background screen (when it exists) or a flat gradient over background.png
                     */
                    public void drawDefaultBackground()
                    {
                        this.drawWorldBackground(0);
                    }
                
                    public void drawWorldBackground(int p_146270_1_)
                    {
                        if (this.mc.theWorld != null)
                        {
                            this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680);
                        }
                        else
                        {
                            this.drawBackground(p_146270_1_);
                        }
                    }
                
                    /**
                     * Draws the background (i is always 0 as of 1.2.2)
                     */
                    public void drawBackground(int p_146278_1_)
                    {
                        GL11.glDisable(GL11.GL_LIGHTING);
                        GL11.glDisable(GL11.GL_FOG);
                        Tessellator tessellator = Tessellator.instance;
                        this.mc.getTextureManager().bindTexture(optionsBackground);
                        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                        float f = 32.0F;
                        tessellator.startDrawingQuads();
                        tessellator.setColorOpaque_I(4210752);
                        tessellator.addVertexWithUV(0.0D, (double)this.height, 0.0D, 0.0D, (double)((float)this.height / f + (float)p_146278_1_));
                        tessellator.addVertexWithUV((double)this.width, (double)this.height, 0.0D, (double)((float)this.width / f), (double)((float)this.height / f + (float)p_146278_1_));
                        tessellator.addVertexWithUV((double)this.width, 0.0D, 0.0D, (double)((float)this.width / f), (double)p_146278_1_);
                        tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, (double)p_146278_1_);
                        tessellator.draw();
                    }
                
                    /**
                     * Returns true if this GUI should pause the game when it is displayed in single-player
                     */
                    public boolean doesGuiPauseGame()
                    {
                        return true;
                    }
                
                    public void confirmClicked(boolean par1, int par2) {}
                
                    /**
                     * Returns true if either windows ctrl key is down or if either mac meta key is down
                     */
                    public static boolean isCtrlKeyDown()
                    {
                        return Minecraft.isRunningOnMac ? Keyboard.isKeyDown(219) || Keyboard.isKeyDown(220) : Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157);
                    }
                
                    /**
                     * Returns true if either shift key is down
                     */
                    public static boolean isShiftKeyDown()
                    {
                        return Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54);
                    }
                }
                

                :::
                Il y a bien la méthode updateScreen() mais elle est vide par défaut et le commentaire dit qu’elle est appelée par la boucle principale, donc normalement ce n’est pas a moi de l’appeler…

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

                  Je ne te demande pas de l’appeler mais de l’override (sais plus l’écrire >.<)
                  Dans ton code tu fais :

                  @Override
                  
                  public void updateScreen(){
                  System.out.println("Je suis content ^^");
                  }
                  

                  ^^

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

                    Ok mais je met quoi dans la méthode ? Le même code que dans mon drawGuiContainerBackgroundLayer() ?

                    ​@Override
                    
                    public void drawGuiContainerBackgroundLayer(float f, int i, int j) 
                    {
                    GL11.glColor4f(1F, 1F, 1F, 1F);
                    this.mc.getTextureManager().bindTexture(texture);
                    int x = (this.width - this.xSize) / 2;
                    int y = (this.height - this.ySize) / 2;
                    this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
                    this.drawTexturedModalRect(x, y, 61, 79, 16, (int) c.MilkLevel/142);
                    //TEST d'affichage barre this.drawTexturedModalRect(61, 6, 176, 0, 16, 7);
                    }
                    

                    EDIT : Je viens de tester comme ça et ça ne marche tjrs pas…
                    EDIT 2 : J’ai regardé en plus la class GuiFurnace et updateScreen() n’est pas présente…

                    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

                      drawGuiContainerBackgroundLayer est appelé à chaque tick, donc ce n’est pas ici le problème.
                      Il faut regarder dans le container.
                      https://github.com/FFMT/Privatizer/blob/master/privatizer_src/fr/mcnanotech/privatizer/common/ContainerPrivateFurnace.java#L44-L98

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

                        D’accord merci, j’ai ajouté dans mon container ces trois méthodes là :

                        ​@Override
                        
                        public void addCraftingToCrafters(ICrafting crafting)
                        {
                        super.addCraftingToCrafters(crafting);
                        crafting.sendProgressBarUpdate(this, 0, this.c.MilkLevel);
                        }
                        public void detectAndSendChanges()
                        {
                        super.detectAndSendChanges();
                        
                        for(int i = 0; i < this.crafters.size(); ++i)
                        {
                        ICrafting icrafting = (ICrafting)this.crafters.get(i);
                        
                        if(this.lastMilkLevel != this.c.MilkLevel)
                        {
                        icrafting.sendProgressBarUpdate(this, 0, this.c.MilkLevel);
                        }
                        }
                        
                        this.lastMilkLevel = this.c.MilkLevel;
                        }
                        
                        @SideOnly(Side.CLIENT)
                        public void updateProgressBar(int id, int value)
                        {
                        this.c.MilkLevel = value;
                        }
                        

                        Maintenant le texte indiquant la valeur du lait fonctionne, la barre toujours pas (mais je pense que c’est juste une erreur de coordonées dans l’image, puisqu’on en voit un bout sur le côté) mais maintenant on ne peut plus mettre de sceau de lait/ sceau vide dans le container, il ne se passe rien ! Pour voir que le texte marchait, j’ai du regarder sur un que j’avais posé avant et qui avait gardé en NBTTag sa valeur de lait…
                        Image :
                        :::

                        :::

                        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

                          Il faudrait le code complet (gui + container + tile entity + bloc).
                          En passant, respecte la convention Java (pas de majuscule début d’un nom de variable) car c’est plus simple pour les repérer.

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

                            Le message est je trouve trop gros ; j’essaierai de poster les classes sur un site externe la prochaine fois mais j’hésite : GitHub mais je n’ai pas de compte et à la base c’est plutôt pour du développement communautaire je trouvais inutile de me créer un compte juste pour ça ou le mettre sur mon site fichiers par exemple mais la coloration du language n’y est pas (http://files.olympe.in/java/GuiMilkContainer.java).

                            EDIT : J’ai tout mis sur GitHub, voir le message suivant.
                            EDIT 2 : Je n’avais pas remarqué il reste des commentaires dans le code j’ai oublié de les supprimer avant de les poster n’y faites pas attention

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

                              GitHub sert à tout le monde. Si ça ne te sert pas pour le dev collaboratif ça te servira au moins comme cloud dédié au code.

                              Envoyé de mon iPhone en utilisant Tapatalk


                              Über Networking Antennas

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

                                Voila j’ai tout mis sur GitHub. Liens :

                                • ContainerMilkContainer.java
                                • GuiMilkContainer.java
                                • TileEntityMilkContainer.java
                                • MilkContainer.java
                                  J’ai également supprimé les codes présents sur l’autre message. Alors , une idée ? J’avoue que là je ne comprends pas en quoi l’ajout de ce code pourrait faire buguer le reste…
                                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

                                  Le problème m’a l’air de venir de la fonction transferStackInSlot, regarde dans le coffre ou dans le four.
                                  Pour l’affichage, c’est surement la texture comme tu l’as dit.

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

                                    J’ai essayé avec ça :

                                    ​ @Override
                                    
                                    public ItemStack transferStackInSlot(EntityPlayer p, int slotN)
                                    {
                                    ItemStack itemstack = null;
                                            Slot slot = (Slot)this.inventorySlots.get(slotN);
                                    
                                            if (slot != null && slot.getHasStack())
                                            {
                                                ItemStack itemstack1 = slot.getStack();
                                                itemstack = itemstack1.copy();
                                                if (itemstack1.stackSize == 0)
                                                {
                                                    slot.putStack((ItemStack)null);
                                                }
                                                else
                                                {
                                                this.mergeItemStack(itemstack1, c.getSizeInventory(), this.inventorySlots.size(), true);
                                                    slot.onSlotChanged();
                                                }
                                            }
                                    
                                            return itemstack;
                                    }
                                    

                                    Ça marche toujours pas… Et je ne comprend pas pourquoi l’ajout des trois méthodes précédentes aurait pu causer un problème à ce niveau…

                                    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

                                      Je ne vois pas d’où vient le problème dans ce cas 😕

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

                                        Ok, pas grave j’essaierai de résoudre ça tout seul, ou si quelqu’un d’autre a une idée qu’il n’hésite pas. :s  Merci quand même  😄

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

                                          C’est bon j’ai réussi ! En fait il fallait juste ajouter la méthode :

                                          ​c.deleteBucketAndModifyLevel();
                                          

                                          au milieu de detectAndSendChanges :

                                          ​@Override
                                          
                                          public void detectAndSendChanges()
                                          {
                                          super.detectAndSendChanges();
                                          c.deleteBucketAndModifyLevel();
                                          for(int i = 0; i < this.crafters.size(); ++i)
                                          {
                                          ICrafting icrafting = (ICrafting)this.crafters.get(i);
                                          
                                          if(this.lastMilkLevel != this.c.milkLevel)
                                          {
                                          icrafting.sendProgressBarUpdate(this, 0, this.c.milkLevel);
                                          }
                                          }
                                          
                                          this.lastMilkLevel = this.c.milkLevel;
                                          }
                                          

                                          Si sa intéresse quelqu’un, les classes sont sur GitHub, à la même adresse. 
                                          EDIT : J’ai également résolu le pb de texture, c’est en fait que je ne sais pas faire une addition/soustraction.

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

                                          MINECRAFT FORGE FRANCE © 2024

                                          Powered by NodeBB