Skip to content

Commit

Permalink
[v1.1.23] Merge pull request #18 from bridge-core/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Joelant05 authored Dec 13, 2020
2 parents cd05f75 + 57c44f4 commit a01dff3
Show file tree
Hide file tree
Showing 20 changed files with 251 additions and 82 deletions.
3 changes: 2 additions & 1 deletion dist/auto-completions.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/auto-completions.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/file-definitions.js

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions dist/file-definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@

"lightning_cache": "model"
},
{
"id": "entity_model",
"includes": "models/blocks",
"file_viewer": "model",
"player": "model",
"rp_definition": true,

"lightning_cache": "model"
},
{
"id": "rp_animation",
"includes": "animations/",
Expand Down Expand Up @@ -368,10 +377,9 @@
"id": "texture_set",
"includes": "textures/blocks/",
"rp_definition": true,
"file_viewer": "json",

"highlighter": "texture_set",
"target_version": "$project_target_version >= 1.16.100",
"target_version": "$project_target_version >= 1.16.200",
"start_state": "texture_set/main",
"file_creator": "texture_set"
},
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "dist/auto-completions.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "deno run --allow-read --allow-write scripts/build.ts"
"build": "deno run --allow-read --allow-write scripts/build.ts",
"dev": "deno run --allow-read --allow-write scripts/watch.ts"
},
"repository": {
"type": "git",
Expand Down
81 changes: 81 additions & 0 deletions packages/auto_completions/biome/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,86 @@
"noise_frequency_scale": "$general.decimal"
}
}
},
"minecraft:forced_features": {
"$feature_rule.general.passes": {
"$dynamic.list.next_index": {
"iterations": "$molang.embedded",
"scatter_chance": "$feature.general.chance_information",
"coordinate_eval_order": "$feature.general.coordinate_eval_order",
"x": {
"@meta": { "is_molang": true },
"@import.value.molang": "$molang.general.boolean and ('query.' + $molang.general.query)",

"extent": {
"$dynamic.list.index_pair": {
"@import.value": "$general.number and ('query.' + $molang.general.query)",
"@meta": {
"validate": {
"confirm": "Bridge.Node.data === '' || Bridge.Node.data === 'true' || Bridge.Node.data === 'false'",
"then": {
"show": true,
"message": "Invalid data type: Expected number or MoLang"
}
}
}
}
},
"distribution": "$feature.general.distributions",
"step_size": "$general.number",
"grid_offset": "$general.number"
},
"z": {
"@meta": { "is_molang": true },
"@import.value.molang": "$molang.general.boolean and ('query.' + $molang.general.query)",

"extent": {
"$dynamic.list.index_pair": {
"@import.value": "$general.number and ('query.' + $molang.general.query)",
"@meta": {
"validate": {
"confirm": "Bridge.Node.data === '' || Bridge.Node.data === 'true' || Bridge.Node.data === 'false'",
"then": {
"show": true,
"message": "Invalid data type: Expected number or MoLang"
}
}
}
}
},
"distribution": "$feature.general.distributions",
"step_size": "$general.number",
"grid_offset": "$general.number"
},
"y": {
"@meta": { "is_molang": true },
"@import.value.molang": "$molang.general.boolean and ('query.' + $molang.general.query)",

"extent": {
"$dynamic.list.index_pair": {
"@import.value": "$general.number and ('query.' + $molang.general.query)",
"@meta": {
"validate": {
"confirm": "Bridge.Node.data === '' || Bridge.Node.data === 'true' || Bridge.Node.data === 'false'",
"then": {
"show": true,
"message": "Invalid data type: Expected number or MoLang"
}
}
}
}
},
"distribution": "$feature.general.distributions",
"step_size": "$general.number",
"grid_offset": "$general.number"
},
"places_feature": {
"$dynamic.list.next_index": {
"@meta": { "is_value": true },
"@import.value.feature_ref": "$dynamic.biome.feature_references"
}
}
}
}
}
}
9 changes: 4 additions & 5 deletions packages/auto_completions/block/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@
"blend",
"alpha_test",
"double_sided"
]
],
"ambient_occlusion": "$general.boolean",
"face_dimming": "$general.boolean"
},
"*": {
"texture": "$dynamic.rp.terrain_texture",
Expand All @@ -159,10 +161,7 @@
"$versioned_template.minecraft:geometry": [
{
"$if": "$format_version >= 1.16.100",
"$data": {
"@meta": { "is_value": true },
"@import.value.model": "$dynamic.cache.model.identifiers"
}
"$data": "$general.model_identifier"
}
],
"$versioned_template.minecraft:on_step_on": [
Expand Down
5 changes: 1 addition & 4 deletions packages/auto_completions/client_entity/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@
}
},
"geometry": {
"$placeholder": {
"@meta": { "is_value": true },
"@import.value": "$dynamic.cache.model.identifiers"
}
"$placeholder": "$general.model_identifier"
},
"animations": {
"$placeholder": {
Expand Down
10 changes: 10 additions & 0 deletions packages/auto_completions/entity/behavior.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,19 +267,29 @@

"minecraft:behavior.drop_item_for": {
"priority": "$general.number",
"cooldown": "$general.number",
"drop_item_chance": "$general.decimal",
"entity_types": "$entity.general.entity_types",
"goal_radius": "$general.decimal",
"loot_table": "$dynamic.loot_table_files",
"max_dist": "$general.number",
"max_head_look_at_height": "$general.number",
"minimum_teleport_distance": "$general.number",
"offering_distance": "$general.number",
"on_drop_attempt": "$entity.general.event_definition",
"search_count": "$general.number",
"search_height": "$general.number",
"search_range": "$general.number",
"seconds_before_pickup": "$general.number",
"speed_multiplier": "$general.decimal",
"time_of_day_range": {
"$dynamic.list.index_pair": "$general.decimal"
},
"target_range": {
"$dynamic.list.index_triple": "$general.number"
},
"teleport_offset": {
"$dynamic.list.index_triple": "$general.number"
}
},
"$versioned_template.minecraft:behavior.eat_block": [
Expand Down
4 changes: 3 additions & 1 deletion packages/auto_completions/entity/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,9 @@
"minecraft:scheduler": {
"min_delay_secs": "$general.number",
"max_delay_secs": "$general.number",
"scheduled_events": "$entity.general.event_definition"
"scheduled_events": {
"$dynamic.list.next_index": "$entity.general.internal_event_definition"
}
},
"minecraft:shareables": {
"all_items": "$general.boolean",
Expand Down
1 change: 1 addition & 0 deletions packages/auto_completions/function/general.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ability": ["worldbuilder", "mayfly", "mute"],
"location": ["~", "^", "@wildcard"],
"target_selector": ["@a", "@e", "@p", "@r", "@s", "@wildcard"],
"fill_option": ["outline", "hollow", "destroy", "keep"],
Expand Down
5 changes: 5 additions & 0 deletions packages/auto_completions/function/main.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"alwaysday": "$general.boolean",
"ability": {
"$function.general.target_selector": {
"$function.general.ability": "$general.boolean"
}
},
"clear": {
"$function.general.target_selector": {
"$function.general.item_identifier": {
Expand Down
5 changes: 5 additions & 0 deletions packages/auto_completions/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@
},
"@import.value.item": "$dynamic.cache.item.identifiers and $vanilla.item_identifier"
},
"model_identifier": {
"@meta": { "is_value": true, "definitions": ["entity_model"] },
"@import.value": "$dynamic.cache.model.identifiers",
"@import.value_old": "$dynamic.cache.model.old_identifiers"
},
"fog_identifier": "$dynamic.cache.fog.identifiers and $vanilla.fog_identifier",
"effect_name": [
"all",
Expand Down
16 changes: 9 additions & 7 deletions packages/auto_completions/manifest/general.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"module_type": [
"data", "resources", "client_data", "interface", "world_template"
],
"capabilities": [
"experimental_custom_ui", "chemistry"
]
}
"module_type": [
"data",
"resources",
"client_data",
"interface",
"world_template"
],
"capabilities": ["experimental_custom_ui", "chemistry", "raytraced"]
}
53 changes: 30 additions & 23 deletions packages/auto_completions/simple/terrain_texture.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
{
"resource_pack_name": { "@meta": { "is_value": true } },
"texture_name": [ "atlas.terrain" ],
"padding": "$general.number",
"num_mip_levels": "$general.number",
"texture_data": {
"$placeholder": {
"textures": {
"$dynamic.list.next_index": {
"@import.value.block_png": "$dynamic.rp.block_png",
"path": {"@meta": {"is_value": true}, "@import.value.block_png": "$dynamic.rp.block_png"},
"overlay_color": {"@meta": {"is_color": true}},
"variations": {
"$dynamic.list.next_index": {
"weight": "$general.number",
"path": {"@meta": {"is_value": true}, "@import.value.block_png": "$dynamic.rp.block_png"},
"overlay_color": {"@meta": {"is_color": true}}
}
}
}
}
}
}
}
"resource_pack_name": { "@meta": { "is_value": true } },
"texture_name": ["atlas.terrain"],
"padding": "$general.number",
"num_mip_levels": "$general.number",
"texture_data": {
"$placeholder": {
"textures": {
"$dynamic.list.next_index": {
"@import.value.block_png": "$dynamic.rp.block_png",
"path": {
"@meta": { "is_value": true },
"@import.value.block_png": "$dynamic.rp.block_png"
},
"overlay_color": { "@meta": { "is_color": true } },
"variations": {
"$dynamic.list.next_index": {
"weight": "$general.number",
"path": {
"@meta": { "is_value": true },
"@import.value.block_png": "$dynamic.rp.block_png"
},
"overlay_color": { "@meta": { "is_color": true } }
}
},
"pbr_emissive": "$general.decimal"
}
}
}
}
}
12 changes: 10 additions & 2 deletions packages/data/file_definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@

"lightning_cache": "model"
},
{
"id": "entity_model",
"includes": "models/blocks",
"file_viewer": "model",
"player": "model",
"rp_definition": true,

"lightning_cache": "model"
},
{
"id": "rp_animation",
"includes": "animations/",
Expand Down Expand Up @@ -368,10 +377,9 @@
"id": "texture_set",
"includes": "textures/blocks/",
"rp_definition": true,
"file_viewer": "json",

"highlighter": "texture_set",
"target_version": "$project_target_version >= 1.16.100",
"target_version": "$project_target_version >= 1.16.200",
"start_state": "texture_set/main",
"file_creator": "texture_set"
},
Expand Down
19 changes: 14 additions & 5 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
try {
await Deno.mkdir('./dist')
} catch {}
import { bundleFileDefs } from './bundleFileDefs.ts'
import { bundleAutoCompletions } from './bundleAutoCompletions.ts'

await import('./bundleAutoCompletions.ts')
await import('./bundleFileDefs.ts')
export async function build() {
try {
await Deno.mkdir('./dist')
} catch {}

await bundleFileDefs()
await bundleAutoCompletions()
}

if (import.meta.main) {
await build()
}
35 changes: 20 additions & 15 deletions scripts/bundleAutoCompletions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import JSON5 from 'https://cdn.skypack.dev/json5@2.0.0'
import { join, basename } from 'https://deno.land/std/path/mod.ts'

const autoCompletions: any = {}
let autoCompletions: any = {}

async function loadDir(
dirPath: string,
Expand All @@ -20,17 +20,22 @@ async function loadDir(
}
}
}
loadDir('./packages/auto_completions').then(async () => {
await Promise.all([
Deno.writeTextFile(
'./dist/auto-completions.js',
`(() => JSON.parse("${JSON.stringify(autoCompletions)
.replace(/\\\"/g, '\\\\"')
.replace(/\"/g, '\\"')}"))()`
),
Deno.writeTextFile(
'./dist/auto-completions.json',
JSON.stringify(autoCompletions)
),
])
})

export async function bundleAutoCompletions() {
autoCompletions = {}

await loadDir('./packages/auto_completions').then(async () => {
await Promise.all([
Deno.writeTextFile(
'./dist/auto-completions.js',
`(() => JSON.parse("${JSON.stringify(autoCompletions)
.replace(/\\\"/g, '\\\\"')
.replace(/\"/g, '\\"')}"))()`
),
Deno.writeTextFile(
'./dist/auto-completions.json',
JSON.stringify(autoCompletions)
),
])
})
}
Loading

0 comments on commit a01dff3

Please sign in to comment.