Contributing to Wiki
You can check out Test to see all the things that are possible with this wiki.
Make sure to also check the README of the wiki repo on GitHub for info on the file structure.
#Formatting Rules
To make the wiki easier to follow, all code should be formatted like this:
- In code blocks, use tab characters, not spaces.
- Use
constfor variables whenever possible. - Use arrow functions (
() => {}) for all functions. - As a name of the event handler callback parameter, use
event. - Omit parentheses for one-parameter arrow functions. (
ServerEvents.recipes(event => {})). - Use descriptive but concise names for variable names (like
ctx,context), do not use single letter names (c) unless it's a commonly used name (iandjfor loop indices,x,yandzfor coordinates). - Whenever a Minecraft item is used, use it with the
minecraft:namespace. Did you know you could skip it? - Don't leave trailing commas.
- For string literals, use single quotes (
'minecraft:stone'), unless usage of double quotes will result in less quotes being escaped ("I'm not escaped!"). - After starting a comment, leave a space (
// This is a comment with a space!). - Use Beans.
- Whenever a floating point number is used with the floating point equal to 0 (ie.
5.0), skip the floating point. - After operators like
if,for, etc., use a space. Always wrap code in a branch with a block, unless that branch results in an early return.
if (player.hand == "OFF_HAND") return // Here, `return` doesn't need to be wrapped in a block.
if (player.hand == "MAIN_HAND") {
console.log("Right-clicked with main hand")
}- Do not use semicolons, unless that's absolutely necessary due to the code being parsed unexpectedly. Such cases should be avoided if possible.
console.log("Hello, world!")
// Here, a semicolon is needed in order for code to be not parsed as:
// console.log("Hello, world!")['minecraft:stone', 'minecraft:cobblestone'].forEach(item => {})
;['minecraft:stone', 'minecraft:cobblestone'].forEach(item => {})You can check
https://kubejs.com/wiki/preview/x for a preview of a currently open PR.