Package net.minecraftforge.common.util

Examples of net.minecraftforge.common.util.ForgeDirection


  public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
    if(!world.setBlock(x, y, z, field_150939_a, 0, 3)) {
      return false;
    }
    if(world.getBlock(x, y, z) == field_150939_a) {
      ForgeDirection onFace = ForgeDirection.values()[side].getOpposite();
      TileEntity te = world.getTileEntity(x, y, z);
      if(te instanceof TileElectricLight) {
        TileElectricLight el = ((TileElectricLight) te);
        el.setFace(onFace);
        Type t= Type.values()[metadata];
View Full Code Here


  @SideOnly(Side.CLIENT)
  public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {

    TileEntity te = blockAccess.getTileEntity(x, y, z);
    if(te instanceof TileElectricLight) {
      ForgeDirection onFace = ((TileElectricLight) te).getFace();
      if(side == (onFace.getOpposite().ordinal())) {
        boolean on = blockAccess.getBlockMetadata(x, y, z) != 0;
        return on ? blockIcon : blockIconOff;
      }
      return blockIconSide;
    }
View Full Code Here

    return world.getBlockMetadata(x, y, z) > 0 ? 15 : 0;
  }

  @Override
  public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) {
    ForgeDirection onFace = ForgeDirection.DOWN;
    TileEntity te = blockAccess.getTileEntity(x, y, z);
    if(te instanceof TileElectricLight) {
      onFace = ((TileElectricLight) te).getFace();
    }
View Full Code Here

      float startX = x;
      float startY = y + 0.35F;
      float startZ = z;
      for (int k = 0; k < 2; k++) {
        int ran2adn5 = (int) Math.round((Math.random() * 3) + 2);
        ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[ran2adn5];
        if(dir.offsetY == 0) {
          for (int i = 0; i < 2; i++) {

            float xOffset = 0.52f * (1 - dir.offsetX) (dir.offsetX * (-0.1F + rand.nextFloat() * 0.2F));
            float yOffset = -0.1F + rand.nextFloat() * 0.2F;
 
View Full Code Here

  }

  private void setCartDirection(EntityMinecart cart) {
    int meta = transciever.getWorldObj().getBlockMetadata(transciever.xCoord, transciever.yCoord + 1, transciever.zCoord);
    ForgeDirection dir = BlockEnderRail.getDirection(meta);
    double velocity = Math.max(Math.abs(cart.motionX), Math.abs(cart.motionZ));
    cart.motionX = dir.offsetX * velocity;
    cart.motionZ = dir.offsetZ * velocity;
   
  }
View Full Code Here

    BlockCoord railCoord = new BlockCoord(transciever).getLocation(ForgeDirection.UP);
    int meta = worldObj.getBlockMetadata(railCoord.x, railCoord.y, railCoord.z);

    double buf = 1;
    ForgeDirection dir = BlockEnderRail.getDirection(meta);
    Vector3d offset = ForgeDirectionOffsets.forDirCopy(dir);
    offset.scale(buf);
    offset.x = Math.abs(offset.x);
    offset.z = Math.abs(offset.z);
    List res = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(railCoord.x - offset.x, railCoord.y,
View Full Code Here

  public static boolean isReverse(int meta) {
    return MetadataUtil.isBitSet(3, meta);
  }

  public static ForgeDirection getDirection(int meta) {
    ForgeDirection result;
    if(isEastWest(meta)) {
      result = ForgeDirection.EAST;
    } else {
      result = ForgeDirection.SOUTH;
    }
    if(isReverse(meta)) {
      result = result.getOpposite();
    }
    return result;
  }
View Full Code Here

    void doTeleport() {
      int toDim = reciever.getWorldObj().provider.dimensionId;
      int meta = reciever.getBlockMetadata();

      //Make sure player not on the track and is in a safe position
      ForgeDirection railDir = EnderIO.blockEnderRail.getDirection(meta);
      int xOffset = Math.abs(railDir.offsetX);
      int zOffset = Math.abs(railDir.offsetZ);
      BlockCoord startPos = new BlockCoord(reciever).getLocation(ForgeDirection.UP);
      boolean foundSpot = false;
      for (int i = 1; i < 3 && !foundSpot; i++) {
View Full Code Here

 
  @Override
  public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
    TileCrusher te = (TileCrusher) world.getTileEntity(x, y, z);
    if(te != null && te.isActive()) {
      ForgeDirection front = ForgeDirection.values()[te.facing];

      for (int i = 0; i < 3; i++) {
        double px = x + 0.5 + front.offsetX * 0.51;
        double pz = z + 0.5 + front.offsetZ * 0.51;
        double py = y + world.rand.nextFloat() * 0.8f + 0.1f;
View Full Code Here

       
    GL11.glTranslatef(0.5F, 1, 0.5F);   
    GL11.glRotatef(180F, 1F, 0F, 0F);
    GL11.glScalef(1, 0.667f, 1);
   
    ForgeDirection dir = ForgeDirection.getOrientation(facing);
    if(dir == ForgeDirection.SOUTH) {
      facing = 0;
     
    } else if(dir == ForgeDirection.WEST) {
      facing = -1;
View Full Code Here

TOP

Related Classes of net.minecraftforge.common.util.ForgeDirection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.