Beispiel #1
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 #2
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;
 }
 public void func_71902_a(
     IBlockAccess p_71902_1_, int p_71902_2_, int p_71902_3_, int p_71902_4_) {
   if (p_71902_1_.func_72798_a(p_71902_2_, p_71902_3_, p_71902_4_ - 1) == this.field_71990_ca) {
     this.func_71905_a(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F);
   } else if (p_71902_1_.func_72798_a(p_71902_2_, p_71902_3_, p_71902_4_ + 1)
       == this.field_71990_ca) {
     this.func_71905_a(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F);
   } else if (p_71902_1_.func_72798_a(p_71902_2_ - 1, p_71902_3_, p_71902_4_)
       == this.field_71990_ca) {
     this.func_71905_a(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
   } else if (p_71902_1_.func_72798_a(p_71902_2_ + 1, p_71902_3_, p_71902_4_)
       == this.field_71990_ca) {
     this.func_71905_a(0.0625F, 0.0F, 0.0625F, 1.0F, 0.875F, 0.9375F);
   } else {
     this.func_71905_a(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
   }
 }
 /** Is this block indirectly powering the block on the specified side */
 @Override
 public boolean isProvidingWeakPower(IBlockAccess blocks, int x, int y, int z, int side) {
   // TODO: Make this only power in directions parallel to the surface it's attached to?
   TileEntity tile = blocks.getBlockTileEntity(x, y, z);
   if (tile instanceof TileReceiver) {
     return ((TileReceiver) tile).isActive();
   }
   return false;
 }
Beispiel #5
0
 public void func_82541_d(
     IBlockAccess p_82541_1_, int p_82541_2_, int p_82541_3_, int p_82541_4_) {
   int var5 = p_82541_1_.func_72805_g(p_82541_2_, p_82541_3_, p_82541_4_);
   if ((var5 & 4) != 0) {
     this.func_71905_a(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
   } else {
     this.func_71905_a(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
   }
 }
Beispiel #6
0
 public void func_71902_a(
     IBlockAccess p_71902_1_, int p_71902_2_, int p_71902_3_, int p_71902_4_) {
   this.field_72022_cl =
       (double)
           ((float) (p_71902_1_.func_72805_g(p_71902_2_, p_71902_3_, p_71902_4_) * 2 + 2) / 16.0F);
   float var5 = 0.125F;
   this.func_71905_a(
       0.5F - var5, 0.0F, 0.5F - var5, 0.5F + var5, (float) this.field_72022_cl, 0.5F + var5);
 }
 /** Is this block powering the block on the specified side */
 @Override
 public boolean isProvidingStrongPower(IBlockAccess blocks, int x, int y, int z, int side) {
   // TODO: Make this only return true for the block it's attached to, so it acts like
   // levers/buttons.
   TileEntity tile = blocks.getBlockTileEntity(x, y, z);
   if (tile instanceof TileReceiver) {
     return ((TileReceiver) tile).isActive();
   }
   return false;
 }
Beispiel #8
0
 @SideOnly(Side.CLIENT)
 public int func_72265_d(IBlockAccess p_72265_1_, int p_72265_2_, int p_72265_3_, int p_72265_4_) {
   int var5 = p_72265_1_.func_72805_g(p_72265_2_, p_72265_3_, p_72265_4_);
   return var5 < 7
       ? -1
       : (p_72265_1_.func_72798_a(p_72265_2_ - 1, p_72265_3_, p_72265_4_)
               == this.field_72267_a.field_71990_ca
           ? 0
           : (p_72265_1_.func_72798_a(p_72265_2_ + 1, p_72265_3_, p_72265_4_)
                   == this.field_72267_a.field_71990_ca
               ? 1
               : (p_72265_1_.func_72798_a(p_72265_2_, p_72265_3_, p_72265_4_ - 1)
                       == this.field_72267_a.field_71990_ca
                   ? 2
                   : (p_72265_1_.func_72798_a(p_72265_2_, p_72265_3_, p_72265_4_ + 1)
                           == this.field_72267_a.field_71990_ca
                       ? 3
                       : -1))));
 }
 /**
  * Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
  */
 public int getBlockTexture(
     IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
   if (par5 == 1) {
     return 14;
   } else if (par5 == 0) {
     return 14;
   } else {
     int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
     return par5 != var6 ? 12 : 11;
   }
 }
 public int func_71865_a(
     IBlockAccess p_71865_1_, int p_71865_2_, int p_71865_3_, int p_71865_4_, int p_71865_5_) {
   if (!this.func_71853_i()) {
     return 0;
   } else {
     int var6 =
         ((TileEntityChest) p_71865_1_.func_72796_p(p_71865_2_, p_71865_3_, p_71865_4_))
             .field_70427_h;
     return MathHelper.func_76125_a(var6, 0, 15);
   }
 }
Beispiel #11
0
 public boolean func_72250_d(
     IBlockAccess p_72250_1_, int p_72250_2_, int p_72250_3_, int p_72250_4_) {
   int var5 = p_72250_1_.func_72798_a(p_72250_2_, p_72250_3_, p_72250_4_);
   if (var5 != this.field_71990_ca && var5 != Block.field_71993_bv.field_71990_ca) {
     Block var6 = Block.field_71973_m[var5];
     return var6 != null && var6.field_72018_cp.func_76218_k() && var6.func_71886_c()
         ? var6.field_72018_cp != Material.field_76266_z
         : false;
   } else {
     return true;
   }
 }
 public void func_71902_a(
     IBlockAccess p_71902_1_, int p_71902_2_, int p_71902_3_, int p_71902_4_) {
   if (this.field_72242_a) {
     this.func_71905_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
   } else {
     boolean var5 = (p_71902_1_.func_72805_g(p_71902_2_, p_71902_3_, p_71902_4_) & 8) != 0;
     if (var5) {
       this.func_71905_a(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
     } else {
       this.func_71905_a(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
     }
   }
 }
Beispiel #13
0
 @SuppressWarnings({"all"})
 public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l) {
   switch (l) {
     case 0:
     case 1:
       return 6 * 16 + 2;
     default:
       if (iblockaccess.getBlockId(i, j - 1, k) == blockID) {
         return 6 * 16 + 1;
       } else {
         return 6 * 16 + 0;
       }
   }
 }
 public boolean func_71865_a(
     IBlockAccess p_71865_1_, int p_71865_2_, int p_71865_3_, int p_71865_4_, int p_71865_5_) {
   if (!this.field_72130_a) {
     return false;
   } else {
     int var6 = p_71865_1_.func_72805_g(p_71865_2_, p_71865_3_, p_71865_4_);
     return var6 == 5 && p_71865_5_ == 1
         ? false
         : (var6 == 3 && p_71865_5_ == 3
             ? false
             : (var6 == 4 && p_71865_5_ == 2
                 ? false
                 : (var6 == 1 && p_71865_5_ == 5 ? false : var6 != 2 || p_71865_5_ != 4)));
   }
 }
 public void func_238_a(IBlockAccess p_238_1_, int p_238_2_, int p_238_3_, int p_238_4_) {
   int var5 = p_238_1_.func_602_e(p_238_2_, p_238_3_, p_238_4_) & 7;
   float var6 = 0.1875F;
   if (var5 == 1) {
     this.func_213_a(0.0F, 0.2F, 0.5F - var6, var6 * 2.0F, 0.8F, 0.5F + var6);
   } else if (var5 == 2) {
     this.func_213_a(1.0F - var6 * 2.0F, 0.2F, 0.5F - var6, 1.0F, 0.8F, 0.5F + var6);
   } else if (var5 == 3) {
     this.func_213_a(0.5F - var6, 0.2F, 0.0F, 0.5F + var6, 0.8F, var6 * 2.0F);
   } else if (var5 == 4) {
     this.func_213_a(0.5F - var6, 0.2F, 1.0F - var6 * 2.0F, 0.5F + var6, 0.8F, 1.0F);
   } else {
     var6 = 0.25F;
     this.func_213_a(0.5F - var6, 0.0F, 0.5F - var6, 0.5F + var6, 0.6F, 0.5F + var6);
   }
 }
Beispiel #16
0
 public int func_71855_c(
     IBlockAccess p_71855_1_, int p_71855_2_, int p_71855_3_, int p_71855_4_, int p_71855_5_) {
   int var6 = p_71855_1_.func_72805_g(p_71855_2_, p_71855_3_, p_71855_4_);
   if ((var6 & 8) == 0) {
     return 0;
   } else {
     int var7 = var6 & 7;
     return var7 == 5 && p_71855_5_ == 1
         ? 15
         : (var7 == 4 && p_71855_5_ == 2
             ? 15
             : (var7 == 3 && p_71855_5_ == 3
                 ? 15
                 : (var7 == 2 && p_71855_5_ == 4 ? 15 : (var7 == 1 && p_71855_5_ == 5 ? 15 : 0))));
   }
 }
  /** Updates the blocks bounds based on its current state. Args: world, x, y, z */
  public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
    int var5 = var1.getBlockMetadata(var2, var3, var4);
    float var6 = 0.0F;
    float var7 = 0.0F;
    float var8 = 0.0F;
    float var9 = 1.0F;
    float var10 = 1.0F;
    float var11 = 1.0F;

    if (var5 == 0) {
      var6 = 0.2F;
      var7 = 0.2F;
      var8 = 0.45F;
      var9 = 0.8F;
      var10 = 0.8F;
      var11 = 1.0F;
    }

    if (var5 == 1) {
      var6 = 0.0F;
      var7 = 0.2F;
      var8 = 0.2F;
      var9 = 0.55F;
      var10 = 0.8F;
      var11 = 0.8F;
    }

    if (var5 == 2) {
      var6 = 0.2F;
      var7 = 0.2F;
      var8 = 0.0F;
      var9 = 0.8F;
      var10 = 0.8F;
      var11 = 0.55F;
    }

    if (var5 == 3) {
      var6 = 0.45F;
      var7 = 0.2F;
      var8 = 0.2F;
      var9 = 1.0F;
      var10 = 0.8F;
      var11 = 0.8F;
    }

    this.setBlockBounds(var6, var7, var8, var9, var10, var11);
  }
Beispiel #18
0
 public int func_71865_a(
     IBlockAccess p_71865_1_, int p_71865_2_, int p_71865_3_, int p_71865_4_, int p_71865_5_) {
   return (p_71865_1_.func_72805_g(p_71865_2_, p_71865_3_, p_71865_4_) & 8) > 0 ? 15 : 0;
 }
 @Override
 public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int i, int j, int k) {
   setBlockBounds(
       0.0F, 0.0F, 0.0F, 1.0F, 0.01F + iblockaccess.getBlockMetadata(i, j, k) / 16F, 1.0F);
 }
Beispiel #20
0
 @SideOnly(Side.CLIENT)
 public int func_71920_b(IBlockAccess p_71920_1_, int p_71920_2_, int p_71920_3_, int p_71920_4_) {
   return this.func_71889_f_(p_71920_1_.func_72805_g(p_71920_2_, p_71920_3_, p_71920_4_));
 }
Beispiel #21
0
  public boolean func_82542_g(
      IBlockAccess p_82542_1_, int p_82542_2_, int p_82542_3_, int p_82542_4_) {
    int var5 = p_82542_1_.func_72805_g(p_82542_2_, p_82542_3_, p_82542_4_);
    int var6 = var5 & 3;
    float var7 = 0.5F;
    float var8 = 1.0F;
    if ((var5 & 4) != 0) {
      var7 = 0.0F;
      var8 = 0.5F;
    }

    float var9 = 0.0F;
    float var10 = 1.0F;
    float var11 = 0.0F;
    float var12 = 0.5F;
    boolean var13 = true;
    int var14;
    int var15;
    int var16;
    if (var6 == 0) {
      var9 = 0.5F;
      var12 = 1.0F;
      var14 = p_82542_1_.func_72798_a(p_82542_2_ + 1, p_82542_3_, p_82542_4_);
      var15 = p_82542_1_.func_72805_g(p_82542_2_ + 1, p_82542_3_, p_82542_4_);
      if (func_82543_e(var14) && (var5 & 4) == (var15 & 4)) {
        var16 = var15 & 3;
        if (var16 == 3
            && !this.func_82540_f(p_82542_1_, p_82542_2_, p_82542_3_, p_82542_4_ + 1, var5)) {
          var12 = 0.5F;
          var13 = false;
        } else if (var16 == 2
            && !this.func_82540_f(p_82542_1_, p_82542_2_, p_82542_3_, p_82542_4_ - 1, var5)) {
          var11 = 0.5F;
          var13 = false;
        }
      }
    } else if (var6 == 1) {
      var10 = 0.5F;
      var12 = 1.0F;
      var14 = p_82542_1_.func_72798_a(p_82542_2_ - 1, p_82542_3_, p_82542_4_);
      var15 = p_82542_1_.func_72805_g(p_82542_2_ - 1, p_82542_3_, p_82542_4_);
      if (func_82543_e(var14) && (var5 & 4) == (var15 & 4)) {
        var16 = var15 & 3;
        if (var16 == 3
            && !this.func_82540_f(p_82542_1_, p_82542_2_, p_82542_3_, p_82542_4_ + 1, var5)) {
          var12 = 0.5F;
          var13 = false;
        } else if (var16 == 2
            && !this.func_82540_f(p_82542_1_, p_82542_2_, p_82542_3_, p_82542_4_ - 1, var5)) {
          var11 = 0.5F;
          var13 = false;
        }
      }
    } else if (var6 == 2) {
      var11 = 0.5F;
      var12 = 1.0F;
      var14 = p_82542_1_.func_72798_a(p_82542_2_, p_82542_3_, p_82542_4_ + 1);
      var15 = p_82542_1_.func_72805_g(p_82542_2_, p_82542_3_, p_82542_4_ + 1);
      if (func_82543_e(var14) && (var5 & 4) == (var15 & 4)) {
        var16 = var15 & 3;
        if (var16 == 1
            && !this.func_82540_f(p_82542_1_, p_82542_2_ + 1, p_82542_3_, p_82542_4_, var5)) {
          var10 = 0.5F;
          var13 = false;
        } else if (var16 == 0
            && !this.func_82540_f(p_82542_1_, p_82542_2_ - 1, p_82542_3_, p_82542_4_, var5)) {
          var9 = 0.5F;
          var13 = false;
        }
      }
    } else if (var6 == 3) {
      var14 = p_82542_1_.func_72798_a(p_82542_2_, p_82542_3_, p_82542_4_ - 1);
      var15 = p_82542_1_.func_72805_g(p_82542_2_, p_82542_3_, p_82542_4_ - 1);
      if (func_82543_e(var14) && (var5 & 4) == (var15 & 4)) {
        var16 = var15 & 3;
        if (var16 == 1
            && !this.func_82540_f(p_82542_1_, p_82542_2_ + 1, p_82542_3_, p_82542_4_, var5)) {
          var10 = 0.5F;
          var13 = false;
        } else if (var16 == 0
            && !this.func_82540_f(p_82542_1_, p_82542_2_ - 1, p_82542_3_, p_82542_4_, var5)) {
          var9 = 0.5F;
          var13 = false;
        }
      }
    }

    this.func_71905_a(var9, var7, var11, var10, var8, var12);
    return var13;
  }
Beispiel #22
0
 private boolean func_82540_f(
     IBlockAccess p_82540_1_, int p_82540_2_, int p_82540_3_, int p_82540_4_, int p_82540_5_) {
   int var6 = p_82540_1_.func_72798_a(p_82540_2_, p_82540_3_, p_82540_4_);
   return func_82543_e(var6)
       && p_82540_1_.func_72805_g(p_82540_2_, p_82540_3_, p_82540_4_) == p_82540_5_;
 }
 @Override
 public float getBlockBrightness(IBlockAccess iblockaccess, int i, int j, int k) {
   float f = iblockaccess.getLightBrightness(i, j, k);
   float f1 = iblockaccess.getLightBrightness(i, j + 1, k);
   return f > f1 ? f : f1;
 }
Beispiel #24
0
 @Override
 public int getBlockTexture(IBlockAccess iblockaccess, int x, int y, int z, int side) {
   int m = iblockaccess.getBlockMetadata(x, y, z);
   return getBlockTextureFromSideAndMetadata(side, m);
 }
 /**
  * Checks the specified block coordinate to see if it can catch fire. Args: blockAccess, x, y, z
  */
 public boolean canBlockCatchFire(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
   return chanceToEncourageFire[par1IBlockAccess.getBlockId(par2, par3, par4)] > 0;
 }
Beispiel #26
0
 public void func_71902_a(
     IBlockAccess p_71902_1_, int p_71902_2_, int p_71902_3_, int p_71902_4_) {
   int var5 = p_71902_1_.func_72805_g(p_71902_2_, p_71902_3_, p_71902_4_);
   this.func_82534_e(var5);
 }
 @Override
 @SideOnly(Side.CLIENT)
 public int colorMultiplier(IBlockAccess iBlockAccess, int x, int y, int z) {
   return iBlockAccess.getBiomeGenForCoords(x, z).getBiomeFoliageColor();
 }
 @Override
 public boolean isPoweringTo(IBlockAccess iblockaccess, int i, int j, int k, int l) {
   return (iblockaccess.getBlockMetadata(i, j, k) & 8) > 0;
 }
 public boolean func_231_b(
     IBlockAccess p_231_1_, int p_231_2_, int p_231_3_, int p_231_4_, int p_231_5_) {
   return (p_231_1_.func_602_e(p_231_2_, p_231_3_, p_231_4_) & 8) > 0;
 }