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 setBlockBoundsBasedOnState(
      IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    int i = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
    float f = 0.375F;

    setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.375F);
    if (i == 0) {
      setBlockBounds(0.0F, 1.0F - f, 0.0F, 1.0F, 1.0F, 1.0F);
    }

    if (i == 1) {
      setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
    }

    if (i == 2) {
      setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
    }

    if (i == 3) {
      setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
    }

    if (i == 4) {
      setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
    }

    if (i == 5) {
      setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
    }
  }
예제 #3
0
  @Override
  public void setBlockBoundsBasedOnState(IBlockAccess access, int i, int j, int k) {
    int dir = access.getBlockMetadata(i, j, k);

    if (dir == 0) {
      this.setBlockBounds(0.0F, 0F, 0.85F, 1F, 1F, 1F);
    } else if (dir == 1) {
      this.setBlockBounds(0.0F, 0F, 0.0F, 0.15F, 1F, 1F);
    } else if (dir == 2) {
      this.setBlockBounds(0.0F, 0F, 0.00F, 1F, 1F, 0.15F);
    } else if (dir == 3) {
      this.setBlockBounds(0.85F, 0F, 0.0F, 1F, 1F, 1F);
    }
  }