Skip to content

Commit

Permalink
Merge pull request #614 from misode/mcdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
misode authored Nov 27, 2024
2 parents 55f961c + 1abc28f commit aef57e7
Show file tree
Hide file tree
Showing 86 changed files with 5,953 additions and 4,276 deletions.
2,234 changes: 1,768 additions & 466 deletions package-lock.json

Large diffs are not rendered by default.

35 changes: 14 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,37 @@
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"lint": "eslint . --ext .ts,.tsx"
"lint": "eslint . --ext .ts,.tsx",
"postinstall": "patch-package"
},
"keywords": [],
"author": "Misode",
"license": "MIT",
"dependencies": {
"@giscus/react": "^2.2.3",
"@mcschema/core": "^0.13.0",
"@mcschema/java-1.15": "^0.2.13",
"@mcschema/java-1.16": "^0.6.20",
"@mcschema/java-1.17": "^0.2.40",
"@mcschema/java-1.18": "^0.3.16",
"@mcschema/java-1.18.2": "^0.1.26",
"@mcschema/java-1.19": "^0.1.54",
"@mcschema/java-1.19.3": "^0.0.17",
"@mcschema/java-1.19.4": "^0.1.21",
"@mcschema/java-1.20": "^0.0.24",
"@mcschema/java-1.20.2": "^0.0.15",
"@mcschema/java-1.20.3": "^0.0.16",
"@mcschema/java-1.20.5": "^0.0.42",
"@mcschema/java-1.21": "^0.0.27",
"@mcschema/java-1.21.2": "^0.0.16",
"@mcschema/java-1.21.4": "^0.0.15",
"@mcschema/locales": "^0.1.104",
"@spyglassmc/core": "^0.4.15",
"@spyglassmc/java-edition": "^0.3.19",
"@spyglassmc/json": "^0.3.17",
"@spyglassmc/locales": "^0.3.9",
"@spyglassmc/mcdoc": "^0.3.18",
"@spyglassmc/nbt": "^0.3.18",
"@zip.js/zip.js": "^2.4.5",
"brace": "^0.11.1",
"buffer": "^6.0.3",
"comment-json": "^4.1.1",
"deepslate": "^0.22.3",
"deepslate-1.18": "npm:deepslate@0.9.0-beta.9",
"deepslate-1.18.2": "npm:deepslate@0.9.0",
"deepslate-1.20.4": "npm:deepslate@0.20.1",
"deepslate": "^0.22.3",
"diff": "^7.0.0",
"highlight.js": "^11.5.1",
"howler": "^2.2.3",
"js-yaml": "^3.14.1",
"lz-string": "^1.4.4",
"marked": "^4.0.10",
"rfdc": "^1.3.0",
"sourcemapped-stacktrace": "^1.1.11"
"sourcemapped-stacktrace": "^1.1.11",
"spark-md5": "^3.0.2",
"vscode-languageserver-textdocument": "^1.0.12"
},
"devDependencies": {
"@preact/preset-vite": "^2.4.0",
Expand All @@ -61,10 +52,12 @@
"@types/lz-string": "^1.3.34",
"@types/marked": "^4.0.1",
"@types/seedrandom": "^2.4.28",
"@types/spark-md5": "^3.0.5",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.17.0",
"patch-package": "^8.0.0",
"postcss": "^8.4.31",
"preact": "^10.8.0",
"preact-router": "^3.2.1",
Expand Down
44 changes: 44 additions & 0 deletions patches/@spyglassmc+mcdoc+0.3.18.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/node_modules/@spyglassmc/mcdoc/lib/runtime/checker/index.js b/node_modules/@spyglassmc/mcdoc/lib/runtime/checker/index.js
index 2d51735..70ac4a0 100644
--- a/node_modules/@spyglassmc/mcdoc/lib/runtime/checker/index.js
+++ b/node_modules/@spyglassmc/mcdoc/lib/runtime/checker/index.js
@@ -545,9 +545,9 @@ function simplifyReference(typeDef, context) {
context.ctx.logger.warn(`Tried to access unknown reference ${typeDef.path}`);
return { typeDef: { kind: 'union', members: [] } };
}
- if (data.simplifiedTypeDef) {
- return { typeDef: data.simplifiedTypeDef };
- }
+ // if (data.simplifiedTypeDef) {
+ // return { typeDef: data.simplifiedTypeDef };
+ // }
const simplifiedResult = simplify(data.typeDef, context);
if (typeDef.attributes?.length) {
simplifiedResult.typeDef = {
@@ -555,16 +555,16 @@ function simplifyReference(typeDef, context) {
attributes: [...typeDef.attributes, ...simplifiedResult.typeDef.attributes ?? []],
};
}
- if (!simplifiedResult.dynamicData) {
- symbol.amend({
- data: {
- data: {
- ...data,
- simplifiedTypeDef: simplifiedResult.typeDef,
- },
- },
- });
- }
+ // if (!simplifiedResult.dynamicData) {
+ // symbol.amend({
+ // data: {
+ // data: {
+ // ...data,
+ // simplifiedTypeDef: simplifiedResult.typeDef,
+ // },
+ // },
+ // });
+ // }
return simplifiedResult;
}
function simplifyDispatcher(typeDef, context) {
116 changes: 116 additions & 0 deletions public/mcdoc/immersive_weathering.mcdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
use ::java::server::util::direction::Direction
use ::java::server::util::block_state::BlockState
use ::java::data::worldgen::biome::Precipitation
use ::java::data::worldgen::processor_list::BlockMatch
use ::java::data::worldgen::processor_list::BlockStateMatch
use ::java::data::worldgen::processor_list::RandomBlockMatch
use ::java::data::worldgen::processor_list::RandomBlockStateMatch
use ::java::data::worldgen::processor_list::TagMatch

dispatch minecraft:resource[immersive_weathering:block_growth] to struct BlockGrowth {
area_condition: AreaCondition,
position_predicates?: [PositionTest],
growth_chance: float @ 0..1,
growth_for_face: [GrowthFace],
owners: [#[id="block"] string],
replacing_target: RuleTest,
target_self?: boolean,
destroy_target?: boolean,
}

struct GrowthFace {
direction?: Direction,
weight?: int,
growth: [struct {
weight: int,
data: BlockPair,
}],
}

struct BlockPair {
block: BlockState,
above_block?: BlockState,
}

struct AreaCondition {
type: ("generate_if_not_too_many" | "neighbor_based_generation"),
...immersive_weathering:area_condition[[type]],
}

dispatch immersive_weathering:area_condition[generate_if_not_too_many] to struct GenerateIfNotTooMany {
radiusX: int,
radiusY: int,
radiusZ: int,
requiredAmount: int,
yOffset?: int,
must_have?: RuleTest,
must_not_have?: RuleTest,
includes?: (#[id(registry="block",tags="allowed")] string | [#[id="block"] string]),
}

dispatch immersive_weathering:area_condition[neighbor_based_generation] to struct NeighborBasedGeneration {
must_have: RuleTest,
must_not_have?: RuleTest,
required_amount?: int,
directions: [Direction],
}

struct PositionTest {
type: ("biome_match" | "day_test" | "nand" | "precipitation_test" | "temperature_range"),
...immersive_weathering:position_test[[type]],
}

dispatch immersive_weathering:position_test[biome_match] to struct BiomeMatch {
biomes: (#[id(registry="worldgen/biome",tags="allowed")] string | [#[id="worldgen/biome"] string]),
}

dispatch immersive_weathering:position_test[day_test] to struct DayTest {
day: boolean,
}

dispatch immersive_weathering:position_test[nand] to struct Nand {
predicates: [PositionTest],
}

dispatch immersive_weathering:position_test[precipitation_test] to struct PrecipitationTest {
precipitation: Precipitation,
}

dispatch immersive_weathering:position_test[temperature_range] to struct TemperatureRange {
min: float,
max: float,
use_local_pos?: boolean,
}

struct RuleTest {
predicate_type: #[id] RuleTestType,
...immersive_weathering:rule_test[[predicate_type]],
}

enum(string) RuleTestType {
#[starred] BlockSetMatch = "immersive_weathering:block_set_match",
#[starred] FluidMatch = "immersive_weathering:fluid_match",
#[starred] TreeLog = "immersive_weathering:tree_log",
BlockMatch = "block_match",
BlockStateMatch = "blockstate_match",
RandomBlockMatch = "random_block_match",
RandomBlockStateMatch = "random_blockstate_match",
TagMatch = "tag_match",
}

dispatch immersive_weathering:rule_test[block_match] to BlockMatch
dispatch immersive_weathering:rule_test[blockstate_match] to BlockStateMatch
dispatch immersive_weathering:rule_test[random_block_match] to RandomBlockMatch
dispatch immersive_weathering:rule_test[random_blockstate_match] to RandomBlockStateMatch
dispatch immersive_weathering:rule_test[tag_match] to TagMatch

dispatch immersive_weathering:rule_test[immersive_weathering:block_set_match] to struct BlockSetMatch {
blocks: (#[id(registry="block",tags="allowed")] string | [#[id="block"] string]),
probability?: float @ 0..1,
}

dispatch immersive_weathering:rule_test[immersive_weathering:fluid_match] to struct FluidMatch {
fluids: #[id="fluid"] string,
}

dispatch immersive_weathering:rule_test[immersive_weathering:tree_log] to struct {}
Loading

0 comments on commit aef57e7

Please sign in to comment.