示例#1
0
 @Override
 public void renderWorldBlock(
     RenderBlocks renderblocks, IBlockAccess iba, int i, int j, int k, int md) {
   TileBreaker tb = (TileBreaker) CoreLib.getTileEntity(iba, i, j, k, TileBreaker.class);
   if (tb != null) {
     this.context.setDefaults();
     this.context.setLocalLights(0.5F, 1.0F, 0.8F, 0.8F, 0.6F, 0.6F);
     int act = tb.Active ? 1 : 0;
     this.context.setPos(i, j, k);
     this.context.readGlobalLights(iba, i, j, k);
     this.context.setIcon(
         super.block.getIcon(58, md),
         super.block.getIcon(49 + act, md),
         super.block.getIcon(51 + act, md),
         super.block.getIcon(51 + act, md),
         super.block.getIcon(51 + act, md),
         super.block.getIcon(51 + act, md));
     this.context.setSize(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
     this.context.setupBox();
     this.context.transform();
     this.context.orientTextures(tb.Rotation);
     // RenderLib.bindTexture("/eloraam/machine/machine1.png");
     this.context.renderGlobFaces(63);
     // RenderLib.unbindTexture();
   }
 }
示例#2
0
  @Override
  public void renderWorldBlock(
      RenderBlocks renderblocks, IBlockAccess iba, int i, int j, int k, int md) {
    TileLogic tl = (TileLogic) CoreLib.getTileEntity(iba, i, j, k, TileLogic.class);
    if (tl != null) {
      Tessellator tess = Tessellator.instance;
      tess.draw();

      // this.renderCovers(iba, tl);
      super.context.setBrightness(super.block.getMixedBrightnessForBlock(iba, i, j, k));
      this.setMatrixWorld(i, j, k, tl.Rotation);
      this.renderWorldPart(iba, tl);
      int ts = this.getTorchState(tl);
      RenderLogic.TorchPos[] tpv = this.getTorchVectors(tl);
      if (tpv != null) {
        for (int n = 0; n < tpv.length; ++n) { // TODO: .
          // IIcon icon = (ts & 1 << n) > 0 ? super.block.getIcon(0, md) :super.block.getIcon(1,
          // md);
          this.renderRedstoneTorch(tpv[n].x, tpv[n].y, tpv[n].z, tpv[n].h, (ts & 1 << n) > 0);
        }
      }

      this.context.bindBlockTexture();
      tess.startDrawingQuads();
    }
  }
示例#3
0
 @Override
 public void randomDisplayTick(World world, int i, int j, int k, Random random) {
   TileLogic tl = (TileLogic) CoreLib.getTileEntity(world, i, j, k, TileLogic.class);
   if (tl != null) {
     int ts = this.getTorchState(tl);
     if (ts != 0) {
       this.setMatrixDisplayTick(i, j, k, tl.Rotation, random);
       RenderLogic.TorchPos[] tpv = this.getTorchVectors(tl);
       if (tpv != null) {
         int rv = random.nextInt(tpv.length);
         if ((ts & 1 << rv) != 0) {
           this.renderTorchPuff(world, "reddust", tpv[rv].x, tpv[rv].y, tpv[rv].z);
         }
       }
     }
   }
 }
  public boolean onItemUseFirst(
      ItemStack var1,
      EntityPlayer var2,
      World var3,
      int var4,
      int var5,
      int var6,
      int var7,
      float var8,
      float var9,
      float var10) {
    if (CoreLib.isClient(var3)) {
      return false;
    } else {
      boolean var11 = false;

      if (var2 != null && var2.isSneaking()) {
        var11 = true;
      }

      int var12 = var3.getBlockId(var4, var5, var6);
      int var13 = var3.getBlockMetadata(var4, var5, var6);

      if (var12 != Block.redstoneRepeaterIdle.blockID
          && var12 != Block.redstoneRepeaterActive.blockID) {
        if (var12 == Block.dispenser.blockID) {
          var13 = var13 & 3 ^ var13 >> 2;
          var13 += 2;
          var3.setBlock(var4, var5, var6, var13);
          var1.damageItem(1, var2);
          return true;
        } else if (var12 != Block.pistonBase.blockID && var12 != Block.pistonStickyBase.blockID) {
          IRotatable var14 =
              (IRotatable) CoreLib.getTileEntity(var3, var4, var5, var6, IRotatable.class);

          if (var14 == null) {
            return false;
          } else {
            MovingObjectPosition var15 = CoreLib.retraceBlock(var3, var2, var4, var5, var6);

            if (var15 == null) {
              return false;
            } else {
              int var16 = var14.getPartMaxRotation(var15.subHit, var11);

              if (var16 == 0) {
                return false;
              } else {
                int var17 = var14.getPartRotation(var15.subHit, var11);
                ++var17;

                if (var17 > var16) {
                  var17 = 0;
                }

                var14.setPartRotation(var15.subHit, var11, var17);
                var1.damageItem(1, var2);
                return true;
              }
            }
          }
        } else {
          ++var13;

          if (var13 > 5) {
            var13 = 0;
          }

          var3.setBlock(var4, var5, var6, var13);
          var1.damageItem(1, var2);
          return true;
        }
      } else {
        var3.setBlock(var4, var5, var6, var13 & 12 | var13 + 1 & 3);
        var1.damageItem(1, var2);
        return true;
      }
    }
  }
示例#5
0
  @Override
  public void renderWorldBlock(
      RenderBlocks renderblocks, IBlockAccess iba, int i, int j, int k, int md) {
    TileMachine tb = (TileMachine) CoreLib.getTileEntity(iba, i, j, k, TileMachine.class);
    if (tb != null) {
      Tessellator tess = Tessellator.instance;
      tess.draw();

      this.context.setDefaults();
      this.context.setLocalLights(0.5F, 1.0F, 0.8F, 0.8F, 0.6F, 0.6F);
      this.context.setPos(i, j, k);
      this.context.readGlobalLights(iba, i, j, k);
      this.context.setBrightness(super.block.getMixedBrightnessForBlock(iba, i, j, k));
      int tex;
      if (md == 0) {
        tex = tb.Active ? 1 : 0;
        this.context.setIcon(
            getIcon(48, md),
            getIcon(53 + tex, md),
            getIcon(56, md),
            getIcon(56, md),
            getIcon(55, md),
            getIcon(55, md));
      } else {
        int t2;
        if (md == 4) {
          tex = 96 + (tb.Active ? 1 : 0);
          t2 = tex + 2 + (tb.Powered ? 2 : 0);
          this.context.setIcon(
              getIcon(102, md),
              getIcon(103, md),
              getIcon(tex, md),
              getIcon(tex, md),
              getIcon(t2, md),
              getIcon(t2, md));
        } else if (md == 5) {
          tex = tb.Charged ? (tb.Active ? 2 : 1) : 0;
          t2 = 116 + (tb.Charged ? 1 : 0) + (tb.Active ? 2 : 0);
          this.context.setIcon(
              getIcon(113 + tex, md),
              getIcon(112, md),
              getIcon(t2, md),
              getIcon(t2, md),
              getIcon(t2, md),
              getIcon(t2, md));
        } else if (md == 8) {
          tex = 120 + (tb.Charged ? 1 : 0) + (tb.Delay | tb.Active ? 2 : 0);
          this.context.setIcon(
              getIcon(124, md),
              getIcon(125, md),
              getIcon(tex, md),
              getIcon(tex, md),
              getIcon(tex, md),
              getIcon(tex, md));
        } else if (md == 10) {
          tex = 104 + (tb.Active ? 1 : 0);
          t2 = tex + 2 + (tb.Powered ? 2 : 0);
          this.context.setIcon(
              getIcon(102, md),
              getIcon(103, md),
              getIcon(tex, md),
              getIcon(tex, md),
              getIcon(t2, md),
              getIcon(t2, md));
        } else if (md == 12) {
          tex = tb.Active ? 1 : 0;
          this.context.setIcon(
              getIcon(48, md),
              getIcon(164 + tex, md),
              getIcon(167, md),
              getIcon(167, md),
              getIcon(166, md),
              getIcon(166, md));
        } else if (md == 13) {
          tex = tb.Active ? 1 : 0;
          this.context.setIcon(
              getIcon(172 + tex, md),
              getIcon(168 + tex, md),
              getIcon(171, md),
              getIcon(171, md),
              getIcon(170, md),
              getIcon(170, md));
        } else if (md == 14) {
          tex = tb.Active ? 1 : 0;
          this.context.setIcon(
              getIcon(58, md),
              getIcon(89, md),
              getIcon(91 + tex, md),
              getIcon(91 + tex, md),
              getIcon(90, md),
              getIcon(90, md));
        } else if (md == 15) {
          tex = tb.Active ? 1 : 0;
          this.context.setIcon(
              getIcon(58, md),
              getIcon(89, md),
              getIcon(93 + tex, md),
              getIcon(93 + tex, md),
              getIcon(90, md),
              getIcon(90, md));
        } else {
          tex = 59 + (tb.Active ? 1 : 0) + (md == 3 ? 2 : 0);
          this.context.setIcon(
              getIcon(58, md),
              getIcon(57, md),
              getIcon(tex, md),
              getIcon(tex, md),
              getIcon(tex, md),
              getIcon(tex, md));
        }
      }

      this.context.setSize(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
      this.context.setupBox();
      this.context.transform();
      this.context.orientTextures(tb.Rotation);

      // RenderLib.bindTexture("/eloraam/machine/machine1.png");
      tess.startDrawingQuads();
      this.context.renderGlobFaces(63);
      tess.draw();
      // RenderLib.unbindTexture();

      this.context.bindBlockTexture();
      tess.startDrawingQuads();
    }
  }