diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml deleted file mode 100644 index a26c8f7..0000000 --- a/.github/workflows/preview.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Deploy PR previews - -on: - pull_request: - types: - - opened - - reopened - - synchronize - - closed - -concurrency: preview-${{ github.ref }} - -jobs: - deploy-preview: - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install and Build - run: | - yarn - yarn run build - - - name: Deploy preview - uses: rossjrw/pr-preview-action@v1 - with: - source-dir: ./public/ - preview-branch: preview diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 46a45ad..0000000 --- a/.gitignore +++ /dev/null @@ -1,67 +0,0 @@ -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -junit.xml - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git -node_modules -integration-tests/gatsby-cli/execution-folder/* -*.un~ -dist -bin/published.js - -# Build Path of Test Fixtures -test/**/public -.gatsby-context.js -.DS_Store -public/ -node_modules/ -e2e-tests/gatsby-pnp/ -__diff_output__/ -.cache/ -.netlify -.Rhistory - -# IDE specific -.idea/ -.vscode/ -*.sw* - -# misc -.serverless/ -.eslintcache -scripts/.env - -# lock files -yarn.lock -package-lock.json -# ignore any lock file other than main lock file -!/yarn.lock - -# starters are special; we want to persist the lock files -!starters/*/package-lock.json -!themes/gatsby-starter-blog-theme/package-lock.json -!themes/gatsby-starter-notes-theme/package-lock.json -!themes/gatsby-starter-theme/package-lock.json -!themes/gatsby-starter-theme-workspace/package-lock.json diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index b08ffc7..0000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -v16.0.0 \ No newline at end of file diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..9d90a1b --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +preview.mcjava.dev \ No newline at end of file diff --git a/README.md b/README.md index 6606ac3..59333c8 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,3 @@ -# mcjava-wiki - -This is a technical wiki for Minecraft: Java Edition, primarily focused on resource-related tutorials. The ultimate goal is to be a reliable source of information for all things Java Edition resource pack related. It is accessible at https://wiki.mcjava.dev/docs. - -## Why? - -Though the Minecraft Wiki currently maintains a tutorial with regards to creating a resource pack, the page is largely disorganized and leaves much to be desired. In general, the wiki markdown format is also limiting, as it does not allow for niceties that developing ones own site affords. - -Furthermore, the success of the [Bedrock Wiki](https://wiki.bedrock.dev/) in this format is also a source of motivation, which is an excellent resource for technical information related to Bedrock Edition resource packs and behavior packs. - -## Technical Information - -- Written primarily in Markdown / [MDX](https://github.com/mdx-js/mdx) -- Built with [Gatsby](https://www.gatsbyjs.com/) -- Deployed via [Cloudflare Pages](https://developers.cloudflare.com/pages/) -- Uses the [Smooth Doc](https://github.com/gregberge/smooth-doc) theme - -## Running Locally - -```bash -git clone https://github.com/mcjava-wiki/mcjava-wiki -cd mcjava-wiki -yarn # if using npm you night need --legacy-peer-deps -yarn run develop -``` - -Visit `http://localhost:8000/` to view local changes. - -## Contributing - -Contributions are also welcome. Please create a pull request. For detailed instructions, refer to our [Contributing Page](https://wiki.mcjava.dev/docs/about/contributing). +# mcjava-wiki PR Previews +This is branch is used to provide preview of PRs to the wiki. You can access the preview for any PR by going to `https://preview.mcjava.dev/pr-preview/`. \ No newline at end of file diff --git a/css/custom.css b/css/custom.css deleted file mode 100644 index eab1963..0000000 --- a/css/custom.css +++ /dev/null @@ -1,92 +0,0 @@ -@font-face { - font-family: 'icomoon'; - src: local('icomoon'), url(../static/fonts/icomoon.ttf) format('truetype'); -} - -pre[class*="language-"] { - position: relative; - -webkit-overflow-scrolling: touch; - } - pre[class*="language-"]::before { - background: black; - border-radius: 0 0.25rem 0 0.25rem; - color: white; - font-size: 12px; - letter-spacing: 0.025rem; - padding: 0.1rem 0.5rem; - position: absolute; - right: 0; - text-align: right; - text-transform: uppercase; - top: 0; - } - - pre[class~="language-javascript"]::before { - content: "js"; - background: #f7df1e; - color: black; - } - - pre[class~="language-js"]::before { - content: "js"; - background: #f7df1e; - color: black; - } - - pre[class~="language-html"]::before { - content: "html"; - background: #005a9c; - color: white; - } - - pre[class~="language-css"]::before { - content: "css"; - background: #ff9800; - color: white; - } - - pre[class~="language-json"]::before { - content: "json"; - background: #09a859; - color: white; - } - - pre[class~="language-bash"]::before { - content: "bash"; - background: #4f11e0; - color: white; - } - - pre[class~="language-text"]::before { - content: "text"; - background: #ececec; - color: #1d1d1d; - } - - pre[class~="language-md"]::before { - content: "md"; - background: #0991cf; - color: #ffffff; - } - - pre[class~="language-mdx"]::before { - content: "mdx"; - background: #ffd900; - color: #000000; - } - - pre[class~="language-mcfunction"]::before { - content: "mcfunction"; - background: #04f38f; - color: white; - } - - .highlight-line { - background-color: #1b314f; - display: block; - margin-right: -1em; - margin-left: -1em; - padding-right: 1em; - padding-left: 0.75em; - border-left: 0.3em solid #f99; - } \ No newline at end of file diff --git a/gatsby-browser.js b/gatsby-browser.js deleted file mode 100644 index 22af90b..0000000 --- a/gatsby-browser.js +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react' -import { RootWrapper } from './src/components/RootWrapper' -import { PageWrapper } from './src/components/PageWrapper' -import Prism from 'prism-react-renderer/prism' - -(typeof global !== 'undefined' ? global : window).Prism = Prism - -require('./src/components/mcfunction') - -require("./css/custom.css") - -export const wrapRootElement = ({ element }) => { - return {element} -} - -export const wrapPageElement = ({ element, props }) => { - return {element} -} diff --git a/gatsby-config.js b/gatsby-config.js deleted file mode 100644 index 92edb7d..0000000 --- a/gatsby-config.js +++ /dev/null @@ -1,148 +0,0 @@ -const path = require('path') - -module.exports = { - siteMetadata: { - title: "mcjava-wiki", - githubRepositoryURL: 'https://github.com/mcjava-wiki/mcjava-wiki', - githubDefaultBranch: 'main', - sections: [ - 'About', - 'Basics', - 'External Programs', - 'Textures', - 'Models', - 'Predicates', - 'Sounds', - 'Languages', - 'Block States', - 'Particles', - 'Fonts', - 'GUIs', - 'Texts', - 'Shaders', - 'Bedrock Equivalencies', - 'Techniques', - 'Troubleshooting' - ], - baseDirectory: path.resolve(__dirname, './'), - navItems: [{ title: 'Docs', url: '/docs/about/introduction/' }], - description: "Comprehensive documentation for creating and editing Minecraft: Java Edition resource packs", - siteUrl: "https://wiki.mcjava.dev", - author: 'Kas-tle', - docSearch: { - apiKey: 'da0ca3a42123b75779221abdd6edf8b6', - indexName: 'mcjava', - }, - }, - plugins: [ - // Build - { - resolve: 'gatsby-plugin-styled-components', - options: { - topLevelImportPaths: ['@xstyled/styled-components'], - }, - }, - { - resolve: `gatsby-remark-images`, - options: { - linkImagesToOriginal: false, - backgroundColor: `transparent`, - }, - }, - 'gatsby-plugin-catch-links', - { - resolve: 'gatsby-plugin-mdx', - options: { - extensions: [`.mdx`, `.md`], - gatsbyRemarkPlugins: [ - { - resolve: require.resolve( - './src/plugins/gatsby-remark-autolink-headers', - ), - }, - { - resolve: `gatsby-remark-images`, - options: { - maxWidth: 1200, - }, - }, - ], - }, - }, - 'gatsby-transformer-sharp', - 'gatsby-plugin-sharp', - 'gatsby-plugin-react-helmet', - { - resolve: require.resolve( - './src/plugins/gatsby-remark-autolink-headers', - ), - }, - - // Source - { - resolve: 'gatsby-source-filesystem', - options: { - path: `${__dirname}/pages`, - name: 'default-page', - }, - }, - { - resolve: 'gatsby-source-filesystem', - options: { - path: `${__dirname}/images`, - name: 'default-image', - }, - }, - { - resolve: 'gatsby-source-filesystem', - options: { - path: `./pages`, - name: 'page', - }, - }, - { - resolve: 'gatsby-source-filesystem', - options: { - path: `./images`, - name: 'image', - }, - }, - // SEO - { - resolve: 'gatsby-plugin-sitemap', - options: {}, - }, - 'gatsby-plugin-meta-redirect', - { - resolve: `gatsby-plugin-manifest`, - options: { - name: "mcjava-wiki", - short_name: "mcjava-wiki", - start_url: '/', - display: 'minimal-ui', - icon: 'images/logo-manifest.png', - }, - }, - { - resolve: 'gatsby-plugin-robots-txt', - options: { - resolveEnv: () => process.env.CONTEXT || process.env.NODE_ENV, - env: { - production: { - policy: [{ userAgent: '*' }], - }, - 'branch-deploy': { - policy: [{ userAgent: '*', disallow: ['/'] }], - sitemap: null, - host: null, - }, - 'deploy-preview': { - policy: [{ userAgent: '*', disallow: ['/'] }], - sitemap: null, - host: null, - }, - }, - }, - }, - ], -} diff --git a/gatsby-node.js b/gatsby-node.js deleted file mode 100644 index eb92a13..0000000 --- a/gatsby-node.js +++ /dev/null @@ -1,247 +0,0 @@ -const fs = require('fs') -const path = require('path') -const { createFilePath } = require('gatsby-source-filesystem') -const { getSiteUrl } = require('./src/theme-options') - -function createSchemaCustomization({ actions }) { - const { createTypes } = actions - const typeDefs = ` - type NavItem { - title: String! - url: String! - } - - type AlgoliaDocSearchMetadata { - apiKey: String! - indexName: String! - } - - type SiteSiteMetadata { - title: String! - description: String! - siteUrl: String! - author: String - githubRepositoryURL: String - sections: [String!] - navItems: [NavItem!] - docSearch: AlgoliaDocSearchMetadata - } - - type MdxFrontmatter { - title: String! - slug: String - section: String - order: Int - redirect: String - } - ` - createTypes(typeDefs) -} - -function createDirectoryIfNotExists({ reporter }, pathname) { - if (!fs.existsSync(pathname)) { - reporter.info(`creating the ${pathname} directory`) - fs.mkdirSync(pathname) - } -} - -async function onPreBootstrap(options) { - // Create all required directories - createDirectoryIfNotExists(options, 'pages') - createDirectoryIfNotExists(options, 'pages/docs') - createDirectoryIfNotExists(options, 'images') -} - -function onCreateMdxNode({ node, getNode, actions }, options) { - const { createNodeField } = actions - const slug = node.frontmatter.slug || createFilePath({ node, getNode }) - const pageType = /\/pages\/docs\//.test(node.fileAbsolutePath) - ? 'doc' - : 'page' - - createNodeField({ - name: 'id', - node, - value: node.id, - }) - - createNodeField({ - name: 'pageType', - node, - value: pageType, - }) - - createNodeField({ - name: 'title', - node, - value: node.frontmatter.title, - }) - - createNodeField({ - name: 'description', - node, - value: node.frontmatter.description || '', - }) - - createNodeField({ - name: 'slug', - node, - value: slug, - }) - - createNodeField({ - name: 'section', - node, - value: node.frontmatter.section || '', - }) - - createNodeField({ - name: 'redirect', - node, - value: node.frontmatter.redirect || '', - }) - - function getOrderField() { - if (!Number.isNaN(Number(node.frontmatter.order))) { - return node.frontmatter.order - } - return -9999 - } - - createNodeField({ - name: 'order', - node, - value: getOrderField(), - }) - - const url = new URL(getSiteUrl(options)) - url.pathname = slug - - createNodeField({ - name: 'url', - node, - value: url.toString(), - }) - - function getEditLink() { - const { - baseDirectory = path.resolve(__dirname, './'), - githubRepositoryURL = 'https://github.dev/mcjava-wiki/mcjava-wiki', - githubDefaultBranch = 'main', - } = options - const repositoryURL = githubRepositoryURL - if (!baseDirectory || !repositoryURL) return '' - const relativePath = node.fileAbsolutePath.replace(baseDirectory, '') - return `${repositoryURL}/blob/${githubDefaultBranch}${relativePath}` - } - - createNodeField({ - name: 'editLink', - node, - value: getEditLink(), - }) -} - -function onCreateNode(...args) { - if (args[0].node.internal.type === `Mdx`) { - onCreateMdxNode(...args) - } -} - -async function createPages({ graphql, actions, reporter }) { - const { createPage, createRedirect } = actions - - const { data, errors } = await graphql(` - query { - allMdx { - edges { - node { - id - fields { - slug - pageType - redirect - } - parent { - ... on File { - sourceInstanceName - } - } - } - } - } - } - `) - - if (errors) { - reporter.panicOnBuild(`Error while running GraphQL query.`) - return - } - - const filteredEdges = data.allMdx.edges.filter((edge) => { - if (edge.node.parent.sourceInstanceName === 'default-page') { - const { slug } = edge.node.fields - const hasCustom404 = data.allMdx.edges.find( - (_edge) => edge !== _edge && _edge.node.fields.slug === slug, - ) - return !hasCustom404 - } - return true - }) - - // Create pages - filteredEdges.forEach(({ node }) => { - if (node.fields.redirect) { - createRedirect({ - fromPath: node.fields.slug, - toPath: node.fields.redirect, - redirectInBrowser: true, - }) - } - - createPage({ - path: node.fields.slug, - component: path.resolve( - __dirname, - `./src/templates/${node.fields.pageType}.js`, - ), - context: { - id: node.id, - }, - }) - }) -} - -const pluginOptionsSchema = (/** @type {{ Joi: import('joi') }} */ { Joi }) => { - return Joi.object({ - // Validate that the anonymize option is defined by the user and is a boolean - name: Joi.string().required(), - description: Joi.string().required(), - siteUrl: Joi.string(), - shortName: Joi.string(), - sections: Joi.array().items(Joi.string()), - navItems: Joi.array().items( - Joi.object({ - title: Joi.string().required(), - url: Joi.string().required(), - }), - ), - baseDirectory: Joi.string(), - githubRepositoryURL: Joi.string(), - githubDefaultBranch: Joi.string(), - author: Joi.string(), - docSearch: Joi.object({ - apiKey: Joi.string().required(), - indexName: Joi.string().required(), - }), - sitemap: Joi.object(), - }) -} - -module.exports = { - createSchemaCustomization, - onPreBootstrap, - onCreateNode, - createPages, - pluginOptionsSchema, -} diff --git a/gatsby-ssr.js b/gatsby-ssr.js deleted file mode 100644 index 7e7e9f3..0000000 --- a/gatsby-ssr.js +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react' -import { getColorModeInitScriptElement } from '@xstyled/styled-components' -import { RootWrapper } from './src/components/RootWrapper' -import { PageWrapper } from './src/components/PageWrapper' - -export const wrapPageElement = ({ element, props }) => { - return ( - - {element} - - ) -} - -export const onRenderBody = ({ setPreBodyComponents }) => { - setPreBodyComponents([getColorModeInitScriptElement()]) -} diff --git a/images/404.png b/images/404.png deleted file mode 100644 index 5eaeaee..0000000 Binary files a/images/404.png and /dev/null differ diff --git a/images/hero-background.png b/images/hero-background.png deleted file mode 100644 index ac3bf6d..0000000 Binary files a/images/hero-background.png and /dev/null differ diff --git a/images/logo-manifest.png b/images/logo-manifest.png deleted file mode 100644 index 45162f4..0000000 Binary files a/images/logo-manifest.png and /dev/null differ diff --git a/images/logo-nav-dark.svg b/images/logo-nav-dark.svg deleted file mode 100644 index 84f477b..0000000 --- a/images/logo-nav-dark.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/logo-nav-light.svg b/images/logo-nav-light.svg deleted file mode 100644 index 4565bd6..0000000 --- a/images/logo-nav-light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/licensing/LICENSE-theme b/licensing/LICENSE-theme deleted file mode 100644 index ee1418f..0000000 --- a/licensing/LICENSE-theme +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Greg Bergé - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/package.json b/package.json deleted file mode 100644 index d98d19f..0000000 --- a/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "mcjava-wiki", - "version": "0.0.0", - "private": true, - "scripts": { - "develop": "gatsby develop", - "build": "gatsby build", - "serve": "gatsby serve" - }, - "dependencies": { - "@docsearch/css": "^3.0.0-alpha.41", - "@docsearch/react": "^3.0.0-alpha.41", - "@mdx-js/mdx": "^1.6.22", - "@mdx-js/react": "^1.6.22", - "@xstyled/styled-components": "^2.5.0", - "babel-plugin-styled-components": "^1.12.0", - "fs-extra": "^9.1.0", - "gatsby-plugin-catch-links": "^4.0.0-zz-next.2", - "gatsby-plugin-compile-es6-packages": "^2.1.1", - "gatsby-plugin-image": "^2.0.0-zz-next.3", - "gatsby-plugin-manifest": "^4.0.0-zz-next.4", - "gatsby-plugin-mdx": "^3.0.0-zz-next.3", - "gatsby-plugin-meta-redirect": "^1.1.1", - "gatsby-plugin-react-helmet": "^5.0.0-zz-next.2", - "gatsby-plugin-robots-txt": "^1.6.10", - "gatsby-plugin-sharp": "^4.0.0-zz-next.6", - "gatsby-plugin-sitemap": "^5.0.0-zz-next.4", - "gatsby-plugin-styled-components": "^5.0.0-zz-next.2", - "gatsby-remark-images": "^5.11.0", - "gatsby-source-filesystem": "^3.14.0", - "gatsby-transformer-sharp": "^3.14.0", - "github-slugger": "^1.4.0", - "mdast-util-to-string": "^2.0.0", - "parse-numeric-range": "^1.2.0", - "polished": "^4.1.0", - "prism-react-renderer": "^1.2.1", - "prismjs": "^1.25.0", - "react-helmet": "^6.1.0", - "react-icons": "^4.3.1", - "react-live": "^2.3.0", - "reakit": "^1.3.10", - "styled-components": "^5.3.1", - "unist-util-visit": "^2.0.3" - }, - "devDependencies": { - "gatsby": "^4.0.0-zz-next.8", - "react": "^17.0.2", - "react-dom": "^17.0.2", - "standard-version": "^9.3.2" - } -} diff --git a/pages/404.mdx b/pages/404.mdx deleted file mode 100644 index e8eddab..0000000 --- a/pages/404.mdx +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: Page not found ---- - -import { x } from '@xstyled/styled-components' -import { Article, ScreenContainer, Button } from '../src/components' -import { Link } from 'gatsby' -import notFoundImageURL from '../images/404.png' - -
- - There's a leak in the website. - - - The page you are looking for does not actually exist. - -
- -
-
-
diff --git a/pages/docs/about/community-resources.mdx b/pages/docs/about/community-resources.mdx deleted file mode 100644 index e9e6232..0000000 --- a/pages/docs/about/community-resources.mdx +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: Community Resources -section: About -slug: /docs/about/community-resources -order: 2 ---- - -import { RiDiscordFill, RiCheckboxCircleFill } from 'react-icons/ri' - -# Community Resources - -This pages details important community resources for Java resource pack development. - -## Discord Servers - -Much of the information regarding more advanced use of Minecraft resource packs is bottled up accross various Discord communities. The links below refer to some of the more relavent of those. - -### mcjava-wiki - -The official discord server for this project. The primary purpose of this Discord is to support and facilitate contributions to this wiki, though resource pack support is also availible. - - -
- -
-
- -
-
- -### Blockbench - -The official Discord of the 3D modeling program Blockbench. Blockbench is the most commonly used Minecraft 3D modeling program. Though the Discord is primarily for supporting Blockbench, general resource pack help is also commonly provided for all platforms Blockbench supports. - - -
- -
-
- -
-
- -### Minecraft - -The official Minecraft Discord server. Some help is offered for both Bedrock and Java resource packs, though it can be quite chaotic given the size of the Discord. The search functionality is sometimes useful due to the shear number of questions that have been asked. - - -
- -
-
- -
-
- -### Nullbox - -A Discord primarily focused on voxel modeling for Minecraft: Java Edition. This Discord may be especially helpful for users of Cubik, as this is the tool of choice for voxel-style Minecraft models. - - -
- -
-
- -
-
- -## Sites - -### Minecraft Wiki - -The [Minecraft Wiki](https://minecraft.fandom.com/wiki/Minecraft_Wiki) contains some general information about resource packs, as well as specific information about various items and blocks, such as blockstates, that may be of use when creating a resource pack. - diff --git a/pages/docs/about/contributing.mdx b/pages/docs/about/contributing.mdx deleted file mode 100644 index df25d58..0000000 --- a/pages/docs/about/contributing.mdx +++ /dev/null @@ -1,297 +0,0 @@ ---- -title: Contributing -section: About -slug: /docs/about/contributing -order: 3 ---- - -# Contributing - -Contributions to this wiki are welcomed and appreciated. If you are generally experienced with [Markdown](https://www.markdownguide.org/)/[MDX](https://mdxjs.com/) and [GitHub](https://github.com/), contributing is as simple as forking the wiki repository and creating a pull request. - -This guide still may be helpful for experienced users, as it will give you an idea of the specific features of [Gatsby](https://www.gatsbyjs.com/docs/) this [custom theme](https://smooth-doc.com/). - -If unfamiliar with this process, fear not! This guide will walk you through the contribution process in a step-by-step manner. If you still have questions, feel free to join the [Discord](https://discord.com/invite/rqsKmmh89J) for assistance. If completely lost, you may also submit articles to `Kastle#4801` via Discord. - -## GitHub Desktop - -Though it is possible to use GitHub's web editor, it is reccomended that you download [GitHub Desktop](https://desktop.github.com/) if you plan to contribute on an ongoing basis. The linked landing page should provide a suitable download for your system. If you do not yet have a GitHub account, GitHub Desktop will prompt you to create one. - -### Forking the Repository - -1. From the `File` menu, select `Cline Repository...` -2. Select `URL` and enter `https://github.com/mcjava-wiki/mcjava-wiki` -3. Chose the desired location of the repository on your system with `Local Path` -4. Click `Clone` -5. From the `Repository` menu, select `Push` -6. Click `Fork This Repository` -7. Choose `To contribute to the parent project` and click `Continue` - -### Editing the Repository - -The files of the repository may now be editted from the location at which you cloned the repository in the previous instructions. Before editting, it is recommended that you create a new branch for each major contribution if you plan to contribute frequently. To create a new branch: - -1. From the `Branch` menu, select `New Branch...` -2. Enter a name for the branch that describes your intended contribution (e.g. animated-textures) -3. Click `Create Branch` - -To switch between branches, you may use the `Current Branch` tab in the top right of the window. When switching branches, GitHub Desktop will pull the files for the given branch from GitHub and update your repository folder automatically. - -It is reccomended, though also not required, that you utilize a text editing application with syntax checking and highlighting. [Visual Studio Code](https://code.visualstudio.com/) and [Atom](https://atom.io/) are both excellent options availible on all major operating systems. - -### Committing Changes - -Changes are not tracked by the repository until they are committed. GitHub Desktop will show you any files you have changed in the `Changes` tab. Once you are satisfied with your changes, you may commit them through the GitHub Desktop GUI. It is good practice to give a reasonable summary of each commit, describing what is being changed and why. This will make the process of reviewing your pull request much smoother. - -If you are not satisfied with any changes to files, you may discard those changes without committing by highlighting them, right clicking, and selecting `Discard Changes`. This will revert the changes to the last commit. - -### Pushing Changes - -After making committing changes, pushing your changes to GitHub is as simple as selecting `Push` from the `Repository` menu. Generally, it is a good idea to push frequently, as this will ensure your changes are also stored on GitHub. - -### Opening a Pull Request - -Once you are completely satisfied with your article and have pushed all needed changes, you may open a pull request for review. To create a pull request: - -1. From the `Branch` menu, select `Create Pull Request` -2. After your web browser opens, login to GitHub if needed, then click `Create pull request` -3. Use the comment box to summarize the changes made by your pull request -4. Click `Create Pull Request` - -After opening your PR, your proposed changes will be reviewed by a wiki administrator. They will either requst any needed changes, or if no changes are needed, merge your proposed changes into the project. - -## Live Previewing Changes - -To build the site and preview locally, you'll need [NodeJS](https://nodejs.org/en/). - -```bash highlights={3} -git clone https://github.com/mcjava-wiki/mcjava-wiki -cd mcjava-wiki -npm install #--legacy-peer-deps -npm run develop -``` - -Changes can be live previewed with the above commands. Uncomment `--legacy-peer-deps` if running npm 7. If you are not able to preview your changes, do not stress. A preview will be automatically generated when you open your pull request. - -## Considerations - -This section details considerations specific to this project based on the tools that we utilize, as well as custom features that we have added. - -### File Organization - -The pages of this wiki are stored in the path `/pages/docs` of the repository. In here, you will find a folder for each section of the wiki. Please keep any contributions to the correct section. If you are unsure of the section under which a contribution fits, please ask in the Discord. - -If you feel it needed to add a new section for your contribution, you may do so by adding to the `sections` array in `gatsby-config.js`. This will register the new section to the navigation bar. You may then create a new directory in `/pages/docs`. - -### Page Header - -All pages must have a page header for Gatsby to register them. The page header consists of the following information: - -```mdx title={/pages/docs/about/contributing.mdx} ---- -title: Contributing -section: About -slug: /docs/about/contributing -order: 3 ---- -``` - -- `title` defines the title of the page that appears in the navigation bar -- `section` defines the section under which the page will appear -- `slug` defines the URL path of the page (e.g. `/docs/about/contributing` will produce the URL `https://wiki.mcjava.dev/docs/about/contributing`) -- `order` defines the position of the page in its respective section of the navigation bar, with `1` being first, and higher numbers being after - -### Markdown Syntax - -All pages are created with MDX files. MDX is a subset of Markdown. If needed, it is also acceptable to right in plain HTML, which Gatsby should parse correctly in most cases. - -MDX uses markdown syntax. A complete style guide for markdown is availible [here](https://www.markdownguide.org/basic-syntax/). Here is a brief visual summary: - -*** - -```md title={Headings} -# Heading Level 1 - -This heading should only be used as the title of the page - -## Heading Level 2 - -This heading should be used for major sections - -### Heading Level 3 - -This heading should be used for subsections. -Only heading levels 2 and 3 will be displayed on the right sidebar. -Headings go all the way to level 6 by adding more hashtags. -``` - -

Heading Level 1

- -This heading should only be used as the title of the page - -

Heading Level 1

- -This heading should be used for major sections - -

Heading Level 1

- -This heading should be used for subsections. -Only heading levels 2 and 3 will be displayed on the right sidebar. -Headings go all the way to level 6 by adding more hashtags. - -*** - -```md title={Bolding and Italics} -**Bold Text** - -*Italic Text* - -***Bold and Italic Text*** -``` - -**Bold Text** - -*Italic Text* - -***Bold and Italic Text*** - -*** - -```md title={Block Quotes} -> This is a block quote -> -> and more -``` - -> This is a block quote -> -> and more - -*** - -```md title={Lists} -1. First item -2. Second item -3. Third item - 1. Indented item - 2. Indented item -4. Fourth item - -- First item -- Second item -- Third item - - Indented item - - Indented item -- Fourth item -``` - -1. First item -2. Second item -3. Third item - 1. Indented item - 2. Indented item -4. Fourth item - -- First item -- Second item -- Third item - - Indented item - - Indented item -- Fourth item - -*** - -```md title={Images} -![Tux, the Linux mascot](./img/tux.png) -``` - -Note that we specify the path for this image relative to the mdx file of the page: - -![Tux, the Linux mascot](./img/tux.png) - -*** - -```md title={Lines} -There will be an extra line under this -*** -``` - -There will be an extra line under this -*** - -*** - -```md title={Links} -My favorite browser is: -[Firefox Developer Edition](https://www.mozilla.org/en-US/firefox/developer/ "The best browser! (and this hover tip is optional)"). - - - - -``` - -My favorite browser is: -[Firefox Developer Edition](https://www.mozilla.org/en-US/firefox/developer/ "The best browser! (and this hover tip is optional)"). - - - - - -*** - -```md title={Inline Code} -`Put barticks around inline code` -``` - -`Put barticks around inline code` - -*** - -### Code Blocks - -Code blocks are one of the most common components of the wiki. Consequently, an effort was made to add useful features to code blocks. The example below shows how to utilize syntax highlighting and codeblock titles. - -```text -`​``json title={/path/somefile.json} highlights={2,4-6} -{ - "hello": "world", - "some_nums": [ - 1, - 2, - 3 - ] -} -`​`` -``` - -The tripple bartick should be followed by the language in which you are writing. Most commonly, this will be `json`. You may then optionally add a title using the syntax `title={somefile.json}`. Ensure this is seperated from the langauge by a space. You may also define lines to highlight with the syntax `highlights={1,2-4}`. Here, commas seperate lines and ranges, and a range can be specified with a hyphen. - -The code block would then render as: - -```json title={/path/somefile.json} highlights={2,4-6} -{ - "hello": "world", - "some_nums": [ - 1, - 2, - 3 - ] -} -``` - -## Key Takeaways - -- Contributions are always welcome, and are critical to the success and quality of the wiki -- The general process of contributing is: - - Forking the repository - - Making, committing, and pushing changes - - Opening a pull request -- Frequent contributors should install [GitHub Desktop](https://desktop.github.com/) -- The wiki is powered by [Gatsby](https://www.gatsbyjs.com/), and can be previewed locally with npm, provided [NodeJS](https://nodejs.org/en/) is installed -- Pages on the wiki are found under the path `/pages/docs` of the repository -- All pages must have a proper header specifying `title`, `section`, `slug`, and `order` -- Pages are written in MDX, which uses [markdown syntax](https://www.markdownguide.org/basic-syntax/) -- Code blocks have special features like titles, langauage syntax highlighting, and line highlighting - - Define the language with no spaces after the tripple bartick (e.g. `json`) - - Define a code block title with the syntax `title={sometitle.json}`, seperated from the language by a space - - Define line highlighting with the syntax `highlights={1,3-4}`, seperated from the language by a space \ No newline at end of file diff --git a/pages/docs/about/img/tux.png b/pages/docs/about/img/tux.png deleted file mode 100644 index 1228337..0000000 Binary files a/pages/docs/about/img/tux.png and /dev/null differ diff --git a/pages/docs/about/introduction.mdx b/pages/docs/about/introduction.mdx deleted file mode 100644 index 1f23afa..0000000 --- a/pages/docs/about/introduction.mdx +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: Introduction -section: About -slug: /docs/about/introduction -order: 1 ---- - -# About - -This is a technical wiki for Minecraft: Java Edition, primarily focused on resource-related tutorials. The ultimate goal is to be a reliable source of information for all things Java Edition resource pack related. - -## Why? - -Though the Minecraft Wiki currently maintains a tutorial with regards to creating a resource pack, the page is largely disorganized and leaves much to be desired. In general, the wiki markdown format is also limiting, as it does not allow for niceties that developing ones own site affords. - -Furthermore, the success of the [Bedrock Wiki](https://wiki.bedrock.dev/) in this format is also a source of motivation, which is an excellent resource for technical information related to Bedrock Edition resource packs and behavior packs. - -## Technical Information - -- Written primarily in Markdown / [MDX](https://github.com/mdx-js/mdx) -- Built with [Gatsby](https://www.gatsbyjs.com/) -- Deployed via [Cloudflare Pages](https://developers.cloudflare.com/pages/) -- Uses the [Smooth Doc](https://github.com/gregberge/smooth-doc) theme - -## Running Live Locally - -```bash highlights={3} -git clone https://github.com/mcjava-wiki/mcjava-wiki -cd mcjava-wiki -npm install #--legacy-peer-deps -npm run develop -``` - -Note that uncommenting `--legacy-peer-deps` may be required if using npm 7. Please use Visit `http://localhost:8000/` to view local changes. Changes should update live as edits are made on file save. - -## Contributing - -Contributions are also welcome. Please create a pull request [here](https://github.com/mcjava-wiki/mcjava-wiki/pulls). Refer to the contributing section for a more detailed guide. - - diff --git a/pages/docs/basics/default-assets.mdx b/pages/docs/basics/default-assets.mdx deleted file mode 100644 index 168dca4..0000000 --- a/pages/docs/basics/default-assets.mdx +++ /dev/null @@ -1,105 +0,0 @@ ---- -title: Default Assets -section: Basics -slug: /docs/basics/default-assets -order: 1 ---- - -# Default Assets - -The default assets are an excellent resource for understanding the general structure of resource pack. Note that these assets should be used for reference only, and never distributed with third party packs, as Mojang holds the rights to the default assets. - -## Extracting the Main Assets - -The process of extracting the default assets varies by platform. In general, the process consists of navigating to your minecraft folder, navigating to the versions folder, selecting your version of choice, unpacking the jar file of your chosen version, and placing the included assets folder in a safe location. - -### Windows - -1. Press `Win + R` and enter the following: `%appdata%\.minecraft\versions` -2. Select the folder of the version to to be extracted -3. Make a copy of the jar file, and unzip with a third-party unpacking application, such as WinRar, if available -4. If already unzipped proceed to step 8; else, change the extension to `.zip` -5. Select the 'View' tab in File Explorer and ensure 'File name extensions' is checked and shown -6. Right click the enclosing version folder and select 'Open PowerShell window here' -7. From the PowerShell prompt, enter `Expand-Archive [FILE_NAME].zip` -8. Navigate to the assets folder from the expanded archive and place it in a safe location - -### MacOS - -1. From finder, press `Cmd + Shift + G` -2. Enter the following path into the prompt: `~/Library/Application Support/minecraft/versions` -3. Select the folder of the version to to be extracted -4. Right click (or `Ctrl + Click`) the assets folder and select `Services > New Terminal at Folder` -5. Run the following from terminal: `unzip 1.15.jar 'assets/**/*'` -6. Navigate to the assets folder from the expanded archive and place it in a safe location - -### Linux - -Perform the following from the command line: -```bash -cd ~/.minecraft/versions/1.16.5 -unzip 1.15.jar 'assets/**/*' -mv assets [TARGET-DIRECTORY] -``` - -## Extracting the Hashed Assets - -Not all assets are contained in the assets folder found in the game jar file, most notably sounds. To extract these assets, one must use the correct index for the desired version from `./assets/indexes` of the Minecraft folder. This process would be extremely tedious to perform manually, so it must be automated. The guide below describes the process of doing so with NodeJS. - -### NodeJS - -First, ensure NodeJS is installed. If not, simply visit the [NodeJS](https://nodejs.org/en/) website and download the proper version for your operating system. - -### Location - -Navigate to the correct location for your operating system: -- Windows: `%appdata%\.minecraft\assets` -- MacOS: `~/Library/Application Support/minecraft/versions` -- Linux: `~/.minecraft/assets` - -### Script - -Create a script in the assets folder called `extract-assets.js`. Use the following contents, being sure to changes the indexes path to the JSON file for the desired major version: - -```js highlights={4} title={./minecraft/assets/extract-assets.js} -// ensure fs-extra is installed in folder w/ npm i fs-extra -var fs = require('fs-extra') -// select the JSON index of your chosen version -var objects = require('./indexes/1.17.json').objects - -for (var filePath in objects) { - var copyPath = './target/' + filePath.replace('minecraft/','assets/minecraft/').replace('realms/','assets/realms/') - var hash = objects[filePath].hash - var objectPath = './objects/' + hash.substring(0, 2) + '/' + hash - console.log(objectPath, '->', copyPath) - fs.copySync(objectPath, copyPath) -} -``` - -### Extraction - -Next, open a terminal window and ensure your current directory is the assets folder: -- Windows: Right click the assets folder and select 'Open PowerShell window here' -- MacOS: Right click (or `Ctrl + Click`) the assets folder and select `Services > New Terminal at Folder` -- Linux: `cd ~/.minecraft/assets` - -From your terminal window, install the required fs-extra npm package with: -```bash -npm i fs-extra -``` - -Call the script with: -```bash -node extract-assets.js -``` - -The assets will then be extracted to a folder names `./target`. You may then place this in a safe place or merge it with your extracted main assets. - -## Key Takeaways - -- The default assets provide a template for how to structure your resource pack -- You should never distribute the default assets in your own packs -- Extracting the default assets is accomplished by: - - Navigating to the versions folder of the minecraft folder - - Selecting the desired version folder and unpacking the enclosed jar file to find the assets folder -- Certain assets, such as sounds, are not included in the game jar, and must be extracted programmatically uses the version index file diff --git a/pages/docs/basics/pack-structure.mdx b/pages/docs/basics/pack-structure.mdx deleted file mode 100644 index b4a8a75..0000000 --- a/pages/docs/basics/pack-structure.mdx +++ /dev/null @@ -1,167 +0,0 @@ ---- -title: Pack Structure -section: Basics -slug: /docs/basics/pack-structure -order: 3 ---- - -# Pack Structure - -This page will explain how Java Edition resource packs are structured, and therefores gives an idea of how to create your first resource pack from scratch. - -## Overview - -```text title={Default Resources} -📦Root - ┣ 📂assets - ┃ ┣ 📂minecraft - ┃ ┃ ┣ 📂blockstates - ┃ ┃ ┣ 📂font - ┃ ┃ ┣ 📂icons - ┃ ┃ ┣ 📂lang - ┃ ┃ ┣ 📂models - ┃ ┃ ┃ ┣ 📂block - ┃ ┃ ┃ ┗ 📂item - ┃ ┃ ┣ 📂particles - ┃ ┃ ┣ 📂resourcepacks - ┃ ┃ ┣ 📂shaders - ┃ ┃ ┃ ┣ 📂post - ┃ ┃ ┃ ┗ 📂program - ┃ ┃ ┣ 📂sounds - ┃ ┃ ┣ 📂texts - ┃ ┃ ┣ 📂textures - ┃ ┃ ┗ 📜sounds.json - ┣ 📜pack.mcmeta - ┗ 📜pack.png -``` - -## Root Items - -These items are not in any folder of the resource pack. It is important to note when compressing a resource pack that these items should be compressed at the same level as the assets folder. A compressed resource pack will not load if compressed from the enclosing folder. - -### pack.mcmeta - -Files of the extension `.mcmeta` use the JSON syntax. Here is an excerpt of this file from the vanilla pack: - -```json title={pack.mcmeta} highlights={10-11} -{ - "language": { - "en_us": { - "region": "US", - "name": "English", - "bidirectional": false - } - }, - "pack": { - "description": "The default look and feel of Minecraft", - "pack_format": 6 - } -} -``` - -Though this example defines languages, this is not nesscescary unless defining a new language. The main section with which the average user should be concerned is the highlighted lines above, which specify the description of the pack visible in the resource pack switcher, and the pack format. Pack format is based on the Minecraft version with which the pack is compatible. - -Currently, valid values for `pack_format` are: -- `1`: 1.6.1 to 1.8.9 -- `2`: 1.9 to 1.10.2 -- `3`: 1.11 to 1.12.2 -- `4`: 1.13 to 1.14.4 -- `5`: 1.15 to 1.16.1 -- `6`: 1.16.2 to 1.16.5 -- `7`: 1.17 to 1.17.1 -- `8`: 1.18 to 1.18.2 -- `9`: 1.19 to 1.19.2 -- `11`: 22w42a to 22w44a -- `12`: 1.19.3 and above - - -### pack.png - -The `pack.png` should be a square image, though non-square images will be stretched to conform to a square proportion. Any resolution is acceptable. - -## Assets - -The assets folder contains all of the packs media assets. It encloses the namespace folders. - -### Namespaces - -Namespaces are a rarely utilized feature of Java Editon resource packs. The namespace folders exist immediately after the assets folder. The default namespace is `minecraft`, which is the most commonly utilized. To reference assets from a specific namespace in a resource pack when specifying a file path, the path is prefixed with the namepace and a colon. - -Take the following parented model: - -```json title={model.json} highlights={3-5,7} -{ - "textures": { - "1": "minecraft:block/acacia_log", - "2": "item/acacia_boat", - "3": "custom:item/custom_texture" - }, - "parent": "custom:block/custom_model" -} -``` - -In the above example, the full paths at which assets would be referenced is as follows: -- Texture `"1"` would resolve to `/assets/minecraft/textures/block/acacia_log.png` -- Texture `"2"` would resolve to `/assets/minecraft/textures/item/acacia_boat.png` -- Texture `"3"` would resolve to `/assets/custom/textures/item/acacia_boat.png` -- The parent would resolve to `/assets/custom/models/block/custom_model.json` - -### Block States - -Block states are the properties held by placed blocks. Common examples of blockstates are `facing` and `type`, for example, of which `facing` species the direction that a block faces, and `type` specifies whether a slab is top, bottom, or double. Block states are defined by the JSON files held in the `blockstates` folder. Different block states or combonations of block states can correspond to different models, as well as axis rotations. - -### Font - -The `font` folder contains the configuration information for fonts. This includes `glyph_sizes.bin`, defining the widths of characters used for the unicode font. Three JSON files, uniform.json, `default.json`, and `alt.json`, are present in the default pack. The file `alt.json` lists the provider exclusively for the enchantment table font, while `uniform.json` exclusively lists the provider for the legacy unicode font. The file `default.json` can be used to define new main fonts. These can be of the type `bitmap`, utilized by Minecraft's default font, or `ttf` for TrueType fonts. Bitmap fonts are stored in a subfolder of textures, while TureType fonts are stored directly in this `font` folder. - -### Icons - -The `icons` folder contains the application icons for Minecraft. These icons, however, cannot be pulled directly from a resource pack at this time. - -### Lang - -The `lang` folder contains JSON values that consist of key-value pairs in which the key is the identifier for some string used in the game, and the value is the string when that language file is applied. Language files are generalled named with a two letter contry code seperated by an underscore from a two letter language code. - -### Models - -The `models` folder holds the JSON files that create the games models. These JSON files are constructed with four main fields, `textures`, `elements`, `display`, and `parent`. They can be described as follows: -- `textures` maps texture paths to shortnames which can be referenced by the faces of elements -- `elements` defined all the cubes in the model, their sizes, positions, and textues and UV values of each face -- `display` sets the appearance of a model in terms of scale, position, and rotation for different slots and perspectives, as well as item drops, item frames, and GUI -- `parent`, when specified, pulls any of the non-specified previous fields from the specified parent model - -### Particles - -The `particles` folder contains a JSON file for each particle that specifies an array of textures for the given particle. These textures must be present in the `particle` subfolder of the `textures` folder. When multiple textures are defined for a single particle, this produces a framewise animated particle texture. - -### Resourcepacks - -The `resourcepacks` folder of the default resource pack contains `programmer_art.zip`, which provides the legacy Minecraft textures. Like the `icons` folder, this cannot currently be utilized by custom resource packs. - -### Shaders - -The `shaders` folder is comprised of three subfolders, `core`, `post`, and `program`. In general, shaders affect how the game is rendered. - -#### Program - -The `program` subfolder is comprised of JSON files that specifcy a vertex and fragment shader. - -#### Post - -The `post` subfolder contains shaders written in GLSL, Open GL Shader Language, in the form of vertex shaders (`.vsh`) and fragment shaders (`.fsh`). Vertex shaders are applied to all vertexes, the point where the corners of planes intersect, while fragment shaders are applied to each pixel. - -#### Core - -The `core` subfolder defines shader programs that are directly utilized by the game. - -### Sounds - -The `sounds` folder contains all the sounds for the game. This folder does not ship with the version JAR, and must be extracted from the hashed assets in the assets folder of the Minecraft folder. All sounds are of the OGG format and use the [Vorbis](https://xiph.org/vorbis/) audio codec. These sounds are triggered in game by sound events defined in `sounds.json`, which exists in the namespace folder, above the sounds folder. Events can contain mutliple sounds from which a random sound will be chosen. Weight, volume, and pitch can also be controlled on a per event basis. A subtitle event can also be defined for each sound event, the value of which can then be specified in a language file. - -### Texts - -The texts folder contains three plain text files with the extension `.txt`, `credits.txt`, `end.txt`, and `splashes.txt`. The file `credits.txt` contains the game scrolling credits and utilize book-style color codes with the `§` symbol. The `end.txt` file defines a poem that scrolls when the Enderdragon is defeated, and also uses color codes.The final file, `splashes.txt`, does not utilize color codes. It specifies the random phrases that appear on the start game splash screen. - -### Textures - -The `textures` folder contains all game textures. Textures must utilize the png format. In previous versions, textures were required to be square. This is no longer the case. Textures sometimes are accompanied by `.mcmeta` files that specify texture animation. These folders take the full filename of the texture with extensions, followed by `.mcmeta`. diff --git a/pages/docs/basics/predicates.mdx b/pages/docs/basics/predicates.mdx deleted file mode 100644 index 8213dd8..0000000 --- a/pages/docs/basics/predicates.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Predicates -section: Basics -slug: /docs/basics/predicates -order: 4 ---- - -# Predicates - -This page will explain how Java Edition resource packs use predicates to display different models for a single item based on select ingame NBT values or client-side-only states. - -## Types - -### Custom Model Data - -Custom model data can be defined for any item model and uses the NBT tag `CustomModelData`. Custom model data is simply an intger value, and the predicate value maps directly to its NBT value. Items can be obtained with this nbt tag using the following syntax for the give command: - -`give @p diamond_axe{CustomModelData:1}` - -Note that this is the only predicate that can be used on any item model, as it was added to the game specifically for the purpose of custom resoruce pack creation. Other predicate types can only be used in specific circumstances. - -### Damage and Damaged - -Damage and damaged predicates can only be defined for models that have durability. This generally includes tools, weapons, and armor. In the case of armor, it is important to note that the model will not be visible in armor slots. Damage refers to the durability of the item, while damaged refers to weether or not the item can be damaged. For example, an item with unbreaking NBT cannot be damaged. - -The predicate `damage` is a float that is obtained by dividing the total durability of the item, which varies per item, by the current NBT `Damage` value of the item. - -The predicate `damaged` is technically a boolean represented by 0 or 1. The NBT `{Unbreakable:1b}` most closely maps to a `damaged` value of 0, and its inverse a `damaged` value of 1. However, it is important to note that an item without any NBT `Damage`, regardless of the state of its `Unbreakable` NBT, will always map to a `damaged` value of 0. - -### Other Predicates - -Other predicates are used on an item specific basis, and will be detailed in a later more exhaustive section about predicates: - -- `angle` (compass, recovery_compass) -- `blocking` (shield) -- `broken` (elytra) -- `cast` (fishing_rod) -- `charged` (crossbow) -- `firework` (crossbow) -- `pull` (crossbow, bow) -- `pulling` (crossbow, bow) -- `filled` (bundle, map) -- `level` (light) -- `throwing` (trident) -- `time` (clock) -- `tooting` (goat_horn) - -## Usage - -### Definition - -Predicates are defined in an item model via the `overrides` array as follows. Since these predicates override vanilla items, an overrides array will only be effective for models existing in the `minecraft` namespace. Take the example of a diamond sword with custom model data, damage, and damaged predicates: - -```json title={assets/minecraft/models/diamond_sword.json} highlights={6-50} -{ - "parent": "minecraft:item/handheld", - "textures": { - "layer0": "minecraft:item/diamond_sword" - }, - "overrides": [ - { - "predicate": { - "custom_model_data": 2, - "damaged": 0 - }, - "model": "minecraft:custom/a" - }, - { - "predicate": { - "custom_model_data": 5, - "damaged": 1 - }, - "model": "minecraft:custom/b" - }, - { - "predicate": { - "damage": 0.00192184497, - "damaged": 1 - }, - "model": "minecraft:custom/c" - }, - { - "predicate": { - "damage": 0.00512491992, - "damaged": 0 - }, - "model": "minecraft:custom/d" - }, - { - "predicate": { - "damage": 0.00768737988, - "damaged": 1 - }, - "model": "minecraft:custom/e" - }, - { - "predicate": { - "damage": 0.00384368994, - "custom_model_data": 8, - "damaged": 1 - }, - "model": "minecraft:custom/f" - } - ] -} -``` - -Here, within the overrides array, each entry must have a `predicate` key and a `model` key. While the `predicate` key is an object consisting of multiple predicate values, `model` is a file path that uses standard namespace notation starting from the items folder and excluding the file extension. When no namespace is specified, the `minecraft` namespace is assumed. - -### Predicate Resolution - -It is important to note that what model will be displayed does depend on the order of entires in the `overrides` array. Put succinctly: -- Start at the *end* of the `overrides` array. -- If no value is specified for any given predicate, assume a value of 0. -- Take the first entry that is less than or equal to the actual state of the item. The actual state may be defined by NBT or some internal client state. - -Though these two rules may seem simple, this can become complicated when dealing with predicates like `damaged` that do not map directly to their equivalent NBT value. This concept will be explored later in the more exhaustive predicates section. - -## Key Takeaways - -- Predicates allow the display different models for a single item based on select ingame NBT values or client-side-only states -- The predicate custom model data can be used on any item, the damage and damage predicates can be used on any item with durability, and other predicates exist for use with specific items -- Predicates are defined in the `overrides` array of the model JSON -- Predicates are resolved starting at the *end* of the `overrides` array, using the first entry that is less than or equal to the actual state of the item diff --git a/pages/docs/basics/understanding-json.mdx b/pages/docs/basics/understanding-json.mdx deleted file mode 100644 index c753962..0000000 --- a/pages/docs/basics/understanding-json.mdx +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: Understanding JSON -section: Basics -slug: /docs/basics/understanding-json -order: 2 ---- - -# Understanding JSON - -JSON, an acronym for JavaScript Object Notation, is the standard format used for nearly all text based resource pack entries. It is a hierarchical system of representing data, and contains multiple data types. Understanding the structure and syntax of JSON is key to effectively creating resource packs. - -## Structure - -JSON exists in a hierarchy. Here is an example of such a structure from a modified `sounds.json` file: - -```json title={assets/minecraft/sounds.json} -{ - "ambient.cave": { - "sounds": [ - "ambient/cave/cave1", - "ambient/cave/cave2", - "ambient/cave/cave3" - ], - "subtitle": "subtitles.ambient.cave" - }, - "ambient.basalt_deltas.loop": { - "sounds": [ - { - "name": "ambient/nether/basalt_deltas/ambience", - "stream": true, - "volume": 0.5 - } - ] - } -} -``` - -We'll use this example to analyze the various components of JSON. - -## Data Types - -JSON uses multiple data types. Understanding what each data type stores, when to use it, and how it is formatted will be critical for various aspects of resource pack development. - -### Strings - -A string is simply any text enclosed by quotes, excluding new line characters. An example of a string in the above excerpt is `"ambient/cave/cave1"`. It is important to stress that a string is the only data type enclosed by quotes - -### Numbers - -A number is, as it sounds, a number. Note that placing a number in quotes will make make it a string, as only strings are quoted. An example of a number in the above example is the decimal `0.5`. Numbers may be positive or negative. They may also be represented in exponent notation. For example, `5E-1` would be a valid equivalent of `0.5`. - -### Booleans - -A boolean is a `true` or false `value`. In the above example, `true` is a boolean. Like numbers, enclosing a boolean in quotes will produce a string. - -### Arrays - -Arrays can be thought of as a comma separated list of any data type, including objects, which are discussed below. Arrays are enclosed by brackets (`[...]`). In the above example, the following is an array: - -```json -[ - "ambient/cave/cave1", - "ambient/cave/cave2", - "ambient/cave/cave3" -] -``` - -Though this array consists of only strings, the data types in an array can be mixed and matched as needed. Note that the last piece of data in the array is not followed by a comma. This is one of the most common mistakes by beginners. Using a JSON linter or a text editor with builtin syntax checking will help you to avoid such mistakes. - -### Objects - -Objects consist of a comma separated list of key:value pairs enclosed by elipses `{...}`. The key must be a string, while the value may be any of the aforementioned data types, including another object. In the above example, the following is a simple object, in which the key and value are both strings: - -```json -{ - "subtitle": "subtitles.ambient.cave" -} -``` - -Here, `"subtitle"` is the key, and `"subtitles.ambient.cave"` is the value. The key and the value are always separated by a colon. Like arrays, the final key:value pair is not succeeded by a comma. As the above key:value pair is the first and last in the object, it is not followed by a comma. Data types can, of course be nested, such is this excerpt from above: - -```json -{ - "ambient.basalt_deltas.loop": { - "sounds": [ - { - "name": "ambient/nether/basalt_deltas/ambience", - "stream": true, - "volume": 0.5 - } - ] - } -} -``` - -Here, `"ambient.basalt_deltas.loop"` is the key of an object, whose value is also an object. Nested inside this object, the another object with the key of `"sounds"` is present. The value of this object is then an array, which contains a single object consisting of three key:value pairs. Note again that the last value in an array or object is not followed by a comma. - -## Key Takeaways - -- JSON is a hierarchical format used in nearly all text-based data files in Minecraft resource packs -- The main JSON data types are: - - Strings, e.g. `"ambient/cave/cave1"` - - Numbers, e.g. `0.5` - - Booleans, e.g. `false` - - Arrays, e.g. `[1, 2, "three"]` - - Objects, e.g. `{"key": "value"}` -- When listing pieces of data in arrays and objects, commas are succeed all but the final entry -- Objects and arrays can be continuously nested diff --git a/pages/docs/bedrock-equivalencies/resource-pack-conversion.mdx b/pages/docs/bedrock-equivalencies/resource-pack-conversion.mdx deleted file mode 100644 index 191783c..0000000 --- a/pages/docs/bedrock-equivalencies/resource-pack-conversion.mdx +++ /dev/null @@ -1,119 +0,0 @@ ---- -title: Resource Pack Conversion -section: Bedrock Equivalencies -slug: /docs/bedrock-equivalencies/resource-pack-conversion -order: 1 ---- - -# Resource Pack Conversion - -This page is meant to explain the process of converting a Java resource pack containing [predicates](/docs/basics/predicates) for use with Geyser, which currently include custom model data, damage, and unbreaking status. Though some code snipets may be given as examples, the primary purpose of this page is to explain the general process, whether in a manual or automated fashion. - -## Introduction - -Resource packs are inherently complex, and converting and using your particular pack with Geyser may be more complex. This information here is largely general and geared towards basic 2D and 3D models added through custom model data or damage predicates. Broader support for features like block models, blockstates, armor, sounds, emoji, custom bows, eating animations, inventory for 3D models, item frame displays, etc. may be added to converters and Geyser in the future. But recognize that at this time, you are largely on your own with more complex use cases like this, as the systems to automate these processes are still in development. The bulk of this overview is based on what I have learned from writing an automated bash script called [java2bedrock](https://github.com/Kas-tle/java2bedrock.sh). Do note, however, that this page does contain steps that the converter does not currently carry out. Some of this is due to a lack of support on Geyser's end, while some is due to implementation difficulties on the converter's end. - -## Concept - -When converting a resource pack from Java to Bedrock, even if the conversion process has been automated, it is important to understand what is being done. In the case of predicates commonly used in Java Edition, it must be noted that these do not directly exist on Bedrock Edition. However, Bedrock edition does have the ability to implement fully custom items. Geyser gets around this by allowing the user to map Java predicates to a Bedrock custom item. For more information on Bedrock custom items, please refer to the [Items](https://wiki.bedrock.dev/items/items-intro.html) section of the Bedrock Wiki. The following is an example of a Geyser item mappings file. More information about these files can be found on the [Custom Items](https://wiki.geysermc.org/geyser/custom-items/) page of the Geyser Wiki. - -```json highlights={4} title={./custom_mappings/geyser_mappings.json} -{ - "format_version": "1", - "items": { - "minecraft:apple": [ - { - "name": "test_food", - "custom_model_data": 1, - "icon": "apple_golden" - } - ], - "minecraft:diamond_sword": [ - { - "name": "test_sword_cmd", - "custom_model_data": 1, - "icon": "sword" - }, - { - "name": "test_sword_damage", - "damage_predicate": 1, - "icon": "sword" - } - ] - } -} -``` - -Any converter that operates without a Geyser extension to register its items will need to provide a mappings file in the same format. - -## Gathering Models - -In order to begin the conversion process, what needs converting must first be identified. Since no one item entry depends on another, each model gathering subtype may be done in parallel. - -### Predicate Entries - -The first step in the conversion process is finding all relavent predicate entries. This information is needed to construct the mappings file and decide which models need to be converted. This process can be broken down into steps as following steps, which must be performed on all vanilla item model definitions (contained in the Java resource pack under `assets/minecraft/models/item/*.json`) for each entry contained in their respective overrides arrays: - -1. Store the identifier of the overridden Java item, which matches the name of the model file (e.g. `diamond_sword`) -2. Store or parse the relavent predicate entries, which currently consist of `.predicate.damage`,`.predicate.damaged`, and `.predicate.custom_model_data`: - 1. for `.predicate.damage`, convert the given float to a durability value by multiplying the given float by the max durability of the item, and taking the integer ceiling of the result - 2. for `.predicate.damaged`, convert the given integer to a boolean, using `true` if the given integer is 1, and `false` if the given integer is 0 - 3. for `.predicate.custom_model_data`, simply store the given integer value -3. From the `.model` field of the entry, parse and store the following: - 1. the namespace of the predicate entry's model (e.g. in `minecraft:item/diamond_sword`, the namespace is `minecraft`) - 2. the model path of the predicate entry's model (e.g. in `minecraft:item/diamond_sword`, the model path is `item/`) - 3. the model name of the predicate entry's model (e.g. in `minecraft:item/diamond_sword`, the model name is `diamond_sword`) -4. Hash the Java item identifier and relavent predicate values to construct a unique hash for each predicate entry that will persist accross conversions - -### Vanilla Item Models - -In some cases, the user may want to convert item models that are not implemented through predicate overrides. In such a case, the model will be displayed at a resource pack level with no intervention required from Geyser. A list of models should be made that satisfies the following criteria: - -1. The model's path also exists in the vanilla resources under `assets/minecraft/models/item/*.json` -2. Less the overrides array, the contents of the file do not match that of the same model path in the vanilla resources - 1. this is intended to prevent the bloating of the pack by models that function the same as vanilla models - -### Block Models - -Note that while the process for resolving block models for conversion is described here, Geyser does not currently have support for block mappings. The process for identifying which block models need to be converted should follow this outline: - -1. For all files matching `assets/minecraft/blockstates/*.json` from the vanilla resources, construct an array of all listed models, which are contained under the JSON paths `.multipart.[].apply.model` and `.variants.*.model` -2. For all files in the given resource pack that correspond to a file matching `assets/minecraft/blockstates/*.json` from the vanilla resources construct an array of all listed models using the JSON paths defined above -3. Combine these arrays and remove duplicate entries -4. Construct an array of all model JSONs in the given resource pack -5. Find the union of the model JSONs array and the array derrived from blockstate entries - -## Parental Filtering and Resolution - -Next, the parental status of each model must be determined, whether the model is a predicate entry or a vanilla item model. - -### Parental Resolution - -Nearly all models in the vanilla resources use parentals in order to prevent the repetition of common model elements. This means that the textures, elements, and display settings of a given model will not always be listed in a given model file. However, these must be known before the conversion of the model can occur. As a result, these must be resolved for any block or item model that has been identified for conversion. This is one of the most computationally expensive parts of the conversion process. Furthermore, all textures must be known for texture atlas generation to be completed, as the optimal atlas generation process relies on finding texture overlap accross models. Given that these values will be used quite a ways down the road, it may be impractical to store these all in memory, especially since some high element count models can sometimes have file sizes in the tens of megabytes. It would likely be useful to store the texture list of each model in memory since those will be used shortly in the atlas generation step. This process can be performed in parallel for each model. In the case of item models parental resolution should attempt to continue until the end of the parent chain is reached or elements, textures, and display settings have been found for the model. This is the same for block models, except resolution can stop when elements and textures are found, since display settings are not relavent to block models. - -### Parental Filtering - -Based on the resolved parent, some decisions must be made with regards to the model conversion that will occur later. The most obvious case of this is the parent `minecraft:builtin/generated`. Java models that lead to this parental will render an extruded mesh from a provided texture. There are two ways to mimic this behavior on Bedrock, the pros and cons of which will be discussed in the geometry conversion section. - -## Texture Atlas Generation - -Texture atlases must be generated for each item model, as Bedrock models when implemented as entities via attachables may only have one texture. Items with the `minecraft:builtin/generated` parent should be excluded from this process, since meither method by which they can be displayed allows for UV manipulation. For models that are used only for blocks, it is technically possible to use material instances instead of atlas generation. This would be most helpful in cases where many block models with shared textures are used, and the traditional method of atlas generation would lead to instability due to the size of the generated atlases. - -It should be noted that this is the most difficult part of the pack conversion process from a clientside performance perspective. Since Bedrock supports mobile devices, it is unreasonable to expect that all Bedrock players will have access to a desktop grade GPU. At a maximum, one should aim for generated atlases to be no larger than 4096, though in particularly low spec devices like the Nintendo Switch, even this may be pushing the envelope. - -### Atlas Inclusion - -For our purposes, atlas inclusion will be the process of deciding which textures will be combined into atlases. In my opinion, the optimal method for atlas inclusion follows a proposed algorithim, which should be looped over each item model's texture list. The first item model texture list should be placed as the first entry in a list of texture lists. For all subsequent item model texture lists: - -1. Check to see if the new item model texture lists has any overlapping textures with the current list of texture lists -2. Any texture lists that overlap with new item model texture list should be combined with each other -3. If no texture lists overlap with the new item model texture list, the item model texture list should be placed as its own entry in the list of texture lists -4. The process should continue to the next item model texture list until all item model texture lists have been itterated over - -There are, however, some drawbacks to this method. As previously stated, the size of generated atlases should be kept at a minimum. In packs in which models use mutliple large shared textures, this will lead to the generation of extremely large atlases. Unfortunately, the solution to this problem will often be to reduce texture resolution and reduce the size of shared texture networks in cases where they lead to this result. Such optimizations will likely need to be done manually. - -### Atlas Construction - -Atlases should, of course, be constructed to minimize empty space. In addition, the location of all textures on atlases must be recorded. This is needed to direct UV shifts in the actual model conversion process. The X and Y pixel coordinates and texture path are sufficent. - -## Geometry Conversion \ No newline at end of file diff --git a/pages/docs/external-programs/blockbench.mdx b/pages/docs/external-programs/blockbench.mdx deleted file mode 100644 index 698b878..0000000 --- a/pages/docs/external-programs/blockbench.mdx +++ /dev/null @@ -1,141 +0,0 @@ ---- -title: Blockbench -section: External Programs -slug: /docs/external-programs/blockbench -order: 1 ---- - -import { MdLibraryAdd, MdTune, MdSettings, MdBurstMode, MdFeaturedPlayList, MdAddBox, MdCreateNewFolder, MdDns, MdStar, MdStarBorder, MdZoomOutMap, MdBrightnessAuto, MdClear, MdReplay, MdCheckBox, MdCheckBoxOutlineBlank, MdBlock } from 'react-icons/md' -import { FaThumbtack, FaMagic , FaTimesCircle, FaCamera, FaRegWindowClose, FaLockOpen, FaLock, FaEye, FaEyeSlash, FaCopy, FaClipboard } from 'react-icons/fa' - -# Blockbench - -Blockbench is a robust, modern 3D modeling program for Minecraft. It exports JSON-based model files for use in resource packs. As a free and open source project, it is generally the choice of entry level users. - -## Installation - -Blockbench can be installed by downloading the latest installer from the [installation page](https://blockbench.net/downloads/) and following the prompts. Blockbench is also availible as a web app, which can be accessed [here](https://web.blockbench.net/). It is generally reccomended to use the standalone app if possible for performance reasons, as well as some extended functionality. - -On first opening Blockbench, you will likely be greeted with a changelog. On dismissing this, you will be broungt to the start menu. From here, you can choose the format 'Java Block/Item', which is the format that will be used for unmodded, vanilla resource pack models. - -## Project Settings - -On creating a project, you will be brought to a form prompting you for information about your project. Project settings can be revisted at any time from File > Project... Here is some infor about the options: -- `File Name` is arbitary -- `Parent Model` allows you to use repeated components from another model, and is covered in greater detail in the models section -- `Ambient Occlusion` refers to whether the block model will render with shadows on its faces in game -- `UV Mode` specifies how textures are mapped to faces on your model, and should be left as per-face UV for Java Edition models -- `Texture Size` defines the maximum x and y coordinates that will be used by Blockbench for UV mapping, though this setting is only used by Blockbench, and exported UV values will be translated to a 16 by 16 coordinate system - -## Edit Tab - -The edit tab is where most of your time in Blockbench will be spent. Tab switching may be done in the top right. From the edit tab, you may import textures, create elements, and setup UV mapping. - -### Textures - -Textures may be created or imported from this menu. You may also drag textures from your system''s file explorer utilitiy directly into this menu. It is important to note that, when importing textures, you should place your model within its final location in your resource pack. This will allow Blockbench to export the correct texture paths to your model JSON. - -It is also reccomended that you import the default textures, so that Blockbench may relatively reference these without them being present in your own resource pack. See the full guide on [extracting the default assets](https://wiki.mcjava.dev/docs/basics/default-assets) to obtain these. To make Blockbench aware of these assets: - -1. Navigate to the settings menu from File > Preferences > Settings... -2. Expand the Defaults section -3. Choose Default Path and select Continue when prompted -4. Use your file explorer utility to navigate to the textures folder of the default assets -5. Select the textures folder (`./assets/minecraft/textures`) and open - -The default assets are now set, meaning that Blockbench will now attempt to resolve any references to default textures that are missing from your own resource pack. - -### Outliner - -The outliner allows you to add elements and lists all the elements contained in your model. You may also add groups to organize your model, though it should be noted that groups are purely organizational and in no way factor into Minecraft's rendering of models. - -There is also a Toggle More Options button. This will allow for the application of additional settings on a per-element basis. The options are as follows: - -- Auto UV mode affects how the UV is expanded as the size of the element changes: - - will always attempt to expand in the positive direction and subtract in the negative direction of the UV coordinates until the edge is reached - - will expand the UV based on the direction of element expansion and subtract based on the direction of element deflation - - will keep the UV locked to the same postion, regardless of changes in element size -- Shading mode defines whether or not the element will have shading applied: - - enables shading for the element - - disables shading for the element -- Export mode controlls whether or not the element will be written to the JSON on export: - - will write the element on export - - will not write the element on export -- Lock mode controls whether or not further edits can be made to the element: - - will allow further edits to the element - - will lock the element to its current state -- Visibility mode controls whether or not the element can be seen in Blockbench: - - will show the element in Blockbench - - will not show the element in Blockbench - -### UV Editor - -The UV editor is where the display of textures on each element face is controlled. A miniaturized version of the UV editor with limited options is always displayed above the textures menu. To see the full UV editor, select any elelemnt face and double click the texture displayed on the leftward menu. The following menu options are availible: - -- The UV Grid box defines the amount of steps when dragging the UV size. The default setting will take steps based on the texture pixel size, while the other options step based on the project texture size -- maximizes the UV to use the entire texture on the face -- applies automatic UV based on the element size and proportion (the relative option will only consider proportion) -- mirrors the UV along the X axis -- mirrors the UV along the Y axis -- copies the UV of the current face to the clipboard -- pastes the UV on the clipboard to the current face -- prevents the face from being written to the JSON file -- resets the face to missing texture -- enables or disables tinting -- The cullface selector chooses a face to be culled if there is an adjacent block -- applies automatic culling -- The UV rotation scrollbar rotates the UV as it is displayed on the face in increments of 90º - -### Element - -- Position -- Size -- Pivot -- Rotation - -### Toolbar - -- Move -- Resize -- Rotate -- Pivot -- Vertex Snapping -- Transform Space - -## Paint Tab - -The paint tab allows for direct texture editting on the model with a relatively simple set of tools: - -### Toolbar - -- Paint Brush -- Paint Bucket -- Eraser -- Color Picker -- Draw Shape -- Copy Paste -- Mirror Painting -- Lock Alpha Channel -- Painting Grid - -### Color Picker - -## Display Tab - -The display tab modifies how the model is shown based on inventory slot and camera view, as well as displays in item frames, on ground, and in GUI. - -### Presets - -### Slot - -### Reference Model - -### Display Options - -- Rotation -- Translation -- Scale - -## Plugins - -## Key Takeaways \ No newline at end of file diff --git a/pages/docs/external-programs/cubik.mdx b/pages/docs/external-programs/cubik.mdx deleted file mode 100644 index ef18ae3..0000000 --- a/pages/docs/external-programs/cubik.mdx +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Cubik -section: External Programs -slug: /docs/external-programs/cubik -order: 2 ---- - -# Cubik \ No newline at end of file diff --git a/pages/docs/external-programs/gimp.mdx b/pages/docs/external-programs/gimp.mdx deleted file mode 100644 index 8b90049..0000000 --- a/pages/docs/external-programs/gimp.mdx +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Gimp -section: External Programs -slug: /docs/external-programs/gimp -order: 3 ---- - -# Gimp \ No newline at end of file diff --git a/pages/docs/external-programs/github.mdx b/pages/docs/external-programs/github.mdx deleted file mode 100644 index 33705fa..0000000 --- a/pages/docs/external-programs/github.mdx +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: GitHub -section: External Programs -slug: /docs/external-programs/github -order: 4 ---- - -# GitHub \ No newline at end of file diff --git a/pages/docs/external-programs/imagemagick.mdx b/pages/docs/external-programs/imagemagick.mdx deleted file mode 100644 index 00dd7c3..0000000 --- a/pages/docs/external-programs/imagemagick.mdx +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: ImageMagick -section: External Programs -slug: /docs/external-programs/imagemagick -order: 5 ---- - -# ImageMagick \ No newline at end of file diff --git a/pages/docs/external-programs/jq.mdx b/pages/docs/external-programs/jq.mdx deleted file mode 100644 index 1957771..0000000 --- a/pages/docs/external-programs/jq.mdx +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: jq -section: External Programs -slug: /docs/external-programs/jq -order: 6 ---- - -# jq \ No newline at end of file diff --git a/pages/docs/external-programs/visual-studio-code.mdx b/pages/docs/external-programs/visual-studio-code.mdx deleted file mode 100644 index af5c0ed..0000000 --- a/pages/docs/external-programs/visual-studio-code.mdx +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Visual Studio Code -section: External Programs -slug: /docs/external-programs/visual-studio-code -order: 7 ---- - -# Visual Studio Code \ No newline at end of file diff --git a/pages/docs/index.mdx b/pages/docs/index.mdx deleted file mode 100644 index 01bb4ac..0000000 --- a/pages/docs/index.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -slug: /docs/ -redirect: /docs/about/introduction ---- diff --git a/pages/index.mdx b/pages/index.mdx deleted file mode 100644 index 49dec61..0000000 --- a/pages/index.mdx +++ /dev/null @@ -1,29 +0,0 @@ -import { - ScreenContainer, - Button, - HeroSection, - Hero, - HeroBody, - HeroTitle, - HeroTeaser, - HeroActionList, - HeroAction, -} from "../src/components"; -import heroBackgroundImageURL from "../images/hero-background.png"; - - - - - mc-java wiki - A guide for Minecraft: Java Edition resource packs - - - - - - - - - diff --git a/src/components/AppHeader.js b/src/components/AppHeader.js deleted file mode 100644 index 3c8971a..0000000 --- a/src/components/AppHeader.js +++ /dev/null @@ -1,153 +0,0 @@ -import React from 'react' -import { graphql, useStaticQuery } from 'gatsby' -import styled, { x, useColorMode, down, css } from '@xstyled/styled-components' -import { ScreenContainer } from './ScreenContainer' -import { DocSearch } from './DocSearch' -import { NavLink } from './Nav' -import { AppNav } from './AppNav' - -const AppHeaderQuery = graphql` - query AppHeader { - logos: allFile( - filter: { - sourceInstanceName: { in: ["image", "default-image"] } - name: { glob: "logo-nav*" } - } - sort: { fields: sourceInstanceName, order: DESC } - ) { - nodes { - name - publicURL - } - } - - site { - siteMetadata { - title - docSearch { - apiKey - indexName - } - navItems { - title - url - } - } - } - } -` - -const OuterHeader = styled.header` - background-color: background; - border-bottom-style: solid; - border-bottom-width: base; - border-bottom-color: layout-border; - padding: 2 0; - height: 50; - - ${down( - 'sm', - css` - overflow-x: auto; - `, - )} -` - -const NavSkipLink = styled.a` - text-decoration: none; - left: -999px; - position: absolute; - top: auto; - width: 1px; - height: 1px; - overflow: hidden; - z-index: -999; - color: primary; - - &:focus { - background-color: background; - border-radius: base; - left: auto; - top: auto; - height: auto; - width: max-content; - overflow: auto; - padding: 2; - margin: 2; - text-align: center; - z-index: 999; - } -` - -function useLogo(logos) { - const [mode] = useColorMode() - switch (mode) { - case 'dark': - return ( - logos.find((logo) => logo.name === 'logo-nav-dark') || - logos.find((logo) => logo.name === 'logo-nav') || - null - ) - case 'light': - default: - return ( - logos.find((logo) => logo.name === 'logo-nav-light') || - logos.find((logo) => logo.name === 'logo-nav') || - null - ) - } -} - -export function AppHeader() { - const data = useStaticQuery(AppHeaderQuery) - const logo = useLogo(data.logos.nodes) - - return ( - - - - Skip to content - - - - - {logo ? ( - - ) : ( - - {data.site.siteMetadata.title} - - )} - - - {data.site.siteMetadata.docSearch ? ( - - - - ) : null} - - - - - ) -} diff --git a/src/components/AppNav.js b/src/components/AppNav.js deleted file mode 100644 index 1d17988..0000000 --- a/src/components/AppNav.js +++ /dev/null @@ -1,39 +0,0 @@ -import React from 'react' -import { RiGithubFill, RiDiscordFill } from 'react-icons/ri' -import { Nav, NavList, NavListItem, NavLink } from './Nav' -import { ColorModeSwitcher } from './ColorModeSwitcher' - -export function AppNav() { - return ( - - ) -} diff --git a/src/components/Article.js b/src/components/Article.js deleted file mode 100644 index 7e3903a..0000000 --- a/src/components/Article.js +++ /dev/null @@ -1,229 +0,0 @@ -import styled, { css, up, down } from '@xstyled/styled-components' - -export const Article = styled.article` - .anchor { - fill: on-background; - } - - code { - background-color: background-light; - color: on-background-primary; - border-radius: base; - padding: 0 1; - } - - mark { - background-color: background-mark; - } - - > p { - margin: 3 0; - font-size: 16; - line-height: 1.6; - max-width: 52em; - } - - /* Intro */ - > h1 + p { - font-size: 18; - font-weight: 300; - color: on-background-light; - margin: 2 0 !important; - - ${up( - 'xl', - css` - font-size: 22; - line-height: 1.2; - `, - )}; - - a, - strong { - font-weight: 400; - } - } - - > hr { - margin: 0; - height: 0; - border: 0; - border-top: 1; - border-color: layout-border; - margin: 4 0; - - &:first-child { - margin-top: 0; - } - } - - > h1 { - font-size: 32; - line-height: 1.1; - font-weight: 600; - margin: 40 0 2; - } - - > h2 { - font-size: 24; - line-height: 1.2; - font-weight: 600; - margin: 4 0; - padding-top: 3; - border-top: 1; - border-color: layout-border; - } - - > h1 + h2, - > h2:first-child { - border-top: 0; - margin-top: 0; - padding-top: 0; - } - - > h3 { - font-size: 18; - line-height: 1.2; - font-weight: 600; - margin: 4 0 3; - - ${down( - 'sm', - css` - overflow-wrap: break-word; - word-break: break-word; - `, - )} - } - - > h4 { - font-weight: 500; - font-size: 16; - line-height: 1.2; - margin: 3 0; - } - - > h4 + p { - margin-top: 3; - } - - > ul + p { - margin-top: 2; - } - - .editor { - background-color: editor-background; - color: editor-text; - padding: 3 4; - margin: 4 -3; - overflow: auto; - font-size: 14; - line-height: 1.45; - border-radius: base; - - ${down( - 'sm', - css` - margin-left: -4; - margin-right: -4; - border-radius: 0; - `, - )} - } - - > code { - background-color: editor-background; - border-radius: base; - color: inherit; - font-family: SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, - Courier New, monospace; - font-size: 85%; - padding: 1 2; - } - - img { - max-width: 100%; - } - - ol, - ul { - margin-top: 4; - font-size: 16; - padding-left: 4; - - p, - p:first-of-type { - font-size: 16; - margin-top: 0; - line-height: 1.2; - } - - li { - margin-top: 2; - } - - ol, - ul { - margin-left: 4; - margin-top: 2; - } - } - - ol { - list-style: decimal; - } - - ul { - list-style: disc; - } - - > blockquote { - font-size: 16; - background-color: blockquote-background; - border-left: 8; - border-color: blockquote-border; - padding: 3; - margin: 3 -2; - border-radius: blockquote; - - code { - background-color: rgba(255, 255, 255, 0.1); - background-blend-mode: color; - color: on-background; - border-radius: base; - padding: 0 1; - } - - p { - margin-top: 3; - - &:first-of-type { - margin-top: 0; - } - - &:last-child { - margin-bottom: 0; - } - } - - a { - transition: fast; - color: blockquote-link; - text-decoration: underline; - - &:hover { - color: on-background; - } - } - } - - a { - transition: fast; - text-decoration: underline; - color: on-background-primary; - - &:hover { - color: on-background-primary-dark; - } - } -` diff --git a/src/components/Button.js b/src/components/Button.js deleted file mode 100644 index 78d3c95..0000000 --- a/src/components/Button.js +++ /dev/null @@ -1,85 +0,0 @@ -import * as React from 'react' -import { Button as ReakitButton } from 'reakit/Button' -import styled, { css } from '@xstyled/styled-components' - -const variant = ({ background, backgroundHover, on }) => () => { - return css` - background-color: ${background}; - color: ${on}; - - &:hover:not(:disabled) { - background-color: ${backgroundHover}; - color: ${on}; - } - - &:active:not(:disabled) { - background-color: ${backgroundHover}; - color: ${on}; - } - ` -} - -const InnerButton = styled.buttonBox` - appearance: none; - border-radius: base; - transition: base; - font-weight: 500; - border: 0; - display: inline-flex; - align-items: center; - cursor: pointer; - font-size: 16; - padding: 2 3; - text-decoration: none !important; - - &:disabled { - opacity: 0.5; - cursor: default; - } - - &[data-variant='primary'] { - ${variant({ - background: 'primary-600', - backgroundHover: 'primary-700', - on: 'white', - })} - } - - &[data-variant='success'] { - ${variant({ - background: 'green-600', - backgroundHover: 'green-700', - on: 'white', - })} - } - - &[data-variant='danger'] { - ${variant({ - background: 'red-600', - backgroundHover: 'red-700', - on: 'white', - })} - } - - &[data-variant='neutral'] { - ${variant({ - background: 'gray-300', - backgroundHover: 'gray-400', - on: 'black', - })} - } -` - -export const Button = React.forwardRef( - ({ variant = 'primary', children, ...props }, ref) => { - return ( - - {(buttonProps) => ( - - {children} - - )} - - ) - }, -) diff --git a/src/components/Code.js b/src/components/Code.js deleted file mode 100644 index 8152fd4..0000000 --- a/src/components/Code.js +++ /dev/null @@ -1,284 +0,0 @@ -import React from 'react' -import rangeParser from 'parse-numeric-range'; -import styled, { useTheme, th, up, css } from '@xstyled/styled-components' -import Highlight, { defaultProps } from 'prism-react-renderer' -import { - LiveProvider, - LiveEditor, - LiveError, - LivePreview as BaseLivePreview, -} from 'react-live' -import { mdx } from '@mdx-js/react' -import { FaClipboard } from 'react-icons/fa' - -const Pre = styled.pre` - position: relative; - font-size: 15; - line-height: 1.45; - word-break: normal; - overflow: auto; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - margin: 3 -3; - background-color: editor-background; - color: editor-on; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - hyphens: none; - padding: 4 0; - - box-shadow: rgba(34, 211, 238, 0.20) 0px 0px 200px; - - textarea { - &:focus { - outline: none; - } - } - - & .token-line { - line-height: 1.3em; - height: 1.3em; - } - - ${up( - 'sm', - css` - border-radius: editor; - margin: 3 -2; - `, - )} -` - -// line highlighting -const calculateLinesToHighlight = (meta) => { - const REhighlights = /highlights={([\d,-]+)}/ - if (REhighlights.test(meta)) { - const strlineNumbers = REhighlights.exec(meta)[1] - const lineNumbers = rangeParser(strlineNumbers) - return (index) => (lineNumbers.includes(index + 1)) - } else { - return () => false - } -} - -// code block title -const CodeLabel = styled.button` - position: absolute; - left: 0; - border-radius: 0 0 0.25rem 0rem; - font-size: 12px; - letter-spacing: 0.025rem; - padding: 0.25rem 0.5rem; - text-align: right; - top: 0; - background: #0891B2; - color: #ffffff; -` -const getCodeTitle = (meta) => { - const REtitle = /title={(.*?)}/ - if (REtitle.test(meta)) { - const codeTitle = REtitle.exec(meta)[1] - return {codeTitle} - } else { - return () => false - } -} - - -// line numbering -const LineNo = styled.span` - display: inline-block; - width: 2em; - user-select: none; - opacity: 0.3; - display: inline-flex; - justify-content: flex-end; - padding-right: 0.5rem; -` - -const LivePreview = styled(BaseLivePreview)` - padding: preview-padding-y preview-padding-x; - margin: 3 -3 -3; - border-top: 1; - border-color: editor-border; - border-image: initial; - - white-space: normal; - font-family: base; - overflow: hidden; - - background-color: background; - color: on-background; - - ${up( - 'sm', - css` - border-right: 1; - border-left: 1; - border-radius: editor; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; - border-color: editor-border; - margin-left: -2; - margin-right: -2; - `, - )} -` - -const globalModules = { - react: 'React', -} - -export function LiveConfig({ modules }) { - Object.assign(globalModules, modules) - return null -} - -function req(path) { - const dep = globalModules[path] - - if (!dep) { - throw new Error( - `Unable to resolve path to module '${path}'. Use "LiveConfig" to provide modules.`, - ) - } - return dep -} - -function importToRequire(code) { - return ( - code - // { a as b } => { a: b } - .replace(/([0-9a-z_$]+) as ([0-9a-z_$]+)/gi, '$1: $2') - // import { a } from "a" => const { a } = require("b") - .replace( - /import {([^}]+)} from ([^\s;]+);?/g, - 'const {$1} = require($2);', - ) - // import a from "a" => const a = require("a").default || require("a") - .replace( - /import ([\S]+) from ([^\s;]+);?/g, - 'const $1 = require($2).default || require($2);', - ) - // import * as a from "a" - .replace( - /import \* as ([\S]+) from ([^\s;]+);?/g, - 'const $1 = require($2);', - ) - // import a from "a" => const a = require("a").default || require("a") - .replace( - /import (.+),\s?{([^}]+)} from ([^\s;]+);?/g, - [ - 'const $1 = require($3).default || require($3);', - 'const {$2} = require($3);', - ].join('\n'), - ) - ) -} - -export function usePrismTheme() { - const theme = useTheme() - return th('prism-theme')({ theme }) -} - - -// setup clipboard copy function -const copyToClipboard = (str) => { - const el = document.createElement("textarea") - el.value = str - el.setAttribute("readonly", "") - el.style.position = "absolute" - el.style.left = "-9999px" - document.body.appendChild(el) - el.select() - document.execCommand("copy") - document.body.removeChild(el) -} - -// setup cody copy button -const CopyCode = styled.button` - position: absolute; - right: 0; - border-radius: 0.25rem 0 0 0; - font-size: 12px; - letter-spacing: 0.025rem; - padding: 0.25rem 0.5rem; - text-align: right; - bottom: 0; - opacity: 0.3; - visibility: visible; - background: #67E8F9; - &:hover{ - opacity: 1; - visibility: visible; - } - &:active{ - opacity: 1; - visibility: visible; - background: #34D399; - } -` - -export function Code({ children, lang = 'markup', metastring, live, noInline }) { - const prismTheme = usePrismTheme() - if (live) { - return ( - `/* @jsx mdx */ ${importToRequire(code)}`} - scope={{ mdx, require: req }} - language={lang} - theme={prismTheme} - noInline={noInline} - > - -
-          
-        
- -
- ) - } - const handleClick = () => { copyToClipboard(children.trim()) } - const shouldHighlightLine = calculateLinesToHighlight(metastring) - return ( - - {({ className, style, tokens, getLineProps, getTokenProps }) => ( -
-          {getCodeTitle(metastring)}
-          
- - {tokens.map((line, i) => { - const lineProps = getLineProps({ line, key: i }) - if (shouldHighlightLine(i)) { - lineProps.className = `${lineProps.className} highlight-line` - } - return ( -
- {i + 1} - {line.map((token, key) => ( - - ))} -
- ) - })} -
-
- )} -
- ) -} diff --git a/src/components/ColorModeSwitcher.js b/src/components/ColorModeSwitcher.js deleted file mode 100644 index a549106..0000000 --- a/src/components/ColorModeSwitcher.js +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react' -import { x, useColorMode } from '@xstyled/styled-components' -import { RiMoonClearLine, RiSunLine } from 'react-icons/ri' - -const modeIcons = { - light: RiMoonClearLine, - dark: RiSunLine, -} - -function getInverseMode(mode) { - return mode === 'light' ? 'dark' : 'light' -} - -export const ColorModeSwitcher = React.forwardRef((props, ref) => { - const [mode, setMode] = useColorMode() - const Icon = modeIcons[mode] - return ( - setMode(getInverseMode)} - {...props} - > - - - ) -}) diff --git a/src/components/DocLayout.js b/src/components/DocLayout.js deleted file mode 100644 index e8ff2bf..0000000 --- a/src/components/DocLayout.js +++ /dev/null @@ -1,206 +0,0 @@ -import React from 'react' -import styled, { x, css, up, down, th, useUp } from '@xstyled/styled-components' -import { useDialogState, Dialog, DialogDisclosure } from 'reakit/Dialog' -import { Portal } from 'reakit/Portal' -import { FaBars } from 'react-icons/fa' -import { RiPencilLine } from 'react-icons/ri' -import { ScreenContainer } from './ScreenContainer' -import { SideNav, useSideNavState, useSideNavPrevNext } from './SideNav' -import { PageLayout } from './PageLayout' -import { SiblingNav, SiblingNavLink } from './SiblingNav' -import { Article } from './Article' -import { TableOfContents } from './TableOfContents' - -const SidebarDialog = styled.div` - background-color: background-light-a50; - backdrop-filter: blur(3px); - position: fixed; - top: 50; - right: 0; - bottom: 0; - left: 0; - z-index: 20; - overflow: auto; - transition: base; - opacity: 0; - transition: opacity 250ms ease-in-out, transform 250ms ease-in-out; - transform: translate3d(0, 10vh, 0); - - &[data-enter] { - opacity: 1; - transform: translate3d(0, 0, 0); - } - - &:focus { - outline: none; - } -` - -const Container = styled.div` - z-index: 0; - position: relative; - - ${up( - 'md', - css` - display: grid; - grid-template-columns: 288px minmax(0, 1fr); - grid-gap: ${th.space(5)}; - - .sidebar-container { - display: none; - } - `, -)} - - ${up( - 'xl', - css` - grid-template-columns: 288px minmax(0, 1fr) 288px; - - .sidebar-container { - display: none; - } - `, -)} -` - -const TocContainer = styled.div` - ${down( - 'xl', - css` - display: none; - `, -)} -` - -const SidebarSticky = styled.aside` - position: sticky; - top: ${th.px(50)}; - padding: 4 0; - overflow-y: auto; - height: calc(100vh - 50px); - width: 288px; - - ${down( - 'md', - css` - display: none; - `, -)} -` - -const MenuButton = styled.button` - appearance: none; - border: 0; - border-radius: 20%; - width: 60; - height: 60; - position: fixed; - right: ${th.size(8)}; - top: ${th.size(55)}; - z-index: 25; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - color: background; - background-color: on-background; - transition: base; - transition-property: color; - - &:focus { - color: background; - } - - > svg { - width: 30; - height: 30; - transition: transform 200ms ease-in-out; - } - - &[aria-expanded='true'] { - > svg:last-child { - transform: rotate(90deg); - } - } -` - -function MobileSidebar({ children }) { - const dialog = useDialogState({ animated: true }) - return ( - <> - - {children} - - - - - - - - ) -} - -function PrevNextLinks(props) { - const { prev, next } = useSideNavPrevNext(props) - if (!prev && !next) return null - return ( - - {prev && ( - - {prev.fields.title} - - )} - {next && ( - - {next.fields.title} - - )} - - ) -} - -export function DocLayout({ children, tableOfContents, editLink, ...props }) { - const upMd = useUp('md') - const sideNav = useSideNavState() - return ( - - - - - - -
- {!upMd && ( - - - - )} -
- -
- {children} - {editLink && ( - - Edit this page on GitHub - - )} - -
-
- - - -
-
-
- ) -} diff --git a/src/components/DocSearch.js b/src/components/DocSearch.js deleted file mode 100644 index 964339b..0000000 --- a/src/components/DocSearch.js +++ /dev/null @@ -1,168 +0,0 @@ -import * as React from 'react' -import { Link, navigate } from 'gatsby' -import { createPortal } from 'react-dom' -import styled, { x, createGlobalStyle } from '@xstyled/styled-components' -import { useDocSearchKeyboardEvents } from '@docsearch/react' -import { RiSearchLine } from 'react-icons/ri' -import { Input, InputGroup, InputGroupIcon } from './Input' - -require('@docsearch/css') - -const GlobalStyle = createGlobalStyle` - /* Darkmode */ - body.xstyled-color-mode-dark { - --docsearch-text-color: rgb(245, 246, 247); - --docsearch-container-background: rgba(9, 10, 17, 0.8); - --docsearch-modal-background: rgb(21, 23, 42); - --docsearch-modal-shadow: inset 1px 1px 0 0 rgb(44, 46, 64), - 0 3px 8px 0 rgb(0, 3, 9); - --docsearch-searchbox-background: rgb(9, 10, 17); - --docsearch-searchbox-focus-background: #000; - --docsearch-hit-color: rgb(190, 195, 201); - --docsearch-hit-shadow: none; - --docsearch-hit-background: rgb(9, 10, 17); - --docsearch-key-gradient: linear-gradient( - -26.5deg, - rgb(86, 88, 114) 0%, - rgb(49, 53, 91) 100% - ); - --docsearch-key-shadow: inset 0 -2px 0 0 rgb(40, 45, 85), - inset 0 0 1px 1px rgb(81, 87, 125), 0 2px 2px 0 rgba(3, 4, 9, 0.3); - --docsearch-footer-background: rgb(30, 33, 54); - --docsearch-footer-shadow: inset 0 1px 0 0 rgba(73, 76, 106, 0.5), - 0 -4px 8px 0 rgba(0, 0, 0, 0.2); - --docsearch-logo-color: rgb(255, 255, 255); - --docsearch-muted-color: rgb(127, 132, 151); - } -` - -function Hit({ hit, children }) { - return {children} -} - -const Kbd = styled.kbd` - border: 1; - border-color: control-border; - margin-right: 1; - background-color: control-background; - text-align: center; - padding: 0; - display: inline-flex; - justify-content: center; - font-size: 0.8em; - line-height: 1.2; - font-family: sans-serif; - border-radius: base; - min-width: 1.5em; -` - -let DocSearchModal = null - -export const DocSearch = ({ apiKey, indexName }) => { - const searchButtonRef = React.useRef(null) - const [isShowing, setIsShowing] = React.useState(false) - const [initialQuery, setInitialQuery] = React.useState(null) - - const importDocSearchModalIfNeeded = React.useCallback(() => { - if (DocSearchModal) { - return Promise.resolve() - } - - return Promise.resolve(import('@docsearch/react/modal')).then( - ({ DocSearchModal: Modal }) => { - DocSearchModal = Modal - }, - ) - }, []) - - const onOpen = React.useCallback(() => { - importDocSearchModalIfNeeded().then(() => { - // We check that no other DocSearch modal is showing before opening this - // one (we use one instance for desktop and one instance for mobile). - if (document.body.classList.contains('DocSearch--active')) { - return - } - - setIsShowing(true) - }) - }, [importDocSearchModalIfNeeded, setIsShowing]) - - const onClose = React.useCallback(() => { - setIsShowing(false) - }, [setIsShowing]) - - const onInput = React.useCallback( - (event) => { - importDocSearchModalIfNeeded().then(() => { - setIsShowing(true) - setInitialQuery(event.key) - }) - }, - [importDocSearchModalIfNeeded, setIsShowing, setInitialQuery], - ) - - useDocSearchKeyboardEvents({ - isOpen: isShowing, - onOpen, - onClose, - onInput, - searchButtonRef, - }) - - return ( - <> - -
- - - - - - - - K - - -
- - {isShowing && - createPortal( - { - return items.map((item) => { - const url = new URL(item.url) - return { - ...item, - url: item.url.replace(url.origin, ''), - } - }) - }} - hitComponent={Hit} - />, - document.body, - )} - - ) -} diff --git a/src/components/Feature.js b/src/components/Feature.js deleted file mode 100644 index 5662951..0000000 --- a/src/components/Feature.js +++ /dev/null @@ -1,63 +0,0 @@ -/* eslint-disable jsx-a11y/accessible-emoji */ -/* eslint-disable import/no-extraneous-dependencies */ -import React from 'react' -import styled, { th, x } from '@xstyled/styled-components' -import { ScreenContainer } from './ScreenContainer' - -const InnerFeature = styled.box` - border-left: 1; - border-left-style: dashed; - border-left-color: layout-border; - padding-right: 5 !important; -` - -export const Feature = React.forwardRef((props, ref) => ( - -)) - -export const FeatureTitle = styled.h2` - margin: 3 0; - font-size: 16; - font-weight: 500; - border-left: 1; - border-color: primary-400; - margin-left: ${th.px(-9)}; - padding-left: ${th.px(9)}; -` - -export const FeatureText = styled.p` - color: on-background-light; - font-size: 15; - text-align: justify; - margin: 4 0; -` - -const InnerFeatureImage = styled.img` - margin-top: 3; -` - -export const FeatureImage = React.forwardRef((props, ref) => ( - -)) - -export const FeatureList = React.forwardRef((props, ref) => ( - -)) - -export const FeatureSection = React.forwardRef((props, ref) => ( - -)) diff --git a/src/components/Head.js b/src/components/Head.js deleted file mode 100644 index c0edc3d..0000000 --- a/src/components/Head.js +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react' -import { graphql, useStaticQuery } from 'gatsby' -import { Seo } from './Seo' - -const HeadQuery = graphql` - query HeadQuery { - site { - siteMetadata { - title - } - } - } -` - -export function Head({ title }) { - const data = useStaticQuery(HeadQuery) - return ( - - ) -} diff --git a/src/components/Hero.js b/src/components/Hero.js deleted file mode 100644 index 35a814f..0000000 --- a/src/components/Hero.js +++ /dev/null @@ -1,110 +0,0 @@ -import React from 'react' -import styled, { up, css, x } from '@xstyled/styled-components' -import { ScreenContainer } from './ScreenContainer' - -export const HeroTitle = styled.h1Box` - font-size: 38; - font-weight: 600; - line-height: 1.2; - letter-spacing: -1.12px; - margin: 0 0 2; - - ${up( - 'md', - css` - padding-top: 4; - font-size: 48; - `, - )} - - ${up( - 'xl', - css` - font-size: 60; - `, - )} -` - -export const HeroTeaser = styled.pBox` - font-size: 18; - margin: 3 0; - - ${up( - 'md', - css` - font-size: 20; - `, - )} - - ${up( - 'xl', - css` - font-size: 24; - `, - )} -` - -const InnerHero = styled(ScreenContainer)` - background-repeat: no-repeat; - background-position: top -5% center; - background-size: 100% auto; - padding-top: 65%; - text-align: center; - - ${up( - 'md', - css` - padding-top: 0; - margin-top: 5; - background-position: center right; - background-size: 58% auto; - min-height: 400; - text-align: left; - `, - )} - - ${up( - 'xl', - css` - margin-top: 6; - `, - )} -` - -export const Hero = React.forwardRef( - ({ backgroundImageURL, ...props }, ref) => { - return ( - - ) - }, -) - -export const HeroBody = React.forwardRef((props, ref) => { - return -}) - -export const HeroSection = styled.sectionBox` - overflow: hidden; - padding-top: 2; - padding-bottom: 5; -` - -export const HeroActionList = React.forwardRef((props, ref) => { - return ( - - ) -}) - -export const HeroAction = React.forwardRef((props, ref) => { - return -}) diff --git a/src/components/Input.js b/src/components/Input.js deleted file mode 100644 index 65e59b4..0000000 --- a/src/components/Input.js +++ /dev/null @@ -1,67 +0,0 @@ -import styled from '@xstyled/styled-components' - -export const Input = styled.input` - appearance: none; - background-color: control-background; - border-radius: control; - border-style: solid; - border-width: control; - border-color: control-border; - line-height: control; - padding: 1 2; - color: control-on; - transition: control; - - &::placeholder { - color: control-placeholder; - } - - &:hover { - border-color: control-border-hover; - } - - &:focus { - outline: none; - box-shadow: control-focus; - border-color: control-border-active; - } -` - -export const InputGroup = styled.div` - display: inline-flex; - color: control-placeholder; - transition: control; - position: relative; - - &:focus-within { - color: control-on; - } - - > ${Input} { - flex: 1 1 auto; - width: 1%; - min-width: 0; - padding-left: 32; - } - - > .algolia-autocomplete { - flex: 1 1 auto; - width: 1%; - min-width: 0; - - > ${Input} { - padding-left: 32; - } - } -` - -export const InputGroupIcon = styled.div` - display: flex; - position: absolute; - padding: 1 2; - height: 100%; - align-items: center; - user-select: none; - pointer-events: none; - z-index: 1; -` diff --git a/src/components/MDX.js b/src/components/MDX.js deleted file mode 100644 index bdc1f8d..0000000 --- a/src/components/MDX.js +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react' -import { MDXProvider as BaseMDXProvider } from '@mdx-js/react' -import { Code } from './Code' -import { Table, TableContainer } from './Table' - -function transformCode({ children, className, ...props }) { - const lang = className && className.split('-')[1] - return ( - - {children} - - ) -} - -function getCodeChild(children) { - const childrenArray = React.Children.toArray(children) - if (childrenArray.length !== 1) return null - const [firstChild] = childrenArray - if (firstChild.props.mdxType !== 'code') return null - return firstChild -} - -export const mdxComponents = { - pre: ({ children }) => { - const codeChild = getCodeChild(children) - return codeChild ? transformCode(codeChild.props) :
{children}
- }, - table: ({ children }) => { - return ( - - {children}
-
- ) - }, -} - -export function MDXProvider({ children, components }) { - return ( - - {children} - - ) -} diff --git a/src/components/Nav.js b/src/components/Nav.js deleted file mode 100644 index 071afd8..0000000 --- a/src/components/Nav.js +++ /dev/null @@ -1,60 +0,0 @@ -import React from 'react' -import { Link } from 'gatsby' -import styled, { x, th, down, css } from '@xstyled/styled-components' - -export const Nav = styled.navBox` - ${down( - 'md', - css` - overflow-x: auto; - max-width: calc(100vw - ${th.px(72)}) !important; - `, - )} -` - -const InnerNavLink = styled.aBox` - display: inline-flex; - color: on-background; - transition: base; - transition-property: color; - text-decoration: none; - cursor: pointer; - - &:hover, - &:focus { - color: on-background-light; - } - - /* Reset button */ - appearance: none; - border: 0; - background: transparent; - padding: 0; -` - -export const NavLink = React.forwardRef((props, ref) => { - return -}) - -export const NavListItem = styled.liBox` - list-style-type: none; - white-space: nowrap; - margin: 0; - padding: 0 2; - display: flex; - align-items: center; -` - -export const NavList = React.forwardRef((props, ref) => { - return ( - - ) -}) diff --git a/src/components/NotFound.js b/src/components/NotFound.js deleted file mode 100644 index 2c718eb..0000000 --- a/src/components/NotFound.js +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react' -import { ScreenContainer } from './ScreenContainer' -import { Article } from './Article' - -export function NotFound() { - return ( - -
-

404

-

- We couldn’t find what you were looking for. -

- - Kylo is waiting - -

- Please contact the owner of the site that linked you to the original - URL and let them know their link is broken. -

-
-
- ) -} diff --git a/src/components/PageLayout.js b/src/components/PageLayout.js deleted file mode 100644 index 0d5d124..0000000 --- a/src/components/PageLayout.js +++ /dev/null @@ -1,37 +0,0 @@ -import React from 'react' -import styled from '@xstyled/styled-components' -import { AppHeader } from './AppHeader' -import { Head } from './Head' - -const StickyHeader = styled.div` - position: sticky; - top: 0; - left: 0; - right: 0; - z-index: 10; -` - -const Main = styled.main` - background-color: background; - flex: 1; -` - -const Container = styled.div` - display: flex; - flex-direction: column; - min-height: 100vh; -` - -export function PageLayout({ children, title }) { - return ( - <> - - - - - -
{children}
-
- - ) -} diff --git a/src/components/PageWrapper.js b/src/components/PageWrapper.js deleted file mode 100644 index 725e254..0000000 --- a/src/components/PageWrapper.js +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react' -import { PageLayout } from './PageLayout' -import { DocLayout } from './DocLayout' -import { withPrefix } from "gatsby" -import Helmet from "react-helmet" - -export function PageWrapper({ - children, - props: { - data: { mdx }, - }, -}) { - const isBrowser = typeof window !== 'undefined' - if (!mdx?.fields?.pageType) return children - switch (mdx.fields.pageType) { - case 'doc': - return ( - - {children} - - {isBrowser &&