Пример #1
0
  private void dropBlocks(World world, int x, int y, int z) {
    Block drop = world.getBlock(x, y, z);
    if (drop == Blocks.air) return;
    int dropmeta = world.getBlockMetadata(x, y, z);
    ItemStack sapling = tree.getSapling();
    Block logID = tree.getTreeType().getLogID();

    Collection<ItemStack> drops = this.getDrops(world, x, y, z, drop, dropmeta);
    if (drop == logID && logID != null) {
      if (rand.nextInt(3) == 0) {
        drops.add(
            ReikaItemHelper.getSizedItemStack(ItemStacks.sawdust.copy(), 1 + rand.nextInt(4)));
      }
    }

    for (ItemStack todrop : drops) {
      if (ReikaItemHelper.matchStacks(todrop, sapling)) {
        if (inv[0] != null && inv[0].stackSize >= inv[0].getMaxStackSize()) {
          if (!this.chestCheck(todrop))
            ReikaItemHelper.dropItem(world, dropx, yCoord - 0.25, dropz, todrop);
        } else ReikaInventoryHelper.addOrSetStack(todrop, inv, 0);
      } else {
        if (!this.chestCheck(todrop))
          ReikaItemHelper.dropItem(world, dropx, yCoord - 0.25, dropz, todrop);
      }
    }
  }
 private void craft(World world, int x, int y, int z) {
   if (recipe instanceof FluidRecipe) {
     TileEntity te = this.getAdjacentTileEntity(ForgeDirection.DOWN);
     ((IFluidHandler) te)
         .fill(ForgeDirection.UP, new FluidStack(((FluidRecipe) recipe).fluid, 1000), true);
   } else {
     ReikaInventoryHelper.addOrSetStack(recipe.output.copy(), inv, 1);
   }
   energy.subtract(recipe.energy);
   progress = 0;
   this.markDirty();
 }
 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());
       }
     }
   }
 }
 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);
   }
 }
 /*
 private ReikaOreHelper getVanillaOreByItem(ItemStack is) {
 	return ReikaOreHelper.oreList[is.getItemDamage()%ReikaOreHelper.oreList.length];
 }
  */
 private void bonusItems(ItemStack is) {
   ExtractorBonus e = ExtractorBonus.getBonusForIngredient(is);
   if (e != null && e.doBonus()) {
     ReikaInventoryHelper.addOrSetStack(ExtractorBonus.getBonusItemForIngredient(is), inv, 8);
   }
 }
 private void make(ItemStack toMake) {
   ReikaInventoryHelper.addOrSetStack(toMake, inv, 0);
   int amt = RecipesCrystallizer.getRecipes().getRecipeConsumption(toMake);
   tank.removeLiquid(amt);
 }