@SideOnly(Side.CLIENT)

  /**
   * 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 l = par1IBlockAccess.getBlockMetadata(par2, par3, par4);

    if ((l & 3) == 1) {
      return ColorizerFoliage.getFoliageColorPine();
    } else if ((l & 3) == 2) {
      return ColorizerFoliage.getFoliageColorBirch();
    } else {
      int i1 = 0;
      int j1 = 0;
      int k1 = 0;

      for (int l1 = -1; l1 <= 1; ++l1) {
        for (int i2 = -1; i2 <= 1; ++i2) {
          int j2 =
              par1IBlockAccess.getBiomeGenForCoords(par2 + i2, par4 + l1).getBiomeFoliageColor();
          i1 += (j2 & 16711680) >> 16;
          j1 += (j2 & 65280) >> 8;
          k1 += j2 & 255;
        }
      }

      return (i1 / 9 & 255) << 16 | (j1 / 9 & 255) << 8 | k1 / 9 & 255;
    }
  }
  @Override
  public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
    EnumBlockMultiType type = (EnumBlockMultiType) state.getValue(MULTI_TYPE);
    int renderType = 0;

    switch (type) {
      case CRYO_CHAMBER:
        IBlockState stateAbove = worldIn.getBlockState(pos.up());
        TileEntityMulti tile = (TileEntityMulti) worldIn.getTileEntity(pos);
        if (stateAbove.getBlock() == this
            && (stateAbove.getValue(MULTI_TYPE)) == EnumBlockMultiType.CRYO_CHAMBER) {
          renderType = 0;
        } else {
          renderType = 4;
        }
        if (tile != null && tile.mainBlockPosition != null) {
          IBlockState stateMain = worldIn.getBlockState(tile.mainBlockPosition);
          if (stateMain.getBlock() == MarsBlocks.machine
              && stateMain.getValue(BlockMachineMars.TYPE)
                  == BlockMachineMars.EnumMachineType.CRYOGENIC_CHAMBER) {
            EnumFacing dir = stateMain.getValue(BlockMachineMars.FACING);
            renderType += dir.getHorizontalIndex();
          }
        }
        break;
      default:
        break;
    }

    return state.withProperty(RENDER_TYPE, renderType);
  }
  @SideOnly(Side.CLIENT)
  public int func_71895_b(
      IBlockAccess p_71895_1_, int p_71895_2_, int p_71895_3_, int p_71895_4_, int p_71895_5_) {
    if (p_71895_5_ == 1) {
      return this.field_72059_bZ - 1;
    } else if (p_71895_5_ == 0) {
      return this.field_72059_bZ - 1;
    } else {
      int var6 = p_71895_1_.func_72798_a(p_71895_2_, p_71895_3_, p_71895_4_ - 1);
      int var7 = p_71895_1_.func_72798_a(p_71895_2_, p_71895_3_, p_71895_4_ + 1);
      int var8 = p_71895_1_.func_72798_a(p_71895_2_ - 1, p_71895_3_, p_71895_4_);
      int var9 = p_71895_1_.func_72798_a(p_71895_2_ + 1, p_71895_3_, p_71895_4_);
      byte var10 = 3;
      if (Block.field_71970_n[var6] && !Block.field_71970_n[var7]) {
        var10 = 3;
      }

      if (Block.field_71970_n[var7] && !Block.field_71970_n[var6]) {
        var10 = 2;
      }

      if (Block.field_71970_n[var8] && !Block.field_71970_n[var9]) {
        var10 = 5;
      }

      if (Block.field_71970_n[var9] && !Block.field_71970_n[var8]) {
        var10 = 4;
      }

      return p_71895_5_ == var10 ? this.field_72059_bZ + 1 : this.field_72059_bZ;
    }
  }
  public boolean shouldSideBeRendered(
      IBlockAccess p_149646_1_,
      int p_149646_2_,
      int p_149646_3_,
      int p_149646_4_,
      int p_149646_5_) {
    Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);

    if (this == ModBlocks.IronwoodLeaves) {
      if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_)
          != p_149646_1_.getBlockMetadata(
              p_149646_2_ - Facing.offsetsXForSide[p_149646_5_],
              p_149646_3_ - Facing.offsetsYForSide[p_149646_5_],
              p_149646_4_ - Facing.offsetsZForSide[p_149646_5_])) {
        return true;
      }

      if (block == this) {
        return true;
      }
    }

    return !this.field_149996_a && block == this
        ? false
        : super.shouldSideBeRendered(
            p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
  }
  @Override
  public boolean shouldSideBeRendered(
      IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
    if (par1IBlockAccess.getBlockId(par2, par3, par4) == this.blockID) {
      return false;
    } else {
      final int i = par1IBlockAccess.getBlockId(par2, par3, par4);
      boolean var6 = false;

      if (Block.blocksList[i] != null) {
        var6 = !Block.blocksList[i].isOpaqueCube();
      }

      final boolean var7 = i == 0;

      if ((var6 || var7) && par5 == 3 && !var6) {
        return true;
      } else if ((var6 || var7) && par5 == 4 && !var6) {
        return true;
      } else if ((var6 || var7) && par5 == 5 && !var6) {
        return true;
      } else if ((var6 || var7) && par5 == 2 && !var6) {
        return true;
      } else if ((var6 || var7) && par5 == 0 && !var6) {
        return true;
      } else if ((var6 || var7) && par5 == 1 && !var6) {
        return true;
      } else {
        return false;
      }
    }
  }
  @Override
  public int isProvidingWeakPower(IBlockAccess world, int i, int j, int k, int l) {
    if (!this.wiresProvidePower) {
      return 0;
    } else if (world.getBlockMetadata(i, j, k) == 0) {
      return 0;
    } else {
      boolean poweredNegX = isPoweredOrRepeater(world, i - 1, j, k, 1);
      boolean poweredPosX = isPoweredOrRepeater(world, i + 1, j, k, 3);
      boolean poweredNegZ = isPoweredOrRepeater(world, i, j, k - 1, 2);
      boolean poweredPosZ = isPoweredOrRepeater(world, i, j, k + 1, 0);
      boolean poweredNegY = isPoweredOrRepeater(world, i, j - 1, k, -1);
      boolean poweredPosY = isPoweredOrRepeater(world, i, j + 1, k, -1);

      if ((l == 2 && poweredNegZ)
          || (l == 3 && poweredPosZ)
          || (l == 4 && poweredNegX)
          || (l == 5 && poweredPosX)
          || (l == 0 && poweredNegY)
          || (l == 1 && poweredPosY)) {
        return world.getBlockMetadata(i, j, k);
      }
      return 0;
    }
  }
Exemple #7
0
 private boolean isSameLeaf(IBlockAccess world, BlockPos pos, IBlockState state) {
   if ((world.getBlockState(pos).getBlock() == state.getBlock()
       && world.getBlockState(pos).getValue(META_PROPERTY) == state.getValue(META_PROPERTY))) {
     return true;
   }
   return false;
 }
  @Override
  public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int side) {
    int metadata = world.getBlockMetadata(x, y, z);

    if (metadata >= GCCoreBlockMachine.STORAGE_MODULE_METADATA
        && metadata < GCCoreBlockMachine.ELECTRIC_FURNACE_METADATA) {
      TileEntity tile = world.getBlockTileEntity(x, y, z);

      metadata -= GCCoreBlockMachine.STORAGE_MODULE_METADATA;

      if (side == 0 || side == 1) {
        return this.blockIcon;
      }

      // If it is the front side
      if (side == metadata + 2) {
        return this.iconOutput;
      }
      // If it is the back side
      else if (side == ForgeDirection.getOrientation(metadata + 2).getOpposite().ordinal()) {
        return this.iconInput;
      }

      if (tile instanceof GCCoreTileEntityEnergyStorageModule) {
        return this.iconEnergyStorageModule[
            ((GCCoreTileEntityEnergyStorageModule) tile).scaledEnergyLevel];
      } else {
        return this.iconEnergyStorageModule[0];
      }
    }

    return this.getIcon(side, world.getBlockMetadata(x, y, z));
  }
Exemple #9
0
  @Override
  @SideOnly(Side.CLIENT)
  public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
    int l = 0;
    int i1 = 0;
    int j1 = 0;
    int meta = world.getBlockMetadata(x, y, z);

    for (int k1 = -1; k1 <= 1; ++k1) {
      for (int l1 = -1; l1 <= 1; ++l1) {
        BiomeGenBase biome = world.getBiomeGenForCoords(x + l1, z + k1);
        int grassColor = 0;
        if (meta == 1) {
          double temp = (double) MathHelper.clamp_float(biome.getFloatTemperature(), 0.0F, 1.0F);
          double rainfall = (double) MathHelper.clamp_float(biome.getFloatRainfall(), 0.0F, 1.0F);
          grassColor = GrassColorizerAlternate.getBlueGrassColor(temp, rainfall);
        } else if (meta == 2) {
          double temp = (double) MathHelper.clamp_float(biome.getFloatTemperature(), 0.0F, 1.0F);
          double rainfall = (double) MathHelper.clamp_float(biome.getFloatRainfall(), 0.0F, 1.0F);
          grassColor = GrassColorizerAlternate.getOrangeGrassColor(temp, rainfall);
        } else {
          grassColor = biome.getBiomeGrassColor();
        }
        l += (grassColor & 16711680) >> 16;
        i1 += (grassColor & 65280) >> 8;
        j1 += grassColor & 255;
      }
    }
    return (l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255;
  }
  @Override
  @SideOnly(Side.CLIENT)
  public Icon getBlockTexture(IBlockAccess block, int x, int y, int z, int side) {
    int t = block.getBlockMetadata(x, y, z) & 7;
    int meta = block.getBlockMetadata(x, y, z);
    if (t == 2 || t == 3) {
      if (side == 0 || side == 1) {
        Integer worldID = Minecraft.getMinecraft().thePlayer.worldObj.provider.dimensionId;
        BlockCoord coord = new BlockCoord(x, y, z);
        ChunkCoord chunk = new ChunkCoord(coord);

        if (!ArtificeCore.textureCache.contains(worldID, chunk, coord)) {
          int[] indices = new int[6];
          for (int i = 0; i < indices.length; i++)
            indices[i] = this.getTextureRenderer(i, meta).getTextureIndex(block, x, y, z, i);
          ArtificeCore.textureCache.add(worldID, chunk, coord, indices);
        }

        if (ArtificeCore.textureCache.get(worldID, chunk, coord) == null)
          return this.getIcon(side, meta);
        return this.getTextureRenderer(side, meta)
            .texture
            .textureList[ArtificeCore.textureCache.get(worldID, chunk, coord)[side]];
      } else return this.paverSide;
    }
    if (t == 0) t = 2;
    return ArtificeBlocks.blockMarble.getIcon(side, t);
  }
 @SideOnly(Side.CLIENT)
 public float func_71870_f(
     IBlockAccess p_71870_1_, int p_71870_2_, int p_71870_3_, int p_71870_4_) {
   float var5 = p_71870_1_.func_72801_o(p_71870_2_, p_71870_3_, p_71870_4_);
   float var6 = p_71870_1_.func_72801_o(p_71870_2_, p_71870_3_ + 1, p_71870_4_);
   return var5 > var6 ? var5 : var6;
 }
 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);
 }
 @Override
 public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
   if (pos.getY() == neighbor.getY() && world instanceof World) {
     neighborChanged(
         world.getBlockState(pos), (World) world, pos, world.getBlockState(neighbor).getBlock());
   }
 }
 public boolean canBlockCatchFire(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
   Block block = Block.blocksList[world.getBlockId(x, y, z)];
   if (block != null) {
     return block.isFlammable(world, x, y, z, world.getBlockMetadata(x, y, z), face);
   }
   return false;
 }
Exemple #15
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
   */
  public boolean isProvidingWeakPower(
      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)));
    }
  }
 @Override
 public boolean renderWorldBlock(
     IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
   TileEntity tile = world.getTileEntity(x, y, z);
   int side = -1;
   int meta = world.getBlockMetadata(x, y, z);
   if (tile != null && tile instanceof TileInjector) side = ((TileInjector) tile).side;
   switch (side) {
     case 2:
       RenderBlocksHelper.renderFace(
           world,
           renderer,
           block,
           x,
           y,
           z,
           "x",
           PillarMaterials.values()[meta].block.getIcon(0, 0));
       break;
     case 3:
       RenderBlocksHelper.renderFace(
           world,
           renderer,
           block,
           x,
           y,
           z,
           "x",
           PillarMaterials.values()[meta].block.getIcon(0, 0));
       break;
     case 4:
       RenderBlocksHelper.renderFace(
           world,
           renderer,
           block,
           x,
           y,
           z,
           "z",
           PillarMaterials.values()[meta].block.getIcon(0, 0));
       break;
     case 5:
       RenderBlocksHelper.renderFace(
           world,
           renderer,
           block,
           x,
           y,
           z,
           "z",
           PillarMaterials.values()[meta].block.getIcon(0, 0));
       break;
     case -1:
       break;
     default:
       break;
   }
   return true;
 }
 @Override
 public void onNeighborChange(
     IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) {
   if (world.getBlock(tileX, tileY, tileZ) != InitBlocks.blockSteelPipe) {
     TileSteelPipe tile = (TileSteelPipe) world.getTileEntity(x, y, z);
     tile.updateConnections(); // only on server
   }
 }
 public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) {
   TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
   if (tTileEntity == null) {
     return 0;
   }
   if ((tTileEntity instanceof IGregTechTileEntity)) {
     return ((IGregTechTileEntity) tTileEntity).getLightOpacity();
   }
   return aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 255 : 0;
 }
 protected int func_176401_c(
     IBlockAccess p_176401_1_, BlockPos p_176401_2_, EnumFacing p_176401_3_) {
   IBlockState var4 = p_176401_1_.func_180495_p(p_176401_2_);
   Block var5 = var4.func_177230_c();
   return this.func_149908_a(var5)
       ? (var5 == Blocks.field_150488_af
           ? ((Integer) var4.func_177229_b(BlockRedstoneWire.field_176351_O)).intValue()
           : p_176401_1_.func_175627_a(p_176401_2_, p_176401_3_))
       : 0;
 }
 @SideOnly(Side.CLIENT)
 public int func_71874_e(IBlockAccess p_71874_1_, int p_71874_2_, int p_71874_3_, int p_71874_4_) {
   int var5 = p_71874_1_.func_72802_i(p_71874_2_, p_71874_3_, p_71874_4_, 0);
   int var6 = p_71874_1_.func_72802_i(p_71874_2_, p_71874_3_ + 1, p_71874_4_, 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;
 }
Exemple #21
0
 @SideOnly(Side.CLIENT)
 public boolean func_71877_c(
     IBlockAccess p_71877_1_, int p_71877_2_, int p_71877_3_, int p_71877_4_, int p_71877_5_) {
   if (p_71877_1_.func_72798_a(p_71877_2_, p_71877_3_, p_71877_4_) == this.field_71990_ca) {
     return false;
   } else {
     boolean var6 =
         p_71877_1_.func_72798_a(p_71877_2_ - 1, p_71877_3_, p_71877_4_) == this.field_71990_ca
             && p_71877_1_.func_72798_a(p_71877_2_ - 2, p_71877_3_, p_71877_4_)
                 != this.field_71990_ca;
     boolean var7 =
         p_71877_1_.func_72798_a(p_71877_2_ + 1, p_71877_3_, p_71877_4_) == this.field_71990_ca
             && p_71877_1_.func_72798_a(p_71877_2_ + 2, p_71877_3_, p_71877_4_)
                 != this.field_71990_ca;
     boolean var8 =
         p_71877_1_.func_72798_a(p_71877_2_, p_71877_3_, p_71877_4_ - 1) == this.field_71990_ca
             && p_71877_1_.func_72798_a(p_71877_2_, p_71877_3_, p_71877_4_ - 2)
                 != this.field_71990_ca;
     boolean var9 =
         p_71877_1_.func_72798_a(p_71877_2_, p_71877_3_, p_71877_4_ + 1) == this.field_71990_ca
             && p_71877_1_.func_72798_a(p_71877_2_, p_71877_3_, p_71877_4_ + 2)
                 != this.field_71990_ca;
     boolean var10 = var6 || var7;
     boolean var11 = var8 || var9;
     return var10 && p_71877_5_ == 4
         ? true
         : (var10 && p_71877_5_ == 5
             ? true
             : (var11 && p_71877_5_ == 2 ? true : var11 && p_71877_5_ == 3));
   }
 }
 @SideOnly(Side.CLIENT)
 /**
  * Returns true if the given side of this block type should be rendered, if the adjacent block is
  * at the given coordinates. Args: blockAccess, x, y, z, side
  */
 public boolean shouldSideBeRendered(
     IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
   if (par1IBlockAccess.getBlockId(par2, par3, par4) == this.blockID) {
     return false;
   } else {
     boolean flag =
         par1IBlockAccess.getBlockId(par2 - 1, par3, par4) == this.blockID
             && par1IBlockAccess.getBlockId(par2 - 2, par3, par4) != this.blockID;
     boolean flag1 =
         par1IBlockAccess.getBlockId(par2 + 1, par3, par4) == this.blockID
             && par1IBlockAccess.getBlockId(par2 + 2, par3, par4) != this.blockID;
     boolean flag2 =
         par1IBlockAccess.getBlockId(par2, par3, par4 - 1) == this.blockID
             && par1IBlockAccess.getBlockId(par2, par3, par4 - 2) != this.blockID;
     boolean flag3 =
         par1IBlockAccess.getBlockId(par2, par3, par4 + 1) == this.blockID
             && par1IBlockAccess.getBlockId(par2, par3, par4 + 2) != this.blockID;
     boolean flag4 = flag || flag1;
     boolean flag5 = flag2 || flag3;
     return flag4 && par5 == 4
         ? true
         : (flag4 && par5 == 5 ? true : (flag5 && par5 == 2 ? true : flag5 && par5 == 3));
   }
 }
Exemple #23
0
  public static void setSudisBlockBoundsBasedOnState(
      Block block, IBlockAccess blockAccess, int x, int y, int z, int yOffset) {
    TileEntitySudis tileEntitySudis = (TileEntitySudis) blockAccess.getBlockTileEntity(x, y, z);

    int connectCount = 0;
    float f = 0.375F;
    float f1 = 0.625F;
    float f2 = 0.375F;
    float f3 = 0.625F;

    if (tileEntitySudis != null && tileEntitySudis.getHasMultipleSudes()) {
      boolean flag = canConnectSudisTo(blockAccess, x, y, z - 1);
      boolean flag1 = canConnectSudisTo(blockAccess, x, y, z + 1);
      boolean flag2 = canConnectSudisTo(blockAccess, x - 1, y, z);
      boolean flag3 = canConnectSudisTo(blockAccess, x + 1, y, z);
      if (flag) {
        connectCount++;
      }
      if (flag1) {
        connectCount++;
      }
      if (flag2) {
        connectCount++;
      }
      if (flag3) {
        connectCount++;
      }
      if (connectCount == 0) {
        int metadata = blockAccess.getBlockMetadata(x, y, z);
        int facing = metadata & BlockHelper.MASK_DIR;
        if (facing == BlockHelper.META_DIR_NORTH || facing == BlockHelper.META_DIR_SOUTH) {
          f = .0f;
          f1 = 1.0f;
        } else {
          f2 = .0f;
          f3 = 1.0f;
        }
      } else {
        if (flag || (flag1 && connectCount <= 1)) {
          f2 = 0.0F;
        }
        if (flag1 || (flag && connectCount <= 1)) {
          f3 = 1.0F;
        }
        if (flag2 || (flag3 && connectCount <= 1)) {
          f = 0.0F;
        }
        if (flag3 || (flag2 && connectCount <= 1)) {
          f1 = 1.0F;
        }
      }
    }

    block.setBlockBounds(f, yOffset, f2, f1, MODEL_SUDIS_HEIGHT + yOffset, f3);
  }
  public int sample(int side) {

    if ((sampled & 1 << side) == 0) {
      c.set(pos).offset(side);
      Block block = access.getBlock(c.x, c.y, c.z);
      samples[side] =
          access.getLightBrightnessForSkyBlocks(
              c.x, c.y, c.z, block.getLightValue(access, c.x, c.y, c.z));
      sampled |= 1 << side;
    }
    return samples[side];
  }
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    renderer.renderStandardBlock(block, x, y, z);

    Tessellator ts = Tessellator.instance;
    ForgeDirection face = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
    BlockTerminalFluid terminalBlock = (BlockTerminalFluid) block;
    int[] color = {0, 0, 0};
    TileEntity blockTE = world.getBlockTileEntity(x, y, z);
    if (blockTE instanceof TileEntityTerminalFluid) {
      TileEntityTerminalFluid terminalTE = (TileEntityTerminalFluid) blockTE;
      switch (terminalTE.getColor()) {
        case -1:
          color = fluix.clone();
          break;
        case 0:
          color = blue.clone();
          break;
        case 1:
          color = black.clone();
          break;
        case 2:
          color = white.clone();
          break;
        case 3:
          color = brown.clone();
          break;
        case 4:
          color = red.clone();
          break;
        case 5:
          color = yellow.clone();
          break;
        case 6:
          color = green.clone();
          break;
      }

      boolean active = terminalTE.isMachineActive();

      ts.setBrightness(15 << 2 | 15 << 0);

      if (active) ts.setBrightness(15 << 20 | 15 << 4);

      ts.setColorOpaque_I(0xFFFFFF);
      drawFace(face, block, x, y, z, terminalBlock.baseLayer, renderer);
      for (int i = 0; i < 3; i++) {
        ts.setColorOpaque_I(color[i]);
        drawFace(face, block, x, y, z, terminalBlock.colorLayers[i], renderer);
      }
    }
    return true;
  }
  @Override
  public int getQuantaValue(IBlockAccess world, int x, int y, int z) {

    if (world.getBlockId(x, y, z) == 0) {
      return 0;
    }
    if (world.getBlockId(x, y, z) != blockID) {
      return -1;
    }
    int quantaRemaining = quantaPerBlock - world.getBlockMetadata(x, y, z);
    return quantaRemaining;
  }
Exemple #27
0
 /** Updates the blocks bounds based on its current state. Args: world, x, y, z */
 public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int x, int y, int z) {
   if (iblockaccess.getBlock(x, y, z - 1) == this) {
     this.setBlockBounds(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F);
   } else if (iblockaccess.getBlock(x, y, z + 1) == this) {
     this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F);
   } else if (iblockaccess.getBlock(x - 1, y, z) == this) {
     this.setBlockBounds(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
   } else if (iblockaccess.getBlock(x + 1, y, z) == this) {
     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);
   }
 }
  protected int func_72203_d(
      IBlockAccess p_72203_1_, int p_72203_2_, int p_72203_3_, int p_72203_4_) {
    if (p_72203_1_.func_72803_f(p_72203_2_, p_72203_3_, p_72203_4_) != this.field_72018_cp) {
      return -1;
    } else {
      int var5 = p_72203_1_.func_72805_g(p_72203_2_, p_72203_3_, p_72203_4_);
      if (var5 >= 8) {
        var5 = 0;
      }

      return var5;
    }
  }
  private boolean isBlockLit(IBlockAccess world, int x, int y, int z) {
    int threshhold = LIGHT_THRESHHOLD << 4;

    if (world.getBlock(x, y, z).isOpaqueCube()) {
      return false;
    } else {
      int light = world.getLightBrightnessForSkyBlocks(x, y, z, 0);
      int sky = light % 65536;
      int block = light / 65536;

      return sky > threshhold || block > threshhold;
    }
  }
 @SideOnly(Side.CLIENT)
 public boolean connectTo(IBlockAccess world, int x, int y, int z) {
   if (world.getBlock(x, y, z) == this) {
     return true;
   }
   TileEntity te = world.getTileEntity(x, y, z);
   if (te != null) {
     if (te instanceof IConnectTexture) {
       return ((IConnectTexture) te).connectTexture();
     }
   }
   return false;
 }