Navigation

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Problème rendu ISBRH

    Sans suite
    4
    21
    4471
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • isador
      isador Moddeurs confirmés Modérateurs last edited by

      Bonjour voila j’ai un problème:

      j’ai suivie le tuto du forum pour les rendu ISBRH mais mon bloc est dorénavant invisible:

      normalement il y a des bloc avec une texture (en plus de ce avec la missing texture, cela fesai un quadrillage de 3x3)

      voici mes code:

      package Portal.Blocks;
      
      import java.util.Iterator;
      import java.util.List;
      import java.util.Random;
      
      import Portal.ClientProxy;
      import cpw.mods.fml.relauncher.Side;
      import cpw.mods.fml.relauncher.SideOnly;
      import net.minecraft.block.Block;
      import net.minecraft.block.BlockContainer;
      import net.minecraft.block.material.Material;
      import net.minecraft.creativetab.CreativeTabs;
      import net.minecraft.entity.Entity;
      import net.minecraft.tileentity.TileEntity;
      import net.minecraft.util.AxisAlignedBB;
      import net.minecraft.world.IBlockAccess;
      import net.minecraft.world.World;
      
      public class portalwowm extends Block {
      
      public portalwowm(int id)
      {
      super(id, Material.portal);
      this.setCreativeTab(CreativeTabs.tabBlock);
      
      }
      public boolean isOpaqueCube()
      {
      return false;
      }
      public boolean renderAsNormalBlock()
      {
      return false;
      }
      
      public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int x, int y, int z, int par5)
      {
      return this.getPowerSupply(par1IBlockAccess.getBlockMetadata(x, y, z));
      }
      
      public void breakBlock(World world, int x, int y, int z, int par5, int par6)
      {
      if(this.getPowerSupply(par6) > 0)
      {
      this.notifyChange(world, x, y, z);
      }
      
      super.breakBlock(world, x, y, z, par5, par6);
      }
      
      protected void notifyChange(World world, int x, int y, int z)
      {
      world.notifyBlocksOfNeighborChange(x, y, z, this.blockID);
      world.notifyBlocksOfNeighborChange(x, y - 1, z, this.blockID);
      }
      
      public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
      {
      if(!world.isRemote)
      {
      int l = this.getPowerSupply(world.getBlockMetadata(x, y, z));
      
      if(l == 0)
      {
      this.setStateIfMobInteractsWithPlate(world, x, y, z, l);
      }
      }
      }
      
      protected void setStateIfMobInteractsWithPlate(World world, int x, int y, int z, int par5)
      {
      int i1 = this.getPlateState(world, x, y, z);
      boolean flag = par5 > 0;
      boolean flag1 = i1 > 0;
      
      if(par5 != i1)
      {
      world.setBlockMetadataWithNotify(x, y, z, this.getMetaFromWeight(i1), 2);
      this.notifyChange(world, x, y, z);
      world.markBlockRangeForRenderUpdate(x, y, z, x, y, z);
      }
      
      if(!flag1 && flag)
      {
      world.playSoundEffect((double)x + 0.5D, (double)y + 0.1D, (double)z + 0.5D, "random.click", 0.3F, 0.5F);
      }
      else if(flag1 && !flag)
      {
      world.playSoundEffect((double)x + 0.5D, (double)y + 0.1D, (double)z + 0.5D, "random.click", 0.3F, 0.6F);
      }
      
      if(flag1)
      {
      world.scheduleBlockUpdate(x, y, z, this.blockID, this.tickRate(world));
      }
      }
      
      public void updateTick(World world, int x, int y, int z, Random rand)
      {
      if(!world.isRemote)
      {
      int l = this.getPowerSupply(world.getBlockMetadata(x, y, z));
      
      if(l > 0)
      {
      this.setStateIfMobInteractsWithPlate(world, x, y, z, l);
      }
      }
      }
      
      public int tickRate(World world)
      {
      return 20;
      }
      
      public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
      {
      return null;
      }
      
      protected int getPowerSupply(int metadata)
      {
      return metadata == 1 ? 15 : 0;
      }
      
      protected int getMetaFromWeight(int metadata)
      {
      return metadata > 0 ? 1 : 0;
      }
      
      protected int getPlateState(World world, int x, int y, int z)
      {
      List list = world.getEntitiesWithinAABBExcludingEntity((Entity)null, this.getSensitiveAABB(x, y, z));
      
      //List list = world.getEntitiesWithinAABB(EntityLivingBase.class, this.getSensitiveAABB(x, y, z));
      
      //List list = world.getEntitiesWithinAABB(EntityPlayer.class, this.getSensitiveAABB(x, y, z));
      
      if(list != null && !list.isEmpty())
      {
      Iterator iterator = list.iterator();
      
      while(iterator.hasNext())
      {
      Entity entity = (Entity)iterator.next();
      
      if(!entity.doesEntityNotTriggerPressurePlate())
      {
      return 15;
      }
      }
      }
      
      return 0;
      }
      
      protected AxisAlignedBB getSensitiveAABB(int x, int y, int z)
      {
      float f = 0.125F;
      return AxisAlignedBB.getAABBPool().getAABB((double)((float)x + f), (double)y, (double)((float)z + f), (double)((float)(x + 1) - f), (double)y + 0.25D, (double)((float)(z + 1) - f));
      }
      
      public int isProvidingStrongPower(IBlockAccess blockAccess, int x, int y, int z, int side)
      {
      return side == 1 ? this.getPowerSupply(blockAccess.getBlockMetadata(x, y, z)) : 0;
      }
      
      @SideOnly(Side.CLIENT)
      public int getRenderType()
      {
      
      return ClientProxy.renderTableId;
      }
      @SideOnly(Side.CLIENT)
      public boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side)
      {
      return true;
      }
      
      }
      
      
      package Portal;
      
      import cpw.mods.fml.client.registry.RenderingRegistry;
      
      public class ClientProxy extends CommonProxy{
      
      @Override
      public void registerRenderers(){
      
      //Ici les futurs registrys
      renderTableId = ((cpw.mods.fml.client.registry.RenderingRegistry) RenderingRegistry).getNextAvailableRenderId();
      ((cpw.mods.fml.client.registry.RenderingRegistry) RenderingRegistry).registerBlockHandler(new RenderTable());
      
      }
      public static int renderTableId;
      }
      
      
      package Portal;
      
      import org.lwjgl.opengl.GL11;
      
      import net.minecraft.block.Block;
      import net.minecraft.client.renderer.RenderBlocks;
      import net.minecraft.client.renderer.entity.Render;
      import net.minecraft.world.IBlockAccess;
      import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
      
      public class RenderTable implements ISimpleBlockRenderingHandler
      {
      
      @Override
      public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
      {
      }
      
      @Override
      public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
      {
      return true;
      }
      
      @Override
      public boolean shouldRender3DInInventory()
      {
      return false;
      }
      
      @Override
      public int getRenderId()
      {
      return ClientProxy.renderTableId;
      }
      }
      
      
      package Portal;
      
      import net.minecraft.block.Block;
      import cpw.mods.fml.client.registry.RenderingRegistry;
      import cpw.mods.fml.common.Mod;
      import cpw.mods.fml.common.Mod.EventHandler;
      import cpw.mods.fml.common.Mod.Instance;
      import cpw.mods.fml.common.SidedProxy;
      import cpw.mods.fml.common.event.FMLInitializationEvent;
      import cpw.mods.fml.common.event.FMLPreInitializationEvent;
      import cpw.mods.fml.common.network.NetworkMod;
      import cpw.mods.fml.common.registry.GameRegistry;
      import cpw.mods.fml.common.registry.LanguageRegistry;
      import net.minecraftforge.common.EnumHelper;
      
      @Mod(modid="PM", name="Portal WoW", version="V.1.0.0")
      @NetworkMod(clientSideRequired=true, serverSideRequired=false) //NE JAMAIS MODIFIER
      
      public class Portalmain {
      
      @SidedProxy(clientSide = "Portal.ClientProxy", serverSide = "Portal.CommonProxy")
      public static Portal.CommonProxy proxy;
      
      @Instance("PM")
      public static Portalmain instance;
      
      public static Block portalwowe;
      public static Block portalwowm;
      public static Block portalwowh;
      public static Block portalwowg;
      public static Block blockinvi;
      
      @EventHandler
      public void PreInit(FMLPreInitializationEvent event){
      
      //Configuration
      
      //Portalmain.Blocks
      portalwowe = new Portal.Blocks.portalwowe(2000).setBlockUnbreakable().setStepSound(Block.soundGlassFootstep).setUnlocalizedName("WoWPortaleasy").setTextureName("rm:portalwowe").setLightValue(1.0F);
      portalwowm = new Portal.Blocks.portalwowm(2001).setBlockUnbreakable().setStepSound(Block.soundGlassFootstep).setUnlocalizedName("WoWPortalmedium").setTextureName("rm:portalwowm").setLightValue(1.0F);
      portalwowh = new Portal.Blocks.portalwowh(2002).setBlockUnbreakable().setStepSound(Block.soundGlassFootstep).setUnlocalizedName("WoWPortalhard").setTextureName("rm:portalwowh").setLightValue(1.0F);
      portalwowg = new Portal.Blocks.portalwowg(2003).setBlockUnbreakable().setStepSound(Block.soundGlassFootstep).setUnlocalizedName("WoWPortalgroup").setTextureName("rm:portalwowg").setLightValue(1.0F);
      blockinvi = new Portal.Blocks.blockinvi(2004).setBlockUnbreakable().setStepSound(Block.soundGlassFootstep).setUnlocalizedName("blockinvi").setTextureName("rm:invisi");
      
      //Portalmain.Items
      
      //Registers.Blocks
      GameRegistry.registerBlock(portalwowe, "portalwowe");
      GameRegistry.registerBlock(portalwowm, "portalwowm");
      GameRegistry.registerBlock(portalwowh, "portalwowh");
      GameRegistry.registerBlock(portalwowg, "portalwowg");
      GameRegistry.registerBlock(blockinvi, "blockinvi");
      
      LanguageRegistry.addName(portalwowe, "wowportaleasy");
      LanguageRegistry.addName(portalwowm, "wowportalmedium");
      LanguageRegistry.addName(portalwowh, "wowportalhard");
      LanguageRegistry.addName(portalwowg, "wowportalgroup");
      LanguageRegistry.addName(blockinvi, "blockinvi");
      
      //Registers.Items
      
      }
      
      @EventHandler
      public void PreInit(FMLInitializationEvent Event){
      
      //Render
      proxy.registerRenderers();
      
      //Recipe
      
      //Smelting
      
      }
      
      @EventHandler
      public void PostInit(FMLInitializationEvent event){
      
      }
      }
      
      
      1 Reply Last reply Reply Quote 0
      • robin4002
        robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

        @Override
        public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
        {
        }
        
        @Override
        public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
        {
        return true;
        }
        
        @Override
        public boolean shouldRender3DInInventory()
        {
        return false;
        }
        

        Si tu laisse ça vite c’est normal qu’il n’y est pas de rendu.

        1 Reply Last reply Reply Quote 0
        • isador
          isador Moddeurs confirmés Modérateurs last edited by

          que rajouter? :noob:

          1 Reply Last reply Reply Quote 0
          • Kujaroth
            Kujaroth last edited by

            
            @Override
            public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
            {
            Tessellator tessellator = Tessellator.instance;
            renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F); // crée un "étage" pour le rendu de l'inventaire
            this.renderInInventory(tessellator, renderer, block, metadata); // sauvegarde "l'étage" pour le rendu de l'inventaire
            //etc etc
            }
            
            @Override
            public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
            {
            renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F); // crée un "étage" pour le rendu en jeu
            renderer.renderStandardBlock(block, x, y, z); //sauvegarde "l'étage" pour le rendu en jeu
            //etc etc
            return true;
            }
            
            @Override
            public boolean shouldRender3DInInventory()
            {
            return true;
            }
            
            

            Je ne sais pas si tu me comprendra avec “étage” 😕

            En gros, un bloc plein est égale a 0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F (Xmin, Ymin, Zmin, Xmax, Ymax, Zmax).
            Une demi dalle serait 0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F (la moiter de la hauteur en Ymax, soit 0.5F)

            Un escalier c’est une demi dalle avec une moitié de demi dalle ! Soit :
            0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F (pour la demi-dalle)
            0.0F, 0.5F, 0.5F, 1.0F, 1.0F, 1.0F (pour le haut (j’ai fait ça de tête, pas sur que ce soit exacte)

            cela fait 2 “étages”, mais faut lui dire que tu passe a un autre étage, c’est la qu’entre en jeu le “renderer.renderStandardBlock(block, x, y, z);” ou “this.renderInInventory(tessellator, renderer, block, metadata);” pour le rendu inventaire.

            Ce qui donnerai

            
            renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); // crée le premier étage
            renderer.renderStandardBlock(block, x, y, z); // sauvegarde le premier étage
            renderer.setRenderBounds(0.0F, 0.5F, 0.5F, 1.0F, 1.0F, 1.0F); // crée le deuxième étage
            renderer.renderStandardBlock(block, x, y, z); // sauvegarde le deuxième étage qui est aussi le dernier.
            
            

            C’est assez dure a comprendre au début, mais une fois que t’a compris c’est pire que bidon… Je te recommande vivement de toujours avoir une feuille de papier a coté de toi quand tu utilise se genre de truc, car c’est plus simple de ce visualisé la forme et position sur papier que de tête.

            Voici en bonus une petite images qui t’aidera pour la “construction de tes étages”.

            En espérant avoir été clair ^^’

            1 Reply Last reply Reply Quote 0
            • isador
              isador Moddeurs confirmés Modérateurs last edited by

              D’accord merci je vais essayer tous ça merci.
              Je vous tien au courant

              edit:

              
              @Override
              public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
              {
              Tessellator tessellator = Tessellator.instance;
              renderer.setRenderBounds( 0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); // crée un "étage" pour le rendu de l'inventaire
              this.renderInInventory(tessellator, renderer, block, metadata); // sauvegarde "l'étage" pour le rendu de l'inventaire
              //etc etc
              }
              
              private void renderInInventory(Tessellator tessellator,
              RenderBlocks renderer, Block block, int metadata) {
              // TODO Auto-generated method stub
              
              }
              
              @Override
              public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
              {
              renderer.setRenderBounds( 0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); // crée un "étage" pour le rendu en jeu
              renderer.renderStandardBlock(block, x, y, z); //sauvegarde "l'étage" pour le rendu en jeu
              //etc etc
              return true;
              }
              
              @Override
              public boolean shouldRender3DInInventory()
              {
              return true;
              }
              
              @Override
              public int getRenderId() {
              // TODO Auto-generated method stub
              return 0;
              }
              
              

              le bloc reste invisible. Je parie que je n’ai juste pas compris ce que tu m’as dit ….

              1 Reply Last reply Reply Quote 0
              • robin4002
                robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                C’est pourtant expliqué dans le tutoriel u_U
                Exemple ici :
                https://github.com/FFMT/ModTutoriel/blob/master/tutoriel/client/RenderTable.java

                1 Reply Last reply Reply Quote 0
                • isador
                  isador Moddeurs confirmés Modérateurs last edited by

                  je vien de trouve juste le return 0 que j’avais oublier de changer –’

                  par contre dans le fonction GL11.glScale(x, y, z); que mettre pour x y et z car 0F me met le chunk en noir et 1F ne fait rien.

                  1 Reply Last reply Reply Quote 0
                  • robin4002
                    robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                    0 -> réduit à rien
                    1 -> taille normal
                    2 -> le double
                    etc …

                    1 Reply Last reply Reply Quote 0
                    • isador
                      isador Moddeurs confirmés Modérateurs last edited by

                      oki 🙂

                      mais quand je mes 2F ca faut pareil que 0F

                      1 Reply Last reply Reply Quote 0
                      • robin4002
                        robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                        Étrange, sinon mets 2F directement dans le code renderer.setRenderBounds(…

                        1 Reply Last reply Reply Quote 0
                        • isador
                          isador Moddeurs confirmés Modérateurs last edited by

                          sa ne vas pas si je le met dans le setrenderbound car si je met 1 bloc ca fait une zone de 2x2 avec seulement la hitbox la où le bloc est posé

                          1 Reply Last reply Reply Quote 0
                          • robin4002
                            robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                            Dans tout les cas tu aura seulement la hitbox la où le bloc est placé.
                            On ne peut pas faire de bloc plus grand que 1x1, les codes de minecraft ne le permet pas.
                            La seul solution est de faire que lorsqu’on pose le bloc, d’autres blocs se pose à coté, et lorsqu’on le casse, les autres casses avec. Ensuite pour agrandir la hitbox il une fonction dans Block.java.

                            1 Reply Last reply Reply Quote 0
                            • isador
                              isador Moddeurs confirmés Modérateurs last edited by

                              D’accord je vais regarder ça merci___
                              pour la pose des bloc il faut faire comment?
                              une génération en minX, minY, minZ, maxX, maxY, maxZ ? quelle fonction utiliser?

                              1 Reply Last reply Reply Quote 0
                              • Superloup10
                                Superloup10 Modérateurs last edited by

                                Regarde le code de la porte, c’est le meilleur exemple de la pose de 2 blocs en un seul bloc.

                                1 Reply Last reply Reply Quote 0
                                • isador
                                  isador Moddeurs confirmés Modérateurs last edited by

                                  oki merci 🙂

                                  Edit: j’ai atteint 1 stack de message 😛

                                  1 Reply Last reply Reply Quote 0
                                  • isador
                                    isador Moddeurs confirmés Modérateurs last edited by

                                    je ne trouve pas la partie du code dans la porte

                                    1 Reply Last reply Reply Quote 0
                                    • robin4002
                                      robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                                      Regarde l’item de la porte pour le placement (tu n’es pas obligé d’avoir un item, tu peux passer par l’item bloc (comme avec les metadata)) et pour la destruction c’est la fonction onBlockHarvested.
                                      Sinon tu peux aussi regarder le lampadaire et le parasol de nanotech mod city :
                                      https://github.com/FFMT/nanotech_mod/blob/master/common/fr/mcnanotech/kevin_68/nanotechmod/city/blocks/BlockLamp.java
                                      https://github.com/FFMT/nanotech_mod/blob/master/common/fr/mcnanotech/kevin_68/nanotechmod/city/blocks/ItemBlockLamp.java

                                      https://github.com/FFMT/nanotech_mod/blob/master/common/fr/mcnanotech/kevin_68/nanotechmod/city/blocks/ItemBlockSunShade.java
                                      https://github.com/FFMT/nanotech_mod/blob/master/common/fr/mcnanotech/kevin_68/nanotechmod/city/blocks/BlockSunShade.java

                                      1 Reply Last reply Reply Quote 0
                                      • isador
                                        isador Moddeurs confirmés Modérateurs last edited by

                                        Ok merci

                                        1 Reply Last reply Reply Quote 0
                                        • isador
                                          isador Moddeurs confirmés Modérateurs last edited by

                                          je ne trouve pas quelle partie permet de créer un bloc dans le blockdoor.java

                                          1 Reply Last reply Reply Quote 0
                                          • robin4002
                                            robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                                            c’est la fonction onItemUse

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post
                                            Design by Woryk
                                            Contact / Mentions Légales / Faire un don

                                            MINECRAFT FORGE FRANCE © 2018

                                            Powered by NodeBB