MFF

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

    Créer un Block similaire au Block Barrier

    Planifier Épinglé Verrouillé Déplacé Résolu 1.9.x et 1.10.x
    1.10.x
    43 Messages 7 Publieurs 7.4k 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.
    • jules552J Hors-ligne
      jules552
      dernière édition par

      @‘__Isaac’:

      Je reformule pour savoir si c’est sa que tu veut alors si j’ai compris tu veut une barrière qui se voit que si le joueur la dans la main ?

      Voila exactement sauf que c’est pas un barrier je veux juste que la texture du block s’affiche quand ce joueur le porte dans sa main comme le fait le Block barriere

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

        Et tu as pensé à regarder le block barrier ?

        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
        • BrokenSwingB Hors-ligne
          BrokenSwing Moddeurs confirmés Rédacteurs
          dernière édition par

          Pour information, c’est des particules qui s’affichent et non la texture du bloc

          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 bloc BARRIER est un bloc entièrement invisible et rendu comme une particule dans la fonction doVoidFogParticles et showBarrierParticles de la classe WorldClient.

            Depuis l’event TickEvent.RenderTickEvent il devrait être possible de reproduire ça.

            Une autre possibilité serait d’utiliser une propriété de type boolean avec un bloc state et changer le retour de la fonction Block.getRenderType en fonction de cette état de bloc, le tout utilisé avec la fonction getActualState pour connaitre la valeur de cette boolean.
            Quelques choses de semblable à ceci :

            package com.example.examplemod;
            
            import net.minecraft.block.Block;
            import net.minecraft.block.material.Material;
            import net.minecraft.block.properties.PropertyBool;
            import net.minecraft.block.state.IBlockState;
            import net.minecraft.client.Minecraft;
            import net.minecraft.init.Blocks;
            import net.minecraft.item.Item;
            import net.minecraft.item.ItemStack;
            import net.minecraft.util.BlockRenderLayer;
            import net.minecraft.util.EnumBlockRenderType;
            import net.minecraft.util.math.BlockPos;
            import net.minecraft.world.IBlockAccess;
            import net.minecraftforge.fml.common.FMLCommonHandler;
            import net.minecraftforge.fml.relauncher.Side;
            import net.minecraftforge.fml.relauncher.SideOnly;
            
            public class BlockDemo extends Block
            {
               public static final PropertyBool VISIBLE = PropertyBool.create("visible");
               public BlockDemo(Material materialIn)
               {
                   super(materialIn);
               }
            
               public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
               {
                   if(FMLCommonHandler.instance().getSide().isClient())
                   {
                       return getClientState(state);
                   }
                   return state.withProperty(VISIBLE, Boolean.valueOf(false));
               }
            
               @SideOnly(Side.CLIENT)
               private IBlockState getClientState(IBlockState state)
               {
                   ItemStack stack1 = Minecraft.getMinecraft().thePlayer.getHeldItemMainhand();
                   ItemStack stack2 = Minecraft.getMinecraft().thePlayer.getHeldItemOffhand();
                   if((stack1 != null && stack1.getItem() == Item.getItemFromBlock(this)) || (stack2 != null && stack2.getItem() == Item.getItemFromBlock(this)))
                   {
                       state.withProperty(VISIBLE, Boolean.valueOf(true)); // visible
                   }
                   return state.withProperty(VISIBLE, Boolean.valueOf(false));
               }
            
               public EnumBlockRenderType getRenderType(IBlockState state)
               {
                   if(state.getValue(VISIBLE))
                   {
                       return EnumBlockRenderType.MODEL;
                   }
                   return EnumBlockRenderType.INVISIBLE;
               }
            
               public boolean isFullCube(IBlockState state)
               {
                   return state.getValue(VISIBLE);
               }
            
               public boolean isOpaqueCube(IBlockState state)
               {
                   return state.getValue(VISIBLE);
               }
            }
            
            1 réponse Dernière réponse Répondre Citer 0
            • jules552J Hors-ligne
              jules552
              dernière édition par

              Merci d’avoir pris la peine à tous de me répondre, je vais regarder à ça et je vous dis si ça fonctionne ou non 🙂    , je met le sujet en résolu. Et oui effectivement je viens d’apprendre par l’un de met amis que c’est une particule qui s’affiche dans le block barrier ^^ .

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

                Bon j’ai un petit problème, lorsque que je lance le jeu ça crash 😕

                Voici la class du block que je veux créer :

                 package Blocks;
                
                import javax.annotation.Nullable;
                
                import ibxm.Player;
                import net.minecraft.block.Block;
                import net.minecraft.block.material.Material;
                import net.minecraft.block.properties.PropertyBool;
                import net.minecraft.block.state.IBlockState;
                import net.minecraft.client.Minecraft;
                import net.minecraft.item.Item;
                import net.minecraft.item.ItemStack;
                import net.minecraft.util.EnumBlockRenderType;
                import net.minecraft.util.math.AxisAlignedBB;
                import net.minecraft.util.math.BlockPos;
                import net.minecraft.world.IBlockAccess;
                import net.minecraft.world.World;
                import net.minecraftforge.fml.common.FMLCommonHandler;
                import net.minecraftforge.fml.relauncher.Side;
                import net.minecraftforge.fml.relauncher.SideOnly;
                
                public class LumineuxBlock extends Block
                {
                
                public static final PropertyBool VISIBLE = PropertyBool.create("visible");
                public LumineuxBlock(Material materialIn) 
                {
                super(materialIn);
                this.setBlockUnbreakable();
                this.setLightOpacity(0);
                this.setResistance(6000001.0F);
                        this.disableStats();
                        this.translucent = true;
                
                }
                
                @Nullable
                   public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos)
                   {
                       return NULL_AABB;
                   }
                
                public boolean isFullCube(IBlockState state)
                  {
                      return state.getValue(VISIBLE);
                  }
                
                  public boolean isOpaqueCube(IBlockState state)
                  {
                      return state.getValue(VISIBLE);
                  }
                
                   @SideOnly(Side.CLIENT)
                   public float getAmbientOcclusionLightValue(IBlockState state)
                   {
                       return 1.0F;
                   }
                
                   public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
                   {
                   }
                
                   public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
                   {
                       if(FMLCommonHandler.instance().getSide().isClient())
                       {
                           return getClientState(state);
                       }
                       return state.withProperty(VISIBLE, Boolean.valueOf(false));
                   }
                
                   @SideOnly(Side.CLIENT)
                   private IBlockState getClientState(IBlockState state)
                   {
                       ItemStack stack1 = Minecraft.getMinecraft().thePlayer.getHeldItemMainhand();
                       ItemStack stack2 = Minecraft.getMinecraft().thePlayer.getHeldItemOffhand();
                       if((stack1 != null && stack1.getItem() == Item.getItemFromBlock(this)) || (stack2 != null && stack2.getItem() == Item.getItemFromBlock(this)))
                       {
                           state.withProperty(VISIBLE, Boolean.valueOf(true)); // visible
                       }
                       return state.withProperty(VISIBLE, Boolean.valueOf(false));
                   }
                
                   public EnumBlockRenderType getRenderType(IBlockState state)
                   {
                       if(state.getValue(VISIBLE))
                       {
                           return EnumBlockRenderType.MODEL;
                       }
                       return EnumBlockRenderType.INVISIBLE;
                   }
                }
                

                et voici le Crash Report :

                –-- Minecraft Crash Report ----
                // My bad.
                
                Time: 24/07/16 23:13
                Description: Initializing game
                
                java.lang.IllegalArgumentException: Cannot get property PropertyBool{name=visible, clazz=class java.lang.Boolean, values=[true, false]} as it does not exist in BlockStateContainer{block=null, properties=[]}
                at net.minecraft.block.state.BlockStateContainer$StateImplementation.getValue(BlockStateContainer.java:196)
                at Blocks.LumineuxBlock.isOpaqueCube(LumineuxBlock.java:51)
                at net.minecraft.block.state.BlockStateContainer$StateImplementation.isOpaqueCube(BlockStateContainer.java:433)
                at net.minecraft.block.Block.<init>(Block.java:280)
                at net.minecraft.block.Block.<init>(Block.java:287)
                at Blocks.LumineuxBlock.<init>(LumineuxBlock.java:28)
                at fr.jules552.mod.init.BlocksMod.init(BlocksMod.java:43)
                at fr.jules552.mod.Adamantium.preInit(Adamantium.java:34)
                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.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:579)
                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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
                at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
                at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
                at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
                at com.google.common.eventbus.EventBus.post(EventBus.java:275)
                at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:239)
                at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217)
                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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
                at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
                at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
                at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
                at com.google.common.eventbus.EventBus.post(EventBus.java:275)
                at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142)
                at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:607)
                at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:255)
                at net.minecraft.client.Minecraft.startGame(Minecraft.java:477)
                at net.minecraft.client.Minecraft.run(Minecraft.java:386)
                at net.minecraft.client.main.Main.main(Main.java:118)
                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 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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
                at GradleStart.main(GradleStart.java:26)
                
                A detailed walkthrough of the error, its code path and all known details is as follows:
                –-------------------------------------------------------------------------------------
                
                -- Head --
                Thread: Client thread
                Stacktrace:
                at net.minecraft.block.state.BlockStateContainer$StateImplementation.getValue(BlockStateContainer.java:196)
                at Blocks.LumineuxBlock.isOpaqueCube(LumineuxBlock.java:51)
                at net.minecraft.block.state.BlockStateContainer$StateImplementation.isOpaqueCube(BlockStateContainer.java:433)
                at net.minecraft.block.Block.<init>(Block.java:280)
                at net.minecraft.block.Block.<init>(Block.java:287)
                at Blocks.LumineuxBlock.<init>(LumineuxBlock.java:28)
                at fr.jules552.mod.init.BlocksMod.init(BlocksMod.java:43)
                at fr.jules552.mod.Adamantium.preInit(Adamantium.java:34)
                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.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:579)
                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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
                at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
                at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
                at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
                at com.google.common.eventbus.EventBus.post(EventBus.java:275)
                at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:239)
                at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217)
                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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
                at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
                at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
                at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
                at com.google.common.eventbus.EventBus.post(EventBus.java:275)
                at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142)
                at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:607)
                at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:255)
                at net.minecraft.client.Minecraft.startGame(Minecraft.java:477)
                
                -- Initialization --
                Details:
                Stacktrace:
                at net.minecraft.client.Minecraft.run(Minecraft.java:386)
                at net.minecraft.client.main.Main.main(Main.java:118)
                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 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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
                at GradleStart.main(GradleStart.java:26)
                
                -- System Details --
                Details:
                Minecraft Version: 1.10.2
                Operating System: Windows 10 (amd64) version 10.0
                Java Version: 1.8.0_101, Oracle Corporation
                Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
                Memory: 739617680 bytes (705 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
                JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
                IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
                FML: MCP 9.32 Powered by Forge 12.18.1.2018 4 mods loaded, 4 mods active
                States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
                UCH mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
                UCH FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.1.2018.jar) 
                UCH Forge{12.18.1.2018} [Minecraft Forge] (forgeSrc-1.10.2-12.18.1.2018.jar) 
                UCE adamantium{1.0.0} [Adamantium] (bin) 
                Loaded coremods (and transformers): 
                GL info: ' Vendor: 'Intel' Version: '4.3.0 - Build 20.19.15.4331' Renderer: 'Intel(R) HD Graphics 4600'
                Launched Version: 1.10.2
                LWJGL: 2.9.4
                OpenGL: Intel(R) HD Graphics 4600 GL version 4.3.0 - Build 20.19.15.4331, Intel
                GL Caps: Using GL 1.3 multitexturing.
                Using GL 1.3 texture combiners.
                Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
                Shaders are available because OpenGL 2.1 is supported.
                VBOs are available because OpenGL 1.5 is supported.
                
                Using VBOs: Yes
                Is Modded: Definitely; Client brand changed to 'fml,forge'
                Type: Client (map_client.txt)
                Resource Packs: 
                Current Language: English (US)
                Profiler Position: N/A (disabled)
                CPU: 8x Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz
                

                Pourrais-tu m’indiquer mon erreur s’il te plait et si possible de la corriger? 🙂  encore mille merci de votre aide et de votre patience  :-3</init></init></init></init></init></init>

                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

                  J’ai oublié ces deux fonctions :

                  public int getMetaFromState(IBlockState state)
                  {
                  return 0;
                  }
                  
                  protected BlockStateContainer createBlockState()
                  {
                  return new BlockStateContainer(this, new IProperty[] {VISIBLE});
                  }
                  
                  1 réponse Dernière réponse Répondre Citer 0
                  • jules552J Hors-ligne
                    jules552
                    dernière édition par

                    Merci de ta réponse, ça résout le problème de crash mais un nouveau problème subsiste. Quand je pose le block celui-ci ne possède aucune texture, je veux dire elle affiche la texture rose et noir comme quoi aucune texture n’est chargé, et malheuresement que j’ai le block ou non en main cette texture reste. Voici le nouveau code :

                       package Blocks;
                    
                    import javax.annotation.Nullable;
                    
                    import fr.jules552.mod.init.BlocksMod;
                    import fr.jules552.mod.init.ItemsMod;
                    import net.minecraft.block.Block;
                    import net.minecraft.block.material.Material;
                    import net.minecraft.block.properties.IProperty;
                    import net.minecraft.block.properties.PropertyBool;
                    import net.minecraft.block.state.BlockStateContainer;
                    import net.minecraft.block.state.IBlockState;
                    import net.minecraft.client.Minecraft;
                    import net.minecraft.init.Blocks;
                    import net.minecraft.item.Item;
                    import net.minecraft.item.ItemStack;
                    import net.minecraft.util.BlockRenderLayer;
                    import net.minecraft.util.EnumBlockRenderType;
                    import net.minecraft.util.math.AxisAlignedBB;
                    import net.minecraft.util.math.BlockPos;
                    import net.minecraft.world.IBlockAccess;
                    import net.minecraft.world.World;
                    import net.minecraftforge.fml.common.FMLCommonHandler;
                    import net.minecraftforge.fml.relauncher.Side;
                    import net.minecraftforge.fml.relauncher.SideOnly;
                    
                    public class LumineuxBlock extends Block {
                    
                    public static final PropertyBool VISIBLE = PropertyBool.create("visible");
                    
                    public LumineuxBlock(Material materialIn) {
                    super(materialIn);
                    this.setBlockUnbreakable();
                    this.setLightOpacity(0);
                    this.setResistance(6000001.0F);
                    
                    }
                    
                    @SideOnly(Side.CLIENT)
                    public float getAmbientOcclusionLightValue(IBlockState state) {
                    return 1.0F;
                    }
                    
                    public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
                    if (FMLCommonHandler.instance().getSide().isClient()) {
                    return getClientState(state);
                    }
                    return state.withProperty(VISIBLE, Boolean.valueOf(false));
                    }
                    
                    @SideOnly(Side.CLIENT)
                    private IBlockState getClientState(IBlockState state) {
                    ItemStack stack1 = Minecraft.getMinecraft().thePlayer.getHeldItemMainhand();
                    ItemStack stack2 = Minecraft.getMinecraft().thePlayer.getHeldItemOffhand();
                    if ((stack1 != null && stack1.getItem() == Item.getItemFromBlock(this))
                    || (stack2 != null && stack2.getItem() == Item.getItemFromBlock(this))) {
                    state.withProperty(VISIBLE, Boolean.valueOf(true)); // visible
                    }
                    return state.withProperty(VISIBLE, Boolean.valueOf(false));
                    }
                    
                    public EnumBlockRenderType getRenderType(IBlockState state) {
                    if (state.getValue(VISIBLE)) {
                    return EnumBlockRenderType.MODEL;
                    }
                    return EnumBlockRenderType.INVISIBLE;
                    }
                    
                    @Nullable
                    public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) {
                    return NULL_AABB;
                    }
                    
                    public boolean isFullCube(IBlockState state) {
                    return state.getValue(VISIBLE);
                    }
                    
                    public boolean isOpaqueCube(IBlockState state) {
                    return state.getValue(VISIBLE);
                    }
                    
                    public int getMetaFromState(IBlockState state) {
                    return 0;
                    }
                    
                    protected BlockStateContainer createBlockState() {
                    return new BlockStateContainer(this, new IProperty[] { VISIBLE });
                    }
                    
                    }
                    
                    

                    Merci encore de prendre le temps de me répondre 🙂

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

                      Il faut que tu utilises les jsons (il y a tuto sur le forum) pour mettre ta texture.

                      Envoyé via mobile

                      Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                      AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                      Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                      Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                        @‘AymericRed’:

                        Il faut que tu utilises les jsons (il y a tuto sur le forum) pour mettre ta texture.

                        Envoyé via mobile

                        Mais le problème c’est que le block à déjà un json, je veux dire la texture est déjà mise sur le block, que ce soit dans le models ou dans blockstates les json du block y sont donc aurai-je oublier un autre jsons ?

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

                          Regardes dans les logs, car si la texture est violette et noire, c’est que tu as du te tromper dans le nom d’un fichier.

                          Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                          AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                          Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                          Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                            @‘AymericRed’:

                            Regardes dans les logs, car si la texture est violette et noire, c’est que tu as du te tromper dans le nom d’un fichier.

                            Je vois bien qu’il y a un problème dans les textures mais je sais pas c’est dû à quoi et comment le régler, tient si tu veux un passage de la log montrant la texture qui ne charge pas. Peux-tu me dire pourquoi celle-ci ne charge pas et comment régler ça ?

                            [12:23:35] [Client thread/ERROR] [FML]: Exception loading model for variant adamantium:BlockLumineux#visible=false for blockstate “adamantium:BlockLumineux[visible=false]”
                            net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model adamantium:BlockLumineux#visible=false with loader VariantLoader.INSTANCE, skipping
                            at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]
                            at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:241) ~[ModelLoader.class:?]
                            at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:145) ~[ModelBakery.class:?]
                            at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:229) ~[ModelLoader.class:?]
                            at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:146) ~[ModelLoader.class:?]
                            at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
                            at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:132) [SimpleReloadableResourceManager.class:?]
                            at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:113) [SimpleReloadableResourceManager.class:?]
                            at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:799) [Minecraft.class:?]
                            at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:338) [FMLClientHandler.class:?]
                            at net.minecraft.client.Minecraft.startGame(Minecraft.java:561) [Minecraft.class:?]
                            at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?]
                            at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]
                            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]
                            at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
                            at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]
                            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]
                            at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
                            at GradleStart.main(GradleStart.java:26) [start/:?]
                            Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException
                            at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?]
                            at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1183) ~[ModelLoader$VariantLoader.class:?]
                            at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
                            … 24 more

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

                              Le truc est que tu as te states différents qui ne sont pas spécifiés dans ton fichier json de blockstates, il faut que tu mettes une ligne pour visible=false et une pour visible=true. (On peut aussi ignorer le state au rendu mais je n’ai pas le code sous la main)

                              Envoyé via mobile

                              Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                              AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                              Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                              Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                                En gros comme a dit Aymeric il faut que ton JSON ressemble à ça :

                                
                                {
                                "variants": {
                                "visible=true": {
                                "model": "modid:tonModel"
                                },
                                "visible=false": {
                                "model": "modid:tonModel"
                                }
                                }
                                }
                                
                                

                                Je ne crois pas m’être trompé, je n’ai pas vérifié mais ça devrait aller

                                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

                                  Ou alors il faut lui indiquer d’ignorer l’état de bloc visible. Il y a une fonction pour ça mais je ne me souvient pas de son nom.

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

                                    Je crois que c’est ModelLoader.setCustomStateMapper(Block, IStateMapper)

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

                                      @‘BrokenSwing’:

                                      Je crois que c’est ModelLoader.setCustomStateMapper(Block, IStateMapper)

                                      Du coup je fais comme vous pouvez m’expliquer ? par ce que le blockstate je vois pas comment faire du coup ?

                                      parce que pour le visible=false ça marche comment ?

                                      {
                                            “variants”: {
                                                   “visible=true”: {
                                                          “model”: “adamantium:BlockLumineux”
                                                   },
                                                   “visible=false”: {
                                                          “model”: “???”
                                                   }
                                             }
                                      }

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

                                        Tu met un bloc avec une texture transparente

                                        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

                                          Normalement la fonction getRenderType permet déjà de ne plus rien rendre si le return est EnumBlockRenderType.INVISIBLE.

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

                                            @‘BrokenSwing’:

                                            Tu met un bloc avec une texture transparente

                                            ça ne marche toujours pas même si je remplace par un block qui est invisible, ça reste la même chose

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

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB