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); }-
Solved Hammer qui mine du 3x3x1
• Circus -
Solved Register Entity
• jules552 -
Solved Problème de Potion persistante…
• cyvax -
Solved [1.12.2] TileEntity null
• SpyMan -
Solved TileEntity Cannot be cast to
• Reikenz -
Solved Problème rendue items
• Reikenz -
Solved Problème d'item fantôme
• elx9000 -
Solved Texture de tapis
• aypristyle -
Solved Problème Hache
• aypristyle -
Solved Affichage du GUI incorrect ..
• Flow -
Solved Problème rendu item
• aypristyle -
Solved CustomStateMapper ignoré ?
• EmotionFox -
Solved ItemBlock, problème de texture
• EmotionFox