MFF

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

    Customiser votre bloc

    Planifier Épinglé Verrouillé Déplacé Les blocs
    1.6.x
    69 Messages 17 Publieurs 24.0k Vues 3 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.
    • robin4002R Hors-ligne
      robin4002 Moddeurs confirmés Rédacteurs Administrateurs
      dernière édition par

      Ha oui normal :
      private Object iconDark;
      private Object iconGreen;
      ->
      private Icon iconDark;
      private Icon iconGreen;

      En passant, il faut aussi les enregistrer :

      public void registerIcons(IconRegister iconRegister)
      {
      iconDark = iconRegister.registerIcon("modid:led_dark");
      iconGreen = iconRegister.registerIcon("modid:led_green");
      }
      

      Et dans ton TileEntity :
      //this.readFromNBT(pkt.data);
      Enlève le // sinon ça ne marchera pas.

      Je te conseil également de faire un tour sur les tutoriels suivant :
      http://www.minecraftforgefrance.fr/showthread.php?tid=78
      http://www.minecraftforgefrance.fr/showthread.php?tid=106
      http://www.minecraftforgefrance.fr/showthread.php?tid=115 (surtout le cas “sur un bloc avec metadata”)
      Tu comprendra surement mieux les codes que je t’ai donné.

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

        Ok merci, plus aucune erreur(s) dans BlockLedVerte mais une dans TileEntityLedVerte
        justement la "this.readFromNBT(pkt.data); "
        /
        |
        ICI

        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

          Sur le data ?
          Tu as surement une veille mise à jour de forge, le field doit avoir un autre nom.
          Fait un ctrl + clic sur Packet132TileEntityData ça va ouvrir la classe, regarde la ligne 25, moi j’ai :
          public NBTTagCompound data;
          Sur ta version tu as surement autre chose, il faut que change en fonction de ce que tu as.

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

            Comment on fais pour afficher les lignes déjà ?


            J’ai sa moi

            package net.minecraft.network.packet;
            
            import java.io.DataInput;
            import java.io.DataOutput;
            import java.io.IOException;
            import net.minecraft.nbt.NBTTagCompound;
            
            public class Packet132TileEntityData extends Packet
            {
            /** The X position of the tile entity to update. */
            public int xPosition;
            
            /** The Y position of the tile entity to update. */
            public int yPosition;
            
            /** The Z position of the tile entity to update. */
            public int zPosition;
            
            /** The type of update to perform on the tile entity. */
            public int actionType;
            
            /** Custom parameter 1 passed to the tile entity on update. */
            public NBTTagCompound customParam1;
            
            public Packet132TileEntityData()
            {
            this.isChunkDataPacket = true;
            }
            
            public Packet132TileEntityData(int par1, int par2, int par3, int par4, NBTTagCompound par5NBTTagCompound)
            {
            this.isChunkDataPacket = true;
            this.xPosition = par1;
            this.yPosition = par2;
            this.zPosition = par3;
            this.actionType = par4;
            this.customParam1 = par5NBTTagCompound;
            }
            
            /**
            * Abstract. Reads the raw packet data from the data stream.
            */
            public void readPacketData(DataInput par1DataInput) throws IOException
            {
            this.xPosition = par1DataInput.readInt();
            this.yPosition = par1DataInput.readShort();
            this.zPosition = par1DataInput.readInt();
            this.actionType = par1DataInput.readByte();
            this.customParam1 = readNBTTagCompound(par1DataInput);
            }
            
            /**
            * Abstract. Writes the raw packet data to the data stream.
            */
            public void writePacketData(DataOutput par1DataOutput) throws IOException
            {
            par1DataOutput.writeInt(this.xPosition);
            par1DataOutput.writeShort(this.yPosition);
            par1DataOutput.writeInt(this.zPosition);
            par1DataOutput.writeByte((byte)this.actionType);
            writeNBTTagCompound(this.customParam1, par1DataOutput);
            }
            
            /**
            * Passes this Packet on to the NetHandler for processing.
            */
            public void processPacket(NetHandler par1NetHandler)
            {
            par1NetHandler.handleTileEntityData(this);
            }
            
            /**
            * Abstract. Return the size of the packet (not counting the header).
            */
            public int getPacketSize()
            {
            return 25;
            }
            }
            
            

            PS : Desolé mais la fonction Edit veut pas marcher.

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

              Il s’appelle customParam1
              Pour afficher les lignes, tu vas dans Windows, Preferences, General, Editor, Text Editor (sans dérouler, clic dessus), show line number

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

                C’est bon j’ai affiché les lignes mais maintenant, j’ai déclaré mon item:

                
                Block BlockLedVerte = new BlockLedVerte(2004).func_111022_d("assabody-mod:led_verte_off");
                GameRegistry.registerBlock(BlockLedVerte, "BlockLedVerte");
                LanguageRegistry.addName(BlockLedVerte, "BlockLedVerte");
                
                
                
                public static Block BlockLedVerte;
                
                

                Ainsi que la TileEntity :

                GameRegistry.registerTileEntity(TileEntityLedVerte.class,"tileEntityLedVerte");
                
                

                Mais aucune des deux icones n’est affiché sur le block et avec un signal de redstone non plus.

                1 réponse Dernière réponse Répondre Citer 0
                • Superloup10S Hors-ligne
                  Superloup10 Modérateurs
                  dernière édition par

                  .func_111022_d(“assabody-mod:led_verte_off”) retire-ça et LanguageRegistry.addName(BlockLedVerte, “BlockLedVerte”); ça, c’est inutile et ta version de Forge est très ancienne.

                  Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                  Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                    forge1.6.2-9.10.0.804
                    La derniere version est la .871, je la prend sur http://files.minecraftforge.net/ ?

                    1 réponse Dernière réponse Répondre Citer 0
                    • Superloup10S Hors-ligne
                      Superloup10 Modérateurs
                      dernière édition par

                      Oui, mais prends plutôt minecraftforge-1.6.4-9.11.1.958

                      Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                      Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                        La 1.6.4, elle change beaucoup sur forge ?

                        1 réponse Dernière réponse Répondre Citer 0
                        • Superloup10S Hors-ligne
                          Superloup10 Modérateurs
                          dernière édition par

                          Juste un changement au niveau de la génération des structures, mais tu auras plus de chances de réussir à passer en 1.7.

                          Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                          Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                            Ok lol, bah je passe en 1.6.4 mais je sais pas si sa reglera le problème

                            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

                              public void updateEntity()
                              {
                              if(this.enable)
                              {
                              if(!this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord) || this.worldObj.getBlockPowerInput(this.xCoord, this.yCoord, this.zCoord) <= 8)
                              {
                              this.enable = false;
                              world.markBlockForUpdate(x, y, z);
                              }
                              }
                              else
                              {
                              if(this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord) && this.worldObj.getBlockPowerInput(this.xCoord, this.yCoord, this.zCoord) > 8)
                              {
                              this.enable = true;
                              world.markBlockForUpdate(x, y, z);
                              }
                              }
                              }
                              

                              Utilise plutôt ça, avec l’autre fonction que je t’ai donné ça envoyait pas un update du rendu.

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

                                Lol mon eclipse adore les erreurs, il m’en met sur world, x, y et z

                                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 non, c’est pas ton eclipse qui adore les erreurs, c’est moi qui t’envoie des codes que je tape directement sur le forum x)
                                  this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);

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

                                    Sa ne marche pas, le bloc ne change pas de texture. je ne sais pas pourquoi.
                                    BlockLedVerte:

                                    package Assabody.mod;
                                    
                                    import java.util.Random;
                                    
                                    import cpw.mods.fml.relauncher.Side;
                                    import cpw.mods.fml.relauncher.SideOnly;
                                    
                                    import net.minecraft.block.Block;
                                    import net.minecraft.block.material.Material;
                                    import net.minecraft.client.renderer.texture.IconRegister;
                                    import net.minecraft.creativetab.CreativeTabs;
                                    import net.minecraft.tileentity.TileEntity;
                                    import net.minecraft.util.Icon;
                                    import net.minecraft.world.IBlockAccess;
                                    import net.minecraft.world.World;
                                    
                                    public class BlockLedVerte extends Block{
                                    private Icon iconDark;
                                    private Icon iconGreen;
                                    
                                    public BlockLedVerte(int par1)
                                    {
                                    super(par1, Material.rock);
                                    this.setCreativeTab(ModAssabody.AssabodyCreativeTabs);
                                    }
                                    
                                    public void registerIcons(IconRegister iconRegister)
                                    {
                                    iconDark = iconRegister.registerIcon("mod-assabody:led_led_verte_on");
                                    iconGreen = iconRegister.registerIcon("mod-assabody:led_led_verte_off");
                                    }
                                    
                                    @Override
                                    public TileEntity createTileEntity(World world, int metadata)
                                    {
                                    return new TileEntityLedVerte();
                                    }
                                    
                                    @SideOnly(Side.CLIENT)
                                    public Icon getBlockTexture(IBlockAccess blockaccess, int x, int y, int z, int side)
                                    {
                                    TileEntity te = blockaccess.getBlockTileEntity(x, y, z);
                                    if(te != null && te instanceof TileEntityLedVerte)
                                    {
                                    TileEntityLedVerte tetuto = (TileEntityLedVerte)te;
                                    return tetuto.isEnable() ? this.iconGreen : this.iconDark;
                                    }
                                    return this.getIcon(side, blockaccess.getBlockMetadata(x, y, z));
                                    }
                                    public boolean hasTileEntity(int metadata)
                                    {
                                    return true;
                                    }
                                    
                                    public void onNeighborBlockChange(World world, int x, int y, int z, int neighborblockid, World par1World, int par2, int par3, int par4)
                                    {
                                    if(world.isBlockIndirectlyGettingPowered(x, y, z) && world.getBlockPowerInput(x, y, z) > 8)
                                    {
                                    }
                                    }
                                    
                                    public int idDropped(int par1, Random par2Random, int par3)
                                    {
                                    return this.blockID;
                                    }
                                    
                                    public boolean renderAsNormalBlock()
                                    {
                                    return true;
                                    }
                                    
                                    public boolean isOpaqueCube()
                                    {
                                    return false;
                                    }
                                    }
                                    
                                    

                                    TileEntityLedVerte:

                                    package Assabody.mod;
                                    
                                    import net.minecraft.nbt.NBTTagCompound;
                                    import net.minecraft.network.INetworkManager;
                                    import net.minecraft.network.packet.Packet;
                                    import net.minecraft.network.packet.Packet132TileEntityData;
                                    import net.minecraft.tileentity.TileEntity;
                                    
                                    public class TileEntityLedVerte extends TileEntity
                                    {
                                    private boolean enable;
                                    
                                    public void updateEntity()
                                    {
                                    if(this.enable)
                                    {
                                    if(!this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord) || this.worldObj.getBlockPowerInput(this.xCoord, this.yCoord, this.zCoord) <= 8)
                                    {
                                    this.enable = false;
                                    this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); }
                                    }
                                    else
                                    {
                                    if(this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord) && this.worldObj.getBlockPowerInput(this.xCoord, this.yCoord, this.zCoord) > 8)
                                    {
                                    this.enable = true;
                                    this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); }
                                    }
                                    }
                                    
                                    public boolean isEnable()
                                    {
                                    return enable;
                                    }
                                    
                                    public Packet getDescriptionPacket()
                                    {
                                    NBTTagCompound nbttagcompound = new NBTTagCompound();
                                    this.writeToNBT(nbttagcompound);
                                    return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 4, nbttagcompound);
                                    }
                                    
                                    public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
                                    {
                                    this.readFromNBT(pkt.customParam1);
                                    }
                                    public void readFromNBT(NBTTagCompound nbtTag)
                                    {
                                    super.readFromNBT(nbtTag);
                                    enable = nbtTag.getBoolean("enable");
                                    }
                                    
                                    public void writeToNBT(NBTTagCompound nbtTag)
                                    {
                                    super.writeToNBT(nbtTag);
                                    nbtTag.setBoolean("enable", enable);
                                    }
                                    }
                                    
                                    

                                    Déclaration dans la classe principale :

                                    Block BlockLedVerte = new BlockLedVerte(2004);
                                    GameRegistry.registerBlock(BlockLedVerte, "BlockLedVerte");
                                    
                                    
                                    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

                                      bloc :

                                      package tutoriel.common;
                                      
                                      import net.minecraft.block.Block;
                                      import net.minecraft.block.material.Material;
                                      import net.minecraft.client.renderer.texture.IconRegister;
                                      import net.minecraft.tileentity.TileEntity;
                                      import net.minecraft.util.Icon;
                                      import net.minecraft.world.IBlockAccess;
                                      import net.minecraft.world.World;
                                      import cpw.mods.fml.relauncher.Side;
                                      import cpw.mods.fml.relauncher.SideOnly;
                                      
                                      public class BlockLed extends Block
                                      {
                                      private Icon iconDark;
                                      private Icon iconGreen;
                                      
                                      public BlockLed(int id)
                                      {
                                      super(id, Material.rock);
                                      }
                                      
                                      public void registerIcons(IconRegister iconRegister)
                                      {
                                      iconDark = iconRegister.registerIcon("stone");
                                      iconGreen = iconRegister.registerIcon("glass");
                                      }
                                      
                                      @Override
                                      public TileEntity createTileEntity(World world, int metadata)
                                      {
                                      return new TileEntityLedVerte();
                                      }
                                      
                                      @SideOnly(Side.CLIENT)
                                      @Override
                                      public Icon getBlockTexture(IBlockAccess blockaccess, int x, int y, int z, int side)
                                      {
                                      TileEntity te = blockaccess.getBlockTileEntity(x, y, z);
                                      if(te != null && te instanceof TileEntityLedVerte)
                                      {
                                      TileEntityLedVerte tetuto = (TileEntityLedVerte)te;
                                      return tetuto.isEnable() ? this.iconGreen : this.iconDark;
                                      }
                                      return this.getIcon(side, blockaccess.getBlockMetadata(x, y, z));
                                      }
                                      
                                      public boolean hasTileEntity(int metadata)
                                      {
                                      return true;
                                      }
                                      
                                      @Override
                                      public void onNeighborBlockChange(World world, int x, int y, int z, int neighborblockid)
                                      {
                                      if(!world.isRemote)
                                      {
                                      TileEntity te = world.getBlockTileEntity(x, y, z);
                                      if( && te != null && te instanceof TileEntityLedVerte)
                                      {
                                      TileEntityLedVerte tetuto = (TileEntityLedVerte)te;
                                      if(world.getBlockPowerInput(x, y, z) > 8 || world.getBlockPowerInput(x, y + 1, z) > 8)
                                      {
                                      tetuto.setEnable(true);
                                      }
                                      else
                                      {
                                      tetuto.setEnable(false);
                                      }
                                      }
                                      }
                                      }
                                      }
                                      

                                      Tile entity :

                                      package tutoriel.common;
                                      
                                      import net.minecraft.nbt.NBTTagCompound;
                                      import net.minecraft.network.INetworkManager;
                                      import net.minecraft.network.packet.Packet;
                                      import net.minecraft.network.packet.Packet132TileEntityData;
                                      import net.minecraft.tileentity.TileEntity;
                                      
                                      public class TileEntityLedVerte extends TileEntity
                                      {
                                      private boolean enable;
                                      
                                      public void setEnable(boolean b)
                                      {
                                      enable = b;
                                      this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                                      }
                                      
                                      public boolean isEnable()
                                      {
                                      return enable;
                                      }
                                      
                                      public Packet getDescriptionPacket()
                                      {
                                      NBTTagCompound nbttagcompound = new NBTTagCompound();
                                      this.writeToNBT(nbttagcompound);
                                      return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 4, nbttagcompound);
                                      }
                                      
                                      public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
                                      {
                                      this.readFromNBT(pkt.customParam1);
                                      }
                                      
                                      public void readFromNBT(NBTTagCompound nbtTag)
                                      {
                                      super.readFromNBT(nbtTag);
                                      enable = nbtTag.getBoolean("enable");
                                      }
                                      
                                      public void writeToNBT(NBTTagCompound nbtTag)
                                      {
                                      super.writeToNBT(nbtTag);
                                      nbtTag.setBoolean("enable", enable);
                                      }
                                      }
                                      

                                      Cette fois si j’ai fais les tests, ça fonctionne.
                                      En revanche la fonction world.getBlockPowerInput(x, y, z) > 8 ne fonctionne que si tu as une poudre de redstone à côté, si tu mets une torche ça ne marchera pas.

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

                                        Ok merci beaucoup pour ton aide, je teste sa tout de suite___
                                        MERCI BEAUCOUP 😃
                                        Sa marche !
                                        Je vais enfin pouvoir finir ma salle de concert !!!

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

                                          Bonjour. est-ce qu’il y a une fonction pour empêcher que mon bloc puisse être poussé par un piston ? J’ai déjà regardé dans la class Block, et je n’ai rien trouvé. 😕

                                          1 réponse Dernière réponse Répondre Citer 0
                                          • Superloup10S Hors-ligne
                                            Superloup10 Modérateurs
                                            dernière édition par

                                            En regardant dans le code du piston, on trouve :

                                            private static boolean canPushBlock(int par0, World par1World, int par2, int par3, int par4, boolean par5)
                                            {
                                            if (par0 == Block.obsidian.blockID)
                                            {
                                            return false;
                                            }
                                            

                                            Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                                            Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB