MFF

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

    Hammer qui mine du 3x3x1

    Planifier Épinglé Verrouillé Déplacé Résolu 1.12.x
    1.12.x
    3 Messages 2 Publieurs 1.1k 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.
    • C Hors-ligne
      Circus
      dernière édition par

      Bonjour,

      J’ai trouver ce code mais il mine en 3x3x3 or je voudrais le faire miner en 3x3x1 voici le code

      package fr.circus.celestart.Tool;
      import java.util.List;
      import net.minecraft.block.state.IBlockState;
      import net.minecraft.entity.EntityLivingBase;
      import net.minecraft.entity.item.EntityItem;
      import net.minecraft.entity.item.EntityXPOrb;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.item.ItemPickaxe;
      import net.minecraft.item.ItemStack;
      import net.minecraft.item.Item.ToolMaterial;
      import net.minecraft.tileentity.TileEntity;
      import net.minecraft.util.EnumFacing;
      import net.minecraft.util.math.BlockPos;
      import net.minecraft.util.math.RayTraceResult;
      import net.minecraft.util.math.RayTraceResult.Type;
      import net.minecraft.world.World;
      public class StarModHammer extends ItemPickaxe {
      
       public StarModHammer(ToolMaterial material) {
        super(material);
       }
       public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState block,BlockPos pos, int x, int y, int z, EntityLivingBase living)
       {
           if(living instanceof EntityPlayer)
           {
               for(int x1 = -2; x1 < 3; x1++)
               {
                   for(int y1 = -2; y1 < 3; y1++)
                   {
                       for(int z1 = -2; z1 < 3; z1++)
                       {
                       BlockPos pos1 = new BlockPos(x + x1, y + y1, z + z1);
      
         if(world.getBlockState(pos1).getBlock().getBlockHardness(block ,world, pos1) >= 0) {
         world.getBlockState(pos1).getBlock().harvestBlock(world, (EntityPlayer)living, pos, world.getBlockState(pos1), TileEntity.create(world, getNBTShareTag(stack) ), stack );
         world.setBlockToAir(pos1);
         }
                       }
                   }
               }
           }
      
           return super.onBlockDestroyed(stack, world, block,pos, living);
       }
      }
      

      Je ne comprend pas comment faire le Système de direction en 1.12.2

      Si quelqu’un peut m’aider je lui en serais très reconnaissant

      Amicalement,
      Circus

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

        Si le sujet est résolu, il serait sympa d’indiquer la solution.

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

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

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

          Voici la solution

          public RayTraceResult rayTrace(double blockReachDistance, float partialTicks, World w, EntityLivingBase e)
              {
                  Vec3d vec3d = e.getPositionEyes(partialTicks);
                  Vec3d vec3d1 = e.getLook(partialTicks);
                  Vec3d vec3d2 = vec3d.addVector(vec3d1.x * blockReachDistance, vec3d1.y * blockReachDistance, vec3d1.z * blockReachDistance);
                  return w.rayTraceBlocks(vec3d, vec3d2, false, false, true);
              }
              @Override
              public boolean onBlockDestroyed(ItemStack breaker, World w, IBlockState state, BlockPos pos, EntityLivingBase e)
              {
                  if (e instanceof EntityPlayer && !w.isRemote)
                  {
                      EntityPlayer p = (EntityPlayer) e;
                      RayTraceResult r = this.rayTrace(5.0D, 0.0F, w, e);
                      if (r.typeOfHit == RayTraceResult.Type.BLOCK)
                      {
                          int x = pos.getX();
                          int y = pos.getY();
                          int z = pos.getZ();
                          EnumFacing side = r.sideHit;
                          // Y
                          // UP - DOWN
                          if (side == EnumFacing.DOWN || side == EnumFacing.UP)
                          {
                              this.destroyAndDropBlock(w, p, breaker, x + 1, y, z - 1);
                              this.destroyAndDropBlock(w, p, breaker, x + 1, y, z);
                              this.destroyAndDropBlock(w, p, breaker, x + 1, y, z + 1);
                              this.destroyAndDropBlock(w, p, breaker, x, y, z - 1);
                              // Middle block
                              this.destroyAndDropBlock(w, p, breaker, x, y, z + 1);
                              this.destroyAndDropBlock(w, p, breaker, x - 1, y, z - 1);
                              this.destroyAndDropBlock(w, p, breaker, x - 1, y, z);
                              this.destroyAndDropBlock(w, p, breaker, x - 1, y, z + 1);
                          }
                          // Z
                          // NORTH - SOUTH
                          else if (side == EnumFacing.NORTH || side == EnumFacing.SOUTH)
                          {
                              this.destroyAndDropBlock(w, p, breaker, x + 1, y + 1, z);
                              this.destroyAndDropBlock(w, p, breaker, x, y + 1, z);
                              this.destroyAndDropBlock(w, p, breaker, x - 1, y + 1, z);
                              this.destroyAndDropBlock(w, p, breaker, x + 1, y, z);
                              // Middle block
                              this.destroyAndDropBlock(w, p, breaker, x - 1, y, z);
                              this.destroyAndDropBlock(w, p, breaker, x + 1, y - 1, z);
                              this.destroyAndDropBlock(w, p, breaker, x, y - 1, z);
                              this.destroyAndDropBlock(w, p, breaker, x - 1, y - 1, z);
                          }
                          // X
                          // EAST - WEST
                          else if (side == EnumFacing.EAST || side == EnumFacing.WEST)
                          {
                              this.destroyAndDropBlock(w, p, breaker, x, y + 1, z + 1);
                              this.destroyAndDropBlock(w, p, breaker, x, y + 1, z);
                              this.destroyAndDropBlock(w, p, breaker, x, y + 1, z - 1);
                              this.destroyAndDropBlock(w, p, breaker, x, y, z + 1);
                              // Middle block
                              this.destroyAndDropBlock(w, p, breaker, x, y, z - 1);
                              this.destroyAndDropBlock(w, p, breaker, x, y - 1, z + 1);
                              this.destroyAndDropBlock(w, p, breaker, x, y - 1, z);
                              this.destroyAndDropBlock(w, p, breaker, x, y - 1, z - 1);
                          }
                          return true;
                      }
                  }
                  return super.onBlockDestroyed(breaker, w, state, pos, e);
              }
              private void destroyAndDropBlock(World w, EntityPlayer p, ItemStack breaker, int x, int y, int z)
              {
                  BlockPos pos = new BlockPos(x, y, z);
                  w.getBlockState(pos).getBlock().harvestBlock(w, p, pos, w.getBlockState(pos), w.getTileEntity(pos), breaker);
                  w.setBlockToAir(pos);
              }
          
          1 réponse Dernière réponse Répondre Citer 0
          • 1 / 1
          • Premier message
            Dernier message
          Design by Woryk
          ContactMentions Légales

          MINECRAFT FORGE FRANCE © 2024

          Powered by NodeBB