MFF

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

    Bloc Orientable (TileEntity)

    Planifier Épinglé Verrouillé Déplacé Résolu 1.8.x
    1.8
    71 Messages 6 Publieurs 15.6k 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.
    • EryahE Hors-ligne
      Eryah
      dernière édition par

      Euh… Je ne vois aps du tout de quoi tu veut parler par :
      [size=x-smallRé-écris la fonction onBlockPlaced et rajoutes ceci dedans :]
      ~~[size=x-smallRé-écris la fonction getStateFromMeta si tu veux utiliser les metadatas pour orienter ton block]
      ~~[size=x-smallRé-écris la fonction createBlockState]
      [size=small~~J’ai peut-etre , dans ma puissance naturelle, mal codé mon bloc donc , voici ma classe  ~~   C’EST BON J’AI COMPRIS]

      package eryah.usefulthings.blocks;
      
      import javax.swing.Icon;
      
      import net.minecraft.block.Block;
      import net.minecraft.block.BlockDirectional;
      import net.minecraft.block.material.Material;
      import net.minecraft.client.Minecraft;
      import net.minecraft.client.resources.model.ModelResourceLocation;
      import net.minecraft.entity.EntityLivingBase;
      import net.minecraft.item.Item;
      import net.minecraft.item.ItemStack;
      import net.minecraft.util.EnumFacing;
      import net.minecraft.util.MathHelper;
      import net.minecraft.world.World;
      import net.minecraftforge.fml.common.registry.GameRegistry;
      import net.minecraftforge.fml.relauncher.Side;
      import net.minecraftforge.fml.relauncher.SideOnly;
      import eryah.usefulthings.Reference;
      import eryah.usefulthings.UsefulthingsMod;
      
      public class PlateCrafter extends BlockDirectional {
      
      public static Block platecrafter; {
      this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
      
      }
      
      public static void init()
      {
      platecrafter = new ResinLog(Material.wood).setUnlocalizedName("platecrafter").setCreativeTab(UsefulthingsMod.UTTab);
      }
      
      protected PlateCrafter(Material materialIn) {
      super(materialIn);
      // TODO Auto-generated constructor stub
      }
      
      public static void register()
      {
      GameRegistry.registerBlock(platecrafter, platecrafter.getUnlocalizedName().substring(5));
      }
      
      public static void registerRenders()
      {
      registerRender(platecrafter);
      }
      
      public static void registerRender(Block block)
      {
      Item item = Item.getItemFromBlock(block);
      Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
      }
      
      }
      
      ```~~~~

      Membre fantôme
      Je développe maintenant un jeu sur UnrealEngine4


      Contact :…

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

        Quel est ce morceau de code tout seul au milieu de nulle part ?

        
        public static Block platecrafter; {
        this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
        
        }
        

        Il faut le mettre dans le constructeur et il te manque toutes les méthodes que j’ai cité précédemment.

        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
        • EryahE Hors-ligne
          Eryah
          dernière édition par

          Une erreur sur

          @Override
          public IBlockState getStateFromMeta(int meta) {
          return ((EnumFacing)blockState.getValue(FACING)).getHorizontalIndex();
          
          }
          

          ((EnumFacing)blockState.getValue(FACING)).getHorizontalIndex();
               *Multiple markers at this line
          *

            • Type mismatch: cannot convert from int to *
              IBlockState
              Il me propose de ajouter ‘int’ et après, y’a un erreur sur int, enfin… plein d’erreurs qui forment un boucle

          Membre fantôme
          Je développe maintenant un jeu sur UnrealEngine4


          Contact :…

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

            @‘SCAREX’:

            Quel est ce morceau de code tout seul au milieu de nulle part ?

            
            public static Block platecrafter; {
                   this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
                   
               }
            

            Il faut le mettre dans le constructeur et il te manque toutes les méthodes que j’ai cité précédemment.

            Dès que je l’enlève, il y a des erreurs partout, je dirait 1 toutes les 4 lignes

            Et je n’avais pas compris comment ajouter les méthodes quand j’ai posté le message

            Membre fantôme
            Je développe maintenant un jeu sur UnrealEngine4


            Contact :…

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

              Regarde la classe de la pumpkin, car là j’en peux plus…

              this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
              

              CECI VA DANS LE CONSTRUCTEUR ! Si tu ne sait pas ce qu’est un constructeur : OpenClassrooms

              Pour les autres lignes de code, voici le code à rajouter :

              
              public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
              {
              return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
              }
              
              public IBlockState getStateFromMeta(int meta)
              {
              return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta));
              }
              
              public int getMetaFromState(IBlockState state)
              {
              return ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();
              }
              
              protected BlockState createBlockState()
              {
              return new BlockState(this, new IProperty[] {FACING});
              }
              
              

              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
              • EryahE Hors-ligne
                Eryah
                dernière édition par

                Implicit super constructor BlockDirectional() is undefined. Must explicitly invoke another constructor
                quand je mets le curseur sur

                public static PlateCrafter() {
                this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
                }
                

                PlateCrafter()

                Ce que j’avais avant était un constructeur, mais il avait (je ne sais aps pourquoi, mauvais copier coller de ma part ( oui je fais les blocs comme ça )) ‘Block’ en trop

                Membre fantôme
                Je développe maintenant un jeu sur UnrealEngine4


                Contact :…

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

                  le constructeur ne devrait pas être statique. Quel est ton code en ce moment ?

                  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
                  • EryahE Hors-ligne
                    Eryah
                    dernière édition par

                    package eryah.usefulthings.blocks;
                    
                    import net.minecraft.block.Block;
                    import net.minecraft.block.BlockDirectional;
                    import net.minecraft.block.material.Material;
                    import net.minecraft.block.properties.IProperty;
                    import net.minecraft.block.state.BlockState;
                    import net.minecraft.block.state.IBlockState;
                    import net.minecraft.client.Minecraft;
                    import net.minecraft.client.resources.model.ModelResourceLocation;
                    import net.minecraft.entity.EntityLivingBase;
                    import net.minecraft.item.Item;
                    import net.minecraft.util.BlockPos;
                    import net.minecraft.util.EnumFacing;
                    import net.minecraft.world.World;
                    import net.minecraftforge.fml.common.registry.GameRegistry;
                    import eryah.usefulthings.Reference;
                    import eryah.usefulthings.UsefulthingsMod;
                    
                    public class PlateCrafter extends BlockDirectional {
                    
                    public static Block platecrafter; {
                       }
                    
                    public PlateCrafter() {
                    this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
                    }
                    
                       public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
                       {
                           return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
                       }
                    
                       public IBlockState getStateFromMeta(int meta)
                       {
                           return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta));
                       }
                    
                       public int getMetaFromState(IBlockState state)
                       {
                           return ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();
                       }
                    
                       protected BlockState createBlockState()
                       {
                           return new BlockState(this, new IProperty[] {FACING});
                       }
                    
                    public static void init()
                    {
                    platecrafter = new ResinLog(Material.wood).setUnlocalizedName("platecrafter").setCreativeTab(UsefulthingsMod.UTTab);
                    }
                    
                    protected PlateCrafter(Material materialIn) {
                    super(materialIn);
                    // TODO Auto-generated constructor stub
                    }
                    
                    public static void register()
                    {
                    GameRegistry.registerBlock(platecrafter, platecrafter.getUnlocalizedName().substring(5));
                    }
                    
                    public static void registerRenders()
                    {
                    registerRender(platecrafter);
                    }
                    
                    public static void registerRender(Block block)
                    {
                    Item item = Item.getItemFromBlock(block);
                    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
                    }
                    
                    }
                    
                    

                    C’était un mauvais copier coller, dans mon tout premier bloc, le constructeur est présent ( y’a rien dedans, mais il est la )

                    Membre fantôme
                    Je développe maintenant un jeu sur UnrealEngine4


                    Contact :…

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

                      Ces crochets ne servent à rien :

                      public static Block platecrafter; {
                      }
                      

                      Ton sujet est résolu ?

                      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
                      • EryahE Hors-ligne
                        Eryah
                        dernière édition par

                        Y’a toujours la même erreur
                        Multiple markers at this line

                        • Illegal modifier for the constructor in type PlateCrafter; only public, protected & private are 
                          permitted ( Pourtant c’est bien public PlateCrafter() )
                        • Implicit super constructor BlockDirectional() is undefined. Must explicitly invoke another 
                          constructor
                          Sur Platecrafter()

                        Membre fantôme
                        Je développe maintenant un jeu sur UnrealEngine4


                        Contact :…

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

                          Tu as 2 constructeurs

                          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
                          • EryahE Hors-ligne
                            Eryah
                            dernière édition par

                            Si j’en est 2, je ne voit aps le 2e

                            package eryah.usefulthings.blocks;
                            
                            import net.minecraft.block.Block;
                            import net.minecraft.block.BlockDirectional;
                            import net.minecraft.block.material.Material;
                            import net.minecraft.block.properties.IProperty;
                            import net.minecraft.block.state.BlockState;
                            import net.minecraft.block.state.IBlockState;
                            import net.minecraft.client.Minecraft;
                            import net.minecraft.client.resources.model.ModelResourceLocation;
                            import net.minecraft.entity.EntityLivingBase;
                            import net.minecraft.item.Item;
                            import net.minecraft.util.BlockPos;
                            import net.minecraft.util.EnumFacing;
                            import net.minecraft.world.World;
                            import net.minecraftforge.fml.common.registry.GameRegistry;
                            import eryah.usefulthings.Reference;
                            import eryah.usefulthings.UsefulthingsMod;
                            
                            public class PlateCrafter extends BlockDirectional {
                            
                            public static Block platecrafter;
                            
                            public PlateCrafter() {
                            this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
                            }
                            
                               public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
                               {
                                   return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
                               }
                            
                               public IBlockState getStateFromMeta(int meta)
                               {
                                   return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta));
                               }
                            
                               public int getMetaFromState(IBlockState state)
                               {
                                   return ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();
                               }
                            
                               protected BlockState createBlockState()
                               {
                                   return new BlockState(this, new IProperty[] {FACING});
                               }
                            
                            public static void init()
                            {
                            platecrafter = new ResinLog(Material.wood).setUnlocalizedName("platecrafter").setCreativeTab(UsefulthingsMod.UTTab);
                            }
                            
                            public static void register()
                            {
                            GameRegistry.registerBlock(platecrafter, platecrafter.getUnlocalizedName().substring(5));
                            }
                            
                            public static void registerRenders()
                            {
                            registerRender(platecrafter);
                            }
                            
                            public static void registerRender(Block block)
                            {
                            Item item = Item.getItemFromBlock(block);
                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
                            }
                            
                            }
                            
                            

                            Membre fantôme
                            Je développe maintenant un jeu sur UnrealEngine4


                            Contact :…

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

                              Tu as supprimé le 2ème dans ce dernier code.

                              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
                              • EryahE Hors-ligne
                                Eryah
                                dernière édition par

                                Oui, mais j’ai toujours le problème
                                ( Mais pas tout à fait le même… Je l’avais au tout debut *Implicit super constructor BlockDirectional() is undefined. Must explicitly invoke another constructor *)

                                Membre fantôme
                                Je développe maintenant un jeu sur UnrealEngine4


                                Contact :…

                                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

                                  Car ça devrait être :

                                      public PlateCrafter(Material material)
                                  {
                                  super(material);
                                          this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
                                  }
                                  

                                  Sérieusement apprend le java sinon tu vas mouliner encore longtemps ….

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

                                    J apprend… J apprend. Ce mod me sert à apprendre. Je touche un peu à tout grâce à ce mod. Quand je voudrait faire un truc précis dans un sujet précis, je saurais déjà le faire. Maintenant, si j’ai cette erreur plus tard je saurais que ceci est l’à solution

                                    Envoyé de mon SM-G357FZ en utilisant Tapatalk

                                    Membre fantôme
                                    Je développe maintenant un jeu sur UnrealEngine4


                                    Contact :…

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

                                      Erreur, le model de mon bloc disparait
                                      dans les logs il y a marqué :
                                      [09:31:35] [Client thread/ERROR] [FML]: Model definition for location ut:platecrafter#facing=east not found
                                      [09:31:35] [Client thread/ERROR] [FML]: Model definition for location ut:platecrafter#facing=south not found
                                      [09:31:35] [Client thread/ERROR] [FML]: Model definition for location ut:platecrafter#facing=north not found
                                      [09:31:35] [Client thread/ERROR] [FML]: Model definition for location ut:platecrafter#facing=west not found

                                      Membre fantôme
                                      Je développe maintenant un jeu sur UnrealEngine4


                                      Contact :…

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

                                        Dans ton .json, il faut que tu rajoutes un model pour chaque orientation.

                                        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
                                        • EryahE Hors-ligne
                                          Eryah
                                          dernière édition par

                                          Pfioouuu… Sérieusement ? 
                                          Comment je fait ça ?
                                          Je les empile ?
                                          Comment le jeu va savoir la quelle est pour quelle orientation ?
                                          La Pumpkin ou le four , ils ont pas ça dans leur .json !

                                          Membre fantôme
                                          Je développe maintenant un jeu sur UnrealEngine4


                                          Contact :…

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

                                            Si :

                                            {
                                            "parent": "block/orientable", // C'est ici qu'il faut regarder !
                                            "textures": {
                                            "top": "blocks/pumpkin_top",
                                            "front": "blocks/pumpkin_face_off",
                                            "side": "blocks/pumpkin_side"
                                            }
                                            }
                                            
                                            

                                            Oh tiens, un fichier JSON tout fait pour les développeurs (orientable.json):

                                            {
                                            "parent": "block/cube",
                                            "textures": {
                                            "particle": "#front",
                                            "down": "#top",
                                            "up": "#top",
                                            "north": "#front",
                                            "east": "#side",
                                            "south": "#side",
                                            "west": "#side"
                                            }
                                            }
                                            
                                            

                                            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
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 4 / 4
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB