protected static boolean func_181088_a(
     World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_) {
   return p_181088_2_ == EnumFacing.DOWN
           && World.doesBlockHaveSolidTopSurface(p_181088_0_, p_181088_1_.down())
       ? true
       : p_181088_0_.isSideSolid(p_181088_1_.offset(p_181088_2_), p_181088_2_.getOpposite());
 }
Exemple #2
0
  /** Gets the nearest empty chunk coordinates for the player to wake up from a bed into. */
  public static ChunkCoordinates getNearestEmptyChunkCoordinates(
      World par0World, int par1, int par2, int par3, int par4) {
    int i1 = par0World.getBlockMetadata(par1, par2, par3);
    int j1 = BlockDirectional.getDirection(i1);

    for (int k1 = 0; k1 <= 1; ++k1) {
      int l1 = par1 - footBlockToHeadBlockMap[j1][0] * k1 - 1;
      int i2 = par3 - footBlockToHeadBlockMap[j1][1] * k1 - 1;
      int j2 = l1 + 2;
      int k2 = i2 + 2;

      for (int l2 = l1; l2 <= j2; ++l2) {
        for (int i3 = i2; i3 <= k2; ++i3) {
          if (World.doesBlockHaveSolidTopSurface(par0World, l2, par2 - 1, i3)
              && !par0World.getBlock(l2, par2, i3).getMaterial().isOpaque()
              && !par0World.getBlock(l2, par2 + 1, i3).getMaterial().isOpaque()) {
            if (par4 <= 0) return new ChunkCoordinates(l2, par2, i3);

            --par4;
          }
        }
      }
    }

    return null;
  }
  private void generateStructure(World world, Random rand, int chunkX, int chunkZ) {
    // Need to create a new instance each time or the generate() methods may
    // overlap themselves and cause a crash
    // WorldGeneratorAcademy gen = new WorldGeneratorAcademy();
    FossilWaterStructureGenerator gen = new FossilWaterStructureGenerator();
    int struct; // This will store a random index of the structure to
    // generate
    struct = rand.nextInt(gen.structures.size());
    int x = chunkX + rand.nextInt(16);
    int z = chunkZ + rand.nextInt(16);
    // nice way of getting a height to work from; it returns the topmost
    // non-air block at an x/z position, such as tall grass, dirt or leaves
    int y = world.getHeightValue(x, z);

    // find ground level, ignoring blocks such as grass and water

    while ((!world.doesBlockHaveSolidTopSurface(world, x, y, z)) // && y >
    // world.provider.getAverageGroundLevel())
    // && (!world.doesBlockHaveSolidTopSurface(world, x + 10, y+4, z + 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x - 10, y+4, z - 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x + 10, y+4, z - 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x - 10, y+4, z + 11))
    ) {
      --y;
    }

    if (!world.doesBlockHaveSolidTopSurface(world, x, y, z)
        || (Block.getIdFromBlock(world.getBlock(x, y + 2, z)) != Block.getIdFromBlock(Blocks.water))
    // || !world.doesBlockHaveSolidTopSurface(world, x + 10, y, z + 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x - 10, y, z - 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x + 10, y, z - 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x - 10, y, z + 11))
    // && world.canBlockSeeTheSky(x, y, z)
    ) {
      return;
    } else {
      Revival.Console("Gen: Shipwreck Spawn at " + x + ", " + y + ", " + z);
    }

    int widthX = ((Structure) gen.structures.get(struct)).getWidthX();
    int widthZ = ((Structure) gen.structures.get(struct)).getWidthZ();
    int height = ((Structure) gen.structures.get(struct)).getHeight();
    // Set structure and random facing, then generate; no offset needed here
    gen.setStructure((Structure) gen.structures.get(struct));
    gen.setStructureFacing(rand.nextInt(4));
    gen.generate(world, rand, x, y - (rand.nextInt(3) + 3), z);
  }
 private boolean isSolid(World world, int x, int y, int z) {
   if (World.doesBlockHaveSolidTopSurface(world, x, y, z)) {
     return true;
   } else {
     Block block = world.getBlock(x, y, z);
     return block.canPlaceTorchOnTop(world, x, y, z);
   }
 }
 /**
  * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
  */
 public boolean canPlaceBlockAt(
     World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) {
   return p_149742_3_ >= p_149742_1_.getHeight() - 1
       ? false
       : World.doesBlockHaveSolidTopSurface(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_)
           && super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_)
           && super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_ + 1, p_149742_4_);
 }
  @Override
  public boolean canPlaceBlockAt(World world, int i, int j, int k) {
    Block block = world.getBlock(i, j - 1, k);

    if (block == TFCBlocks.ice || block == TFCBlocks.pottery) return false;
    if (block == TFCBlocks.leaves || block == TFCBlocks.leaves2 || block == TFCBlocks.thatch)
      return true;
    return World.doesBlockHaveSolidTopSurface(world, i, j - 1, k);
  }
 /** Gets if we can place a torch on a block. */
 private boolean canPlaceTorchOn(World par1World, int par2, int par3, int par4) {
   if (par1World.doesBlockHaveSolidTopSurface(par2, par3, par4)) {
     return true;
   } else {
     int var5 = par1World.getBlockId(par2, par3, par4);
     return (Block.blocksList[var5] != null
         && Block.blocksList[var5].canPlaceTorchOnTop(par1World, par2, par3, par4));
   }
 }
 @Override
 @SideOnly(Side.CLIENT)
 public void randomDisplayTick(World world, int x, int y, int z, Random random) {
   if (world.canLightningStrikeAt(x, y + 1, z)
       && !world.doesBlockHaveSolidTopSurface(x, y - 1, z)
       && random.nextInt(15) == 1) {
     double d0 = x + random.nextFloat();
     double d1 = y - 0.05D;
     double d2 = z + random.nextFloat();
     world.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D);
   }
 }
 @Override
 public void randomDisplayTick(World world, int x, int y, int z, Random random) {
   if ((world.canLightningStrikeAt(x, y + 1, z))
       && (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z))
       && (random.nextInt(15) == 1)) {
     double d0 = x + random.nextFloat();
     double d1 = y - 0.05D;
     double d2 = z + random.nextFloat();
     world.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D);
   }
   super.randomDisplayTick(world, x, y, z, random);
 }
  @SideOnly(Side.CLIENT)

  /** A randomly called display update to be able to add particles or other items for display */
  public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
    if (var1.canLightningStrikeAt(var2, var3 + 1, var4)
        && !var1.doesBlockHaveSolidTopSurface(var2, var3 - 1, var4)
        && var5.nextInt(15) == 1) {
      double var6 = (double) ((float) var2 + var5.nextFloat());
      double var8 = (double) var3 - 0.05D;
      double var10 = (double) ((float) var4 + var5.nextFloat());
      var1.spawnParticle("dripWater", var6, var8, var10, 0.0D, 0.0D, 0.0D);
    }
  }
Exemple #11
0
  @SideOnly(Side.CLIENT)

  /** A randomly called display update to be able to add particles or other items for display */
  public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
    if (par1World.canLightningStrikeAt(par2, par3 + 1, par4)
        && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)
        && par5Random.nextInt(15) == 1) {
      double d0 = (double) ((float) par2 + par5Random.nextFloat());
      double d1 = (double) par3 - 0.05D;
      double d2 = (double) ((float) par4 + par5Random.nextFloat());
      par1World.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D);
    }
  }
 public void onBlockAdded(World par1World, int par2, int par3, int par4) {
   /** Change these to your portal frame and Portal block * */
   if ((par1World.getBlockId(par2, par3 - 1, par4) != Block.blockDiamond.blockID)
       || (!Main.TutorialPortal1.tryToCreatePortal(par1World, par2, par3, par4))) {
     if ((!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4))
         && (!canNeighborBurn(par1World, par2, par3, par4))) {
       par1World.setBlockToAir(par2, par3, par4);
     } else {
       par1World.scheduleBlockUpdate(
           par2, par3, par4, this.blockID, tickRate(par1World) + par1World.rand.nextInt(10));
     }
   }
 }
  /** Updates the task */
  public void updateTask() {
    this.thePet
        .getLookHelper()
        .setLookPositionWithEntity(
            this.theOwner, 10.0F, (float) this.thePet.getVerticalFaceSpeed());

    if (!this.thePet.isSitting()) {
      if (--this.field_75343_h <= 0) {
        this.field_75343_h = 10;

        if (!this.petPathfinder.tryMoveToEntityLiving(this.theOwner, this.field_75336_f)) {
          if (!this.thePet.getLeashed()) {
            if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D) {
              int var1 = MathHelper.floor_double(this.theOwner.posX) - 2;
              int var2 = MathHelper.floor_double(this.theOwner.posZ) - 2;
              int var3 = MathHelper.floor_double(this.theOwner.getEntityBoundingBox().minY);

              for (int var4 = 0; var4 <= 4; ++var4) {
                for (int var5 = 0; var5 <= 4; ++var5) {
                  if ((var4 < 1 || var5 < 1 || var4 > 3 || var5 > 3)
                      && World.doesBlockHaveSolidTopSurface(
                          this.theWorld, new BlockPos(var1 + var4, var3 - 1, var2 + var5))
                      && !this.theWorld
                          .getBlockState(new BlockPos(var1 + var4, var3, var2 + var5))
                          .getBlock()
                          .isFullCube()
                      && !this.theWorld
                          .getBlockState(new BlockPos(var1 + var4, var3 + 1, var2 + var5))
                          .getBlock()
                          .isFullCube()) {
                    this.thePet.setLocationAndAngles(
                        (double) ((float) (var1 + var4) + 0.5F),
                        (double) var3,
                        (double) ((float) (var2 + var5) + 0.5F),
                        this.thePet.rotationYaw,
                        this.thePet.rotationPitch);
                    this.petPathfinder.clearPathEntity();
                    return;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  /**
   * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed
   * (coordinates passed are their own) Args: x, y, z, neighbor Block
   */
  public void onNeighborBlockChange(
      World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) {
    int l = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_);

    if ((l & 8) == 0) {
      boolean flag = false;

      if (p_149695_1_.getBlock(p_149695_2_, p_149695_3_ + 1, p_149695_4_) != this) {
        p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_);
        flag = true;
      }

      if (!World.doesBlockHaveSolidTopSurface(
          p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_)) {
        p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_);
        flag = true;

        if (p_149695_1_.getBlock(p_149695_2_, p_149695_3_ + 1, p_149695_4_) == this) {
          p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_ + 1, p_149695_4_);
        }
      }

      if (flag) {
        if (!p_149695_1_.isRemote) {
          this.dropBlockAsItem(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, l, 0);
        }
      } else {
        boolean flag1 =
            p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_, p_149695_4_)
                || p_149695_1_.isBlockIndirectlyGettingPowered(
                    p_149695_2_, p_149695_3_ + 1, p_149695_4_);

        if ((flag1 || p_149695_5_.canProvidePower()) && p_149695_5_ != this) {
          this.func_150014_a(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, flag1);
        }
      }
    } else {
      if (p_149695_1_.getBlock(p_149695_2_, p_149695_3_ - 1, p_149695_4_) != this) {
        p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_);
      }

      if (p_149695_5_ != this) {
        this.onNeighborBlockChange(
            p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_, p_149695_5_);
      }
    }
  }
 /** Ticks the block if it's been scheduled */
 public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
   super.updateTick(par1World, par2, par3, par4, par5Random);
   if (par1World.provider.isSurfaceWorld()
       && par5Random.nextInt(2000) < par1World.difficultySetting) {
     int l;
     for (l = par3; !par1World.doesBlockHaveSolidTopSurface(par2, l, par4) && l > 0; --l) {;
     }
     if (l > 0 && !par1World.isBlockNormalCube(par2, l + 1, par4)) {
       Entity entity =
           ItemMonsterPlacer.spawnCreature(
               par1World, 57, (double) par2 + 0.5D, (double) l + 1.1D, (double) par4 + 0.5D);
       if (entity != null) {
         entity.timeUntilPortal = entity.getPortalCooldown();
       }
     }
   }
 }
  @Override
  public void useDoomsday(
      DoomsdayEffect effect, PropertyDoom doom, EntityPlayer player, boolean crucMoment) {

    double radius = crucMoment ? 8.0D : 4.0D;
    List list =
        WorldHelper.getBlocksInSphericalRange(
            player.worldObj, radius, player.posX, player.posY, player.posZ);
    List list2 =
        player.worldObj.getEntitiesWithinAABBExcludingEntity(
            player, player.boundingBox.expand(radius, radius, radius));

    Block block;
    int[] coords;

    for (int i = 0; i < list2.size(); i++) {
      if (list2.get(i) instanceof EntityMob)
        ((EntityLivingBase) list2.get(i))
            .addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 120, 1));
    }

    for (int i = 0; i < list.size(); i++) {
      coords = (int[]) list.get(i);
      block = player.worldObj.getBlock(coords[0], coords[1], coords[2]);

      if (block == Blocks.lava) {
        player.worldObj.setBlock(coords[0], coords[1], coords[2], Blocks.obsidian);
      } else if (block == Blocks.water) {
        player.worldObj.setBlock(coords[0], coords[1], coords[2], Blocks.ice);
      } else if (block == Blocks.ice) {
        player.worldObj.setBlock(coords[0], coords[1], coords[2], Blocks.packed_ice);
      } else if (block instanceof BlockBush || block instanceof BlockLeaves) {
        player.worldObj.setBlockToAir(coords[0], coords[1], coords[2]);
      } else if (block == Blocks.air
          && World.doesBlockHaveSolidTopSurface(
              player.worldObj, coords[0], coords[1] - 1, coords[2])
          && rand.nextBoolean()) {
        player.worldObj.setBlock(
            coords[0], coords[1], coords[2], Blocks.snow_layer, rand.nextInt(8), 2);
      }
    }

    if (crucMoment) addCrucialMessage(player);
  }
  public void updateTask() {
    this.pet
        .getLookHelper()
        .setLookPositionWithEntity(owner, 10.0F, (float) this.pet.getVerticalFaceSpeed());
    if (--this.tickCount <= 0) {
      this.tickCount = 10;
      if (!this.petPathFinder.tryMoveToEntityLiving(this.owner, this.followSpeed)) {
        if (!this.pet.getLeashed()) {
          if (this.pet.getDistanceSqToEntity(this.owner) >= 144.0D) {
            int i = MathHelper.floor_double(this.owner.posX) - 2;
            int j = MathHelper.floor_double(this.owner.posZ) - 2;
            int k = MathHelper.floor_double(this.owner.getEntityBoundingBox().minY);

            for (int l = 0; l <= 4; ++l) {
              for (int i1 = 0; i1 <= 4; ++i1) {
                if ((l < 1 || i1 < 1 || l > 3 || i1 > 3)
                    && World.doesBlockHaveSolidTopSurface(
                        this.world, new BlockPos(i + l, k - 1, j + i1))
                    && !this.world
                        .getBlockState(new BlockPos(i + l, k, j + i1))
                        .getBlock()
                        .isFullCube()
                    && !this.world
                        .getBlockState(new BlockPos(i + l, k + 1, j + i1))
                        .getBlock()
                        .isFullCube()) {
                  this.pet.setLocationAndAngles(
                      (double) ((float) (i + l) + 0.5F),
                      (double) k,
                      (double) ((float) (j + i1) + 0.5F),
                      this.pet.rotationYaw,
                      this.pet.rotationPitch);
                  this.petPathFinder.clearPathEntity();
                  return;
                }
              }
            }
          }
        }
      }
    }
  }
Exemple #18
0
  public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
    if (((Boolean) state.getValue(WET_PROP)).booleanValue()) {
      EnumFacing var5 = EnumFacing.random(rand);

      if (var5 != EnumFacing.UP && !World.doesBlockHaveSolidTopSurface(worldIn, pos.offset(var5))) {
        double var6 = (double) pos.getX();
        double var8 = (double) pos.getY();
        double var10 = (double) pos.getZ();

        if (var5 == EnumFacing.DOWN) {
          var8 -= 0.05D;
          var6 += rand.nextDouble();
          var10 += rand.nextDouble();
        } else {
          var8 += rand.nextDouble() * 0.8D;

          if (var5.getAxis() == EnumFacing.Axis.X) {
            var10 += rand.nextDouble();

            if (var5 == EnumFacing.EAST) {
              ++var6;
            } else {
              var6 += 0.05D;
            }
          } else {
            var6 += rand.nextDouble();

            if (var5 == EnumFacing.SOUTH) {
              ++var10;
            } else {
              var10 += 0.05D;
            }
          }
        }

        worldIn.spawnParticle(
            EnumParticleTypes.DRIP_WATER, var6, var8, var10, 0.0D, 0.0D, 0.0D, new int[0]);
      }
    }
  }
  @Override
  public void updateTask() {
    theRobit
        .getLookHelper()
        .setLookPositionWithEntity(theOwner, 6.0F, theRobit.getVerticalFaceSpeed() / 10);

    if (theRobit.getFollowing()) {
      if (--ticker <= 0) {
        ticker = 10;

        if (!thePathfinder.tryMoveToEntityLiving(theOwner, moveSpeed)) {
          if (theRobit.getDistanceSqToEntity(theOwner) >= 144.0D) {
            int x = MathHelper.floor_double(theOwner.posX) - 2;
            int y = MathHelper.floor_double(theOwner.posZ) - 2;
            int z = MathHelper.floor_double(theOwner.boundingBox.minY);

            for (int l = 0; l <= 4; ++l) {
              for (int i1 = 0; i1 <= 4; ++i1) {
                if ((l < 1 || i1 < 1 || l > 3 || i1 > 3)
                    && theWorld.doesBlockHaveSolidTopSurface(theWorld, x + l, z - 1, y + i1)
                    && !theWorld.getBlock(x + l, z, y + i1).isNormalCube()
                    && !theWorld.getBlock(x + l, z + 1, y + i1).isNormalCube()) {
                  theRobit.setLocationAndAngles(
                      (x + l) + 0.5F,
                      z,
                      (y + i1) + 0.5F,
                      theRobit.rotationYaw,
                      theRobit.rotationPitch);
                  thePathfinder.clearPathEntity();
                  return;
                }
              }
            }
          }
        }
      }
    }
  }
 @SideOnly(Side.CLIENT)
 public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
   if (par5Random.nextInt(24) == 0) {
     par1World.playSound(
         par2 + 0.5F,
         par3 + 0.5F,
         par4 + 0.5F,
         "fire.fire",
         1.0F + par5Random.nextFloat(),
         par5Random.nextFloat() * 0.7F + 0.3F,
         false);
   }
   if ((!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4))
       && (!Main.TutorialFire1.canBlockCatchFire(
           par1World, par2, par3 - 1, par4, ForgeDirection.UP))) {
     if (Main.TutorialFire1.canBlockCatchFire(
         par1World, par2 - 1, par3, par4, ForgeDirection.EAST)) {
       for (int l = 0; l < 2; l++) {
         float f = par2 + par5Random.nextFloat() * 0.1F;
         float f1 = par3 + par5Random.nextFloat();
         float f2 = par4 + par5Random.nextFloat();
         par1World.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
       }
     }
     if (Main.TutorialFire1.canBlockCatchFire(
         par1World, par2 + 1, par3, par4, ForgeDirection.WEST)) {
       for (int l = 0; l < 2; l++) {
         float f = par2 + 1 - par5Random.nextFloat() * 0.1F;
         float f1 = par3 + par5Random.nextFloat();
         float f2 = par4 + par5Random.nextFloat();
         par1World.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
       }
     }
     if (Main.TutorialFire1.canBlockCatchFire(
         par1World, par2, par3, par4 - 1, ForgeDirection.SOUTH)) {
       for (int l = 0; l < 2; l++) {
         float f = par2 + par5Random.nextFloat();
         float f1 = par3 + par5Random.nextFloat();
         float f2 = par4 + par5Random.nextFloat() * 0.1F;
         par1World.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
       }
     }
     if (Main.TutorialFire1.canBlockCatchFire(
         par1World, par2, par3, par4 + 1, ForgeDirection.NORTH)) {
       for (int l = 0; l < 2; l++) {
         float f = par2 + par5Random.nextFloat();
         float f1 = par3 + par5Random.nextFloat();
         float f2 = par4 + 1 - par5Random.nextFloat() * 0.1F;
         par1World.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
       }
     }
     if (Main.TutorialFire1.canBlockCatchFire(
         par1World, par2, par3 + 1, par4, ForgeDirection.DOWN)) {
       for (int l = 0; l < 2; l++) {
         float f = par2 + par5Random.nextFloat();
         float f1 = par3 + 1 - par5Random.nextFloat() * 0.1F;
         float f2 = par4 + par5Random.nextFloat();
         par1World.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
       }
     }
   } else {
     for (int l = 0; l < 3; l++) {
       float f = par2 + par5Random.nextFloat();
       float f1 = par3 + par5Random.nextFloat() * 0.5F + 0.5F;
       float f2 = par4 + par5Random.nextFloat();
       par1World.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D);
     }
   }
 }
Exemple #21
0
 /**
  * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
  */
 public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
   int var5 = par1World.getBlockId(par2, par3, par4);
   return (var5 == 0 || Block.blocksList[var5].blockMaterial.isReplaceable())
       && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4);
 }
Exemple #22
0
 /**
  * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
  */
 public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
   return par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)
       || par1World.getBlockId(par2, par3 - 1, par4) == Block.glowStone.blockID;
 }
  /** Called when the entity is attacked. */
  public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) {
    if (!super.attackEntityFrom(par1DamageSource, par2)) {
      return false;
    } else {
      EntityLivingBase entitylivingbase = this.getAttackTarget();

      if (entitylivingbase == null && this.getEntityToAttack() instanceof EntityLivingBase) {
        entitylivingbase = (EntityLivingBase) this.getEntityToAttack();
      }

      if (entitylivingbase == null && par1DamageSource.getEntity() instanceof EntityLivingBase) {
        entitylivingbase = (EntityLivingBase) par1DamageSource.getEntity();
      }

      int i = MathHelper.floor_double(this.posX);
      int j = MathHelper.floor_double(this.posY);
      int k = MathHelper.floor_double(this.posZ);

      SummonAidEvent summonAid =
          ForgeEventFactory.fireZombieSummonAid(
              this,
              worldObj,
              i,
              j,
              k,
              entitylivingbase,
              this.getEntityAttribute(field_110186_bp).getAttributeValue());

      if (summonAid.getResult() == Result.DENY) {
        return true;
      } else if (summonAid.getResult() == Result.ALLOW
          || entitylivingbase != null
              && this.worldObj.difficultySetting == EnumDifficulty.HARD
              && (double) this.rand.nextFloat()
                  < this.getEntityAttribute(field_110186_bp).getAttributeValue()) {
        EntityZombie entityzombie;
        if (summonAid.customSummonedAid != null && summonAid.getResult() == Result.ALLOW) {
          entityzombie = summonAid.customSummonedAid;
        } else {
          entityzombie = new EntityZombie(this.worldObj);
        }

        for (int l = 0; l < 50; ++l) {
          int i1 =
              i
                  + MathHelper.getRandomIntegerInRange(this.rand, 7, 40)
                      * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);
          int j1 =
              j
                  + MathHelper.getRandomIntegerInRange(this.rand, 7, 40)
                      * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);
          int k1 =
              k
                  + MathHelper.getRandomIntegerInRange(this.rand, 7, 40)
                      * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);

          if (World.doesBlockHaveSolidTopSurface(this.worldObj, i1, j1 - 1, k1)
              && this.worldObj.getBlockLightValue(i1, j1, k1) < 10) {
            entityzombie.setPosition((double) i1, (double) j1, (double) k1);

            if (this.worldObj.checkNoEntityCollision(entityzombie.boundingBox)
                && this.worldObj
                    .getCollidingBoundingBoxes(entityzombie, entityzombie.boundingBox)
                    .isEmpty()
                && !this.worldObj.isAnyLiquid(entityzombie.boundingBox)) {
              this.worldObj.spawnEntityInWorld(entityzombie);
              if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase);
              entityzombie.onSpawnWithEgg((IEntityLivingData) null);
              this.getEntityAttribute(field_110186_bp)
                  .applyModifier(
                      new AttributeModifier(
                          "Zombie reinforcement caller charge", -0.05000000074505806D, 0));
              entityzombie
                  .getEntityAttribute(field_110186_bp)
                  .applyModifier(
                      new AttributeModifier(
                          "Zombie reinforcement callee charge", -0.05000000074505806D, 0));
              break;
            }
          }
        }
      }

      return true;
    }
  }
 public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) {
   if ((!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4))
       && (!canNeighborBurn(par1World, par2, par3, par4))) {
     par1World.setBlockToAir(par2, par3, par4);
   }
 }
  @Override
  public void onLivingUpdate() {
    this.rotationYaw = this.rotationPitch = this.prevRotationPitch = this.prevRotationYaw = 0;
    this.motionX = this.motionZ = 0D;
    this.motionY = -1D;
    super.onLivingUpdate();

    if (this.worldObj.isRemote) return;

    EntitySeeker seek;
    for (int i = 0; i < this.seekers.size(); i++) {
      seek = this.seekers.get(i);
      if (seek.isDead || seek.getHealth() <= 0 || this.getDistanceToEntity(seek) >= 32.0)
        this.seekers.remove(seek);
    }

    List<EntitySeeker> lst =
        this.worldObj.getEntitiesWithinAABB(
            EntitySeeker.class, this.getEntityBoundingBox().expand(32.0, 32.0, 32.0));

    for (EntitySeeker sk : lst) {
      if (sk.getOwner() == null) {
        sk.setOwner(this);
        this.seekers.add(sk);
      } else if (sk.getOwner() == this && !this.seekers.contains(sk)) {
        this.seekers.add(sk);
      }
    }

    if (this.seekers.isEmpty()
        && this.ticksExisted % 100 == 0
        && !TragicConfig.getBoolean("overlordPhases")) this.spawnSeekers();

    if (this.seekers.isEmpty()
        && this.getPhaseTicks() == 0
        && this.deathTime == 0
        && TragicConfig.getBoolean("overlordPhases")) this.setPhaseTicks(200);

    if (this.getPhaseTicks() > 0 && TragicConfig.getBoolean("overlordPhases")) {
      this.setPhaseTicks(this.getPhaseTicks() - 1);

      if (TragicConfig.getBoolean("overlordGas")) {
        List<BlockPos> lst2 =
            WorldHelper.getBlocksInSphericalRange(
                this.worldObj,
                3.5,
                this.posX + rand.nextInt(4) - rand.nextInt(4),
                this.posY,
                this.posZ + rand.nextInt(4) - rand.nextInt(4));
        for (BlockPos coords : lst2) {
          if (World.doesBlockHaveSolidTopSurface(this.worldObj, coords.down())
              && EntityOverlordCore.replaceableBlocks.contains(
                  this.worldObj.getBlockState(coords).getBlock())) {
            this.worldObj.setBlockState(coords, TragicBlocks.CorruptedGas.getDefaultState());
          }
        }
      }

      if (this.phaseChange) {
        this.phaseChange = false;
        this.setPhaseTicks(0);
        for (EntitySeeker sk : this.seekers) sk.setDead();
        this.spawnSeekers();
        this.phaseDamage = 0F;

        if (this.getHealth() > 0F) {
          float f = this.getMaxHealth() / 5;
          switch (this.getCurrentPhase()) {
            case 0:
              f *= 4;
              break;
            case 1:
              f *= 3;
              break;
            case 2:
              f *= 2;
              break;
            case 3:
              break;
            case 4:
              f = 0;
              break;
            default:
              break;
          }
          this.setHealth(f);
        }

        if (TragicConfig.getBoolean("allowDivinity")) {
          List<Entity> list =
              this.worldObj.getEntitiesWithinAABBExcludingEntity(
                  this, this.getEntityBoundingBox().expand(64.0, 64.0, 64.0));
          for (Entity e : list) {
            if (e instanceof EntityLivingBase
                && ((EntityLivingBase) e).isPotionActive(TragicPotion.Divinity))
              ((EntityLivingBase) e).removePotionEffect(TragicPotion.Divinity.id);
          }
        }
        if (TragicConfig.getBoolean("allowMobSounds"))
          this.worldObj.playSoundAtEntity(
              this, "tragicmc:boss.overlordcocoon.phasecomplete", 1.8F, 1.0F);
      } else {
        if (this.getPhaseTicks() == 199) {
          if (TragicConfig.getBoolean("allowDivinity")) {
            List<Entity> list =
                this.worldObj.getEntitiesWithinAABBExcludingEntity(
                    this, this.getEntityBoundingBox().expand(64.0, 64.0, 64.0));
            for (Entity e : list) {
              if (e instanceof EntityLivingBase
                  && !((EntityLivingBase) e).isPotionActive(TragicPotion.Divinity))
                ((EntityLivingBase) e)
                    .addPotionEffect(new PotionEffect(TragicPotion.Divinity.id, 200));
            }
          }
        }

        if (this.getPhaseTicks() == 0) {
          if (this.getHealth() > 0F) {
            float f = this.getMaxHealth() / 5;
            switch (this.getCurrentPhase()) {
              case 0:
                f *= 5;
                break;
              case 1:
                f *= 4;
                break;
              case 2:
                f *= 3;
                break;
              case 3:
                f *= 2;
                break;
              case 4:
              default:
                break;
            }
            this.setHealth(f);
          }
          this.phaseDamage = 0F;

          for (EntitySeeker sk : this.seekers) sk.setDead();
          this.spawnSeekers();

          if (TragicConfig.getBoolean("allowDivinity")) {
            List<Entity> list =
                this.worldObj.getEntitiesWithinAABBExcludingEntity(
                    this, this.getEntityBoundingBox().expand(64.0, 64.0, 64.0));
            for (Entity e : list) {
              if (e instanceof EntityLivingBase
                  && ((EntityLivingBase) e).isPotionActive(TragicPotion.Divinity))
                ((EntityLivingBase) e).removePotionEffect(TragicPotion.Divinity.id);
            }
          }

          if (TragicConfig.getBoolean("allowMobSounds"))
            this.worldObj.playSoundAtEntity(
                this, "tragicmc:boss.overlordcocoon.phasefail", 1.8F, 1.0F);
        }

        if (TragicConfig.getBoolean("allowMobSounds") && this.getPhaseTicks() % 10 == 0)
          this.worldObj.playSoundAtEntity(this, "tragicmc:boss.overlordcocoon.wah", 1.4F, 1.0F);
      }
    }
  }
  public boolean renderGreekFire(
      IBlockAccess blockAccess,
      BlockGreekFire block,
      int p_147801_2_,
      int p_147801_3_,
      int p_147801_4_) {
    Tessellator tessellator = Tessellator.instance;
    IIcon iicon = block.getFireIcon(0);
    IIcon iicon1 = block.getFireIcon(1);
    IIcon iicon2 = iicon;

    tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
    tessellator.setBrightness(
        block.getMixedBrightnessForBlock(blockAccess, p_147801_2_, p_147801_3_, p_147801_4_));
    double d0 = (double) iicon2.getMinU();
    double d1 = (double) iicon2.getMinV();
    double d2 = (double) iicon2.getMaxU();
    double d3 = (double) iicon2.getMaxV();
    float f = 1.4F;
    double d5;
    double d6;
    double d7;
    double d8;
    double d9;
    double d10;
    double d11;

    if (!World.doesBlockHaveSolidTopSurface(blockAccess, p_147801_2_, p_147801_3_ - 1, p_147801_4_)
        && !block.canCatchFire(blockAccess, p_147801_2_, p_147801_3_ - 1, p_147801_4_, UP)) {
      float f2 = 0.2F;
      float f1 = 0.0625F;
      boolean sides = false;

      if ((p_147801_2_ + p_147801_3_ + p_147801_4_ & 1) == 1) {
        d0 = (double) iicon1.getMinU();
        d1 = (double) iicon1.getMinV();
        d2 = (double) iicon1.getMaxU();
        d3 = (double) iicon1.getMaxV();
      }

      if ((p_147801_2_ / 2 + p_147801_3_ / 2 + p_147801_4_ / 2 & 1) == 1) {
        d5 = d2;
        d2 = d0;
        d0 = d5;
      }

      if (block.canCatchFire(blockAccess, p_147801_2_ - 1, p_147801_3_, p_147801_4_, EAST)) {
        sides = true;
        tessellator.addVertexWithUV(
            (double) ((float) p_147801_2_ + f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) ((float) p_147801_2_ + f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d1);
        tessellator.addVertexWithUV(
            (double) ((float) p_147801_2_ + f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) ((float) p_147801_2_ + f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d1);
      }

      if (block.canCatchFire(blockAccess, p_147801_2_ + 1, p_147801_3_, p_147801_4_, WEST)) {
        sides = true;
        tessellator.addVertexWithUV(
            (double) ((float) (p_147801_2_ + 1) - f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1 - 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1 - 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) ((float) (p_147801_2_ + 1) - f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d1);
        tessellator.addVertexWithUV(
            (double) ((float) (p_147801_2_ + 1) - f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1 - 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1 - 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) ((float) (p_147801_2_ + 1) - f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d1);
      }

      if (block.canCatchFire(blockAccess, p_147801_2_, p_147801_3_, p_147801_4_ - 1, SOUTH)) {
        sides = true;
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) p_147801_4_ + f2),
            d2,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) p_147801_4_ + f2),
            d0,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) p_147801_4_ + f2),
            d0,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) p_147801_4_ + f2),
            d2,
            d1);
      }

      if (block.canCatchFire(blockAccess, p_147801_2_, p_147801_3_, p_147801_4_ + 1, NORTH)) {
        sides = true;
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) (p_147801_4_ + 1) - f2),
            d0,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1 - 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1 - 0),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) (p_147801_4_ + 1) - f2),
            d2,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) (p_147801_4_ + 1) - f2),
            d2,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1 - 0),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1 - 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) (p_147801_4_ + 1) - f2),
            d0,
            d1);
      }

      if (block.canCatchFire(blockAccess, p_147801_2_, p_147801_3_ + 1, p_147801_4_, DOWN)) {
        sides = true;
        d5 = (double) p_147801_2_ + 0.5D + 0.5D;
        d6 = (double) p_147801_2_ + 0.5D - 0.5D;
        d7 = (double) p_147801_4_ + 0.5D + 0.5D;
        d8 = (double) p_147801_4_ + 0.5D - 0.5D;
        d9 = (double) p_147801_2_ + 0.5D - 0.5D;
        d10 = (double) p_147801_2_ + 0.5D + 0.5D;
        d11 = (double) p_147801_4_ + 0.5D - 0.5D;
        double d12 = (double) p_147801_4_ + 0.5D + 0.5D;
        d0 = (double) iicon.getMinU();
        d1 = (double) iicon.getMinV();
        d2 = (double) iicon.getMaxU();
        d3 = (double) iicon.getMaxV();
        ++p_147801_3_;
        f = -0.2F;

        if ((p_147801_2_ + p_147801_3_ + p_147801_4_ & 1) == 0) {
          tessellator.addVertexWithUV(
              d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d2, d1);
          tessellator.addVertexWithUV(
              d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d2, d3);
          tessellator.addVertexWithUV(
              d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d0, d3);
          tessellator.addVertexWithUV(
              d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d0, d1);
          d0 = (double) iicon1.getMinU();
          d1 = (double) iicon1.getMinV();
          d2 = (double) iicon1.getMaxU();
          d3 = (double) iicon1.getMaxV();
          tessellator.addVertexWithUV(
              d10, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d2, d1);
          tessellator.addVertexWithUV(
              d6, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d2, d3);
          tessellator.addVertexWithUV(
              d6, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d0, d3);
          tessellator.addVertexWithUV(
              d10, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d0, d1);
        } else {
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d12, d2, d1);
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d8, d2, d3);
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d8, d0, d3);
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d12, d0, d1);
          d0 = (double) iicon1.getMinU();
          d1 = (double) iicon1.getMinV();
          d2 = (double) iicon1.getMaxU();
          d3 = (double) iicon1.getMaxV();
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d11, d2, d1);
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d7, d2, d3);
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d7, d0, d3);
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d11, d0, d1);
        }
      }
      if (!sides) {
        double d4 = (double) p_147801_2_ + 0.5D + 0.2D;
        d5 = (double) p_147801_2_ + 0.5D - 0.2D;
        d6 = (double) p_147801_4_ + 0.5D + 0.2D;
        d7 = (double) p_147801_4_ + 0.5D - 0.2D;
        d8 = (double) p_147801_2_ + 0.5D - 0.3D;
        d9 = (double) p_147801_2_ + 0.5D + 0.3D;
        d10 = (double) p_147801_4_ + 0.5D - 0.3D;
        d11 = (double) p_147801_4_ + 0.5D + 0.3D;
        tessellator.addVertexWithUV(
            d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d2, d1);
        tessellator.addVertexWithUV(
            d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d2, d3);
        tessellator.addVertexWithUV(
            d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d0, d3);
        tessellator.addVertexWithUV(
            d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d0, d1);
        tessellator.addVertexWithUV(
            d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d2, d1);
        tessellator.addVertexWithUV(
            d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d2, d3);
        tessellator.addVertexWithUV(
            d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d0, d3);
        tessellator.addVertexWithUV(
            d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d0, d1);
        d0 = (double) iicon1.getMinU();
        d1 = (double) iicon1.getMinV();
        d2 = (double) iicon1.getMaxU();
        d3 = (double) iicon1.getMaxV();
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d11, d2, d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d7, d2, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d7, d0, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d11, d0, d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d10, d2, d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d6, d2, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d6, d0, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d10, d0, d1);
        d4 = (double) p_147801_2_ + 0.5D - 0.5D;
        d5 = (double) p_147801_2_ + 0.5D + 0.5D;
        d6 = (double) p_147801_4_ + 0.5D - 0.5D;
        d7 = (double) p_147801_4_ + 0.5D + 0.5D;
        d8 = (double) p_147801_2_ + 0.5D - 0.4D;
        d9 = (double) p_147801_2_ + 0.5D + 0.4D;
        d10 = (double) p_147801_4_ + 0.5D - 0.4D;
        d11 = (double) p_147801_4_ + 0.5D + 0.4D;
        tessellator.addVertexWithUV(
            d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d0, d1);
        tessellator.addVertexWithUV(
            d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d0, d3);
        tessellator.addVertexWithUV(
            d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d2, d3);
        tessellator.addVertexWithUV(
            d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d2, d1);
        tessellator.addVertexWithUV(
            d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d0, d1);
        tessellator.addVertexWithUV(
            d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d0, d3);
        tessellator.addVertexWithUV(
            d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d2, d3);
        tessellator.addVertexWithUV(
            d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d2, d1);
        d0 = (double) iicon.getMinU();
        d1 = (double) iicon.getMinV();
        d2 = (double) iicon.getMaxU();
        d3 = (double) iicon.getMaxV();
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d11, d0, d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d7, d0, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d7, d2, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d11, d2, d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d10, d0, d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d6, d0, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d6, d2, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d10, d2, d1);
      }
    } else {
      double d4 = (double) p_147801_2_ + 0.5D + 0.2D;
      d5 = (double) p_147801_2_ + 0.5D - 0.2D;
      d6 = (double) p_147801_4_ + 0.5D + 0.2D;
      d7 = (double) p_147801_4_ + 0.5D - 0.2D;
      d8 = (double) p_147801_2_ + 0.5D - 0.3D;
      d9 = (double) p_147801_2_ + 0.5D + 0.3D;
      d10 = (double) p_147801_4_ + 0.5D - 0.3D;
      d11 = (double) p_147801_4_ + 0.5D + 0.3D;
      tessellator.addVertexWithUV(
          d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d2, d1);
      tessellator.addVertexWithUV(
          d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d2, d3);
      tessellator.addVertexWithUV(
          d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d0, d3);
      tessellator.addVertexWithUV(
          d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d0, d1);
      tessellator.addVertexWithUV(
          d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d2, d1);
      tessellator.addVertexWithUV(
          d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d2, d3);
      tessellator.addVertexWithUV(
          d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d0, d3);
      tessellator.addVertexWithUV(
          d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d0, d1);
      d0 = (double) iicon1.getMinU();
      d1 = (double) iicon1.getMinV();
      d2 = (double) iicon1.getMaxU();
      d3 = (double) iicon1.getMaxV();
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d11, d2, d1);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d7, d2, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d7, d0, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d11, d0, d1);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d10, d2, d1);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d6, d2, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d6, d0, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d10, d0, d1);
      d4 = (double) p_147801_2_ + 0.5D - 0.5D;
      d5 = (double) p_147801_2_ + 0.5D + 0.5D;
      d6 = (double) p_147801_4_ + 0.5D - 0.5D;
      d7 = (double) p_147801_4_ + 0.5D + 0.5D;
      d8 = (double) p_147801_2_ + 0.5D - 0.4D;
      d9 = (double) p_147801_2_ + 0.5D + 0.4D;
      d10 = (double) p_147801_4_ + 0.5D - 0.4D;
      d11 = (double) p_147801_4_ + 0.5D + 0.4D;
      tessellator.addVertexWithUV(
          d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d0, d1);
      tessellator.addVertexWithUV(
          d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d0, d3);
      tessellator.addVertexWithUV(
          d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d2, d3);
      tessellator.addVertexWithUV(
          d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d2, d1);
      tessellator.addVertexWithUV(
          d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d0, d1);
      tessellator.addVertexWithUV(
          d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d0, d3);
      tessellator.addVertexWithUV(
          d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d2, d3);
      tessellator.addVertexWithUV(
          d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d2, d1);
      d0 = (double) iicon.getMinU();
      d1 = (double) iicon.getMinV();
      d2 = (double) iicon.getMaxU();
      d3 = (double) iicon.getMaxV();
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d11, d0, d1);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d7, d0, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d7, d2, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d11, d2, d1);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d10, d0, d1);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d6, d0, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d6, d2, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d10, d2, d1);
    }

    return true;
  }
  private boolean placeBlock(
      Minecraft minecraft,
      World world,
      EntityPlayer player,
      int x,
      int y,
      int z,
      int itemId,
      int itemDamage) {
    if (!isValidOrientation(player, x, y, z, itemId, itemDamage)) {
      return false;
    }

    if (SchematicWorld.isFluidContainer(itemId) || itemId == Item.sign.itemID) {
      return false;
    }

    int side = 0;
    float offsetY = 0.0f;
    ForgeDirection direction = ForgeDirection.DOWN;
    boolean[] blocks =
        new boolean[] {
          world.getBlockId(x, y + 1, z) > 0,
          world.getBlockId(x, y - 1, z) > 0,
          world.getBlockId(x, y, z + 1) > 0,
          world.getBlockId(x, y, z - 1) > 0,
          world.getBlockId(x + 1, y, z) > 0,
          world.getBlockId(x - 1, y, z) > 0
        };

    for (int i = 0; i < 6; i++) {
      if (blocks[i]) {
        direction = ForgeDirection.getOrientation(i).getOpposite();
        break;
      }
    }

    if (SchematicWorld.isMetadataSensitive(itemId)) {
      int itemDamageInHand = 0xF;
      if (SchematicWorld.isTorch(itemId)) {
        switch (itemDamage) {
          case 1:
            direction = ForgeDirection.WEST;
            break;
          case 2:
            direction = ForgeDirection.EAST;
            break;
          case 3:
            direction = ForgeDirection.NORTH;
            break;
          case 4:
            direction = ForgeDirection.SOUTH;
            break;
          case 5:
            direction = ForgeDirection.DOWN;
            break;
        }

        if (direction == ForgeDirection.DOWN) {
          if (world.doesBlockHaveSolidTopSurface(x, y - 1, z)) {
            itemDamageInHand = 0;
          }
        } else {
          if (world.isBlockSolidOnSide(
              x + direction.offsetX,
              y + direction.offsetY,
              z + direction.offsetZ,
              direction,
              false)) {
            itemDamageInHand = 0;
          }
        }
      } else if (SchematicWorld.isBlock(itemId)) {
        itemDamageInHand = itemDamage;
      } else if (SchematicWorld.isSlab(itemId)) {
        if ((itemDamage & 0x8) != 0 && direction == ForgeDirection.DOWN) {
          direction = ForgeDirection.UP;
        } else if ((itemDamage & 0x8) == 0 && direction == ForgeDirection.UP) {
          direction = ForgeDirection.DOWN;
        }
        offsetY = (itemDamage & 0x8) == 0x0 ? 0.0f : 1.0f;
        itemDamageInHand = itemDamage & 0x7;
      } else if (SchematicWorld.isPistonBase(itemId)) {
        itemDamageInHand = 0;
      } else if (SchematicWorld.isDoubleSlab(itemId)) {
        itemDamageInHand = itemDamage;
      } else if (SchematicWorld.isContainer(itemId)) {
        itemDamageInHand = 0;
      } else if (SchematicWorld.isButton(itemId)) {
        switch (itemDamage & 0x7) {
          case 0x1:
            direction = ForgeDirection.WEST;
            break;
          case 0x2:
            direction = ForgeDirection.EAST;
            break;
          case 0x3:
            direction = ForgeDirection.NORTH;
            break;
          case 0x4:
            direction = ForgeDirection.SOUTH;
            break;
          default:
            return false;
        }

        if (world.isBlockSolidOnSide(
            x + direction.offsetX,
            y + direction.offsetY,
            z + direction.offsetZ,
            direction,
            false)) {
          itemDamageInHand = 0;
        } else {
          return false;
        }
      } else if (SchematicWorld.isPumpkin(itemId)) {
        if (world.doesBlockHaveSolidTopSurface(x, y - 1, z)) {
          itemDamageInHand = 0;
        } else {
          return false;
        }
      } else if (itemId == Item.redstoneRepeater.itemID) {
        itemDamageInHand = 0;
      } else if (itemId == Block.anvil.blockID) {
        switch (itemDamage & 0xC) {
          case 0x0:
            itemDamageInHand = 0;
            break;
          case 0x4:
            itemDamageInHand = 1;
            break;
          case 0x8:
            itemDamageInHand = 2;
            break;
          default:
            return false;
        }
      } else if (itemId == Block.fenceGate.blockID) {
        itemDamageInHand = 0;
      } else if (itemId == Block.trapdoor.blockID) {
        switch (itemDamage & 0x3) {
          case 0x0:
            direction = ForgeDirection.SOUTH;
            break;
          case 0x1:
            direction = ForgeDirection.NORTH;
            break;
          case 0x2:
            direction = ForgeDirection.EAST;
            break;
          case 0x3:
            direction = ForgeDirection.WEST;
            break;
          default:
            return false;
        }

        if ((itemDamage & 0x8) != 0) {
          offsetY = 0.75f;
        }

        if (world.isBlockSolidOnSide(
            x + direction.offsetX,
            y + direction.offsetY,
            z + direction.offsetZ,
            direction,
            false)) {
          itemDamageInHand = 0;
        } else {
          return false;
        }
      } else {
        return false;
      }

      if (!swapToItem(player.inventory, itemId, itemDamageInHand)) {
        return false;
      }
    } else {
      if (!swapToItem(player.inventory, itemId)) {
        return false;
      }

      if (SchematicWorld.isStair(itemId)) {
        direction = (itemDamage & 0x4) == 0x0 ? ForgeDirection.DOWN : ForgeDirection.UP;
      } else if (Block.wood.blockID == itemId) {
        if ((itemDamage & 0xC) == 0x00) {
          direction = ForgeDirection.DOWN;
        } else if ((itemDamage & 0xC) == 0x04) {
          direction = ForgeDirection.EAST;
        } else if ((itemDamage & 0xC) == 0x08) {
          direction = ForgeDirection.NORTH;
        }
      }
    }

    side = getSide(direction);
    if (side != 255 && blocks[side] || !this.settings.placeAdjacent) {
      return placeBlock(minecraft, world, player, x, y, z, direction, 0.0f, offsetY, 0.0f);
    }

    return false;
  }
 public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
   if (par1World.getGameRules().getGameRuleBooleanValue("doFireTick")) {
     Block base = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
     boolean flag =
         (base != null)
             && (base.isFireSource(
                 par1World,
                 par2,
                 par3 - 1,
                 par4,
                 par1World.getBlockMetadata(par2, par3 - 1, par4),
                 ForgeDirection.UP));
     if (!canPlaceBlockAt(par1World, par2, par3, par4)) {
       par1World.setBlockToAir(par2, par3, par4);
     }
     if ((!flag)
         && (par1World.isRaining())
         && ((par1World.canLightningStrikeAt(par2, par3, par4))
             || (par1World.canLightningStrikeAt(par2 - 1, par3, par4))
             || (par1World.canLightningStrikeAt(par2 + 1, par3, par4))
             || (par1World.canLightningStrikeAt(par2, par3, par4 - 1))
             || (par1World.canLightningStrikeAt(par2, par3, par4 + 1)))) {
       par1World.setBlockToAir(par2, par3, par4);
     } else {
       int l = par1World.getBlockMetadata(par2, par3, par4);
       if (l < 15) {
         par1World.setBlockMetadataWithNotify(par2, par3, par4, l + par5Random.nextInt(3) / 2, 4);
       }
       par1World.scheduleBlockUpdate(
           par2, par3, par4, this.blockID, tickRate(par1World) + par5Random.nextInt(10));
       if ((!flag) && (!canNeighborBurn(par1World, par2, par3, par4))) {
         if ((!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) || (l > 3)) {
           par1World.setBlockToAir(par2, par3, par4);
         }
       } else if ((!flag)
           && (!canBlockCatchFire(par1World, par2, par3 - 1, par4, ForgeDirection.UP))
           && (l == 15)
           && (par5Random.nextInt(4) == 0)) {
         par1World.setBlockToAir(par2, par3, par4);
       } else {
         boolean flag1 = par1World.isBlockHighHumidity(par2, par3, par4);
         byte b0 = 0;
         if (flag1) {
           b0 = -50;
         }
         tryToCatchBlockOnFire(
             par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l, ForgeDirection.WEST);
         tryToCatchBlockOnFire(
             par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l, ForgeDirection.EAST);
         tryToCatchBlockOnFire(
             par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l, ForgeDirection.UP);
         tryToCatchBlockOnFire(
             par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l, ForgeDirection.DOWN);
         tryToCatchBlockOnFire(
             par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l, ForgeDirection.SOUTH);
         tryToCatchBlockOnFire(
             par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l, ForgeDirection.NORTH);
         for (int i1 = par2 - 1; i1 <= par2 + 1; i1++) {
           for (int j1 = par4 - 1; j1 <= par4 + 1; j1++) {
             for (int k1 = par3 - 1; k1 <= par3 + 4; k1++) {
               if ((i1 != par2) || (k1 != par3) || (j1 != par4)) {
                 int l1 = 100;
                 if (k1 > par3 + 1) {
                   l1 += (k1 - (par3 + 1)) * 100;
                 }
                 int i2 = getChanceOfNeighborsEncouragingFire(par1World, i1, k1, j1);
                 if (i2 > 0) {
                   int j2 = (i2 + 40 + par1World.difficultySetting * 7) / (l + 30);
                   if (flag1) {
                     j2 /= 2;
                   }
                   if ((j2 > 0)
                       && (par5Random.nextInt(l1) <= j2)
                       && ((!par1World.isRaining())
                           || (!par1World.canLightningStrikeAt(i1, k1, j1)))
                       && (!par1World.canLightningStrikeAt(i1 - 1, k1, par4))
                       && (!par1World.canLightningStrikeAt(i1 + 1, k1, j1))
                       && (!par1World.canLightningStrikeAt(i1, k1, j1 - 1))
                       && (!par1World.canLightningStrikeAt(i1, k1, j1 + 1))) {
                     int k2 = l + par5Random.nextInt(5) / 4;
                     if (k2 > 15) {
                       k2 = 15;
                     }
                     par1World.setBlock(i1, k1, j1, this.blockID, k2, 3);
                   }
                 }
               }
             }
           }
         }
       }
     }
   }
 }
 public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
   return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos)
       && World.doesBlockHaveSolidTopSurface(worldIn, pos.down());
 }
 public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
   return (par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4))
       || (canNeighborBurn(par1World, par2, par3, par4));
 }