コード例 #1
0
 public void grind(World world, int x, int y, int z, int meta) {
   if (y <= 0) return;
   if (!world.isRemote) {
     if (world.getBlockId(harvestx, harvesty, harvestz) == 7) {
       world.playSoundEffect(
           x + 0.5D, y + 0.5D, z + 0.5D, "dig.stone", 0.5F, par5Random.nextFloat() * 0.4F + 0.8F);
       ReikaWorldHelper.legacySetBlockAndMetadataWithNotify(
           world, harvestx, harvesty, harvestz, RotaryCraft.bedrockslice.blockID, 0);
     } else {
       int rockmetadata = world.getBlockMetadata(harvestx, harvesty, harvestz);
       if (rockmetadata < 15) {
         world.playSoundEffect(
             x + 0.5D,
             y + 0.5D,
             z + 0.5D,
             "dig.stone",
             0.5F,
             par5Random.nextFloat() * 0.4F + 0.8F);
         ReikaWorldHelper.legacySetBlockAndMetadataWithNotify(
             world,
             harvestx,
             harvesty,
             harvestz,
             RotaryCraft.bedrockslice.blockID,
             rockmetadata + 1);
       } else {
         world.playSoundEffect(
             x + 0.5D,
             y + 0.5D,
             z + 0.5D,
             "mob.blaze.hit",
             0.5F,
             par5Random.nextFloat() * 0.4F + 0.8F);
         ReikaWorldHelper.legacySetBlockWithNotify(world, harvestx, harvesty, harvestz, 0);
         if (this.isInventoryFull())
           this.dropItem(world, x, y, z, meta, ItemStacks.bedrockdust.copy());
         else ReikaInventoryHelper.addOrSetStack(ItemStacks.bedrockdust, inv, 0);
         RotaryAchievements.BEDROCKBREAKER.triggerAchievement(this.getPlacer());
       }
     }
   }
 }
コード例 #2
0
 public void grind(World world, int mx, int my, int mz, int x, int y, int z, int meta) {
   if (this.processBlock(world, x, y, z)) {
     if (this.isBedrock(world, x, y, z)) {
       world.playSoundEffect(
           x + 0.5D, y + 0.5D, z + 0.5D, "dig.stone", 0.5F, rand.nextFloat() * 0.4F + 0.8F);
       world.setBlock(x, y, z, BlockRegistry.BEDROCKSLICE.getBlockInstance(), 0, 3);
     } else {
       int rockmetadata = world.getBlockMetadata(x, y, z);
       if (rockmetadata < 15) {
         world.playSoundEffect(
             x + 0.5D, y + 0.5D, z + 0.5D, "dig.stone", 0.5F, rand.nextFloat() * 0.4F + 0.8F);
         world.setBlockMetadataWithNotify(x, y, z, rockmetadata + 1, 3);
       } else {
         world.playSoundEffect(
             x + 0.5D, y + 0.5D, z + 0.5D, "mob.blaze.hit", 0.5F, rand.nextFloat() * 0.4F + 0.8F);
         ItemStack is = this.getDrops(world, x, y, z);
         world.setBlockToAir(x, y, z);
         if (!this.chestCheck(world, x, y, z, is)) {
           if (this.isInventoryFull()) ReikaItemHelper.dropItem(world, dropx, dropy, dropz, is);
           else ReikaInventoryHelper.addOrSetStack(is, inv, 0);
         }
         RotaryAchievements.BEDROCKBREAKER.triggerAchievement(this.getPlacer());
         MinecraftForge.EVENT_BUS.post(new BedrockDigEvent(this, x, y, z));
         if (!world.isRemote) this.incrementStep(world, mx, my, mz);
       }
     }
   } else {
     Block b = world.getBlock(x, y, z);
     if (b != Blocks.air && b.getBlockHardness(world, x, y, z) >= 0) {
       ReikaSoundHelper.playBreakSound(world, x, y, z, b);
       if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
         ReikaRenderHelper.spawnDropParticles(world, x, y, z, b, world.getBlockMetadata(x, y, z));
       world.setBlockToAir(x, y, z);
     }
     if (!world.isRemote) this.incrementStep(world, mx, my, mz);
   }
 }