Exemplo n.º 1
0
  /** Called when this EntityThrowable hits a block or entity. */
  @Override
  public void onImpact(MovingObjectPosition mop) {
    if (!this.worldObj.isRemote) {
      ForgeDirection d = ForgeDirection.UP;
      boolean set = false;

      if (worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ) == Blocks.air) {
        worldObj.setBlock(mop.blockX, mop.blockY, mop.blockZ, emasher.blocks.Blocks.smoke());
      } else if (worldObj.getBlock(
              mop.blockX + d.offsetX, mop.blockY + d.offsetY, mop.blockZ + d.offsetZ)
          == Blocks.air) {
        worldObj.setBlock(
            mop.blockX + d.offsetX,
            mop.blockY + d.offsetY,
            mop.blockZ + d.offsetZ,
            emasher.blocks.Blocks.smoke());
      } else {
        for (int i = 2; i < 6; i++) {
          d = ForgeDirection.getOrientation(i);
          if (worldObj.getBlock(
                  mop.blockX + d.offsetX, mop.blockY + d.offsetY, mop.blockZ + d.offsetZ)
              == Blocks.air) {
            worldObj.setBlock(
                mop.blockX + d.offsetX,
                mop.blockY + d.offsetY,
                mop.blockZ + d.offsetZ,
                emasher.blocks.Blocks.smoke());
            set = true;
            break;
          }
        }

        if (!set) {
          d = ForgeDirection.DOWN;

          if (worldObj.getBlock(
                  mop.blockX + d.offsetX, mop.blockY + d.offsetY, mop.blockZ + d.offsetZ)
              == Blocks.air) {
            worldObj.setBlock(
                mop.blockX + d.offsetX,
                mop.blockY + d.offsetY,
                mop.blockZ + d.offsetZ,
                emasher.blocks.Blocks.smoke());
          }
        }
      }

      this.setDead();
    }
  }
Exemplo n.º 2
0
  public void generate(
      Random random, int i, int k, World world, IChunkProvider provider, IChunkProvider provider2) {
    i *= 16;
    k *= 16;

    i += random.nextInt(16);
    k += random.nextInt(16);

    BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(i, k);

    if (BiomeDictionary.isBiomeOfType(biome, Type.SWAMP)
        || BiomeDictionary.isBiomeOfType(biome, Type.FOREST)
        || BiomeDictionary.isBiomeOfType(biome, Type.JUNGLE)
        || BiomeDictionary.isBiomeOfType(biome, Type.PLAINS)) {
      if (!BiomeDictionary.isBiomeOfType(biome, Type.COLD)) {
        if (emasher.blocks.Blocks.hemp().canBlockStay(world, i, world.getHeightValue(i, k), k)
            && random.nextInt(100) == 0) {
          world.setBlock(i, world.getHeightValue(i, k), k, emasher.blocks.Blocks.hemp(), 0, 2);
        }
      }
    }
  }