Add neoforge and immersiveweathering mcdoc

This commit is contained in:
Misode
2024-11-01 00:19:46 +01:00
parent 68eb077c17
commit 00f0c09a34
8 changed files with 320 additions and 46 deletions

View File

@@ -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 {}

179
public/mcdoc/neoforge.mcdoc Normal file
View File

@@ -0,0 +1,179 @@
use ::java::data::worldgen::DecorationStep
use ::java::data::worldgen::CarveStep
use ::java::data::worldgen::biome::SpawnerData
use ::java::data::worldgen::biome::MobSpawnCost
use ::java::data::worldgen::biome::MobCategory
dispatch minecraft:resource[neoforge:biome_modifier] to struct BiomeModifier {
type: #[id] BiomeModifierType,
...neoforge:biome_modifier[[type]],
}
enum(string) BiomeModifierType {
None = "neoforge:none",
AddFeatures = "neoforge:add_features",
RemoveFeatures = "neoforge:remove_features",
AddSpawns = "neoforge:add_spawns",
RemoveSpawns = "neoforge:remove_spawns",
AddCarvers = "neoforge:add_carvers",
RemoveCarvers = "neoforge:remove_carvers",
AddSpawnCosts = "neoforge:add_spawn_costs",
RemoveSpawnCosts = "neoforge:remove_spawn_costs",
}
dispatch neoforge:biome_modifier[neoforge:none] to struct {}
struct BiomeModifierBase {
biomes: (#[id(registry="worldgen/biome",tags="allowed")] string | [#[id="worldgen/biome"] string]),
}
dispatch neoforge:biome_modifier[neoforge:add_features] to struct AddFeatures {
...BiomeModifierBase,
features: (#[id(registry="worldgen/placed_feature",tags="allowed")] string | [#[id="worldgen/placed_feature"] string]),
step: DecorationStep,
}
dispatch neoforge:biome_modifier[neoforge:remove_features] to struct RemoveFeatures {
...BiomeModifierBase,
features: (#[id(registry="worldgen/placed_feature",tags="allowed")] string | [#[id="worldgen/placed_feature"] string]),
steps: (DecorationStep | [DecorationStep]),
}
dispatch neoforge:biome_modifier[neoforge:add_spawns] to struct AddSpawns {
...BiomeModifierBase,
spawners: (SpawnerData | [SpawnerData]),
}
dispatch neoforge:biome_modifier[neoforge:remove_spawns] to struct RemoveSpawns {
...BiomeModifierBase,
entity_types: (#[id(registry="entity_type",tags="allowed")] string | [#[id="entity_type"] string]),
}
dispatch neoforge:biome_modifier[neoforge:add_carvers] to struct AddCarvers {
...BiomeModifierBase,
carvers: (#[id(registry="worldgen/configured_carver",tags="allowed")] string | [#[id="worldgen/configured_carver"] string]),
step: CarveStep,
}
dispatch neoforge:biome_modifier[neoforge:remove_carvers] to struct RemoveCarvers {
...BiomeModifierBase,
carvers: (#[id(registry="worldgen/configured_carver",tags="allowed")] string | [#[id="worldgen/configured_carver"] string]),
step: (CarveStep | [CarveStep]),
}
dispatch neoforge:biome_modifier[neoforge:add_spawn_costs] to struct AddSpawnCosts {
...BiomeModifierBase,
entity_types: (#[id(registry="entity_type",tags="allowed")] string | [#[id="entity_type"] string]),
spawn_cost: MobSpawnCost,
}
dispatch neoforge:biome_modifier[neoforge:remove_spawn_costs] to struct RemoveSpawnCosts {
...BiomeModifierBase,
entity_types: (#[id(registry="entity_type",tags="allowed")] string | [#[id="entity_type"] string]),
}
dispatch minecraft:resource[neoforge:structure_modifier] to struct StructureModifier {
type: #[id] StructureModifierType,
...neoforge:structure_modifier[[type]],
}
enum(string) StructureModifierType {
None = "neoforge:none",
AddSpawns = "neoforge:add_spawns",
RemoveSpawns = "neoforge:remove_spawns",
ClearSpawns = "neoforge:clear_spawns",
}
dispatch neoforge:structure_modifier[neoforge:none] to struct {}
struct StructureModifierBase {
structures: (#[id(registry="worldgen/structure",tags="allowed")] string | [#[id="worldgen/structure"] string]),
}
dispatch neoforge:structure_modifier[neoforge:add_spawns] to struct AddStructureSpawns {
...StructureModifierBase,
spawners: (SpawnerData | [SpawnerData]),
}
dispatch neoforge:structure_modifier[neoforge:remove_spawns] to struct RemoveStructureSpawns {
...StructureModifierBase,
entity_types: (#[id(registry="entity_type",tags="allowed")] string | [#[id="entity_type"] string]),
}
dispatch neoforge:structure_modifier[neoforge:clear_spawns] to struct ClearStructureSpawns {
...StructureModifierBase,
categories: (MobCategory | [MobCategory]),
}
type DataMap<K, V> = struct {
replace?: boolean,
values: struct DataMapValues {
[K]: (
V |
struct ReplaceableValue {
replace?: boolean,
value: V,
} |
)
},
remove?: [K],
}
dispatch minecraft:resource[neoforge:data_map_compostables] to DataMap<#[id(registry="item",tags="allowed")] string, (
float @ 0..1 |
struct Compostable {
chance: float @ 0..1,
can_villager_compost?: boolean,
} |
)>
dispatch minecraft:resource[neoforge:data_map_furnace_fuels] to DataMap<#[id(registry="item", tags="allowed")] string, (
int @ 1.. |
struct FurnaceFuel {
burn_time: int @ 1..,
} |
)>
dispatch minecraft:resource[neoforge:data_map_monster_room_mobs] to DataMap<#[id(registry="entity_type",tags="allowed")] string, (
int @ 0.. |
struct MonsterRoomMob {
weight: int @ 0..,
} |
)>
dispatch minecraft:resource[neoforge:data_map_oxidizables] to DataMap<#[id(registry="block",tags="allowed")] string, (
#[id="block"] string |
struct Oxidizable {
next_oxidation_stage: #[id="block"] string,
} |
)>
dispatch minecraft:resource[neoforge:data_map_parrot_imitations] to DataMap<#[id(registry="entity_type",tags="allowed")] string, (
#[id="sound_event"] string |
struct ParrotImitation {
sound: #[id="sound_event"] string,
} |
)>
dispatch minecraft:resource[neoforge:data_map_raid_hero_gifts] to DataMap<#[id(registry="villager_profession",tags="allowed")] string, (
#[id="loot_table"] string |
struct RaidHeroGift {
loot_table: #[id="loot_table"] string,
} |
)>
dispatch minecraft:resource[neoforge:data_map_vibration_frequencies] to DataMap<#[id(registry="game_event",tags="allowed")] string, (
int @ 1..15 |
struct VibrationFrequency {
frequency: int @ 1..15,
} |
)>
dispatch minecraft:resource[neoforge:data_map_waxables] to DataMap<#[id(registry="block",tags="allowed")] string, (
#[id="block"] string |
struct Waxable {
waxed: #[id="block"] string,
} |
)>

View File

@@ -2,7 +2,7 @@ import * as core from '@spyglassmc/core'
import type { JsonNode } from '@spyglassmc/json'
import { JsonArrayNode, JsonObjectNode, JsonStringNode } from '@spyglassmc/json'
import { JsonStringOptions } from '@spyglassmc/json/lib/parser/string.js'
import type { ListType, McdocType, NumericRange, NumericType, PrimitiveArrayType, TupleType, UnionType } from '@spyglassmc/mcdoc'
import type { Attributes, ListType, McdocType, NumericRange, NumericType, PrimitiveArrayType, TupleType, UnionType } from '@spyglassmc/mcdoc'
import type { McdocCheckerContext, SimplifiedMcdocType, SimplifiedMcdocTypeNoUnion, SimplifyValueNode } from '@spyglassmc/mcdoc/lib/runtime/checker/index.js'
import { simplify } from '@spyglassmc/mcdoc/lib/runtime/checker/index.js'
@@ -130,15 +130,16 @@ export function isInlineTuple(type: TupleType) {
return type.items.length <= 4 && type.items.every(isNumericType)
}
export function formatIdentifier(id: string): string {
export function formatIdentifier(id: string, attributes?: Attributes): string {
if (id.startsWith('!')) {
return '! ' + formatIdentifier(id.substring(1))
return '! ' + formatIdentifier(id.substring(1), attributes)
}
const isStarred = attributes?.some(a => a.name === 'starred')
const text = id
.replace(/^minecraft:/, '')
.replaceAll('_', ' ')
.replace(/[a-z][A-Z]+/g, m => m.charAt(0) + ' ' + m.substring(1).toLowerCase())
return text.charAt(0).toUpperCase() + text.substring(1)
return (isStarred ? '✨ ' : '') + text.charAt(0).toUpperCase() + text.substring(1)
}
export function getCategory(type: McdocType) {

View File

@@ -247,7 +247,7 @@ function EnumHead({ type, optional, node, makeEdit }: Props<SimplifiedEnum>) {
{(value === undefined || optional) && <option value={SPECIAL_UNSET}>{locale('unset')}</option>}
{(value !== undefined && !type.values.map(v => v.value).includes(value)) && <option value={value}>{value}</option>}
{type.values.map(value =>
<option value={value.value}>{formatIdentifier(value.identifier)}</option>
<option value={value.value}>{formatIdentifier(value.identifier, value.attributes)}</option>
)}
</select>
}

View File

@@ -33,8 +33,10 @@ export type UnknownFile = {
}
export const FilePatterns = [
'worldgen/[a-z_]+',
'immersive_weathering/[a-z_]+',
'neoforge/[a-z_]+',
'ohthetreesyoullgrow/[a-z_]+',
'worldgen/[a-z_]+',
'tags/worldgen/[a-z_]+',
'tags/[a-z_]+',
'[a-z_]+',

View File

@@ -237,9 +237,11 @@ export class SpyglassService {
category: 'model',
},
// Partner resources
'ohthetreesyoullgrow/configured_feature': {
category: 'ohthetreesyoullgrow:configured_feature',
},
...Object.fromEntries(siteConfig.generators.filter(gen => gen.dependency).map(gen =>
[gen.path, {
category: gen.id,
}]
)),
},
},
lint: {

View File

@@ -584,15 +584,6 @@
"dependency": "immersive_weathering",
"minVersion": "1.18.2"
},
{
"id": "lithostitched:worldgen_modifier",
"url": "lithostitched/worldgen-modifier",
"path": "lithostitched/worldgen_modifier",
"tags": ["partners"],
"dependency": "lithostitched",
"minVersion": "1.20.2",
"wiki": "https://github.com/Apollounknowndev/lithostitched/wiki/Worldgen-Modifiers"
},
{
"id": "neoforge:biome_modifier",
"url": "neoforge/biome-modifier",
@@ -683,20 +674,6 @@
"minVersion": "1.20.2",
"wiki": "https://github.com/neoforged/NeoForge/blob/1.21.x/src/main/java/net/neoforged/neoforge/common/world/StructureModifiers.java"
},
{
"id": "obsidian:item",
"url": "obsidian/item",
"path": "obsidian_item",
"tags": ["partners"],
"dependency": "obsidian"
},
{
"id": "obsidian:block",
"url": "obsidian/block",
"path": "obsidian_block",
"tags": ["partners"],
"dependency": "obsidian"
},
{
"id": "ohthetreesyoullgrow:configured_feature",
"url": "ohthetreesyoullgrow/feature",

View File

@@ -68,26 +68,23 @@
"generator.error_max_version": "This generator is not available in versions above %0%",
"generator.error_min_version": "The minimum version for this generator is %0%",
"generator.font": "Font",
"generator.immersive_weathering.block_growth": "Block Growth",
"generator.immersive_weathering:block_growth": "Block Growth",
"generator.instrument": "Instrument",
"generator.item_modifier": "Item Modifier",
"generator.jukebox_song": "Jukebox Song",
"generator.lithostitched.worldgen_modifier": "Worldgen Modifier",
"generator.loot_table": "Loot Table",
"generator.model": "Model",
"generator.neoforge.biome_modifier": "Biome Modifier",
"generator.neoforge.data_map_compostables": "Compostables Data Map",
"generator.neoforge.data_map_furnace_fuels": "Furnace Fuels Data Map",
"generator.neoforge.data_map_monster_room_mobs": "Monster Room Mobs Data Map",
"generator.neoforge.data_map_oxidizables": "Oxidizables Data Map",
"generator.neoforge.data_map_parrot_imitations": "Parrot Imitations Data Map",
"generator.neoforge.data_map_raid_hero_gifts": "Raid Hero Gifts Data Map",
"generator.neoforge.data_map_vibration_frequencies": "Vibration Frequencies Data Map",
"generator.neoforge.data_map_waxables": "Waxables Data Map",
"generator.neoforge.structure_modifier": "Structure Modifier",
"generator.neoforge:biome_modifier": "Biome Modifier",
"generator.neoforge:data_map_compostables": "Compostables Data Map",
"generator.neoforge:data_map_furnace_fuels": "Furnace Fuels Data Map",
"generator.neoforge:data_map_monster_room_mobs": "Monster Room Mobs Data Map",
"generator.neoforge:data_map_oxidizables": "Oxidizables Data Map",
"generator.neoforge:data_map_parrot_imitations": "Parrot Imitations Data Map",
"generator.neoforge:data_map_raid_hero_gifts": "Raid Hero Gifts Data Map",
"generator.neoforge:data_map_vibration_frequencies": "Vibration Frequencies Data Map",
"generator.neoforge:data_map_waxables": "Waxables Data Map",
"generator.neoforge:structure_modifier": "Structure Modifier",
"generator.not_found": "Cannot find generator \"%0%\"",
"generator.obsidian.block": "Obsidian Block",
"generator.obsidian.item": "Obsidian Item",
"generator.ohthetreesyoullgrow:configured_feature": "OTTYG Feature",
"generator.pack_mcmeta": "Pack.mcmeta",
"generator.painting_variant": "Painting Variant",