Esempio n. 1
0
 @Override
 /** Renders stairs at the given coordinates */
 public void renderCarpentersBlock(int x, int y, int z) {
   ItemStack coverBlock =
       BlockProperties.hasCover(TE, 6) == true
           ? BlockProperties.getCover(TE, coverRendering)
           : BlockProperties.getCover(TE, 6);
   renderBancBord(coverBlock, x, y, z);
   //		int data = BlockProperties.getMetadata(TE);
   //		int type = BancD.getType(data);
   //		switch (type)
   //		{
   //			case BancD.BANC_1:
   //				renderBancBord(coverBlock, x, y, z);
   //				break;
   //			case BancD.BANC_2:
   //				renderBancBord_2(coverBlock, x, y, z);
   //				break;
   //			case BancD.BANC_3:
   //				renderBancBorde_3(coverBlock, x, y, z);
   //				break;
   //			case BancD.BANC_4:
   //				renderBancBord_4(coverBlock, x, y, z);
   //		}
 }
Esempio n. 2
0
  /** Sets state (open or closed). */
  public static void setState(TEBase TE, int state, boolean playSound) {
    int temp = BlockProperties.getMetadata(TE) & 0xffbf;
    temp |= state << 6;

    World world = TE.getWorldObj();

    if (!world.isRemote && playSound) {
      world.playAuxSFXAtEntity((EntityPlayer) null, 1003, TE.xCoord, TE.yCoord, TE.zCoord, 0);
    }

    BlockProperties.setMetadata(TE, temp);
  }
Esempio n. 3
0
  @Override
  /** Rotates safe so that it faces player. */
  protected boolean onHammerLeftClick(TEBase TE, EntityPlayer entityPlayer) {
    int facing = BlockProperties.getOppositeFacing(entityPlayer);
    ForgeDirection dir = BlockProperties.getDirectionFromFacing(facing);

    if (dir != Safe.getFacing(TE)) {
      Safe.setFacing(TE, facing);
      return true;
    } else {
      return false;
    }
  }
Esempio n. 4
0
 private void renderBancBord(ItemStack coverBlock, int x, int y, int z) {
   int data = BlockProperties.getMetadata(TE);
   int rotation = BancD.getRotation(data);
   switch (rotation) {
     case BancD.BANC_X_NEG:
       renderBlocks.setRenderBounds(0.2D, 0.0D, 0.2D, 0.3D, 0.4D, 0.8D);
       renderBlock(coverBlock, x, y, z);
       renderBlocks.setRenderBounds(0.15D, 0.4D, 0.15D, 1.0D, 0.5D, 0.85D);
       renderBlock(coverBlock, x, y, z);
       break;
     case BancD.BANC_X_POS:
       renderBlocks.setRenderBounds(0.7D, 0.0D, 0.2D, 0.8D, 0.4D, 0.8D);
       renderBlock(coverBlock, x, y, z);
       renderBlocks.setRenderBounds(0.0D, 0.4D, 0.15D, 0.85D, 0.5D, 0.85D);
       renderBlock(coverBlock, x, y, z);
       break;
     case BancD.BANC_Z_NEG:
       renderBlocks.setRenderBounds(0.2D, 0.0D, 0.2D, 0.8D, 0.4D, 0.3D);
       renderBlock(coverBlock, x, y, z);
       renderBlocks.setRenderBounds(0.15D, 0.4D, 0.15D, 0.85D, 0.5D, 1.0D);
       renderBlock(coverBlock, x, y, z);
       break;
     case BancD.BANC_Z_POS:
       renderBlocks.setRenderBounds(0.2D, 0.0D, 0.7D, 0.8D, 0.4D, 0.8D);
       renderBlock(coverBlock, x, y, z);
       renderBlocks.setRenderBounds(0.15D, 0.4D, 0.0D, 0.85D, 0.5D, 0.85D);
       renderBlock(coverBlock, x, y, z);
   }
 }
Esempio n. 5
0
  @Override
  /** Called when the block is placed in the world. */
  public void onBlockPlacedBy(
      World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack) {
    TEBase TE = getTileEntityStrict(world, x, y, z);

    Safe.setFacing(TE, BlockProperties.getOppositeFacing(entityLiving));

    super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
  }
Esempio n. 6
0
  @Override
  /** ejects contained items into the world, and notifies neighbours of an update, as appropriate */
  public void breakBlock(World world, int x, int y, int z, Block block, int metadata) {
    TEBase TE = getTileEntityStrict(world, x, y, z);

    if (TE != null) {

      TECarpentersSafe TE_safe = (TECarpentersSafe) TE;

      if (TE_safe.hasUpgrade()) {
        BlockProperties.ejectEntity(TE, new ItemStack(Items.gold_ingot));
      }

      for (int slot = 0; slot < TE_safe.getSizeInventory(); ++slot) {
        ItemStack itemStack = TE_safe.getStackInSlot(slot);

        if (itemStack != null) {
          BlockProperties.ejectEntity(TE, itemStack);
        }
      }
    }
    super.breakBlock(world, x, y, z, block, metadata);
  }
  @Override
  /** Override to provide custom icons. */
  protected Icon getUniqueIcon(Block block, int side, Icon icon) {
    if (isSideSloped) {
      Slope slope = Slope.slopesList[BlockProperties.getData(TE)];
      int metadata = BlockProperties.getCoverMetadata(TE, coverRendering);

      /* Uncovered sloped oblique faces use triangular frame icons. */
      if (!BlockProperties.hasCover(TE, 6)) {
        if (slope.type.equals(Type.OBLIQUE_INT)) {
          icon =
              slope.isPositive
                  ? IconRegistry.icon_slope_oblique_pt_low
                  : IconRegistry.icon_slope_oblique_pt_high;
        } else if (slope.type.equals(Type.OBLIQUE_EXT)) {
          icon =
              slope.isPositive
                  ? IconRegistry.icon_slope_oblique_pt_high
                  : IconRegistry.icon_slope_oblique_pt_low;
        }
      }

      /* For directional blocks, make sure sloped icons match regardless of side. */
      if (BlockProperties.blockRotates(TE.worldObj, block, TE.xCoord, TE.yCoord, TE.zCoord)) {
        if (metadata % 8 == 0) {
          icon = block.getIcon(slope.isPositive ? 1 : 0, metadata);
        } else {
          icon = block.getIcon(2, metadata);
        }
      } else if (block instanceof BlockDirectional && !slope.type.equals(Type.WEDGE_Y)) {
        icon = block.getBlockTextureFromSide(1);
      }
    }

    return icon;
  }
Esempio n. 8
0
  /** Sets facing (faces opening direction). */
  public static void setFacing(TEBase TE, int facing) {
    int temp = BlockProperties.getMetadata(TE) & 0xffcf;
    temp |= facing << 4;

    BlockProperties.setMetadata(TE, temp);
  }
  @Override
  /** Renders slope. */
  public boolean renderBaseBlock(Block block, int x, int y, int z) {
    Slope slope = Slope.slopesList[BlockProperties.getData(TE)];

    renderBlocks.enableAO = getEnableAO(block);

    setRenderBoundsAndRelight(block, SIDE_ALL, 0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
    populateOffsetLighting(block, x, y, z);

    /* Render sloped faces. */

    isSideSloped = true;

    switch (slope.type) {
      case WEDGE_XZ:
        prepareHorizontalWedge(block, slope, x, y, z);
        break;
      case WEDGE_Y:
        prepareVerticalWedge(block, slope, x, y, z);
        break;
      case WEDGE_INT:
        prepareWedgeIntCorner(block, slope, x, y, z);
        break;
      case WEDGE_EXT:
        prepareWedgeExtCorner(block, slope, x, y, z);
        break;
      case OBLIQUE_INT:
        prepareObliqueIntCorner(block, slope, x, y, z);
        break;
      case OBLIQUE_EXT:
        prepareObliqueExtCorner(block, slope, x, y, z);
        break;
      case PYRAMID:
        preparePyramid(block, slope, x, y, z);
        break;
      default: // PRISM TYPES
        preparePrism(block, slope, x, y, z);
        break;
    }

    isSideSloped = false;

    /* Render non-sloped faces. */

    /* BOTTOM FACE */
    if (slope.hasSide(ForgeDirection.DOWN)
        && srcBlock.shouldSideBeRendered(renderBlocks.blockAccess, x, y - 1, z, DOWN)) {
      prepareFaceYNeg(block, slope, x, y, z);
    }

    /* TOP FACE */
    if (slope.hasSide(ForgeDirection.UP)
        && srcBlock.shouldSideBeRendered(renderBlocks.blockAccess, x, y + 1, z, UP)) {
      prepareFaceYPos(block, slope, x, y, z);
    }

    /* NORTH FACE */
    if (slope.hasSide(ForgeDirection.NORTH)
        && srcBlock.shouldSideBeRendered(renderBlocks.blockAccess, x, y, z - 1, NORTH)) {
      prepareFaceZNeg(block, slope, x, y, z);
    }

    /* SOUTH FACE */
    if (slope.hasSide(ForgeDirection.SOUTH)
        && srcBlock.shouldSideBeRendered(renderBlocks.blockAccess, x, y, z + 1, SOUTH)) {
      prepareFaceZPos(block, slope, x, y, z);
    }

    /* WEST FACE */
    if (slope.hasSide(ForgeDirection.WEST)
        && srcBlock.shouldSideBeRendered(renderBlocks.blockAccess, x - 1, y, z, WEST)) {
      prepareFaceXNeg(block, slope, x, y, z);
    }

    /* EAST FACE */
    if (slope.hasSide(ForgeDirection.EAST)
        && srcBlock.shouldSideBeRendered(renderBlocks.blockAccess, x + 1, y, z, EAST)) {
      prepareFaceXPos(block, slope, x, y, z);
    }

    RenderHelper.startDrawing(QUADS);

    renderBlocks.enableAO = false;
    return true;
  }
  @Override
  /** Renders side. */
  protected void renderBaseSide(int x, int y, int z, int side, Icon icon) {
    int slopeID = BlockProperties.getData(TE);

    switch (renderID) {
      case NORMAL_YN:
        RenderHelper.renderFaceYNeg(renderBlocks, x, y, z, icon);
        break;
      case NORMAL_YP:
        RenderHelper.renderFaceYPos(renderBlocks, x, y, z, icon);
        break;
      case NORMAL_ZN:
        RenderHelper.renderFaceZNeg(renderBlocks, x, y, z, icon);
        break;
      case NORMAL_ZP:
        RenderHelper.renderFaceZPos(renderBlocks, x, y, z, icon);
        break;
      case NORMAL_XN:
        RenderHelper.renderFaceXNeg(renderBlocks, x, y, z, icon);
        break;
      case NORMAL_XP:
        RenderHelper.renderFaceXPos(renderBlocks, x, y, z, icon);
        break;
      case TRIANGLE_XN:
        HelperTriangle.renderFaceXNeg(renderBlocks, x, y, z, icon);
        break;
      case TRIANGLE_XP:
        HelperTriangle.renderFaceXPos(renderBlocks, x, y, z, icon);
        break;
      case TRIANGLE_ZN:
        HelperTriangle.renderFaceZNeg(renderBlocks, x, y, z, icon);
        break;
      case TRIANGLE_ZP:
        HelperTriangle.renderFaceZPos(renderBlocks, x, y, z, icon);
        break;
      case WEDGE_YN:
        HelperOrthoWedge.renderFaceYNeg(renderBlocks, slopeID, x, y, z, icon);
        break;
      case WEDGE_YP:
        HelperOrthoWedge.renderFaceYPos(renderBlocks, slopeID, x, y, z, icon);
        break;
      case WEDGE_SLOPED_ZN:
        HelperOblWedge.renderSlopeZNeg(renderBlocks, slopeID, x, y, z, icon);
        break;
      case WEDGE_ZN:
        HelperOrthoWedge.renderFaceZNeg(renderBlocks, slopeID, x, y, z, icon);
        break;
      case WEDGE_SLOPED_ZP:
        HelperOblWedge.renderSlopeZPos(renderBlocks, slopeID, x, y, z, icon);
        break;
      case WEDGE_ZP:
        HelperOrthoWedge.renderFaceZPos(renderBlocks, slopeID, x, y, z, icon);
        break;
      case WEDGE_SLOPED_XN:
        HelperOblWedge.renderSlopeXNeg(renderBlocks, slopeID, x, y, z, icon);
        break;
      case WEDGE_XN:
        HelperOrthoWedge.renderFaceXNeg(renderBlocks, slopeID, x, y, z, icon);
        break;
      case WEDGE_SLOPED_XP:
        HelperOblWedge.renderSlopeXPos(renderBlocks, slopeID, x, y, z, icon);
        break;
      case WEDGE_XP:
        HelperOrthoWedge.renderFaceXPos(renderBlocks, slopeID, x, y, z, icon);
        break;
      case WEDGE_CORNER_SLOPED_ZN:
        HelperCorner.renderSlopeZNeg(renderBlocks, slopeID, x, y, z, icon);
        break;
      case WEDGE_CORNER_SLOPED_ZP:
        HelperCorner.renderSlopeZPos(renderBlocks, slopeID, x, y, z, icon);
        break;
      case WEDGE_CORNER_SLOPED_XN:
        HelperCorner.renderSlopeXNeg(renderBlocks, slopeID, x, y, z, icon);
        break;
      case WEDGE_CORNER_SLOPED_XP:
        HelperCorner.renderSlopeXPos(renderBlocks, slopeID, x, y, z, icon);
        break;
      case OBL_CORNER_SLOPED_YN:
        HelperOblique.renderSlopeYNeg(renderBlocks, slopeID, x, y, z, icon);
        break;
      case OBL_CORNER_SLOPED_YP:
        HelperOblique.renderSlopeYPos(renderBlocks, slopeID, x, y, z, icon);
        break;
      case PYR_YZNN:
        HelperPyramid.renderFaceYNegZNeg(renderBlocks, x, y, z, icon);
        break;
      case PYR_YZNP:
        HelperPyramid.renderFaceYNegZPos(renderBlocks, x, y, z, icon);
        break;
      case PYR_YXNN:
        HelperPyramid.renderFaceYNegXNeg(renderBlocks, x, y, z, icon);
        break;
      case PYR_YXNP:
        HelperPyramid.renderFaceYNegXPos(renderBlocks, x, y, z, icon);
        break;
      case PYR_YZPN:
        HelperPyramid.renderFaceYPosZNeg(renderBlocks, x, y, z, icon);
        break;
      case PYR_YZPP:
        HelperPyramid.renderFaceYPosZPos(renderBlocks, x, y, z, icon);
        break;
      case PYR_YXPN:
        HelperPyramid.renderFaceYPosXNeg(renderBlocks, x, y, z, icon);
        break;
      case PYR_YXPP:
        HelperPyramid.renderFaceYPosXPos(renderBlocks, x, y, z, icon);
        break;
      case PRISM_NORTH_XN:
        HelperPrism.renderNorthFaceXNeg(renderBlocks, x, y, z, icon);
        break;
      case PRISM_NORTH_XP:
        HelperPrism.renderNorthFaceXPos(renderBlocks, x, y, z, icon);
        break;
      case PRISM_SOUTH_XN:
        HelperPrism.renderSouthFaceXNeg(renderBlocks, x, y, z, icon);
        break;
      case PRISM_SOUTH_XP:
        HelperPrism.renderSouthFaceXPos(renderBlocks, x, y, z, icon);
        break;
      case PRISM_WEST_ZN:
        HelperPrism.renderWestFaceZNeg(renderBlocks, x, y, z, icon);
        break;
      case PRISM_WEST_ZP:
        HelperPrism.renderWestFaceZPos(renderBlocks, x, y, z, icon);
        break;
      case PRISM_EAST_ZN:
        HelperPrism.renderEastFaceZNeg(renderBlocks, x, y, z, icon);
        break;
      case PRISM_EAST_ZP:
        HelperPrism.renderEastFaceZPos(renderBlocks, x, y, z, icon);
        break;
      case PRISM_WEDGE_ZN:
        HelperPrism.renderSlopeZNeg(renderBlocks, x, y, z, icon);
        break;
      case PRISM_WEDGE_ZP:
        HelperPrism.renderSlopeZPos(renderBlocks, x, y, z, icon);
        break;
      case PRISM_WEDGE_XN:
        HelperPrism.renderSlopeXNeg(renderBlocks, x, y, z, icon);
        break;
      case PRISM_WEDGE_XP:
        HelperPrism.renderSlopeXPos(renderBlocks, x, y, z, icon);
        break;
    }
  }
Esempio n. 11
0
 /** Returns door rigidity (requires redstone for activation). */
 public static int getRigidity(TEBase TE) {
   int temp = BlockProperties.getMetadata(TE) & 0x100;
   return temp >> 8;
 }
Esempio n. 12
0
  /** Sets door rigidity (requires redstone for activation). */
  public static void setRigidity(TEBase TE, int rigid) {
    int temp = BlockProperties.getMetadata(TE) & 0xfeff;
    temp |= rigid << 8;

    BlockProperties.setMetadata(TE, temp);
  }
Esempio n. 13
0
  /** Sets door piece (top or bottom). */
  public static void setPiece(TEBase TE, int piece) {
    int temp = BlockProperties.getMetadata(TE) & 0xff7f;
    temp |= piece << 7;

    BlockProperties.setMetadata(TE, temp);
  }
Esempio n. 14
0
 /** Returns facing (faces opening direction). */
 public static int getFacing(TEBase TE) {
   int temp = BlockProperties.getMetadata(TE) & 0x30;
   return temp >> 4;
 }
Esempio n. 15
0
  /** Sets hinge side (relative to facing). */
  public static void setHingeSide(TEBase TE, int hingeSide) {
    int temp = BlockProperties.getMetadata(TE) & 0xfff7;
    temp |= hingeSide << 3;

    BlockProperties.setMetadata(TE, temp);
  }
Esempio n. 16
0
 /** Returns hinge side (relative to facing). */
 public static int getHinge(TEBase TE) {
   int temp = BlockProperties.getMetadata(TE) & 0x8;
   return temp >> 3;
 }
Esempio n. 17
0
  /** Sets type. */
  public static void setType(TEBase TE, int type) {
    int temp = BlockProperties.getMetadata(TE) & 0xfff8;
    temp |= type;

    BlockProperties.setMetadata(TE, temp);
  }
Esempio n. 18
0
 /** Returns type. */
 public static int getType(TEBase TE) {
   return BlockProperties.getMetadata(TE) & 0x7;
 }
Esempio n. 19
0
 /** Returns open/closed state. */
 public static int getState(TEBase TE) {
   int temp = BlockProperties.getMetadata(TE) & 0x40;
   return temp >> 6;
 }
Esempio n. 20
0
 /** Returns door piece (top or bottom). */
 public static int getPiece(TEBase TE) {
   int temp = BlockProperties.getMetadata(TE) & 0x80;
   return temp >> 7;
 }