• S'inscrire
    • Se connecter
    • Recherche
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes

    Résolu Demi escaliers

    1.7.x
    1.7.2
    4
    9
    1646
    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.
    • H
      Hardstylerz59 dernière édition par

      Bonjour à tous,

      Travaillant sur le mod Héritiers (http://www.minecraftforgefrance.fr/showthread.php?tid=954), j’ai récemment ajouté des “quarts de blocs” qui sont très utile pour faire des branches d’arbres ou autre. 
      :::

      :::
      Et j’aurais aimé adapté ceci pour les escaliers, donc faire des demis escaliers qui seraient orientable comme les branches.

      public class Branch
      extends BlockRotatedPillar {
          private IIcon sideIcon;
      
          public Branch(String name, String textureName) {
              super(Material.wood);
              this.setCreativeTab(ModSDA.naturalTab);
              this.setBlockName(name);
              this.setBlockTextureName(textureName);
              this.setLightOpacity(0);
              this.setStepSound(soundTypeWood);
          }
      
          public int onBlockPlaced(World world, int x, int y, int z, int side, float deltaX, float deltaY, float deltaZ, int metadata) {
              float dX = deltaX - (float)((int)deltaX);
              float dY = deltaY - (float)((int)deltaY);
              float dZ = deltaZ - (float)((int)deltaZ);
              if (dZ == 0.0f) {
                  if ((double)dX < 0.3 && (double)dY < 0.3) {
                      world.setBlockMetadataWithNotify(x, y, z, 4, 2);
                      return 4;
                  }
                  if ((double)dX > 0.7 && (double)dY < 0.3) {
                      world.setBlockMetadataWithNotify(x, y, z, 3, 2);
                      return 3;
                  }
                  if ((double)dX < 0.3 && (double)dY > 0.7) {
                      world.setBlockMetadataWithNotify(x, y, z, 2, 2);
                      return 2;
                  }
                  if ((double)dX > 0.7 && (double)dY > 0.7) {
                      world.setBlockMetadataWithNotify(x, y, z, 1, 2);
                      return 1;
                  }
                  world.setBlockMetadataWithNotify(x, y, z, 0, 2);
                  return 0;
              }
              if (dY == 0.0f) {
                  if ((double)dX < 0.3 && (double)dZ < 0.3) {
                      world.setBlockMetadataWithNotify(x, y, z, 9, 2);
                      return 9;
                  }
                  if ((double)dX > 0.7 && (double)dZ < 0.3) {
                      world.setBlockMetadataWithNotify(x, y, z, 8, 2);
                      return 8;
                  }
                  if ((double)dX < 0.3 && (double)dZ > 0.7) {
                      world.setBlockMetadataWithNotify(x, y, z, 7, 2);
                      return 7;
                  }
                  if ((double)dX > 0.7 && (double)dZ > 0.7) {
                      world.setBlockMetadataWithNotify(x, y, z, 6, 2);
                      return 6;
                  }
                  world.setBlockMetadataWithNotify(x, y, z, 5, 2);
                  return 5;
              }
              if (dX == 0.0f) {
                  if ((double)dY < 0.3 && (double)dZ < 0.3) {
                      world.setBlockMetadataWithNotify(x, y, z, 14, 2);
                      return 14;
                  }
                  if ((double)dY > 0.7 && (double)dZ < 0.3) {
                      world.setBlockMetadataWithNotify(x, y, z, 13, 2);
                      return 13;
                  }
                  if ((double)dY < 0.3 && (double)dZ > 0.7) {
                      world.setBlockMetadataWithNotify(x, y, z, 12, 2);
                      return 12;
                  }
                  if ((double)dY > 0.7 && (double)dZ > 0.7) {
                      world.setBlockMetadataWithNotify(x, y, z, 11, 2);
                      return 11;
                  }
                  world.setBlockMetadataWithNotify(x, y, z, 10, 2);
                  return 10;
              }
              return metadata;
          }
      
          public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
              double xD = x;
              double yD = y;
              double zD = z;
              int metadata = world.getBlockMetadata(x, y, z);
              if (metadata == 0) {
                  return AxisAlignedBB.getBoundingBox((double)(xD + 0.25), (double)(yD + 0.25), (double)zD, (double)(xD + 0.75), (double)(yD + 0.75), (double)(zD + 1.0));
              }
              if (metadata == 1) {
                  return AxisAlignedBB.getBoundingBox((double)(xD + 0.5), (double)(yD + 0.5), (double)zD, (double)(xD + 1.0), (double)(yD + 1.0), (double)(zD + 1.0));
              }
              if (metadata == 2) {
                  return AxisAlignedBB.getBoundingBox((double)xD, (double)(yD + 0.5), (double)zD, (double)(xD + 0.5), (double)(yD + 1.0), (double)(zD + 1.0));
              }
              if (metadata == 3) {
                  return AxisAlignedBB.getBoundingBox((double)(xD + 0.5), (double)yD, (double)zD, (double)(xD + 1.0), (double)(yD + 0.5), (double)(zD + 1.0));
              }
              if (metadata == 4) {
                  return AxisAlignedBB.getBoundingBox((double)xD, (double)yD, (double)zD, (double)(xD + 0.5), (double)(yD + 0.5), (double)(zD + 1.0));
              }
              if (metadata == 5) {
                  return AxisAlignedBB.getBoundingBox((double)(xD + 0.25), (double)yD, (double)(zD + 0.25), (double)(xD + 0.75), (double)(yD + 1.0), (double)(zD + 0.75));
              }
              if (metadata == 6) {
                  return AxisAlignedBB.getBoundingBox((double)(xD + 0.5), (double)yD, (double)(zD + 0.5), (double)(xD + 1.0), (double)(yD + 1.0), (double)(zD + 1.0));
              }
              if (metadata == 7) {
                  return AxisAlignedBB.getBoundingBox((double)xD, (double)yD, (double)(zD + 0.5), (double)(xD + 0.5), (double)(yD + 1.0), (double)(zD + 1.0));
              }
              if (metadata == 8) {
                  return AxisAlignedBB.getBoundingBox((double)(xD + 0.5), (double)yD, (double)zD, (double)(xD + 1.0), (double)(yD + 1.0), (double)(zD + 0.5));
              }
              if (metadata == 9) {
                  return AxisAlignedBB.getBoundingBox((double)xD, (double)yD, (double)zD, (double)(xD + 0.5), (double)(yD + 1.0), (double)(zD + 0.5));
              }
              if (metadata == 10) {
                  return AxisAlignedBB.getBoundingBox((double)xD, (double)(yD + 0.25), (double)(zD + 0.25), (double)(xD + 1.0), (double)(yD + 0.75), (double)(zD + 0.75));
              }
              if (metadata == 11) {
                  return AxisAlignedBB.getBoundingBox((double)xD, (double)(yD + 0.5), (double)(zD + 0.5), (double)(xD + 1.0), (double)(yD + 1.0), (double)(zD + 1.0));
              }
              if (metadata == 12) {
                  return AxisAlignedBB.getBoundingBox((double)xD, (double)yD, (double)(zD + 0.5), (double)(xD + 1.0), (double)(yD + 0.5), (double)(zD + 1.0));
              }
              if (metadata == 13) {
                  return AxisAlignedBB.getBoundingBox((double)xD, (double)(yD + 0.5), (double)zD, (double)(xD + 1.0), (double)(yD + 1.0), (double)(zD + 0.5));
              }
              if (metadata == 14) {
                  return AxisAlignedBB.getBoundingBox((double)xD, (double)yD, (double)zD, (double)(xD + 1.0), (double)(yD + 0.5), (double)(zD + 0.5));
              }
              return AxisAlignedBB.getBoundingBox((double)(xD + 0.25), (double)(yD + 0.25), (double)zD, (double)(xD + 0.75), (double)(yD + 0.75), (double)(zD + 1.0));
          }
      
          public void func_149743_a(World world, int x, int y, int z, AxisAlignedBB axisAlignedBB, List list, Entity entity) {
              this.setBlockBoundsBasedOnState((IBlockAccess)world, x, y, z);
              super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
          }
      
          public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z) {
              int metadata = iBlockAccess.getBlockMetadata(x, y, z);
              if (metadata == 0) {
                  this.setBlockBounds(0.25f, 0.25f, 0.0f, 0.75f, 0.75f, 1.0f);
              } else if (metadata == 1) {
                  this.setBlockBounds(0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 1.0f);
              } else if (metadata == 2) {
                  this.setBlockBounds(0.0f, 0.5f, 0.0f, 0.5f, 1.0f, 1.0f);
              } else if (metadata == 3) {
                  this.setBlockBounds(0.5f, 0.0f, 0.0f, 1.0f, 0.5f, 1.0f);
              } else if (metadata == 4) {
                  this.setBlockBounds(0.0f, 0.0f, 0.0f, 0.5f, 0.5f, 1.0f);
              } else if (metadata == 5) {
                  this.setBlockBounds(0.25f, 0.0f, 0.25f, 0.75f, 1.0f, 0.75f);
              } else if (metadata == 6) {
                  this.setBlockBounds(0.5f, 0.0f, 0.5f, 1.0f, 1.0f, 1.0f);
              } else if (metadata == 7) {
                  this.setBlockBounds(0.0f, 0.0f, 0.5f, 0.5f, 1.0f, 1.0f);
              } else if (metadata == 8) {
                  this.setBlockBounds(0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.5f);
              } else if (metadata == 9) {
                  this.setBlockBounds(0.0f, 0.0f, 0.0f, 0.5f, 1.0f, 0.5f);
              } else if (metadata == 10) {
                  this.setBlockBounds(0.0f, 0.25f, 0.25f, 1.0f, 0.75f, 0.75f);
              } else if (metadata == 11) {
                  this.setBlockBounds(0.0f, 0.5f, 0.5f, 1.0f, 1.0f, 1.0f);
              } else if (metadata == 12) {
                  this.setBlockBounds(0.0f, 0.0f, 0.5f, 1.0f, 0.5f, 1.0f);
              } else if (metadata == 13) {
                  this.setBlockBounds(0.0f, 0.5f, 0.0f, 1.0f, 1.0f, 0.5f);
              } else if (metadata == 14) {
                  this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.5f, 0.5f);
              }
          }
      
          public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entity, int metadata, float deltaX, float deltaY, float deltaZ) {
              if (entity.inventory.getCurrentItem() != null) {
                  return false;
              }
              int m = world.getBlockMetadata(x, y, z) + 1;
              if (m > 14) {
                  m = 0;
              }
              world.setBlockMetadataWithNotify(x, y, z, m, 2);
              return true;
          }
      
          public void setBlockBoundsForItemRender() {
              this.setBlockBounds(0.25f, 0.25f, 0.0f, 0.75f, 0.75f, 1.0f);
          }
      
          public void registerBlockIcons(IIconRegister register) {
              this.blockIcon = register.registerIcon(this.getTextureName() + "_top");
              this.sideIcon = register.registerIcon(this.getTextureName());
          }
      
          public IIcon getIcon(int side, int metadata) {
              if (metadata >= 0 && metadata <= 4) {
                  if (side == 2 || side == 3) {
                      return this.getTopIcon(metadata);
                  }
                  return this.getSideIcon(metadata);
              }
              if (metadata >= 5 && metadata <= 9) {
                  if (side == 0 || side == 1) {
                      return this.getTopIcon(metadata);
                  }
                  return this.getSideIcon(metadata);
              }
              if (metadata >= 10 && metadata <= 14) {
                  if (side == 4 || side == 5) {
                      return this.getTopIcon(metadata);
                  }
                  return this.getSideIcon(metadata);
              }
              return this.getSideIcon(metadata);
          }
      
          public static int func_150165_c(int integer1) {
              return integer1;
          }
      
          public boolean isOpaqueCube() {
              return false;
          }
      
          public int func_149745_a(Random random) {
              return 1;
          }
      
          public boolean renderAsNormalBlock() {
              return false;
          }
      
          public Item getItemDropped(int integer1, Random random, int integer2) {
              return Item.getItemFromBlock((Block)this);
          }
      
          public void breakBlock(World world, int x, int y, int z, Block block, int metadata) {
              int byt = 4;
              int bytPlus1 = byt + 1;
              if (world.checkChunksExist(x - bytPlus1, y - bytPlus1, z - bytPlus1, x + bytPlus1, y + bytPlus1, z + bytPlus1)) {
                  for (int xDelta = - byt; xDelta <= byt; ++xDelta) {
                      for (int yDelta = - byt; yDelta <= byt; ++yDelta) {
                          for (int zDelta = - byt; zDelta <= byt; ++zDelta) {
                              Block blockBis = world.getBlock(x + xDelta, y + yDelta, z + zDelta);
                              if (!blockBis.isLeaves((IBlockAccess)world, x + xDelta, y + yDelta, z + zDelta)) continue;
                              blockBis.beginLeavesDecay(world, x + xDelta, y + yDelta, z + zDelta);
                          }
                      }
                  }
              }
          }
      
          protected IIcon getSideIcon(int metadata) {
              return this.sideIcon;
          }
      
          protected IIcon getTopIcon(int metadata) {
              return this.blockIcon;
          }
      
          public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) {
              return true;
          }
      
          public boolean isWood(IBlockAccess world, int x, int y, int z) {
              return true;
          }
      
          private boolean checkSideIsSolid(Block block) {
              return false;
          }
      
      }
      
      

      Voici mon code pour les branches.

      Cordialement Hard

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

        C’est quoi pour toi un “demi-escalier” ?

        Site web contenant mes scripts : http://SCAREXgaming.github.io

        Pas de demandes de support par MP ni par skype SVP.
        Je n'accepte sur skype que l…

        1 réponse Dernière réponse Répondre Citer 0
        • AymericRed
          AymericRed dernière édition par

          Oui parce que qu’on voit pas ce que tu veux faire précisément.

          Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

          AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

          Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
          Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

            Pareil, je n’ai pas vraiment comprit x)
            Je vois mal comment faire la moitié d’un escalier.

            1 réponse Dernière réponse Répondre Citer 0
            • H
              Hardstylerz59 dernière édition par

              Lol, je m’explique un peu mieux 😛

              Vous voyez l’image des “branches” que j’ai mise sur le 1er post, et bien en gros rajouter la moitié de la branche d’un coté pour faire un demi escalier. De comme ça :

              :::

              :::

              A comme ça :
              :::

              :::
              Ce qui ressemble à un demi escalier xD, mais qu’on peut poser dans tout les sens du coup comme les “branches”.

              Cordialement Hard

              1 réponse Dernière réponse Répondre Citer 0
              • AymericRed
                AymericRed dernière édition par

                Ceci va être plus compliqué à faire, jongler avec les orientations mais il y a un mod ForgeMicroblocks qui fait ça et bien plus avec les blocs d’autres mods, regarde de ce côté…

                Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

                1 réponse Dernière réponse Répondre Citer 0
                • H
                  Hardstylerz59 dernière édition par

                  Recu ! Merci beaucoup 🙂
                  Je passerais en résolu si ça fonctionne 😛

                  Hard

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

                    En gros un escalier qui fait 1/8 d’un bloc complet ?
                    En effet c’est complexe à faire, à mon avis il n’y a même pas assez de métadata pour prendre en compte toutes les possibilités. Donc tile entity obligatoire
                    Sinon comme AymericRed l’a dit il y a un mod nommé forge multi part qui fait déjà ce genre de chose.

                    1 réponse Dernière réponse Répondre Citer 0
                    • H
                      Hardstylerz59 dernière édition par

                      Ou alors après peut être plus simple c’est faire une demi branche, comme ça je peux le placer pour faire un “demi escalier”

                      Mais je vais regarder via le mod que vous avez donné 🙂

                      Merci beaucoup

                      EDIT : C’est ce que j’ai fais et ça fonctionne, j’ai eu ce que je voulais 🙂

                      1 réponse Dernière réponse Répondre Citer 0
                      • 1 / 1
                      • Premier message
                        Dernier message
                      Design by Woryk
                      Contact / Mentions Légales

                      MINECRAFT FORGE FRANCE © 2018

                      Powered by NodeBB