Example #1
0
  public void func_71860_a(
      World p_71860_1_,
      int p_71860_2_,
      int p_71860_3_,
      int p_71860_4_,
      EntityLiving p_71860_5_,
      ItemStack p_71860_6_) {
    int var7 =
        MathHelper.func_76128_c((double) (p_71860_5_.field_70177_z * 4.0F / 360.0F) + 0.5D) & 3;
    int var8 = p_71860_1_.func_72805_g(p_71860_2_, p_71860_3_, p_71860_4_) & 4;
    if (var7 == 0) {
      p_71860_1_.func_72921_c(p_71860_2_, p_71860_3_, p_71860_4_, 2 | var8, 2);
    }

    if (var7 == 1) {
      p_71860_1_.func_72921_c(p_71860_2_, p_71860_3_, p_71860_4_, 1 | var8, 2);
    }

    if (var7 == 2) {
      p_71860_1_.func_72921_c(p_71860_2_, p_71860_3_, p_71860_4_, 3 | var8, 2);
    }

    if (var7 == 3) {
      p_71860_1_.func_72921_c(p_71860_2_, p_71860_3_, p_71860_4_, 0 | var8, 2);
    }
  }
 @Override
 public void onPacketData(NetworkManager network, String channel, byte[] data) {
   DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data));
   int x;
   int y;
   int z;
   int typ;
   boolean hasStacks;
   int[] items = null;
   try {
     x = dis.readInt();
     y = dis.readInt();
     z = dis.readInt();
     typ = dis.readByte();
     hasStacks = dis.readByte() != 0;
     if (hasStacks) {
       items = new int[24];
       for (int i = 0; i < items.length; i++) {
         items[i] = dis.readInt();
       }
     }
   } catch (IOException e) {
     return;
   }
   World world = mod_IronChest.proxy.getCurrentWorld();
   TileEntity te = world.getBlockTileEntity(x, y, z);
   if (te instanceof TileEntityIronChest) {
     TileEntityIronChest icte = (TileEntityIronChest) te;
     icte.handlePacketData(typ, items);
   }
 }
Example #3
0
 public boolean func_71903_a(
     World p_71903_1_,
     int p_71903_2_,
     int p_71903_3_,
     int p_71903_4_,
     EntityPlayer p_71903_5_,
     int p_71903_6_,
     float p_71903_7_,
     float p_71903_8_,
     float p_71903_9_) {
   int var10 = p_71903_1_.func_72805_g(p_71903_2_, p_71903_3_, p_71903_4_);
   int var11 = var10 & 7;
   int var12 = 8 - (var10 & 8);
   if (var12 == 0) {
     return true;
   } else {
     p_71903_1_.func_72921_c(p_71903_2_, p_71903_3_, p_71903_4_, var11 + var12, 3);
     p_71903_1_.func_72909_d(
         p_71903_2_, p_71903_3_, p_71903_4_, p_71903_2_, p_71903_3_, p_71903_4_);
     p_71903_1_.func_72908_a(
         (double) p_71903_2_ + 0.5D,
         (double) p_71903_3_ + 0.5D,
         (double) p_71903_4_ + 0.5D,
         "random.click",
         0.3F,
         0.6F);
     this.func_82536_d(p_71903_1_, p_71903_2_, p_71903_3_, p_71903_4_, var11);
     p_71903_1_.func_72836_a(
         p_71903_2_, p_71903_3_, p_71903_4_, this.field_71990_ca, this.func_71859_p_(p_71903_1_));
     return true;
   }
 }
 public void updateTick(World world, int i, int j, int k, Random random1) {
   int l = world.getBlockMetadata(i, j, k);
   world.setBlockAndMetadata(i, j, k, blockID, l);
   TileEntityChest tileentitychest = (TileEntityChest) world.getBlockTileEntity(i, j, k);
   if (tileentitychest != null) {
     if (chanceToTick == 0) {
       boolean continueChecking = true;
       int slotNumber = 0;
       while (continueChecking == true) {
         if (tileentitychest.getStackInSlot(slotNumber) == null && slotNumber < 27) {
           if (slotNumber == 26) {
             if (world.getClosestPlayer(i, j, k, 32) == null) {
               WeightedRandomChestContent.generateChestContents(
                   random1,
                   ChestHookRegistry.chestCommonContents,
                   tileentitychest,
                   random1.nextInt(5) + 1);
               DayZLog.info("Refilled Common Chest at " + i + ", " + j + ", " + k + ".");
               continueChecking = false;
             } else {
               continueChecking = false;
             }
           } else {
             slotNumber++;
           }
         } else {
           continueChecking = false;
         }
       }
     }
   }
 }
  /**
   * 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 = 0;

    if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID) {
      ++var5;
    }

    if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID) {
      ++var5;
    }

    if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID) {
      ++var5;
    }

    if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID) {
      ++var5;
    }

    return var5 > 1
        ? false
        : (this.isThereANeighborChest(par1World, par2 - 1, par3, par4)
            ? false
            : (this.isThereANeighborChest(par1World, par2 + 1, par3, par4)
                ? false
                : (this.isThereANeighborChest(par1World, par2, par3, par4 - 1)
                    ? false
                    : !this.isThereANeighborChest(par1World, par2, par3, par4 + 1))));
  }
  /** Called when the block is placed in the world. */
  public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving par5EntityLiving) {
    TileCandyMaker tile = (TileCandyMaker) world.getBlockTileEntity(i, j, k);

    if (tile != null) {
      tile.checkRedstonePower();
    }
    int var6 =
        MathHelper.floor_double((double) (par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

    if (var6 == 0) {
      world.setBlockMetadataWithNotify(i, j, k, 2);
    }

    if (var6 == 1) {
      world.setBlockMetadataWithNotify(i, j, k, 5);
    }

    if (var6 == 2) {
      world.setBlockMetadataWithNotify(i, j, k, 3);
    }

    if (var6 == 3) {
      world.setBlockMetadataWithNotify(i, j, k, 4);
    }
  }
Example #7
0
  @Override
  public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving) {
    if (!(world.getBlockMetadata(x, y, z) == 6)) {
      TileEntityBasicMachine tileEntity =
          (TileEntityBasicMachine) world.getBlockTileEntity(x, y, z);
      int side =
          MathHelper.floor_double((double) (entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
      int change = 3;

      switch (side) {
        case 0:
          change = 2;
          break;
        case 1:
          change = 5;
          break;
        case 2:
          change = 3;
          break;
        case 3:
          change = 4;
          break;
      }

      tileEntity.setFacing((short) change);
    }
  }
  public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer) {
    meta = world.getBlockMetadata(i, j, k);
    xCoord = i;
    yCoord = j;
    zCoord = k;
    // Minecraft mc = ModLoader.getMinecraftInstance();
    ItemStack equippedItem = entityplayer.getCurrentEquippedItem();
    int itemid;
    if (equippedItem != null) {
      itemid = entityplayer.getCurrentEquippedItem().itemID;
    } else {
      itemid = 0;
    }

    if (world.isRemote) {
      return true;
    } else {
      if ((TileEntityTerraMetallurgy) world.getBlockTileEntity(i, j, k) != null) {
        TileEntityTerraMetallurgy tileentityanvil;
        tileentityanvil = (TileEntityTerraMetallurgy) world.getBlockTileEntity(i, j, k);
        ItemStack is = entityplayer.getCurrentEquippedItem();

        entityplayer.openGui(mod_TFC.instance, mod_TFC.terraMetallurgyGuiId, world, i, j, k);
        // ModLoader.openGUI(entityplayer, new GuiTerraMetallurgy(entityplayer.inventory,
        // tileentityanvil, world));
      }
      return true;
    }
  }
  public boolean func_71930_b(World p_71930_1_, int p_71930_2_, int p_71930_3_, int p_71930_4_) {
    int var5 = 0;
    if (p_71930_1_.func_72798_a(p_71930_2_ - 1, p_71930_3_, p_71930_4_) == this.field_71990_ca) {
      ++var5;
    }

    if (p_71930_1_.func_72798_a(p_71930_2_ + 1, p_71930_3_, p_71930_4_) == this.field_71990_ca) {
      ++var5;
    }

    if (p_71930_1_.func_72798_a(p_71930_2_, p_71930_3_, p_71930_4_ - 1) == this.field_71990_ca) {
      ++var5;
    }

    if (p_71930_1_.func_72798_a(p_71930_2_, p_71930_3_, p_71930_4_ + 1) == this.field_71990_ca) {
      ++var5;
    }

    return var5 > 1
        ? false
        : (this.func_72291_l(p_71930_1_, p_71930_2_ - 1, p_71930_3_, p_71930_4_)
            ? false
            : (this.func_72291_l(p_71930_1_, p_71930_2_ + 1, p_71930_3_, p_71930_4_)
                ? false
                : (this.func_72291_l(p_71930_1_, p_71930_2_, p_71930_3_, p_71930_4_ - 1)
                    ? false
                    : !this.func_72291_l(p_71930_1_, p_71930_2_, p_71930_3_, p_71930_4_ + 1))));
  }
Example #10
0
  @Override
  public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
    DataInputStream data = new DataInputStream(new ByteArrayInputStream(packet.data));
    try {

      int packetID = data.read();
      switch (packetID) {
        case PacketIds.TILE_UPDATE:
          PacketTileUpdate packetT = new PacketTileUpdate();
          packetT.readData(data);
          onTileUpdate((EntityPlayer) player, packetT);
          break;

        case PacketIds.STATE_UPDATE:
          PacketTileState inPacket = new PacketTileState();
          inPacket.readData(data);
          World world = ((EntityPlayer) player).worldObj;
          TileEntity tile = world.getBlockTileEntity(inPacket.posX, inPacket.posY, inPacket.posZ);
          if (tile instanceof ISyncedTile) {
            inPacket.applyStates(data, (ISyncedTile) tile);
          }
          break;
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
  @Override
  public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) {
    for (int i = 0;
        ((i = par1World.getBlockId(par3, par4, par5)) == 0 || i == Block.leaves.blockID)
            && par4 > 0;
        par4--) {}

    for (int j = 0; j < 128; j++) {
      int k = (par3 + par2Random.nextInt(8)) - par2Random.nextInt(8);
      int l = (par4 + par2Random.nextInt(4)) - par2Random.nextInt(4);
      int i1 = (par5 + par2Random.nextInt(8)) - par2Random.nextInt(8);

      boolean old =
          ODNBXlite.MapFeatures < ODNBXlite.FEATURES_13
              || ODNBXlite.Generator < ODNBXlite.GEN_NEWBIOMES;
      boolean oldc =
          ((BlockFlower) Block.blocksList[tallGrassID]).canBlockStay(par1World, k, l, i1);
      boolean newc = Block.blocksList[tallGrassID].canBlockStay(par1World, k, l, i1);
      if (par1World.isAirBlock(k, l, i1) && ((oldc && old) || (!old && newc))) {
        par1World.setBlock(k, l, i1, tallGrassID, tallGrassMetadata, 0);
      }
    }

    return true;
  }
  @Override
  public void decorate(World par1World, Random par2Random, int par3, int par4) {
    super.decorate(par1World, par2Random, par3, par4);
    int var5 = 3 + par2Random.nextInt(6);

    for (int var6 = 0; var6 < var5; ++var6) {
      int var7 = par3 + par2Random.nextInt(16);
      int var8 = par2Random.nextInt(28) + 4;
      int var9 = par4 + par2Random.nextInt(16);
      int var10 = par1World.getBlockId(var7, var8, var9);

      if (var10 == Block.stone.blockID) {
        int var11 = 0;

        if (var8 <= 48 + par1World.rand.nextInt(2)) {
          byte var12 = 1;

          if (var8 <= 24 + par1World.rand.nextInt(2)) {
            var12 = 2;
          }

          var11 = Block.oreEmerald.GetMetadataConversionForStrataLevel(var12, 0);
        }

        par1World.setBlock(var7, var8, var9, Block.oreEmerald.blockID, var11, 2);
      }
    }
  }
Example #13
0
  public int func_85104_a(
      World p_85104_1_,
      int p_85104_2_,
      int p_85104_3_,
      int p_85104_4_,
      int p_85104_5_,
      float p_85104_6_,
      float p_85104_7_,
      float p_85104_8_,
      int p_85104_9_) {
    int var10 = p_85104_1_.func_72805_g(p_85104_2_, p_85104_3_, p_85104_4_);
    int var11 = var10 & 8;
    var10 &= 7;
    if (p_85104_5_ == 2 && p_85104_1_.func_72809_s(p_85104_2_, p_85104_3_, p_85104_4_ + 1)) {
      var10 = 4;
    } else if (p_85104_5_ == 3 && p_85104_1_.func_72809_s(p_85104_2_, p_85104_3_, p_85104_4_ - 1)) {
      var10 = 3;
    } else if (p_85104_5_ == 4 && p_85104_1_.func_72809_s(p_85104_2_ + 1, p_85104_3_, p_85104_4_)) {
      var10 = 2;
    } else if (p_85104_5_ == 5 && p_85104_1_.func_72809_s(p_85104_2_ - 1, p_85104_3_, p_85104_4_)) {
      var10 = 1;
    } else {
      var10 = this.func_72260_l(p_85104_1_, p_85104_2_, p_85104_3_, p_85104_4_);
    }

    return var10 + var11;
  }
Example #14
0
  public boolean func_250_a(
      World p_250_1_, int p_250_2_, int p_250_3_, int p_250_4_, EntityPlayer p_250_5_) {
    if (p_250_1_.field_1026_y) {
      return true;
    } else {
      int var6 = p_250_1_.func_602_e(p_250_2_, p_250_3_, p_250_4_);
      int var7 = var6 & 7;
      int var8 = 8 - (var6 & 8);
      p_250_1_.func_691_b(p_250_2_, p_250_3_, p_250_4_, var7 + var8);
      p_250_1_.func_701_b(p_250_2_, p_250_3_, p_250_4_, p_250_2_, p_250_3_, p_250_4_);
      p_250_1_.func_684_a(
          (double) p_250_2_ + 0.5D,
          (double) p_250_3_ + 0.5D,
          (double) p_250_4_ + 0.5D,
          "random.click",
          0.3F,
          var8 > 0 ? 0.6F : 0.5F);
      p_250_1_.func_611_g(p_250_2_, p_250_3_, p_250_4_, this.field_376_bc);
      if (var7 == 1) {
        p_250_1_.func_611_g(p_250_2_ - 1, p_250_3_, p_250_4_, this.field_376_bc);
      } else if (var7 == 2) {
        p_250_1_.func_611_g(p_250_2_ + 1, p_250_3_, p_250_4_, this.field_376_bc);
      } else if (var7 == 3) {
        p_250_1_.func_611_g(p_250_2_, p_250_3_, p_250_4_ - 1, this.field_376_bc);
      } else if (var7 == 4) {
        p_250_1_.func_611_g(p_250_2_, p_250_3_, p_250_4_ + 1, this.field_376_bc);
      } else {
        p_250_1_.func_611_g(p_250_2_, p_250_3_ - 1, p_250_4_, this.field_376_bc);
      }

      return true;
    }
  }
Example #15
0
  public boolean generateNode(World world, Random random, int i, int j, int k) {
    setBlockAndMetadata(world, i, j, k, FloraTrees.redwood.blockID, mdWood);
    for (int l = i - 1; l <= i + 1; l++) {
      for (int k1 = k - 1; k1 <= k + 1; k1++) {
        for (int j2 = j - 1; j2 <= j + 1; j2++) {
          int i3 = world.getBlockId(l, j2, k1);
          if (i3 != FloraTrees.floraLeaves.blockID && !Block.opaqueCubeLookup[i3]) {
            setBlockAndMetadata(world, l, j2, k1, FloraTrees.floraLeaves.blockID, mdLeaves);
          }
        }
      }
    }

    for (int i1 = i - 1; i1 <= i + 1; i1++) {
      for (int l1 = k - 2; l1 <= k + 2; l1++) {
        int k2 = world.getBlockId(i1, j, l1);
        if (k2 != FloraTrees.floraLeaves.blockID && !Block.opaqueCubeLookup[k2]) {
          setBlockAndMetadata(world, i1, j, l1, FloraTrees.floraLeaves.blockID, mdLeaves);
        }
      }
    }

    for (int j1 = i - 2; j1 <= i + 2; j1++) {
      for (int i2 = k - 1; i2 <= k + 1; i2++) {
        int l2 = world.getBlockId(j1, j + 1, i2);
        if (l2 != FloraTrees.floraLeaves.blockID && !Block.opaqueCubeLookup[l2]) {
          setBlockAndMetadata(world, j1, j, i2, FloraTrees.floraLeaves.blockID, mdLeaves);
        }
      }
    }

    return true;
  }
  @Override
  public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) {
    if (par1World.getBlockMaterial(par3, par4, par5) != Material.water) return false;
    else {
      int var6 = par2Random.nextInt(radius - 2) + 2;
      byte var7 = 2;

      for (int var8 = par3 - var6; var8 <= par3 + var6; ++var8) {
        for (int var9 = par5 - var6; var9 <= par5 + var6; ++var9) {
          int var10 = var8 - par3;
          int var11 = var9 - par5;

          if (var10 * var10 + var11 * var11 <= var6 * var6) {
            for (int var12 = par4 - var7; var12 <= par4 + var7; ++var12) {
              int var13 = par1World.getBlockId(var8, var12, var9);

              if (var13 == Block.sand.blockID) {
                par1World.setBlock(var8, var12, var9, sandID);
              }
            }
          }
        }
      }

      return true;
    }
  }
  /** Called whenever the block is added into the world. Args: world, x, y, z */
  @Override
  public void onBlockAdded(final World par1World, final int par2, final int par3, final int par4) {
    super.onBlockAdded(par1World, par2, par3, par4);

    if (par1World.getBlockId(par2, par3, par4) == this.blockID) {
      par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate());
    }
  }
Example #18
0
 public void Eject(World par1World, int par2, int par3, int par4) {
   if ((TileEntityTerraLogPile) par1World.getBlockTileEntity(par2, par3, par4) != null) {
     TileEntityTerraLogPile tileentityanvil;
     tileentityanvil = (TileEntityTerraLogPile) par1World.getBlockTileEntity(par2, par3, par4);
     tileentityanvil.ejectContents();
     par1World.removeBlockTileEntity(par2, par3, par4);
   }
 }
Example #19
0
  @Override
  public void onNeighborBlockChange(World world, int x, int y, int z, int par4) {

    /* Check that we are still on a solid block */
    if (!world.isBlockSolidOnSide(x, y - 1, z, ForgeDirection.UP)) {
      this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
      world.setBlockWithNotify(x, y, z, 0);
    }
  }
 @Override
 public void onBlockRemoval(World world, int i, int j, int k) {
   int l = world.getBlockMetadata(i, j, k);
   if (l > 0) {
     world.notifyBlocksOfNeighborChange(i, j, k, blockID);
     world.notifyBlocksOfNeighborChange(i, j - 1, k, blockID);
   }
   super.onBlockRemoval(world, i, j, k);
 }
Example #21
0
  /** Called when the block is clicked by a player. Args: x, y, z, entityPlayer */
  @Override
  public boolean blockActivated(World world, int x, int y, int z, EntityPlayer entityplayer) {
    boolean hasHammer = false;
    for (int i = 0; i < 9; i++) {
      if (entityplayer.inventory.mainInventory[i] != null
          && entityplayer.inventory.mainInventory[i].getItem() instanceof ItemHammer)
        hasHammer = true;
    }
    if (entityplayer.getCurrentEquippedItem() != null
        && entityplayer.getCurrentEquippedItem().getItem() instanceof ItemChisel
        && hasHammer) {
      MovingObjectPosition objectMouseOver = Helper.getMouseOverObject(entityplayer, world);
      if (objectMouseOver == null) {
        return false;
      }
      int side = objectMouseOver.sideHit;

      int id = world.getBlockId(x, y, z);
      byte meta = (byte) world.getBlockMetadata(x, y, z);

      byte newMeta = 0;
      if (side == 0) {
        newMeta = (byte) (newMeta | 4);
      }

      int rot =
          MathHelper.floor_double((double) (entityplayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
      byte flip = (byte) (newMeta & 4);
      byte m = 0;

      if (rot == 0) {
        m = (byte) (2 | flip);
      } else if (rot == 1) {
        m = (byte) (1 | flip);
      } else if (rot == 2) {
        m = (byte) (3 | flip);
      } else if (rot == 3) {
        m = (byte) (0 | flip);
      }

      int mode = 0;
      if (!TFC_Core.isClient()) {
        PlayerInfo pi = PlayerManagerTFC.getInstance().getPlayerInfoFromPlayer(entityplayer);

        if (pi != null) mode = pi.ChiselMode;
      } else mode = ItemChisel.mode;

      if (mode == 1) {
        ItemChisel.CreateStairs(world, x, y, z, id, meta, m);
        return true;
      } else if (mode == 2) {
        ItemChisel.CreateSlab(world, x, y, z, id, meta, side);
        return true;
      }
    }
    return false;
  }
 public void run(int playerId) {
   World world = SpoutClient.getHandle().theWorld;
   TileEntity te = world.getBlockTileEntity(x, y, z);
   if (te != null && te instanceof TileEntitySign) {
     TileEntitySign sign = (TileEntitySign) te;
     GuiEditSign gui = new GuiEditSign(sign);
     SpoutClient.getHandle().displayGuiScreen(gui);
   }
 }
Example #23
0
 private int func_72260_l(World p_72260_1_, int p_72260_2_, int p_72260_3_, int p_72260_4_) {
   return p_72260_1_.func_72809_s(p_72260_2_ - 1, p_72260_3_, p_72260_4_)
       ? 1
       : (p_72260_1_.func_72809_s(p_72260_2_ + 1, p_72260_3_, p_72260_4_)
           ? 2
           : (p_72260_1_.func_72809_s(p_72260_2_, p_72260_3_, p_72260_4_ - 1)
               ? 3
               : (p_72260_1_.func_72809_s(p_72260_2_, p_72260_3_, p_72260_4_ + 1) ? 4 : 1)));
 }
Example #24
0
 public boolean func_71930_b(World p_71930_1_, int p_71930_2_, int p_71930_3_, int p_71930_4_) {
   return p_71930_1_.func_72809_s(p_71930_2_ - 1, p_71930_3_, p_71930_4_)
       ? true
       : (p_71930_1_.func_72809_s(p_71930_2_ + 1, p_71930_3_, p_71930_4_)
           ? true
           : (p_71930_1_.func_72809_s(p_71930_2_, p_71930_3_, p_71930_4_ - 1)
               ? true
               : p_71930_1_.func_72809_s(p_71930_2_, p_71930_3_, p_71930_4_ + 1)));
 }
 @Override
 public void updateTick(World world, int i, int j, int k, Random random) {
   if (world.getBlockMetadata(i, j, k) < 2) {
     if (random.nextInt(5) == 2) {
       world.setBlockWithNotify(i, j, k, 0);
     } else {
       world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
     }
   }
 }
  public void func_72272_c_(World p_72272_1_, int p_72272_2_, int p_72272_3_, int p_72272_4_) {
    int var5 =
        p_72272_1_.func_72805_g(p_72272_2_, p_72272_3_, p_72272_4_)
            + MathHelper.func_76136_a(p_72272_1_.field_73012_v, 2, 5);
    if (var5 > 7) {
      var5 = 7;
    }

    p_72272_1_.func_72921_c(p_72272_2_, p_72272_3_, p_72272_4_, var5, 2);
  }
Example #27
0
  private final int getBlockHeight(World world, int x, int z) {
    if (MinimapConfig.getInstance().isCavemap()) {
      Chunk chunk = world.getChunkFromBlockCoords(x, z);
      cmdist.setSeed((x & 0xffff) | ((z & 0xffff) << 16));
      float dist =
          distance(
              (int) Minecraft.getMinecraft().thePlayer.posX,
              (int) Minecraft.getMinecraft().thePlayer.posZ,
              x,
              z);
      int y = (int) Minecraft.getMinecraft().thePlayer.posY;
      if (dist > 5) y -= (cmdist.nextInt((int) (dist)) - ((int) dist / 2));
      x &= 0xf;
      z &= 0xf;

      if (y < 0) {
        y = 0;
      } else if (y > 255) {
        y = 255;
      }

      if (blockIsSolid(chunk, x, y, z)) {
        int itery = y;
        while (true) {
          itery++;
          if (itery > y + 10) return y + 10;
          if (!blockIsSolid(chunk, x, itery, z)) {
            return itery - 1;
          }
        }
      }
      while (y > -1) {
        y--;
        if (blockIsSolid(chunk, x, y, z)) {
          return y;
        }
      }
      return -1;
    }

    return world.getHeightValue(x, z) - 1;

    // return world.b(x, z).b(x & 0xf, z & 0xf);
    /*
     * li chunk = world.b(x, z); int y = (int)(game.h.aM); // starty; x &=
     * 0xf; z &= 0xf;
     *
     * //while (y > 0) // {
     *
     *
     * if (getBlockColor(id, meta).alpha == 0) return -1; // y--; else return
     * y + 1; // what //}
     */
    // return -1;
  }
 /** Checks the neighbor blocks to see if there is a chest there. Args: world, x, y, z */
 private boolean isThereANeighborChest(World par1World, int par2, int par3, int par4) {
   return par1World.getBlockId(par2, par3, par4) != this.blockID
       ? false
       : (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID
           ? true
           : (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID
               ? true
               : (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID
                   ? true
                   : par1World.getBlockId(par2, par3, par4 + 1) == this.blockID)));
 }
Example #29
0
 public boolean func_71850_a_(
     World p_71850_1_, int p_71850_2_, int p_71850_3_, int p_71850_4_, int p_71850_5_) {
   return p_71850_5_ == 2 && p_71850_1_.func_72809_s(p_71850_2_, p_71850_3_, p_71850_4_ + 1)
       ? true
       : (p_71850_5_ == 3 && p_71850_1_.func_72809_s(p_71850_2_, p_71850_3_, p_71850_4_ - 1)
           ? true
           : (p_71850_5_ == 4 && p_71850_1_.func_72809_s(p_71850_2_ + 1, p_71850_3_, p_71850_4_)
               ? true
               : p_71850_5_ == 5
                   && p_71850_1_.func_72809_s(p_71850_2_ - 1, p_71850_3_, p_71850_4_)));
 }
Example #30
0
 public boolean func_243_a(World p_243_1_, int p_243_2_, int p_243_3_, int p_243_4_) {
   return p_243_1_.func_28100_h(p_243_2_ - 1, p_243_3_, p_243_4_)
       ? true
       : (p_243_1_.func_28100_h(p_243_2_ + 1, p_243_3_, p_243_4_)
           ? true
           : (p_243_1_.func_28100_h(p_243_2_, p_243_3_, p_243_4_ - 1)
               ? true
               : (p_243_1_.func_28100_h(p_243_2_, p_243_3_, p_243_4_ + 1)
                   ? true
                   : p_243_1_.func_28100_h(p_243_2_, p_243_3_ - 1, p_243_4_))));
 }