MFF

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

    Diverses Questions

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    29 Messages 3 Publieurs 5.3k 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.
    • SCAREXS Hors-ligne
      SCAREX
      dernière édition par

      @‘sosoh’:

      Ok, mais apres la texture va s’update ?

      Soit elle sera update avec le render soit avec le onNeighborChange, donc je pense qu’il n’y a pas de soucis, mais à verifier.

      Site web contenant mes scripts : http://SCAREXgaming.github.io

      Pas de demandes de support par MP ni par skype SVP.
      Je n'accepte sur skype que l…

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

        En fait je penses que je vais faire autrement mais pour ça j’ai besoin de savoir comment détecter quand un slot change de contenu: Je veux faire que quand je mets un sceau d’eau dans un slot, le sceau remplit soit remplacer par un sceau vide et que le NBTTag contenu obtienne la valeur “eau” et dans ce cas la, la texture change.

        Developpeur d'Hogsmod, un mod implémentant le Monde d'Harry Potter dans Minecraft!

        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 que tu as est sur le rendu dans l’inventaire, lorsque le rendu dans l’inventaire est fait l’objet tile est null, il faut donc prévoir le coup. Ou alors séparer le rendu dans le monde et celui dans l’inventaire.

          Ce n’est pas du tout par la fonction onNeighborChange qu’il faut passer.

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

            Tu peux m’aider ou pas ? Je t’avoues ne pas avoir tout saisis ^^

            Developpeur d'Hogsmod, un mod implémentant le Monde d'Harry Potter dans Minecraft!

            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

              Envoie la classe de ton TESR en entier.

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

                VOila:

                
                package com.harrypotter.sosoh.client.render.blocks;
                
                import org.lwjgl.opengl.GL11;
                
                import com.harrypotter.sosoh.client.model.blocks.ModelChaudron;
                import com.harrypotter.sosoh.common.ModHarryPotter;
                import com.harrypotter.sosoh.common.blocks.TileEntityChaudron;
                
                import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
                import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
                import net.minecraft.tileentity.TileEntity;
                import net.minecraft.util.ResourceLocation;
                
                public class TileEntityChaudronSpecialRenderer extends TileEntitySpecialRenderer {
                
                public static ModelChaudron model = new ModelChaudron();
                    public static ResourceLocation texture = new ResourceLocation(ModHarryPotter.MODID, "textures/models/blocks/model_block_chaudron.png");;
                
                    public TileEntityChaudronSpecialRenderer()
                    {
                        this.func_147497_a(TileEntityRendererDispatcher.instance);
                    }
                
                    @Override
                    public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialRenderTick)
                    {
                        this.renderTileEntityChaudronAt((TileEntityChaudron)tile, x, y, z, partialRenderTick);
                    }
                
                    private void renderTileEntityChaudronAt(TileEntityChaudron tile, double x, double y, double z, float partialRenderTick)
                    {
                        GL11.glPushMatrix();
                        GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D);
                        GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
                        GL11.glRotatef((90F * tile.getDirection()) + 180F, 0.0F, 1.0F, 0.0F);
                        this.bindTexture(texture);
                        model.renderAll();
                        GL11.glPopMatrix();
                    }
                }
                
                

                et

                
                package com.harrypotter.sosoh.client.render.blocks;
                
                import net.minecraft.block.Block;
                import net.minecraft.client.Minecraft;
                import net.minecraft.client.renderer.RenderBlocks;
                import net.minecraft.world.IBlockAccess;
                
                import org.lwjgl.opengl.GL11;
                
                import com.harrypotter.sosoh.common.ModHarryPotter;
                import com.harrypotter.sosoh.proxy.ClientProxy;
                
                import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
                
                public class BlockChaudronTechneRender implements ISimpleBlockRenderingHandler {
                
                    @Override
                    public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer)
                    {
                        if(block == ModHarryPotter.blockChaudron && metadata == 0)
                        {
                            GL11.glPushMatrix();
                            GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
                            GL11.glTranslatef(0.0F, -1.0F, 0.0F);
                            GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
                            Minecraft.getMinecraft().getTextureManager().bindTexture(TileEntityChaudronSpecialRenderer.texture);
                            TileEntityChaudronSpecialRenderer.model.renderAll();
                            GL11.glPopMatrix();
                        }
                    }
                
                    @Override
                    public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
                    {
                        return false;
                    }
                
                    @Override
                    public boolean shouldRender3DInInventory(int modelId)
                    {
                        return true;
                    }
                
                    @Override
                    public int getRenderId()
                    {
                        return ClientProxy.blockChaudronRenderId;
                    }
                }
                
                

                Developpeur d'Hogsmod, un mod implémentant le Monde d'Harry Potter dans Minecraft!

                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

                  Avec cette méthode tu ne devrait pas avoir de NPE avec le rendu dans l’inventaire, c’est étrange. Actuellement le rendu fonctionne où non ?

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

                    Oui il fonctionne

                    Developpeur d'Hogsmod, un mod implémentant le Monde d'Harry Potter dans Minecraft!

                    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

                      Et quand tu utilise l’autre code que tu as mit à la première page (lui :

                      ​if (tile.getContenu().equalsIgnoreCase("vide") {
                          this.texture = new ResourceLocation(ModHarryPotter.MODID, "textures/models/blocks/model_block_chaudron.png");
                      } else {
                          this.texture = new ResourceLocation(ModHarryPotter.MODID, "textures/models/blocks/model_block_chaudron.png");
                      }
                      
                      

                      ) ça crash ?
                      Je trouve ça étrange, il n’y a pas de raison pour que cela crash pourtant …

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

                        Tu as pas une idee de comment je pourrais faire ?

                        Developpeur d'Hogsmod, un mod implémentant le Monde d'Harry Potter dans Minecraft!

                        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

                          Heu … ? tu n’as pas répondu à ma question x)

                          Car ce que tu es en train de faire c’est exactement comme ça que je l’aurai fait. Et kevin_68 l’a fait dans son mod spotlight, ça fonctionne très bien.

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

                            J’ai cru que c’était rhétorique car tu as dis “Je trouve ça étrange […]”. x) Le code je le juste avant d’appliquer la texture ?

                            EDIT:
                            Je l’ai mis ici:

                            
                            private void renderTileEntityChaudronAt(TileEntityChaudron tile, double x, double y, double z, float partialRenderTick)
                            
                                {
                                    GL11.glPushMatrix();
                                    GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D);
                                    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
                                    GL11.glRotatef((90F * tile.getDirection()) + 180F, 0.0F, 1.0F, 0.0F);
                                    if (tile.getContenu().equalsIgnoreCase("vide")) {
                                        this.texture = new ResourceLocation(ModHarryPotter.MODID, "textures/models/blocks/model_block_chaudron.png");
                                    } else {
                                        this.texture = new ResourceLocation(ModHarryPotter.MODID, "textures/models/blocks/model_block_chaudron.png");
                                    }
                            
                                    this.bindTexture(texture);
                                    model.renderAll();
                                    GL11.glPopMatrix();
                                }
                            

                            Et ça crash:

                            [23:05:10] [main/INFO] [GradleStart]: Extra: []

                            [23:06:42] [Server thread/INFO]: Stopping server
                            [23:06:42] [Server thread/INFO]: Saving players
                            [23:06:42] [Server thread/INFO]: Saving worlds
                            [23:06:42] [Server thread/INFO]: Saving chunks for level ‘Nouveau monde’/Overworld
                            [23:06:42] [Server thread/INFO]: Saving chunks for level ‘Nouveau monde’/Nether
                            [23:06:42] [Server thread/INFO]: Saving chunks for level ‘Nouveau monde’/The End
                            [23:06:42] [Server thread/INFO] [FML]: Unloading dimension 0
                            [23:06:42] [Server thread/INFO] [FML]: Unloading dimension -1
                            [23:06:42] [Server thread/INFO] [FML]: Unloading dimension 1
                            [23:06:42] [Server thread/INFO] [FML]: Applying holder lookups
                            [23:06:42] [Server thread/INFO] [FML]: Holder lookups applied
                            [23:06:43] [Client thread/FATAL]: Reported exception thrown!
                            net.minecraft.util.ReportedException: Rendering Block Entity
                            at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:148) ~[TileEntityRendererDispatcher.class:?]
                            at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126) ~[TileEntityRendererDispatcher.class:?]
                            at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:539) ~[RenderGlobal.class:?]
                            at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1300) ~[EntityRenderer.class:?]
                            at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1091) ~[EntityRenderer.class:?]
                            at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1056) ~[Minecraft.class:?]
                            at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]
                            at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
                            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
                            at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
                            at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
                            at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]
                            at GradleStart.main(GradleStart.java:45) [start/:?]
                            Caused by: java.lang.NullPointerException
                            at com.harrypotter.sosoh.client.render.blocks.TileEntityChaudronSpecialRenderer.renderTileEntityChaudronAt(TileEntityChaudronSpecialRenderer.java:36) ~[TileEntityChaudronSpecialRenderer.class:?]
                            at com.harrypotter.sosoh.client.render.blocks.TileEntityChaudronSpecialRenderer.renderTileEntityAt(TileEntityChaudronSpecialRenderer.java:27) ~[TileEntityChaudronSpecialRenderer.class:?]
                            at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141) ~[TileEntityRendererDispatcher.class:?]
                            … 15 more
                            [23:06:43] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: –-- Minecraft Crash Report ----
                            // Quite honestly, I wouldn’t worry myself about that.

                            Time: 18/02/15 23:06
                            Description: Rendering Block Entity

                            java.lang.NullPointerException: Rendering Block Entity
                            at com.harrypotter.sosoh.client.render.blocks.TileEntityChaudronSpecialRenderer.renderTileEntityChaudronAt(TileEntityChaudronSpecialRenderer.java:36)
                            at com.harrypotter.sosoh.client.render.blocks.TileEntityChaudronSpecialRenderer.renderTileEntityAt(TileEntityChaudronSpecialRenderer.java:27)
                            at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141)
                            at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126)
                            at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:539)
                            at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1300)
                            at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1091)
                            at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1056)
                            at net.minecraft.client.Minecraft.run(Minecraft.java:951)
                            at net.minecraft.client.main.Main.main(Main.java:164)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            at java.lang.reflect.Method.invoke(Unknown Source)
                            at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
                            at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                            at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
                            at GradleStart.main(GradleStart.java:45)

                            A detailed walkthrough of the error, its code path and all known details is as follows:

                            – Head –
                            Stacktrace:
                            at com.harrypotter.sosoh.client.render.blocks.TileEntityChaudronSpecialRenderer.renderTileEntityChaudronAt(TileEntityChaudronSpecialRenderer.java:36)
                            at com.harrypotter.sosoh.client.render.blocks.TileEntityChaudronSpecialRenderer.renderTileEntityAt(TileEntityChaudronSpecialRenderer.java:27)

                            – Block Entity Details –
                            Details:
                            Name: ModHarryPotter.MODID:BlockChaudron // com.harrypotter.sosoh.common.blocks.TileEntityChaudron
                            Block type: ID #165 (tile.chaudron // com.harrypotter.sosoh.common.blocks.BlockChaudron)
                            Block data value: 0 / 0x0 / 0b0000
                            Block location: World: (-138,4,1356), Chunk: (at 6,0,12 in -9,84; contains blocks -144,0,1344 to -129,255,1359), Region: (-1,2; contains chunks -32,64 to -1,95, blocks -512,0,1024 to -1,255,1535)
                            Actual block type: ID #165 (tile.chaudron // com.harrypotter.sosoh.common.blocks.BlockChaudron)
                            Actual block data value: 0 / 0x0 / 0b0000
                            Stacktrace:
                            at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141)
                            at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126)
                            at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:539)
                            at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1300)

                            Developpeur d'Hogsmod, un mod implémentant le Monde d'Harry Potter dans Minecraft!

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

                              Au pire, mets une valeur par défaut et regarde ce que ça donne, normalement il ne devrais plus y avoir de NPE.

                              Site web contenant mes scripts : http://SCAREXgaming.github.io

                              Pas de demandes de support par MP ni par skype SVP.
                              Je n'accepte sur skype que l…

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

                                Valeur ou ?

                                Developpeur d'Hogsmod, un mod implémentant le Monde d'Harry Potter dans Minecraft!

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

                                  @‘sosoh’:

                                  Valeur ou ?

                                  public RessourceLocation texture = new RessourceLocation(MODID, “textures…”);

                                  Site web contenant mes scripts : http://SCAREXgaming.github.io

                                  Pas de demandes de support par MP ni par skype SVP.
                                  Je n'accepte sur skype que l…

                                  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

                                    at com.harrypotter.sosoh.client.render.blocks.TileEntityChaudronSpecialRenderer.ren derTileEntityChaudronAt(TileEntityChaudronSpecialRenderer.java:36) ~[TileEntityChaudronSpecialRenderer.class:?]
                                    Tu as quoi à la ligne 36 ?

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

                                      Désolé, de repondre que maintenant, j’étais occupé, à la ligne 36 j’ai:

                                      ​if (tile.getContenu().equalsIgnoreCase("vide")) {
                                      
                                                  this.texture = new ResourceLocation(ModHarryPotter.MODID, "textures/models/blocks/model_block_chaudron.png");
                                              } else {
                                                  this.texture = new ResourceLocation(ModHarryPotter.MODID, "textures/models/blocks/model_block_chaudron.png");
                                              }
                                      

                                      Developpeur d'Hogsmod, un mod implémentant le Monde d'Harry Potter dans Minecraft!

                                      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 contenu est null. Fait comme ça :
                                        if (tile.getContenu() != null && tile.getContenu().equalsIgnoreCase(“vide”)) {

                                        ou :
                                        if (“vide”.equalsIgnoreCase(tile.getContenu())) {

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

                                        MINECRAFT FORGE FRANCE © 2024

                                        Powered by NodeBB