Skip to content

Commit

Permalink
chore(release): 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Lete114 committed Aug 27, 2023
0 parents commit 3be2876
Show file tree
Hide file tree
Showing 38 changed files with 2,903 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
env:
es6: true

extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended']

parserOptions:
ecmaVersion: latest
sourceType: module

parser: '@typescript-eslint/parser'

plugins: ['@typescript-eslint']

ignorePatterns: [src/index.*, dist]

rules:
# off OR 0
# warn OR 1
# error OR 2
no-console: error # disable console
no-var: error ## disable var
quotes: [error, single, { avoidEscape: true }] ## Use single quotes
indent: [error, 2, { SwitchCase: 1 }] ## Indent two spaces
comma-dangle: [error, never] ## Prohibit end commas
semi: [error, never] ## Prohibit end semicolons
arrow-parens: [error, always] ## Arguments to arrow functions must be enclosed in parentheses
array-bracket-spacing: [error, never] ## Prohibit spaces inside the array brackets
brace-style: error ## Force one true brace style
camelcase: warn ## Force property name to hump style
computed-property-spacing: [error, never] ## Prohibit the use of spaces within calculated attributes
curly: [error, multi-line] ## https://cn.eslint.org/docs/rules/curly#multi
eol-last: [error, always] ## Forced use of line feeds (LF)
eqeqeq: [error, smart] ## https://cn.eslint.org/docs/rules/eqeqeq#smart
max-depth: [error, 3] ## Maximum nesting depth for mandatory block statements
max-len: [warn, 120] ## Line feed after 120 characters
max-statements: [warn, 20] ## Limit the maximum number of statements in a function block
new-cap: [warn, { capIsNew: false }] ## Requires constructors to be initialized with capital letters
no-extend-native: error ## Disable extension of native types
no-mixed-spaces-and-tabs: error ## Disable mixed indentation of spaces and tabs
no-trailing-spaces: error ## Disable end-of-line spaces
# no-unused-vars: 1 ## Prohibit the appearance of unused variables
no-use-before-define: [error, nofunc] ## Prohibit the use of variables before they are defined
object-curly-spacing: [error, always] ## No spaces in brackets allowed
keyword-spacing: [error, { before: true, after: true }] ## Force the use of consistent spaces before and after keywords
space-unary-ops: error ## Prohibit spaces before or after unary operators
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

pack
src/behavior_pack/functions
node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
6 changes: 6 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
trailingComma: none
tabWidth: 2
printWidth: 120
semi: false
singleQuote: true
arrowParens: always
339 changes: 339 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# More Falling Leaves

All trees have the same falling leaf particle effect as the cherry blossom trees

<p align="center">
<img src="src/behavior_pack//pack_icon.png" style="width: 80%;">
</p>

## Download

To download, you need to go to the GitHub repository [releases](https://github.com/mcbe-mods/More-Falling-Leaves/releases)

## Usage

No need to turn on any experimental game content

<p align="center">
<img src="images/animation-origin.gif">
</p>

## LICENSE

Please note that the open source license is GPL-2.0 and you should strictly adhere to it.

- Why is it GPL-2.0 license?
- Because I had a lot of trouble developing this mod, and I wanted to learn from it or see how others wrote it, but all I saw was ugly or obfuscated JavaScript code, and I hope that every minecraft player or minecraft mod developer will make the source code public so that more people can learn and make the mod, making the minecraft community community more active and make minecraft more playable. Of course, I also hope that when you borrow someone else's code or other content, you mark it with the author's name, **please respect every open source mod author!**
56 changes: 56 additions & 0 deletions generate.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { writeFile } from 'fs'
import { ensureDirSync, removeSync } from 'fs-extra/esm'
import { fileURLToPath } from 'url'
import { join } from 'path'
import { getRadiusRange, getRandomProbability } from '@mcbe-mods/utils'

const __dirname = fileURLToPath(new URL('.', import.meta.url))

const behaviorPackPath = join(__dirname, 'src/behavior_pack')
const functionPath = join(behaviorPackPath, 'functions')
const functionParticlesPath = join(functionPath, 'particles')
const mainPath = join(functionPath, 'main.mcfunction')
const tickPath = join(functionPath, 'tick.json')

removeSync(functionPath)
ensureDirSync(functionParticlesPath)

const isOdd = (number) => number % 2 === 0

// get 10 radius location
const locations = getRadiusRange({ x: 0, y: 0, z: 0 }, 10)
// Filter odd numbers
.filter(({ x, z }) => isOdd(x) && isOdd(z))

const interval = [1, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500]
const leaves = ['mangrove_leaves', 'leaves', 'leaves2', 'azalea_leaves', 'azalea_leaves_flowered']
const intervalLeaves = []

for (const leave of leaves) {
const commands = locations
.map(({ x, y, z }) => {
const random = getRandomProbability(50) ? 0.1 : 0
const subCommand = `if block ~${x} ~${y + -1} ~${z} air`
const runCommand = `run particle mfl:oak ~${x + -0.5} ~${y + random} ~${z + -0.5}`
return `execute as @a at @s if block ~${x} ~${y} ~${z} ${leave} ${subCommand} ${runCommand}`
})
.join('\n')

const _interval = interval.map((i) => `execute as @a[scores={time=${i}}] run function particles/${leave}`).join('\n')
intervalLeaves.push(_interval)

const path = join(functionParticlesPath, `${leave}.mcfunction`)
writeFile(path, commands, () => {})
}

const mainContext = `
scoreboard objectives add time dummy
scoreboard players add @a time 1
${intervalLeaves.map((i) => i).join('\n\n')}
execute as @a[scores={time=500..}] run scoreboard players set @a time 0`
writeFile(mainPath, mainContext, () => {})

const tickContext = JSON.stringify({ values: ['main'] })
writeFile(tickPath, tickContext, () => {})
Binary file added images/animation-origin.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/animation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "quick-start",
"private": true,
"packageManager": "[email protected]",
"version": "0.0.0",
"type": "module",
"scripts": {
"preinstall": "node scripts/preinstall.js",
"generate":"node generate.mjs",
"dev": "node scripts/watch.js",
"clear": "node scripts/clear.js",
"copy": "node scripts/copy.js",
"package": "node scripts/package.js",
"build": "node scripts/build.js",
"builds": "pnpm run clear && pnpm run copy && pnpm run build && pnpm run package",
"lint": "eslint src && prettier --check src",
"lint:fix": "eslint --fix src && prettier --check --write src"
},
"devDependencies": {
"@minecraft/server": "1.4.0-beta.1.20.10-stable",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-typescript": "^11.1.2",
"@types/fs-extra": "^11.0.1",
"@types/node": "^20.4.5",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"archiver": "^5.3.1",
"chokidar": "^3.5.3",
"eslint": "^8.46.0",
"fast-glob": "^3.3.1",
"fs-extra": "^11.1.1",
"prettier": "^3.0.0",
"rollup": "^3.27.0",
"tslib": "^2.6.1",
"typescript": "^5.0.2"
},
"dependencies": {
"@mcbe-mods/utils": "^0.1.0"
}
}
Loading

0 comments on commit 3be2876

Please sign in to comment.