コード例 #1
0
 private boolean RenderMachineInWorld(
     RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block) {
   if (world.getBlockMetadata(x, y, z) < 4) {
     block.setBlockBounds(0.0F, 0.0F, 0.0F, 1F, 1F, 1F);
     renderer.renderStandardBlock(block, x, y, z);
   } else if (world.getBlockMetadata(x, y, z) == 4) {
     block.setBlockBounds(0, 0, 0, 1, 0.5f, 1);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0.25f, 0.5f, 0.25f, 0.75f, 0.625f, 0.75f);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0.625f, 0.625f, 0.625f, 0.375f, 1, 0.375f);
     renderer.renderStandardBlock(block, x, y, z);
   } else if (world.getBlockMetadata(x, y, z) == 5) {
     block.setBlockBounds(0, 0, 0, 1, 0.125f, 1);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0.625f, .125f, 0.625f, 0.375f, 0.375f, 0.375f);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0, 0.375f, 0, 1, 0.5f, 1);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0, 0.5f, 0.875f, 1, 0.875f, 1);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0, 0.5f, 0, 1, 0.875f, 0.125f);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0, 0.5f, 0.875f, 1, 0.875f, 1);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0, 0.5f, 0.125f, 0.125f, 0.875f, 0.875f);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0.875f, 0.5f, 0.125f, 1, 0.875f, 0.875f);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0.375f, 0.5f, 0.375f, 0.625f, 1, 0.625f);
     renderer.renderStandardBlock(block, x, y, z);
   }
   return true;
 }
コード例 #2
0
 private boolean RenderWarheadInWorld(
     RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block) {
   if (world.getBlockMetadata(x, y, z) != 12
       && world.getBlockMetadata(x, y, z) != 0
       && world.getBlockMetadata(x, y, z) != 15) {
     block.setBlockBounds(0.1F, 0.0F, 0.1F, 0.9F, 0.7F, .9F);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0.2F, 0.7F, 0.2F, 0.8F, 0.9F, 0.8F);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0.3F, 0.9F, 0.3F, 0.7F, 1F, 0.7F);
     renderer.renderStandardBlock(block, x, y, z);
   } else {
     block.setBlockBounds(0.0F, 0.0F, 0F, 1F, 0.1F, 1F);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0F, 0.1F, 0F, 1F, 1F, .1F);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0F, 0.1F, 0.9F, 1F, 1F, 1F);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0F, 0.1F, 0.1F, 0.1F, 1F, 0.9F);
     renderer.renderStandardBlock(block, x, y, z);
     block.setBlockBounds(0.9F, 0.1F, 0.1F, 1F, 1F, .9F);
     renderer.renderStandardBlock(block, x, y, z);
   }
   block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
   return true;
 }
コード例 #3
0
  /**
   * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color.
   * Note only called when first determining what to render.
   */
  public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);

    if ((var5 & 3) == 1) {
      return ColorizerFoliage.getFoliageColorPine();
    } else if ((var5 & 3) == 2) {
      return ColorizerFoliage.getFoliageColorBirch();
    } else {
      int var6 = 0;
      int var7 = 0;
      int var8 = 0;

      for (int var9 = -1; var9 <= 1; ++var9) {
        for (int var10 = -1; var10 <= 1; ++var10) {
          int var11 =
              par1IBlockAccess
                  .getBiomeGenForCoords(par2 + var10, par4 + var9)
                  .getBiomeFoliageColor();
          var6 += (var11 & 16711680) >> 16;
          var7 += (var11 & 65280) >> 8;
          var8 += var11 & 255;
        }
      }

      return (var6 / 9 & 255) << 16 | (var7 / 9 & 255) << 8 | var8 / 9 & 255;
    }
  }
コード例 #4
0
 public static TileEntity getTileEntity(IBlockAccess blockaccess, int x, int y, int z) {
   HashSet<ChunkCoordinates> visited = Sets.newHashSet();
   Block block = blockaccess.getBlock(x, y, z);
   while (block != NailedBlocks.portalController) {
     if (isValidLinkPortalBlock(block) == 0) {
       return null;
     }
     ChunkCoordinates pos = new ChunkCoordinates(x, y, z);
     if (!visited.add(pos)) {
       return null;
     }
     int meta = blockaccess.getBlockMetadata(x, y, z);
     if (meta == 0) {
       return null;
     }
     if (meta == 1) {
       y--;
     } else if (meta == 2) {
       y++;
     } else if (meta == 3) {
       z--;
     } else if (meta == 4) {
       z++;
     } else if (meta == 5) {
       x--;
     } else if (meta == 6) {
       x++;
     } else {
       return null;
     }
     block = blockaccess.getBlock(x, y, z);
   }
   return blockaccess.getTileEntity(x, y, z);
 }
コード例 #5
0
  /** Updates the blocks bounds based on its current state. Args: world, x, y, z */
  public void setBlockBoundsBasedOnState(
      IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    int i = par1IBlockAccess.getBlockMetadata(par2, par3, par4);

    switch (getDirectionMeta(i)) {
      case 0:
        setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
        break;

      case 1:
        setBlockBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
        break;

      case 2:
        setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.25F);
        break;

      case 3:
        setBlockBounds(0.0F, 0.0F, 0.75F, 1.0F, 1.0F, 1.0F);
        break;

      case 4:
        setBlockBounds(0.0F, 0.0F, 0.0F, 0.25F, 1.0F, 1.0F);
        break;

      case 5:
        setBlockBounds(0.75F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        break;
    }
  }
コード例 #6
0
  /** Updates the blocks bounds based on its current state. Args: world, x, y, z */
  public void setBlockBoundsBasedOnState(
      IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    int i = par1IBlockAccess.getBlockMetadata(par2, par3, par4);

    if (isExtended(i)) {
      switch (getOrientation(i)) {
        case 0:
          setBlockBounds(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F);
          break;

        case 1:
          setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F);
          break;

        case 2:
          setBlockBounds(0.0F, 0.0F, 0.25F, 1.0F, 1.0F, 1.0F);
          break;

        case 3:
          setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.75F);
          break;

        case 4:
          setBlockBounds(0.25F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
          break;

        case 5:
          setBlockBounds(0.0F, 0.0F, 0.0F, 0.75F, 1.0F, 1.0F);
          break;
      }
    } else {
      setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
    }
  }
コード例 #7
0
ファイル: BlockRail.java プロジェクト: Busboombot/Pixelmon
 /**
  * Return the rails metadata (without the power bit if the rail uses one). Can be used to make the
  * cart think the rail something other than it is, for example when making diamond junctions or
  * switches. The cart parameter will often be null unless it it called from EntityMinecart.
  *
  * <p>Valid rail metadata is defined as follows: 0x0: flat track going North-South 0x1: flat track
  * going West-East 0x2: track ascending to the East 0x3: track ascending to the West 0x4: track
  * ascending to the North 0x5: track ascending to the South 0x6: WestNorth corner (connecting East
  * and South) 0x7: EastNorth corner (connecting West and South) 0x8: EastSouth corner (connecting
  * West and North) 0x9: WestSouth corner (connecting East and North)
  *
  * <p>All directions are Notch defined. In MC Beta 1.8.3 the Sun rises in the North. In MC 1.0.0
  * the Sun rises in the East.
  *
  * @param world The world.
  * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
  * @param y The rail X coordinate.
  * @param x The rail Y coordinate.
  * @param z The rail Z coordinate.
  * @return The metadata.
  */
 public int getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int x, int y, int z) {
   int meta = world.getBlockMetadata(x, y, z);
   if (isPowered) {
     meta = meta & 7;
   }
   return meta;
 }
コード例 #8
0
  /** Updates the blocks bounds based on its current state. Args: world, x, y, z */
  public void setBlockBoundsBasedOnState(
      IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 7;

    switch (var5) {
      case 1:
      default:
        this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
        break;

      case 2:
        this.setBlockBounds(0.25F, 0.25F, 0.5F, 0.75F, 0.75F, 1.0F);
        break;

      case 3:
        this.setBlockBounds(0.25F, 0.25F, 0.0F, 0.75F, 0.75F, 0.5F);
        break;

      case 4:
        this.setBlockBounds(0.5F, 0.25F, 0.25F, 1.0F, 0.75F, 0.75F);
        break;

      case 5:
        this.setBlockBounds(0.0F, 0.25F, 0.25F, 0.5F, 0.75F, 0.75F);
    }
  }
コード例 #9
0
 public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int i, int j, int k) {
   int l = iblockaccess.getBlockMetadata(i, j, k);
   float f = 0.0625F;
   float f1 = (float) (1 + l * 2) / 16F;
   float f2 = 0.5F;
   setBlockBounds(f1, 0.0F, f, 1.0F - f, f2, 1.0F - f);
 }
コード例 #10
0
  @Override
  public void setBlockBoundsBasedOnState(
      IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    int i = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
    float f = 0.375F;

    setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.375F);
    if (i == 0) {
      setBlockBounds(0.0F, 1.0F - f, 0.0F, 1.0F, 1.0F, 1.0F);
    }

    if (i == 1) {
      setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
    }

    if (i == 2) {
      setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
    }

    if (i == 3) {
      setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
    }

    if (i == 4) {
      setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
    }

    if (i == 5) {
      setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
    }
  }
コード例 #11
0
  /** Is this block powering the block on the specified side */
  public boolean isPoweringTo(
      IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
    if (!this.wiresProvidePower) {
      return false;
    } else if (par1IBlockAccess.getBlockMetadata(par2, par3, par4) == 0) {
      return false;
    } else if (par5 == 1) {
      return true;
    } else {
      boolean var6 =
          isPoweredOrRepeater(par1IBlockAccess, par2 - 1, par3, par4, 1)
              || !par1IBlockAccess.isBlockNormalCube(par2 - 1, par3, par4)
                  && isPoweredOrRepeater(par1IBlockAccess, par2 - 1, par3 - 1, par4, -1);
      boolean var7 =
          isPoweredOrRepeater(par1IBlockAccess, par2 + 1, par3, par4, 3)
              || !par1IBlockAccess.isBlockNormalCube(par2 + 1, par3, par4)
                  && isPoweredOrRepeater(par1IBlockAccess, par2 + 1, par3 - 1, par4, -1);
      boolean var8 =
          isPoweredOrRepeater(par1IBlockAccess, par2, par3, par4 - 1, 2)
              || !par1IBlockAccess.isBlockNormalCube(par2, par3, par4 - 1)
                  && isPoweredOrRepeater(par1IBlockAccess, par2, par3 - 1, par4 - 1, -1);
      boolean var9 =
          isPoweredOrRepeater(par1IBlockAccess, par2, par3, par4 + 1, 0)
              || !par1IBlockAccess.isBlockNormalCube(par2, par3, par4 + 1)
                  && isPoweredOrRepeater(par1IBlockAccess, par2, par3 - 1, par4 + 1, -1);

      if (!par1IBlockAccess.isBlockNormalCube(par2, par3 + 1, par4)) {
        if (par1IBlockAccess.isBlockNormalCube(par2 - 1, par3, par4)
            && isPoweredOrRepeater(par1IBlockAccess, par2 - 1, par3 + 1, par4, -1)) {
          var6 = true;
        }

        if (par1IBlockAccess.isBlockNormalCube(par2 + 1, par3, par4)
            && isPoweredOrRepeater(par1IBlockAccess, par2 + 1, par3 + 1, par4, -1)) {
          var7 = true;
        }

        if (par1IBlockAccess.isBlockNormalCube(par2, par3, par4 - 1)
            && isPoweredOrRepeater(par1IBlockAccess, par2, par3 + 1, par4 - 1, -1)) {
          var8 = true;
        }

        if (par1IBlockAccess.isBlockNormalCube(par2, par3, par4 + 1)
            && isPoweredOrRepeater(par1IBlockAccess, par2, par3 + 1, par4 + 1, -1)) {
          var9 = true;
        }
      }

      return !var8 && !var7 && !var6 && !var9 && par5 >= 2 && par5 <= 5
          ? true
          : (par5 == 2 && var8 && !var6 && !var7
              ? true
              : (par5 == 3 && var9 && !var6 && !var7
                  ? true
                  : (par5 == 4 && var6 && !var8 && !var9
                      ? true
                      : par5 == 5 && var7 && !var8 && !var9)));
    }
  }
コード例 #12
0
 public boolean isPoweringTo(IBlockAccess iblockaccess, int i, int j, int k, int l) {
   if (!wiresProvidePower) {
     return false;
   }
   if (iblockaccess.getBlockMetadata(i, j, k) == 0) {
     return false;
   }
   if (l == 1) {
     return true;
   }
   boolean flag =
       isPowerProviderOrWire(iblockaccess, i - 1, j, k)
           || !iblockaccess.isBlockOpaqueCube(i - 1, j, k)
               && isPowerProviderOrWire(iblockaccess, i - 1, j - 1, k);
   boolean flag1 =
       isPowerProviderOrWire(iblockaccess, i + 1, j, k)
           || !iblockaccess.isBlockOpaqueCube(i + 1, j, k)
               && isPowerProviderOrWire(iblockaccess, i + 1, j - 1, k);
   boolean flag2 =
       isPowerProviderOrWire(iblockaccess, i, j, k - 1)
           || !iblockaccess.isBlockOpaqueCube(i, j, k - 1)
               && isPowerProviderOrWire(iblockaccess, i, j - 1, k - 1);
   boolean flag3 =
       isPowerProviderOrWire(iblockaccess, i, j, k + 1)
           || !iblockaccess.isBlockOpaqueCube(i, j, k + 1)
               && isPowerProviderOrWire(iblockaccess, i, j - 1, k + 1);
   if (!iblockaccess.isBlockOpaqueCube(i, j + 1, k)) {
     if (iblockaccess.isBlockOpaqueCube(i - 1, j, k)
         && isPowerProviderOrWire(iblockaccess, i - 1, j + 1, k)) {
       flag = true;
     }
     if (iblockaccess.isBlockOpaqueCube(i + 1, j, k)
         && isPowerProviderOrWire(iblockaccess, i + 1, j + 1, k)) {
       flag1 = true;
     }
     if (iblockaccess.isBlockOpaqueCube(i, j, k - 1)
         && isPowerProviderOrWire(iblockaccess, i, j + 1, k - 1)) {
       flag2 = true;
     }
     if (iblockaccess.isBlockOpaqueCube(i, j, k + 1)
         && isPowerProviderOrWire(iblockaccess, i, j + 1, k + 1)) {
       flag3 = true;
     }
   }
   if (!flag2 && !flag1 && !flag && !flag3 && l >= 2 && l <= 5) {
     return true;
   }
   if (l == 2 && flag2 && !flag && !flag1) {
     return true;
   }
   if (l == 3 && flag3 && !flag && !flag1) {
     return true;
   }
   if (l == 4 && flag && !flag2 && !flag3) {
     return true;
   }
   return l == 5 && flag1 && !flag2 && !flag3;
 }
コード例 #13
0
ファイル: BlockDoor.java プロジェクト: Busboombot/Pixelmon
  /**
   * Returns the full metadata value created by combining the metadata of both blocks the door takes
   * up.
   */
  public int getFullMetadata(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
    boolean var6 = (var5 & 8) != 0;
    int var7;
    int var8;

    if (var6) {
      var7 = par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4);
      var8 = var5;
    } else {
      var7 = var5;
      var8 = par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4);
    }

    boolean var9 = (var8 & 1) != 0;
    int var10 = var7 & 7 | (var6 ? 8 : 0) | (var9 ? 16 : 0);
    return var10;
  }
コード例 #14
0
 protected int func_94488_g(
     IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
   int var6 = par1IBlockAccess.getBlockId(par2, par3, par4);
   return this.func_94477_d(var6)
       ? (var6 == Block.redstoneWire.blockID
           ? par1IBlockAccess.getBlockMetadata(par2, par3, par4)
           : par1IBlockAccess.isBlockProvidingPowerTo(par2, par3, par4, par5))
       : 0;
 }
コード例 #15
0
  public boolean isPoweringTo(IBlockAccess iblockaccess, int i, int j, int k, int l) {
    int meta = iblockaccess.getBlockMetadata(i, j, k);

    if (!globalToLocal.containsKey(l)) return false;

    if (globalToLocal.get(l) == getPositionMetadata(meta)) return getInternalPowerState(meta);

    return false;
  }
コード例 #16
0
 public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int i, int j, int k) {
   boolean flag = iblockaccess.getBlockMetadata(i, j, k) == 1;
   float f = 0.0625F;
   if (flag) {
     setBlockBounds(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
   } else {
     setBlockBounds(f, 0.0F, f, 1.0F - f, 0.0625F, 1.0F - f);
   }
 }
  /**
   * Returns the full metadata value created by combining the metadata of both blocks the door takes
   * up.
   */
  public int getFullMetadata(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    int i = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
    boolean flag = (i & 8) != 0;
    int j;
    int k;

    if (flag) {
      j = par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4);
      k = i;
    } else {
      j = i;
      k = par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4);
    }

    boolean flag1 = (k & 1) != 0;
    int l = j & 7 | (flag ? 8 : 0) | (flag1 ? 0x10 : 0);
    return l;
  }
コード例 #18
0
ファイル: BlockStairs.java プロジェクト: operacraft/Minecraft
  public void func_82541_d(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);

    if ((var5 & 4) != 0) {
      this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
    } else {
      this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
    }
  }
コード例 #19
0
ファイル: BlockRail.java プロジェクト: Busboombot/Pixelmon
  /** Updates the blocks bounds based on its current state. Args: world, x, y, z */
  public void setBlockBoundsBasedOnState(
      IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);

    if (var5 >= 2 && var5 <= 5) {
      this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F);
    } else {
      this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
    }
  }
コード例 #20
0
  /** Updates the blocks bounds based on its current state. Args: world, x, y, z */
  public void setBlockBoundsBasedOnState(
      IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    int var5 = getDirection(par1IBlockAccess.getBlockMetadata(par2, par3, par4));

    if (var5 != 2 && var5 != 0) {
      this.setBlockBounds(0.375F, 0.0F, 0.0F, 0.625F, 1.0F, 1.0F);
    } else {
      this.setBlockBounds(0.0F, 0.0F, 0.375F, 1.0F, 1.0F, 0.625F);
    }
  }
コード例 #21
0
  /** Updates the blocks bounds based on its current state. Args: world, x, y, z */
  @Override
  public void setBlockBoundsBasedOnState(
      IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    int i = getDirection(par1IBlockAccess.getBlockMetadata(par2, par3, par4));

    if (i == 2 || i == 0) {
      setBlockBounds(0.0F, 0.0F, 0.375F, 1.0F, 1.0F, 0.625F);
    } else {
      setBlockBounds(0.375F, 0.0F, 0.0F, 0.625F, 1.0F, 1.0F);
    }
  }
コード例 #22
0
 /** Is this block powering the block on the specified side */
 public boolean isPoweringTo(
     IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
   if (!this.isRepeaterPowered) {
     return false;
   } else {
     int var6 = getDirection(par1IBlockAccess.getBlockMetadata(par2, par3, par4));
     return var6 == 0 && par5 == 3
         ? true
         : (var6 == 1 && par5 == 4
             ? true
             : (var6 == 2 && par5 == 2 ? true : var6 == 3 && par5 == 5));
   }
 }
コード例 #23
0
ファイル: BlockFluid.java プロジェクト: Karang/Spoutcraft
  /**
   * Returns the flow decay but converts values indicating falling liquid (values >=8) to their
   * effective source block value of zero.
   */
  protected int getEffectiveFlowDecay(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    if (par1IBlockAccess.getBlockMaterial(par2, par3, par4) != this.blockMaterial) {
      return -1;
    } else {
      int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);

      if (var5 >= 8) {
        var5 = 0;
      }

      return var5;
    }
  }
コード例 #24
0
  @Override
  public void setBlockBoundsBasedOnState(IBlockAccess access, int i, int j, int k) {
    int dir = access.getBlockMetadata(i, j, k);

    if (dir == 0) {
      this.setBlockBounds(0.0F, 0F, 0.85F, 1F, 1F, 1F);
    } else if (dir == 1) {
      this.setBlockBounds(0.0F, 0F, 0.0F, 0.15F, 1F, 1F);
    } else if (dir == 2) {
      this.setBlockBounds(0.0F, 0F, 0.00F, 1F, 1F, 0.15F);
    } else if (dir == 3) {
      this.setBlockBounds(0.85F, 0F, 0.0F, 1F, 1F, 1F);
    }
  }
コード例 #25
0
ファイル: BlockRedstoneWire.java プロジェクト: Eladkay/mc-dev
  /**
   * Returns true if redstone wire can connect to the specified block. Params: World, X, Y, Z, side
   * (not a normal notch-side, this can be 0, 1, 2, 3 or -1)
   */
  public static boolean isPowerProviderOrWire(
      IBlockAccess par0IBlockAccess, int par1, int par2, int par3, int par4) {
    int var5 = par0IBlockAccess.getBlockId(par1, par2, par3);

    if (var5 == Block.redstoneWire.blockID) {
      return true;
    } else if (var5 == 0) {
      return false;
    } else if (!Block.redstoneRepeaterIdle.func_94487_f(var5)) {
      return Block.blocksList[var5].canProvidePower() && par4 != -1;
    } else {
      int var6 = par0IBlockAccess.getBlockMetadata(par1, par2, par3);
      return par4 == (var6 & 3) || par4 == Direction.footInvisibleFaceRemap[var6 & 3];
    }
  }
コード例 #26
0
ファイル: BlockRedstoneWire.java プロジェクト: Eladkay/mc-dev
  /**
   * Returns true if the block coordinate passed can provide power, or is a redstone wire, or if its
   * a repeater that is powered.
   */
  public static boolean isPoweredOrRepeater(
      IBlockAccess par0IBlockAccess, int par1, int par2, int par3, int par4) {
    if (isPowerProviderOrWire(par0IBlockAccess, par1, par2, par3, par4)) {
      return true;
    } else {
      int var5 = par0IBlockAccess.getBlockId(par1, par2, par3);

      if (var5 == Block.redstoneRepeaterActive.blockID) {
        int var6 = par0IBlockAccess.getBlockMetadata(par1, par2, par3);
        return par4 == (var6 & 3);
      } else {
        return false;
      }
    }
  }
コード例 #27
0
ファイル: BlockMachine.java プロジェクト: blued00r/Mekanism
  @Override
  @SideOnly(Side.CLIENT)
  public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side) {
    int metadata = world.getBlockMetadata(x, y, z);
    TileEntityBasicMachine tileEntity = (TileEntityBasicMachine) world.getBlockTileEntity(x, y, z);

    if (metadata == 0) {
      if (side == tileEntity.facing) {
        return isActive(world, x, y, z) ? 8 : 9;
      } else {
        return 2;
      }
    } else if (metadata == 1) {
      if (side == tileEntity.facing) {
        return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX : 14;

      } else {
        return 2;
      }
    } else if (metadata == 2) {
      if (side == tileEntity.facing) {
        return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX + 1 : 15;
      } else {
        return 2;
      }
    } else if (metadata == 3) {
      if (side == tileEntity.facing) {
        return isActive(world, x, y, z) ? 12 : 13;
      } else {
        return 2;
      }
    } else if (metadata == 4) {
      if (side == 0 || side == 1) {
        return isActive(world, x, y, z) ? 20 : 18;
      } else {
        if (side == tileEntity.facing) {
          return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX + 2 : 16;
        } else if (side
            == ForgeDirection.getOrientation(tileEntity.facing).getOpposite().ordinal()) {
          return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX + 3 : 17;
        } else {
          return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX + 4 : 19;
        }
      }
    } else {
      return 0;
    }
  }
コード例 #28
0
ファイル: BlockCocoa.java プロジェクト: Faik-man/movecraft
  /** Updates the blocks bounds based on its current state. Args: world, x, y, z */
  public void setBlockBoundsBasedOnState(
      IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
    int var6 = getDirection(var5);
    int var7 = func_72219_c(var5);
    int var8 = 4 + var7 * 2;
    int var9 = 5 + var7 * 2;
    float var10 = (float) var8 / 2.0F;

    switch (var6) {
      case 0:
        this.setBlockBounds(
            (8.0F - var10) / 16.0F,
            (12.0F - (float) var9) / 16.0F,
            (15.0F - (float) var8) / 16.0F,
            (8.0F + var10) / 16.0F,
            0.75F,
            0.9375F);
        break;
      case 1:
        this.setBlockBounds(
            0.0625F,
            (12.0F - (float) var9) / 16.0F,
            (8.0F - var10) / 16.0F,
            (1.0F + (float) var8) / 16.0F,
            0.75F,
            (8.0F + var10) / 16.0F);
        break;
      case 2:
        this.setBlockBounds(
            (8.0F - var10) / 16.0F,
            (12.0F - (float) var9) / 16.0F,
            0.0625F,
            (8.0F + var10) / 16.0F,
            0.75F,
            (1.0F + (float) var8) / 16.0F);
        break;
      case 3:
        this.setBlockBounds(
            (15.0F - (float) var8) / 16.0F,
            (12.0F - (float) var9) / 16.0F,
            (8.0F - var10) / 16.0F,
            0.9375F,
            0.75F,
            (8.0F + var10) / 16.0F);
    }
  }
コード例 #29
0
  /**
   * Returns true if the block is emitting indirect/weak redstone power on the specified side. If
   * isBlockNormalCube returns true, standard redstone propagation rules will apply instead and this
   * will not be called. Args: World, X, Y, Z, side. Note that the side is reversed - eg it is 1
   * (up) when checking the bottom of the block.
   */
  public int isProvidingWeakPower(
      IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
    int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);

    if (!this.func_96470_c(var6)) {
      return 0;
    } else {
      int var7 = getDirection(var6);
      return var7 == 0 && par5 == 3
          ? this.func_94480_d(par1IBlockAccess, par2, par3, par4, var6)
          : (var7 == 1 && par5 == 4
              ? this.func_94480_d(par1IBlockAccess, par2, par3, par4, var6)
              : (var7 == 2 && par5 == 2
                  ? this.func_94480_d(par1IBlockAccess, par2, par3, par4, var6)
                  : (var7 == 3 && par5 == 5
                      ? this.func_94480_d(par1IBlockAccess, par2, par3, par4, var6)
                      : 0)));
    }
  }
コード例 #30
0
  /**
   * Returns the current state of the stem. Returns -1 if the stem is not fully grown, or a value
   * between 0 and 3 based on the direction the stem is facing.
   */
  public int getState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    int i = par1IBlockAccess.getBlockMetadata(par2, par3, par4);

    if (i < 7) {
      return -1;
    }

    if (par1IBlockAccess.getBlockId(par2 - 1, par3, par4) == fruitType.blockID) {
      return 0;
    }

    if (par1IBlockAccess.getBlockId(par2 + 1, par3, par4) == fruitType.blockID) {
      return 1;
    }

    if (par1IBlockAccess.getBlockId(par2, par3, par4 - 1) == fruitType.blockID) {
      return 2;
    }

    return par1IBlockAccess.getBlockId(par2, par3, par4 + 1) != fruitType.blockID ? -1 : 3;
  }