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;
 }
 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);
 }
 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;
 }
Beispiel #4
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) {
    // Spout Start - Biome water
    if (this.blockMaterial != Material.water) {
      return 0xffffff;
    }
    int color = par1IBlockAccess.getWaterColorCache(par2, par3, par4);
    if (color == -1 || Configuration.isFancyBiomeColors()) {

      int var5 = 0;
      int var6 = 0;
      int var7 = 0;

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

      color = (var5 / 9 & 255) << 16 | (var6 / 9 & 255) << 8 | var7 / 9 & 255;
      par1IBlockAccess.setWaterColorCache(par2, par3, par4, color);
    }
    return color;
    // Spout End - Biome Water
  }
Beispiel #5
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;
    }
  }
  /** 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)));
    }
  }
 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;
 }
 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;
 }
Beispiel #9
0
 /**
  * Goes straight to getLightBrightnessForSkyBlocks for Blocks, does some fancy computing for
  * Fluids
  */
 public int getMixedBrightnessForBlock(
     IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
   int var5 = par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3, par4, 0);
   int var6 = par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3 + 1, par4, 0);
   int var7 = var5 & 255;
   int var8 = var6 & 255;
   int var9 = var5 >> 16 & 255;
   int var10 = var6 >> 16 & 255;
   return (var7 > var8 ? var7 : var8) | (var9 > var10 ? var9 : var10) << 16;
 }
  public static boolean e(IBlockAccess iblockaccess, int i, int j, int k, int l) {
    int i1 = iblockaccess.getTypeId(i, j, k);

    if (i1 == Block.REDSTONE_WIRE.id) return true;
    if (i1 == 0) return false;
    if ((i1 != Block.DIODE_OFF.id) && (i1 != Block.DIODE_ON.id)) {
      return (Block.byId[i1].isPowerSource()) && (l != -1);
    }
    int j1 = iblockaccess.getData(i, j, k);

    return (l == (j1 & 0x3)) || (l == Direction.e[(j1 & 0x3)]);
  }
 public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int i, int j, int k) {
   if (iblockaccess.getBlockId(i - 1, j, k) == blockID
       || iblockaccess.getBlockId(i + 1, j, k) == blockID) {
     float f = 0.5F;
     float f2 = 0.125F;
     setBlockBounds(0.5F - f, 0.0F, 0.5F - f2, 0.5F + f, 1.0F, 0.5F + f2);
   } else {
     float f1 = 0.125F;
     float f3 = 0.5F;
     setBlockBounds(0.5F - f1, 0.0F, 0.5F - f3, 0.5F + f1, 1.0F, 0.5F + f3);
   }
 }
  public static boolean f(IBlockAccess iblockaccess, int i, int j, int k, int l) {
    if (e(iblockaccess, i, j, k, l)) {
      return true;
    }
    int i1 = iblockaccess.getTypeId(i, j, k);

    if (i1 == Block.DIODE_ON.id) {
      int j1 = iblockaccess.getData(i, j, k);

      return l == (j1 & 0x3);
    }
    return false;
  }
Beispiel #13
0
  /**
   * 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;
    }
  }
 /** 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) {
   if (par1IBlockAccess.getBlockId(par2, par3, par4 - 1) == this.blockID) {
     this.setBlockBounds(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F);
   } else if (par1IBlockAccess.getBlockId(par2, par3, par4 + 1) == this.blockID) {
     this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F);
   } else if (par1IBlockAccess.getBlockId(par2 - 1, par3, par4) == this.blockID) {
     this.setBlockBounds(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
   } else if (par1IBlockAccess.getBlockId(par2 + 1, par3, par4) == this.blockID) {
     this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 1.0F, 0.875F, 0.9375F);
   } else {
     this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
   }
 }
  public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
    if (!this.a) {
      return false;
    } else if (iblockaccess.getData(i, j, k) == 0) {
      return false;
    } else if (l == 1) {
      return true;
    } else {
      boolean flag =
          g(iblockaccess, i - 1, j, k, 1)
              || !iblockaccess.t(i - 1, j, k) && g(iblockaccess, i - 1, j - 1, k, -1);
      boolean flag1 =
          g(iblockaccess, i + 1, j, k, 3)
              || !iblockaccess.t(i + 1, j, k) && g(iblockaccess, i + 1, j - 1, k, -1);
      boolean flag2 =
          g(iblockaccess, i, j, k - 1, 2)
              || !iblockaccess.t(i, j, k - 1) && g(iblockaccess, i, j - 1, k - 1, -1);
      boolean flag3 =
          g(iblockaccess, i, j, k + 1, 0)
              || !iblockaccess.t(i, j, k + 1) && g(iblockaccess, i, j - 1, k + 1, -1);

      if (!iblockaccess.t(i, j + 1, k)) {
        if (iblockaccess.t(i - 1, j, k) && g(iblockaccess, i - 1, j + 1, k, -1)) {
          flag = true;
        }

        if (iblockaccess.t(i + 1, j, k) && g(iblockaccess, i + 1, j + 1, k, -1)) {
          flag1 = true;
        }

        if (iblockaccess.t(i, j, k - 1) && g(iblockaccess, i, j + 1, k - 1, -1)) {
          flag2 = true;
        }

        if (iblockaccess.t(i, j, k + 1) && g(iblockaccess, i, j + 1, k + 1, -1)) {
          flag3 = true;
        }
      }

      return !flag2 && !flag1 && !flag && !flag3 && l >= 2 && l <= 5
          ? true
          : (l == 2 && flag2 && !flag && !flag1
              ? true
              : (l == 3 && flag3 && !flag && !flag1
                  ? true
                  : (l == 4 && flag && !flag2 && !flag3
                      ? true
                      : l == 5 && flag1 && !flag2 && !flag3)));
    }
  }
Beispiel #16
0
  /**
   * 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];
    }
  }
Beispiel #17
0
  /**
   * 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;
      }
    }
  }
  public static boolean f(IBlockAccess iblockaccess, int i, int j, int k, int l) {
    int i1 = iblockaccess.getTypeId(i, j, k);

    if (i1 == Block.REDSTONE_WIRE.id) {
      return true;
    } else if (i1 == 0) {
      return false;
    } else if (i1 != Block.DIODE_OFF.id && i1 != Block.DIODE_ON.id) {
      return Block.byId[i1].isPowerSource() && l != -1;
    } else {
      int j1 = iblockaccess.getData(i, j, k);

      return l == (j1 & 3) || l == Direction.f[j1 & 3];
    }
  }
Beispiel #19
0
  public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
    float f;
    float f1;

    if (iblockaccess.getTypeId(i - 1, j, k) != this.id
        && iblockaccess.getTypeId(i + 1, j, k) != this.id) {
      f = 0.125F;
      f1 = 0.5F;
      this.a(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
    } else {
      f = 0.5F;
      f1 = 0.125F;
      this.a(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
    }
  }
Beispiel #20
0
  @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;
    }
  }
Beispiel #21
0
 /**
  * Checks if a machine is in it's active state.
  *
  * @param world
  * @param x
  * @param y
  * @param z
  * @return if machine is active
  */
 public boolean isActive(IBlockAccess world, int x, int y, int z) {
   TileEntityBasicMachine tileEntity = (TileEntityBasicMachine) world.getBlockTileEntity(x, y, z);
   if (tileEntity != null) {
     return tileEntity.isActive;
   }
   return false;
 }
  @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);
    }
  }
Beispiel #23
0
 public void updateShape(IBlockAccess iblockaccess, BlockPosition blockposition) {
   float f = 0.1875F;
   switch (SyntheticClass_1.b[
       ((EnumLeverPosition) iblockaccess.getType(blockposition).get(FACING)).ordinal()]) {
     case 1:
       a(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f);
       break;
     case 2:
       a(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f);
       break;
     case 3:
       a(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F);
       break;
     case 4:
       a(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F);
       break;
     case 5:
     case 6:
       f = 0.25F;
       a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f);
       break;
     case 7:
     case 8:
       f = 0.25F;
       a(0.5F - f, 0.4F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
   }
 }
Beispiel #24
0
 /**
  * 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;
 }
  public static Icon getSideSnowGrassTexture(
      IBlockAccess var0, int var1, int var2, int var3, int var4) {
    if (!isBetterGrass()) {
      return TextureUtils.iconSnowSide;
    } else {
      if (isBetterGrassFancy()) {
        switch (var4) {
          case 2:
            --var3;
            break;

          case 3:
            ++var3;
            break;

          case 4:
            --var1;
            break;

          case 5:
            ++var1;
        }

        int var5 = var0.getBlockId(var1, var2, var3);

        if (var5 != 78 && var5 != 80) {
          return TextureUtils.iconSnowSide;
        }
      }

      return TextureUtils.iconSnow;
    }
  }
  /** 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;
    }
  }
 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);
 }
  /** 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);
    }
  }
Beispiel #29
0
  public void a(IBlockAccess iblockaccess, int i, int j, int k) {
    if (!this.b) {
      int l = iblockaccess.getData(i, j, k);
      float f = 0.28125F;
      float f1 = 0.78125F;
      float f2 = 0.0F;
      float f3 = 1.0F;
      float f4 = 0.125F;

      this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
      if (l == 2) {
        this.a(f2, f, 1.0F - f4, f3, f1, 1.0F);
      }

      if (l == 3) {
        this.a(f2, f, 0.0F, f3, f1, f4);
      }

      if (l == 4) {
        this.a(1.0F - f4, f, f2, 1.0F, f1, f3);
      }

      if (l == 5) {
        this.a(0.0F, f, f2, f4, f1, f3);
      }
    }
  }
  /** 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);
    }
  }