MFF

    Minecraft Forge France
    • Récent
    • Populaire
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    Problème de texture

    Planifié Épinglé Verrouillé Déplacé Résolu 1.8.x
    1.8
    12 Messages 5 Publieurs 2.6k Vues 1 Abonné
    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.
    • G Hors-ligne
      Gregouzy
      dernière édition par

      Bonjour, j’essaye actuellement de créer un bloc qui fonctionnerai comme le bloc de canne à sucre. J’ai donc récupéré le code existant de la canne à sucre. Mais lors du lancement du jeu j’ai quelques erreurs :

      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=3 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=15 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=2 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=1 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=0 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=11 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=12 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=13 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=14 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=10 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=9 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=8 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=7 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=6 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=5 not found
      [19:03:23] [Client thread/ERROR] [FML]: Model definition for location scmod:bamboo_plant#age=4 not found
      

      Je pense que ça vient des différentes state qui varient en fonction de l’age mais je ne vois pas comment régler ce problème…

      Merci d’avance pour vos réponses.

      1 réponse Dernière réponse Répondre Citer 0
      • DiabolicaTrixD Hors-ligne
        DiabolicaTrix Correcteurs Moddeurs confirmés
        dernière édition par

        Envoie ton code pour voir 😉

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

          Comme je l’ai dit, c’est principalement le code du BlockReed existant dans le jeu, j’ai juste modifié quelques trucs.

          ​package fr.scrollcraft.scmod.block;
          
          import java.util.Iterator;
          import java.util.Random;
          
          import net.minecraft.block.Block;
          import net.minecraft.block.material.Material;
          import net.minecraft.block.properties.IProperty;
          import net.minecraft.block.properties.PropertyInteger;
          import net.minecraft.block.state.BlockState;
          import net.minecraft.block.state.IBlockState;
          import net.minecraft.creativetab.CreativeTabs;
          import net.minecraft.init.Blocks;
          import net.minecraft.init.Items;
          import net.minecraft.item.Item;
          import net.minecraft.util.AxisAlignedBB;
          import net.minecraft.util.BlockPos;
          import net.minecraft.util.EnumFacing;
          import net.minecraft.util.EnumWorldBlockLayer;
          import net.minecraft.world.IBlockAccess;
          import net.minecraft.world.World;
          import net.minecraftforge.fml.relauncher.Side;
          import net.minecraftforge.fml.relauncher.SideOnly;
          
          public class BambooPlant extends Block implements net.minecraftforge.common.IPlantable
          {
              public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15);
              private static final String __OBFID = "CL_00000300";
          
              public BambooPlant()
              {
                  super(Material.plants);
                  this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0)));
                  float f = 0.375F;
                  this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
                  this.setTickRandomly(true);
                  this.setUnlocalizedName("bamboo_plant");
                  this.setHardness(0.0F);
                  this.setStepSound(soundTypeGrass);
                  this.setCreativeTab(CreativeTabs.tabBlock);
                  this.disableStats();
              }
          
              public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
              {
                  if (worldIn.getBlockState(pos.down()).getBlock() == Blocks.reeds || this.checkForDrop(worldIn, pos, state))
                  {
                      if (worldIn.isAirBlock(pos.up()))
                      {
                          int i;
          
                          for (i = 1; worldIn.getBlockState(pos.down(i)).getBlock() == this; ++i)
                          {
                              ;
                          }
          
                          if (i < 3)
                          {
                              int j = ((Integer)state.getValue(AGE)).intValue();
          
                              if (j == 15)
                              {
                                  worldIn.setBlockState(pos.up(), this.getDefaultState());
                                  worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(0)), 4);
                              }
                              else
                              {
                                  worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(j + 1)), 4);
                              }
                          }
                      }
                  }
              }
          
              public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
              {
                  Block block = worldIn.getBlockState(pos.down()).getBlock();
                  if (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this)) return true;
          
                  if (block == this)
                  {
                      return true;
                  }
                  else if (block != Blocks.grass && block != Blocks.dirt && block != Blocks.sand)
                  {
                      return false;
                  }
                  else
                  {
                      Iterator iterator = EnumFacing.Plane.HORIZONTAL.iterator();
                      EnumFacing enumfacing;
          
                      if (!iterator.hasNext())
                      {
                          return false;
                      }
          
                      enumfacing = (EnumFacing)iterator.next();
          
                      return true;
                  }
              }
          
              /**
               * Called when a neighboring block changes.
               */
              public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
              {
                  this.checkForDrop(worldIn, pos, state);
              }
          
              protected final boolean checkForDrop(World worldIn, BlockPos p_176353_2_, IBlockState state)
              {
                  if (this.canBlockStay(worldIn, p_176353_2_))
                  {
                      return true;
                  }
                  else
                  {
                      this.dropBlockAsItem(worldIn, p_176353_2_, state, 0);
                      worldIn.setBlockToAir(p_176353_2_);
                      return false;
                  }
              }
          
              public boolean canBlockStay(World worldIn, BlockPos pos)
              {
                  return this.canPlaceBlockAt(worldIn, pos);
              }
          
              public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
              {
                  return null;
              }
          
              /**
               * Get the Item that this Block should drop when harvested.
               *  
               * @param fortune the level of the Fortune enchantment on the player's tool
               */
              public Item getItemDropped(IBlockState state, Random rand, int fortune)
              {
                  return Items.reeds;
              }
          
              public boolean isOpaqueCube()
              {
                  return false;
              }
          
              public boolean isFullCube()
              {
                  return false;
              }
          
              @SideOnly(Side.CLIENT)
              public Item getItem(World worldIn, BlockPos pos)
              {
                  return Items.reeds;
              }
          
              @SideOnly(Side.CLIENT)
              public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
              {
                  return worldIn.getBiomeGenForCoords(pos).getGrassColorAtPos(pos);
              }
          
              /**
               * Convert the given metadata into a BlockState for this Block
               */
              public IBlockState getStateFromMeta(int meta)
              {
                  return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta));
              }
          
              @SideOnly(Side.CLIENT)
              public EnumWorldBlockLayer getBlockLayer()
              {
                  return EnumWorldBlockLayer.CUTOUT;
              }
          
              /**
               * Convert the BlockState into the correct metadata value
               */
              public int getMetaFromState(IBlockState state)
              {
                  return ((Integer)state.getValue(AGE)).intValue();
              }
          
              protected BlockState createBlockState()
              {
                  return new BlockState(this, new IProperty[] {AGE});
              }
          
              @Override
              public net.minecraftforge.common.EnumPlantType getPlantType(IBlockAccess world, BlockPos pos)
              {
                  return net.minecraftforge.common.EnumPlantType.Beach;
              }
              @Override
              public IBlockState getPlant(IBlockAccess world, BlockPos pos)
              {
                  return this.getDefaultState();
              }
          
          
          1 réponse Dernière réponse Répondre Citer 0
          • SCAREXS Hors-ligne
            SCAREX
            dernière édition par

            Envoi les blockstate surtout.

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

              Déjà, enlève le OBFID_, il ne sert à rien ^^

              Et le bug vient des fichiers de models qui ne sont pas trouvés, donne nous le code où tu enregistres les textures.

              PS: Je n’ai pas vu ton message SCAREX.

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

                Le blockstate :

                {
                  "variants": {
                      "normal": { "model": "scmod:bamboo_plant" }
                  }
                }
                

                L’enregistrement des textures :

                ​proxy.registerBlockTexture(bambooPlant, "bamboo_plant");
                

                Je précise que j’utilise forge depuis 1 semaine donc il se peut que l’erreur soit très conne… 😄

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

                  dans les variantes, il me semble qu’il faut mettre chaque métadata.

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

                    Une idée du nom qu’elles devraient avoir ?

                    J’ai testé avec age=0 , age=1, etc… à la place de “normal”, j’ai également testé avec 0, 1, 2, etc…

                    Aucun ne marche pour le moment…

                    1 réponse Dernière réponse Répondre Citer 0
                    • robin4002R En ligne
                      robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                      dernière édition par

                      {
                      "variants": {
                      "age=0": { "model": "scmod:bamboo_plant" },
                      "age=1": { "model": "scmod:bamboo_plant" },
                      "age=2": { "model": "scmod:bamboo_plant" }
                      }
                      }
                      

                      Pourtant c’est bien comme ça qu’il faut faire.

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

                        J’ai réessayé comme ça :

                        {
                         "variants": {
                             "age=0": { "model": "scmod:bamboo_plant" },
                             "age=1": { "model": "scmod:bamboo_plant" },
                             "age=2": { "model": "scmod:bamboo_plant" }
                        "age=3": { "model": "scmod:bamboo_plant" }
                             "age=4": { "model": "scmod:bamboo_plant" }
                             "age=5": { "model": "scmod:bamboo_plant" }
                             "age=6": { "model": "scmod:bamboo_plant" }
                             "age=7": { "model": "scmod:bamboo_plant" }
                             "age=8": { "model": "scmod:bamboo_plant" }
                             "age=9": { "model": "scmod:bamboo_plant" }
                             "age=10": { "model": "scmod:bamboo_plant" }
                             "age=11": { "model": "scmod:bamboo_plant" }
                             "age=12": { "model": "scmod:bamboo_plant" }
                             "age=13": { "model": "scmod:bamboo_plant" }
                             "age=14": { "model": "scmod:bamboo_plant" }
                             "age=15": { "model": "scmod:bamboo_plant" }
                         }
                        }
                        

                        La texture ne s’affiche toujours pas et j’ai quelques erreurs dans la console :

                        http://pastebin.com/mBFtpNN6

                        (Désolé pour le pastebin, mais le forum m’empêchait de poster un message trop long.)

                        1 réponse Dernière réponse Répondre Citer 0
                        • robin4002R En ligne
                          robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                          dernière édition par

                          Ton json est erroné. Il manque pleins de virgule. Toutes les lignes devrait en avoir une sauf la dernière.
                          http://jsonlint.com/

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

                            En effet, merci.

                            Tout marche bien maintenant, merci à vous !

                            1 réponse Dernière réponse Répondre Citer 0

                            Bonjour ! Vous semblez intéressé par cette conversation, mais vous n’avez pas encore de compte.

                            Marre de refaire défiler les mêmes messages ? Créez un compte pour retrouver votre position, recevoir des notifications des nouvelles réponses, sauvegarder vos favoris et voter pour les messages que vous appréciez.

                            Grâce à votre participation, ce message peut devenir encore meilleur 💗

                            S'inscrire Se connecter
                            • 1 / 1
                            • Premier message
                              Dernier message
                            Design by Woryk
                            ContactMentions Légales

                            MINECRAFT FORGE FRANCE © 2024

                            Powered by NodeBB