MFF

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

    Blocks de portail

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.x
    23 Messages 4 Publieurs 4.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.
    • DeletedD Hors-ligne
      Deleted
      dernière édition par

      @‘MrBlockTNT’:

      @Julot10085 : Je parle de la structure du portail et non des blocs nommés ‘portal’.

      @robin4002 : Je ne suis sûr que du code soit nécessaire c’est de la théorie.

      Je prenais le block portals comme exemple, dans ma tête je pensais au bloc constituant le portail tel que l’obsidienne désolé je suis allé trop vite. Mais enfin tu peux remplacer le block constituant le portail par te tien autrement c’est pas possible

      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

        Si justement j’ai besoin de tes codes pour voir ce que tu as fait et donc conclure pourquoi ça ne fonctionne pas avec un bloc custom …

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

          Apparemment il semble que ça marche avec des blocs (de mon mod) possédant une classe dédiée (type BlockGrass).

          L’erreur doit être dans cette classe (le système du drop est une expérience) :
          BlockDragonsMod.java :

          
          package fr.MrBlockTNT.Dragons.block;
          
          import java.util.Random;
          
          import net.minecraft.block.Block;
          import net.minecraft.block.material.Material;
          import net.minecraft.item.Item;
          import fr.MrBlockTNT.Dragons.core.Dragons;
          
          public class BlockDragonsMod extends Block
          {
          Block drop;
          
          public BlockDragonsMod(Material material)
          {
          super(material);
          drop = null;
          this.setCreativeTab(Dragons.DragonsTab);
          }
          
          public BlockDragonsMod(Block block, Material material)
          {
          super(material);
          drop = block;
          this.setCreativeTab(Dragons.DragonsTab);
          }
          
          public Item getItemDropped(int a, Random b, int c)
          {
          return Item.getItemFromBlock(this.drop);
          }
          }
          
          

          Mes mods:

          • New Ores
          • More Dragons
          1 réponse Dernière réponse Répondre Citer 0
          • DeletedD Hors-ligne
            Deleted
            dernière édition par

            @‘MrBlockTNT’:

            Apparemment il semble que ça marche avec des blocs (de mon mod) possédant une classe dédiée (type BlockGrass).

            L’erreur doit être dans cette classe (le système du drop est une expérience) :
            BlockDragonsMod.java :

            
            package fr.MrBlockTNT.Dragons.block;
            
            import java.util.Random;
            
            import net.minecraft.block.Block;
            import net.minecraft.block.material.Material;
            import net.minecraft.item.Item;
            import fr.MrBlockTNT.Dragons.core.Dragons;
            
            public class BlockDragonsMod extends Block
            {
            Block drop;
            
            public BlockDragonsMod(Material material)
            {
            super(material);
            drop = null;
            this.setCreativeTab(Dragons.DragonsTab);
            }
            
            public BlockDragonsMod(Block block, Material material)
            {
            super(material);
            drop = block;
            this.setCreativeTab(Dragons.DragonsTab);
            }
            
            public Item getItemDropped(int a, Random b, int c)
            {
            return Item.getItemFromBlock(this.drop);
            }
            }
            
            

            Euh essaie de mettre en commentaire ta ligne

            
            drop = null
            
            

            pour voir si ça change quelque chose

            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

              Je vois pas de problème en rapport avec ton histoire de portail.
              En revanche fait attention, celle classe peut déclencher un NPE …
              Normalement tu mets TaClassePrincipale.nomDuBloc et voila.

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

                Je pense pas étant donné que mon block “structure” possède les 2 arguments (logiquement, drop sera quand même null), mais je teste quand même.

                EDIT : C’est bien ce que je pensais ça ne marche pas.

                Mes mods:

                • New Ores
                • More Dragons
                1 réponse Dernière réponse Répondre Citer 0
                • DeletedD Hors-ligne
                  Deleted
                  dernière édition par

                  @‘MrBlockTNT’:

                  Je pense pas étant donné que mon block “structure” possède les 2 arguments (logiquement, drop sera quand même null), mais je teste quand même.

                  EDIT : C’est bien ce que je pensais ça ne marche pas.

                  Autant pour moi….

                  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 posté une réponse qui est resté inaperçu :
                    @‘robin4002’:

                    Je vois pas de problème en rapport avec ton histoire de portail.
                    En revanche fait attention, celle classe peut déclencher un NPE …
                    Normalement tu mets TaClassePrincipale.nomDuBloc et voila.

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

                      A désolé je n’avais pas vu.
                      Le rapport avec le portail c’est que c’est la classe du bloc ‘structure/container’ du portail.


                      Je ne comprends plus rien : avec deux classes différentes possédant le même code un bloc sur les deux marche… 😞

                      Mes mods:

                      • New Ores
                      • More Dragons
                      1 réponse Dernière réponse Répondre Citer 0
                      • DiangleD Hors-ligne
                        Diangle
                        dernière édition par

                        Je ne comprend pas ton problème xD.

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

                          Envoie tout tes codes en rapport avec le portail.

                          1 réponse Dernière réponse Répondre Citer 0
                          • bin4r1sB Hors-ligne
                            bin4r1s
                            dernière édition par robin4002

                            Classe principale (Dragons.java) :

                            fire_stone = (new BlockDragonsMod(this.fire_stone, Material.rock)).setHardness(20.0F).setResistance(2000.0F).setStepSound(Block.soundTypeStone).setBlockName("fire_stone").setBlockTextureName("dragons:fire_stone");
                            GameRegistry.registerBlock(fire_stone, "fire_stone");
                            

                            IDimBlockPortal.java (non, ce n’est pas une interface 😄 (I = Ice))

                            package fr.MrBlockTNT.Dragons.dimension.ice;
                            
                            import java.util.Random;
                            
                            import net.minecraft.block.Block;
                            import net.minecraft.block.material.Material;
                            import net.minecraft.entity.Entity;
                            import net.minecraft.entity.player.EntityPlayerMP;
                            import net.minecraft.init.Blocks;
                            import net.minecraft.item.ItemStack;
                            import net.minecraft.util.AxisAlignedBB;
                            import net.minecraft.util.MovingObjectPosition;
                            import net.minecraft.world.IBlockAccess;
                            import net.minecraft.world.World;
                            import cpw.mods.fml.relauncher.Side;
                            import cpw.mods.fml.relauncher.SideOnly;
                            import fr.MrBlockTNT.Dragons.block.BlockBase;
                            import fr.MrBlockTNT.Dragons.core.Dragons;
                            
                            public class IDimBlockPortal extends BlockBase
                            {
                                public static Block portalMaterial = Dragons.fire_stone;
                            
                                public IDimBlockPortal()
                                {
                                    super(Material.portal);
                                    this.setTickRandomly(true);
                                    this.setStepSound(Block.soundTypeGlass);
                                    this.setLightLevel(0.75F);
                                }
                            
                                @Override
                                public void setBlockBoundsBasedOnState(IBlockAccess blockaccess, int x, int y, int z)
                                {
                                    float f;
                                    float f1;
                            
                                    if(!blockaccess.getBlock(x - 1, y, z).equals(this) && !blockaccess.getBlock(x + 1, y, z).equals(this))
                                    {
                                        f = 0.125F;
                                        f1 = 0.5F;
                                        this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
                                    }
                                    else
                                    {
                                        f = 0.5F;
                                        f1 = 0.125F;
                                        this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
                                    }
                                }
                            
                                @Override
                                public void setBlockBoundsForItemRender()
                                {
                                    float f1 = 0.125F;
                                    this.setBlockBounds(0, 0.0F, 0.5F - f1, 1F, 1.0F, 0.5F + f1);
                                }
                            
                                @Override
                                public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
                                {
                                    return null;
                                }
                            
                            @Override
                            public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
                            {
                            int y2 = y;
                            while(world.getBlock(x, y2, z).equals(this))
                            {
                            y2–;
                            }
                            if(!world.getBlock(x, y2, z).equals(this.portalMaterial))
                            {
                            world.setBlockToAir(x, y, z);
                            }
                            int y3 = y2 + 1;
                            boolean portalIsGood = false;
                            if(world.getBlock(x, y3, z + 1).equals(this))
                            {
                            portalIsGood = (world.getBlock(x, y2, z).equals(this.portalMaterial) && world.getBlock(x, y2, z + 1).equals(this.portalMaterial) && world.getBlock(x, y2 + 1, z + 2).equals(this.portalMaterial) && world.getBlock(x, y2 + 2, z + 2).equals(this.portalMaterial) && world.getBlock(x, y2 + 3, z + 2).equals(this.portalMaterial) && world.getBlock(x, y2 + 1, z - 1).equals(this.portalMaterial) && world.getBlock(x, y2 + 2, z - 1).equals(this.portalMaterial) && world.getBlock(x, y2 + 3, z - 1).equals(this.portalMaterial) && world.getBlock(x, y2 + 4, z - 1).equals(this.portalMaterial) && world.getBlock(x, y2 + 4, z).equals(this.portalMaterial));
                            }
                            else if(world.getBlock(x, y3, z - 1).equals(this))
                            {
                            portalIsGood = (world.getBlock(x, y2, z).equals(this.portalMaterial) && world.getBlock(x, y2, z - 1).equals(this.portalMaterial) && world.getBlock(x, y2 + 1, z - 2).equals(this.portalMaterial) && world.getBlock(x, y2 + 2, z - 2).equals(this.portalMaterial) && world.getBlock(x, y2 + 3, z - 2).equals(this.portalMaterial) && world.getBlock(x, y2 + 1, z + 1).equals(this.portalMaterial) && world.getBlock(x, y2 + 2, z + 1).equals(this.portalMaterial) && world.getBlock(x, y2 + 3, z + 1).equals(this.portalMaterial) && world.getBlock(x, y2 + 4, z + 1).equals(this.portalMaterial) && world.getBlock(x, y2 + 4, z).equals(this.portalMaterial));
                            }
                            else if(world.getBlock(x + 1, y3, z).equals(this))
                            {
                            portalIsGood = (world.getBlock(x, y2, z).equals(this.portalMaterial) && world.getBlock(x + 1, y2, z).equals(this.portalMaterial) && world.getBlock(x + 2, y2 + 1, z).equals(this.portalMaterial) && world.getBlock(x + 2, y2 + 2, z).equals(this.portalMaterial) && world.getBlock(x + 2, y2 + 3, z).equals(this.portalMaterial) && world.getBlock(x - 1, y2 + 1, z).equals(this.portalMaterial) && world.getBlock(x - 1, y2 + 2, z).equals(this.portalMaterial) && world.getBlock(x - 1, y2 + 3, z).equals(this.portalMaterial) && world.getBlock(x + 1, y2 + 4, z).equals(this.portalMaterial) && world.getBlock(x, y2 + 4, z).equals(this.portalMaterial));
                            }
                            else if(world.getBlock(x - 1, y3, z).equals(this))
                            {
                            portalIsGood = (world.getBlock(x, y2, z).equals(this.portalMaterial) && world.getBlock(x - 1, y2, z).equals(this.portalMaterial) && world.getBlock(x - 2, y2 + 1, z).equals(this.portalMaterial) && world.getBlock(x - 2, y2 + 2, z).equals(this.portalMaterial) && world.getBlock(x - 2, y2 + 3, z).equals(this.portalMaterial) && world.getBlock(x + 1, y2 + 1, z).equals(this.portalMaterial) && world.getBlock(x + 1, y2 + 2, z).equals(this.portalMaterial) && world.getBlock(x + 1, y2 + 3, z).equals(this.portalMaterial) && world.getBlock(x + 1, y2 + 4, z).equals(this.portalMaterial) && world.getBlock(x, y2 + 4, z).equals(this.portalMaterial));
                            }
                            
                            if(!portalIsGood)
                            {
                            world.setBlockToAir(x, y, z);
                            }
                            }
                            
                                @Override
                                public boolean isOpaqueCube()
                                {
                                    return false;
                                }
                            
                                @Override
                                public boolean renderAsNormalBlock()
                                {
                                    return false;
                                }
                            
                                @Override
                                public int quantityDropped(Random random)
                                {
                                    return 0;
                                }
                            
                                @Override
                                public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
                                {
                                    if((entity.ridingEntity == null) && (entity.riddenByEntity == null))
                                    {
                                        if(entity.dimension != Dragons.dimensionIdIce)
                                        {
                                            if(entity instanceof EntityPlayerMP)
                                            {
                                                EntityPlayerMP player = (EntityPlayerMP)entity;
                                                if(player.timeUntilPortal > 0)
                                                {
                                                    player.timeUntilPortal = 10;
                                                }
                                                else
                                                {
                                                    player.timeUntilPortal = 10;
                                                    player.mcServer.getConfigurationManager().transferPlayerToDimension(player, Dragons.dimensionIdIce, new IDimTeleporter(player.mcServer.worldServerForDimension(Dragons.dimensionIdIce)));
                                                }
                                            }
                                            else
                                            {
                                                EntityTeleporter.teleportToDim(entity, Dragons.dimensionIdIce);
                                            }
                                        }
                                        else
                                        {
                                            if(entity instanceof EntityPlayerMP)
                                            {
                                                EntityPlayerMP player = (EntityPlayerMP)entity;
                                                if(player.timeUntilPortal > 0)
                                                {
                                                    player.timeUntilPortal = 10;
                                                }
                                                else
                                                {
                                                    player.timeUntilPortal = 10;
                                                    player.mcServer.getConfigurationManager().transferPlayerToDimension(player, 0, new IDimTeleporter(player.mcServer.worldServerForDimension(0)));
                                                }
                                            }
                                            else
                                            {
                                                EntityTeleporter.teleportToDim(entity, 0);
                                            }
                                        }
                                    }
                            
                                }
                            
                                @SideOnly(Side.CLIENT)
                                @Override
                                public int getRenderBlockPass()
                                {
                                    return 1;
                                }
                            
                                @SideOnly(Side.CLIENT)
                                @Override
                                public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
                                {
                                    return null;
                                }
                            
                                @Override
                                public void breakBlock(World world, int x, int y, int z, Block block, int metadata)
                                {
                                    super.breakBlock(world, x, y, z, block, metadata);
                                    if(world.getBlock(x, y + 1, z).equals(this))
                                    {
                                        world.setBlockToAir(x, y + 1, z);
                                    }
                                    if(world.getBlock(x, y - 1, z).equals(this))
                                    {
                                        world.setBlockToAir(x, y - 1, z);
                                    }
                                    if(world.getBlock(x + 1, y, z).equals(this))
                                    {
                                        world.setBlockToAir(x + 1, y, z);
                                    }
                                    if(world.getBlock(x - 1, y, z).equals(this))
                                    {
                                        world.setBlockToAir(x - 1, y, z);
                                    }
                                    if(world.getBlock(x, y, z + 1).equals(this))
                                    {
                                        world.setBlockToAir(x, y, z + 1);
                                    }
                                    if(world.getBlock(x, y, z - 1).equals(this))
                                    {
                                        world.setBlockToAir(x, y, z - 1);
                                    }
                                }
                            }
                            

                            Mes mods:

                            • New Ores
                            • More Dragons
                            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 ? Je ne vois pas où est le problème, ça devrait très bien fonctionner non ?

                              1 réponse Dernière réponse Répondre Citer 0
                              • bin4r1sB Hors-ligne
                                bin4r1s
                                dernière édition par robin4002

                                Et bien apparemment non 😞

                                Code de l’activateur ? :
                                ItemIcePortalOpener.java :

                                package fr.MrBlockTNT.Dragons.item;
                                
                                import net.minecraft.entity.player.EntityPlayer;
                                import net.minecraft.item.Item;
                                import net.minecraft.item.ItemStack;
                                import net.minecraft.world.World;
                                import fr.MrBlockTNT.Dragons.core.Dragons;
                                import fr.MrBlockTNT.Dragons.dimension.ice.IDimBlockPortal;
                                
                                public class ItemIcePortalOpener extends Item
                                {
                                    public ItemIcePortalOpener()
                                    {
                                        super();
                                    }
                                
                                    public boolean onItemUse(ItemStack stack, EntityPlayer player, World par3World, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
                                    {
                                        if(!par3World.isRemote && par3World.getBlock(x, y, z).equals(IDimBlockPortal.portalMaterial))
                                        {
                                            if(par3World.getBlock(x, y, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x - 1, y, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x - 2, y + 1, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x - 2, y + 2, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x - 2, y + 3, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x + 1, y + 1, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x + 1, y + 2, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x + 1, y + 3, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x - 1, y + 4, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 4, z).equals(IDimBlockPortal.portalMaterial))
                                            {
                                                for(int i = 0; i < 3; i++)
                                                {
                                                    par3World.setBlock(x, y + 1 + i, z, Dragons.ice_portal);
                                                    par3World.setBlock(x - 1, y + 1 + i, z, Dragons.ice_portal);
                                                }
                                                if(!player.capabilities.isCreativeMode)
                                                {
                                                    stack.stackSize–;
                                                }
                                                return true;
                                            }
                                
                                            if(par3World.getBlock(x, y, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x + 1, y, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x + 2, y + 1, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x + 2, y + 2, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x + 2, y + 3, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x - 1, y + 1, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x - 1, y + 2, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x - 1, y + 3, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x + 1, y + 4, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 4, z).equals(IDimBlockPortal.portalMaterial))
                                            {
                                                for(int i = 0; i < 3; i++)
                                                {
                                                    par3World.setBlock(x, y + 1 + i, z, Dragons.ice_portal);
                                                    par3World.setBlock(x + 1, y + 1 + i, z, Dragons.ice_portal);
                                                }
                                                if(!player.capabilities.isCreativeMode)
                                                {
                                                    stack.stackSize--;
                                                }
                                                return true;
                                            }
                                
                                            if(par3World.getBlock(x, y, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y, z - 1).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 1, z - 2).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 2, z - 2).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 3, z - 2).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 1, z + 1).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 2, z + 1).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 3, z + 1).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 4, z - 1).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 4, z).equals(IDimBlockPortal.portalMaterial))
                                            {
                                                for(int i = 0; i < 3; i++)
                                                {
                                                    par3World.setBlock(x, y + 1 + i, z, Dragons.ice_portal);
                                                    par3World.setBlock(x, y + 1 + i, z - 1, Dragons.ice_portal);
                                                }
                                                if(!player.capabilities.isCreativeMode)
                                                {
                                                    stack.stackSize--;
                                                }
                                                return true;
                                            }
                                
                                            if(par3World.getBlock(x, y, z).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y, z + 1).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 1, z + 2).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 2, z + 2).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 3, z + 2).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 1, z - 1).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 2, z - 1).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 3, z - 1).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 4, z + 1).equals(IDimBlockPortal.portalMaterial) && par3World.getBlock(x, y + 4, z).equals(IDimBlockPortal.portalMaterial))
                                            {
                                                for(int i = 0; i < 3; i++)
                                                {
                                                    par3World.setBlock(x, y + 1 + i, z, Dragons.ice_portal);
                                                    par3World.setBlock(x, y + 1 + i, z + 1, Dragons.ice_portal);
                                                }
                                                if(!player.capabilities.isCreativeMode)
                                                {
                                                    stack.stackSize--;
                                                }
                                                return true;
                                            }
                                        }
                                        if(par3World.isRemote)
                                        {
                                            par3World.spawnParticle("largesmoke", x, y, z, hitX, hitY, hitZ);
                                        }
                                        return false;
                                    }
                                }
                                

                                Mes mods:

                                • New Ores
                                • More Dragons
                                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

                                  Dans le constructeur de la classe IDimBlockPortal, ajoutes :
                                  System.out.println(portalMaterial.getUnlocalizedName());

                                  ça t’affiche son nom dans la console ou le jeu crash avec un NPE ?

                                  1 réponse Dernière réponse Répondre Citer 0
                                  • bin4r1sB Hors-ligne
                                    bin4r1s
                                    dernière édition par robin4002

                                    Ah ! NPE !

                                    Comment le solutionner ?

                                    [12:26:01] [Client thread/ERROR] [FML]: Caught exception from Dragons
                                    java.lang.NullPointerException
                                    at fr.MrBlockTNT.Dragons.dimension.ice.IDimBlockPortal.<init>(IDimBlockPortal.java:30) ~[IDimBlockPortal.class:?]
                                    at fr.MrBlockTNT.Dragons.core.Dragons.PreInit(Dragons.java:137) ~[Dragons.class:?]
                                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]
                                    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
                                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
                                    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
                                    at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[FMLModContainer.class:?]
                                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]
                                    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
                                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
                                    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
                                    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) ~[guava-15.0.jar:?]
                                    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) ~[guava-15.0.jar:?]
                                    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) ~[guava-15.0.jar:?]
                                    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) ~[guava-15.0.jar:?]
                                    at com.google.common.eventbus.EventBus.post(EventBus.java:267) ~[guava-15.0.jar:?]
                                    at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[LoadController.class:?]
                                    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[LoadController.class:?]
                                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]
                                    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
                                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
                                    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
                                    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) ~[guava-15.0.jar:?]
                                    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) ~[guava-15.0.jar:?]
                                    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) ~[guava-15.0.jar:?]
                                    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) ~[guava-15.0.jar:?]
                                    at com.google.common.eventbus.EventBus.post(EventBus.java:267) ~[guava-15.0.jar:?]
                                    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]
                                    at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:512) [Loader.class:?]
                                    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) [FMLClientHandler.class:?]
                                    at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) [Minecraft.class:?]
                                    at net.minecraft.client.Minecraft.run(Minecraft.java:892) [Minecraft.class:?]
                                    at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
                                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]
                                    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
                                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
                                    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
                                    at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
                                    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
                                    –-- Minecraft Crash Report ----
                                    // Who set us up the TNT?
                                    
                                    Time: 30/08/14 12:26
                                    Description: Initializing game
                                    
                                    java.lang.NullPointerException: Initializing game
                                    at fr.MrBlockTNT.Dragons.dimension.ice.IDimBlockPortal.<init>(IDimBlockPortal.java:30)
                                    at fr.MrBlockTNT.Dragons.core.Dragons.PreInit(Dragons.java:137)
                                    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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)
                                    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.EventHandler.handleEvent(EventHandler.java:74)
                                    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)
                                    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
                                    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
                                    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
                                    at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
                                    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
                                    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.EventHandler.handleEvent(EventHandler.java:74)
                                    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)
                                    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
                                    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
                                    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
                                    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
                                    at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:512)
                                    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)
                                    at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)
                                    at net.minecraft.client.Minecraft.run(Minecraft.java:892)
                                    at net.minecraft.client.main.Main.main(Main.java:112)
                                    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:134)
                                    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                                    
                                    A detailed walkthrough of the error, its code path and all known details is as follows:
                                    ---------------------------------------------------------------------------------------
                                    
                                    -- Head --
                                    Stacktrace:
                                    at fr.MrBlockTNT.Dragons.dimension.ice.IDimBlockPortal.<init>(IDimBlockPortal.java:30)
                                    at fr.MrBlockTNT.Dragons.core.Dragons.PreInit(Dragons.java:137)
                                    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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)
                                    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.EventHandler.handleEvent(EventHandler.java:74)
                                    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)
                                    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
                                    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
                                    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
                                    at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
                                    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
                                    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.EventHandler.handleEvent(EventHandler.java:74)
                                    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)
                                    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
                                    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
                                    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
                                    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
                                    at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:512)
                                    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)
                                    at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)
                                    
                                    -- Initialization --
                                    Details:
                                    Stacktrace:
                                    at net.minecraft.client.Minecraft.run(Minecraft.java:892)
                                    at net.minecraft.client.main.Main.main(Main.java:112)
                                    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:134)
                                    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                                    
                                    -- System Details --
                                    Details:
                                    Minecraft Version: 1.7.2
                                    Operating System: Windows Vista (x86) version 6.0
                                    Java Version: 1.8.0_11, Oracle Corporation
                                    Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
                                    Memory: 789954048 bytes (753 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 MB)
                                    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
                                    AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
                                    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
                                    FML: MCP v9.03 FML v7.2.211.1121 Minecraft Forge 10.12.2.1121 4 mods loaded, 4 mods active
                                    mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
                                    FML{7.2.211.1121} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized
                                    Forge{10.12.2.1121} [Minecraft Forge] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized
                                    Dragons{1.0.0} [More Dungeons and Dragons - pre-alpha] (bin) Unloaded->Constructed->Errored
                                    Launched Version: 1.6
                                    LWJGL: 2.9.0
                                    OpenGL: GeForce 9300 GE/PCIe/SSE2/3DNOW! GL version 3.3.0, NVIDIA Corporation
                                    Is Modded: Definitely; Client brand changed to 'fml,forge'
                                    Type: Client (map_client.txt)
                                    Resource Packs: []
                                    Current Language: ~~ERROR~~ NullPointerException: null
                                    Profiler Position: N/A (disabled)
                                    Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
                                    Anisotropic Filtering: Off (1)
                                    #@!@# Game crashed! Crash report saved to: #@!@# C:\Minecraft\More Dragons 1.7.2\mod\forge\eclipse\.\crash-reports\crash-2014-08-30_12.26.01-client.txt
                                    Java HotSpot(TM) Client VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
                                    

                                    Mes mods:

                                    • New Ores
                                    • More Dragons
                                    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

                                      Bon voila, on a trouvé le problème, portalMaterial est null.
                                      Donc ça veut dire qu’au moment ou tu initialises ton bloc IDimBlockPortal, Dragons.fire_stone est null.
                                      La solution ? Il faut juste initialisé fire_stone avant IDimBlockPortal dans ta classe principale.
                                      Et voila.

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

                                        Ah merci :), je teste.

                                        EDIT: ça marche à la perfection, sujet résolu.

                                        Mes mods:

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

                                        MINECRAFT FORGE FRANCE © 2024

                                        Powered by NodeBB