Copy schema locales + add advancement tab

This commit is contained in:
Misode
2020-06-01 00:11:21 +02:00
parent ea8e0e534e
commit 3520fe8bba
4 changed files with 20 additions and 20 deletions

View File

@@ -6,8 +6,7 @@ import {
BooleanNode,
RangeNode,
MapNode,
ListNode,
SCHEMAS
ListNode
} from 'minecraft-schemas'
const EntityCollection = ['sheep', 'pig']

View File

@@ -4,6 +4,7 @@ import {
SourceView,
ConditionSchema,
LootTableSchema,
AdvancementSchema,
LOCALES
} from 'minecraft-schemas'
@@ -11,13 +12,18 @@ import { SandboxSchema } from './Sandbox'
const predicateModel = new DataModel(ConditionSchema)
const lootTableModel = new DataModel(LootTableSchema)
const advancementModel = new DataModel(AdvancementSchema)
const sandboxModel = new DataModel(SandboxSchema)
let model = lootTableModel
let sourceView = new SourceView(model, document.getElementById('source')!, {indentation: 2})
let treeView = new TreeView(model, document.getElementById('view')!)
const modelSelector = document.createElement('select')
modelSelector.value = 'predicate'
modelSelector.innerHTML = `
<option value="advancement">Advancement</option>
<option value="loot-table">Loot Table</option>
<option value="predicate">Predicate</option>
<option value="sandbox">Sandbox</option>`
@@ -26,19 +32,18 @@ modelSelector.addEventListener('change', evt => {
model = sandboxModel
} else if (modelSelector.value === 'loot-table') {
model = lootTableModel
} else if (modelSelector.value === 'advancement') {
model = advancementModel
} else {
model = predicateModel
}
new TreeView(model, document!.getElementById('view')!)
new SourceView(model, document!.getElementById('source')!)
sourceView.setModel(model)
treeView.setModel(model)
model.invalidate()
})
document.getElementById('header')?.append(modelSelector)
new TreeView(model, document!.getElementById('view')!)
new SourceView(model, document!.getElementById('source')!)
fetch('build/locales/en.json')
fetch('build/locales-schema/en.json')
.then(r => r.json())
.then(l => {
LOCALES.register('en', l)

View File

@@ -1,13 +1,2 @@
{
"add": "Add",
"chance": "Chance",
"condition": "Condition",
"condition.random_chance": "Random Chance",
"false": "False",
"remove": "Remove",
"true": "True",
"type": "Type",
"overworld": "Overworld",
"the_nether": "The Nether",
"the_end": "The End"
}

View File

@@ -18,7 +18,14 @@ module.exports = (env, argv) => ({
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: 'src/locales', to: 'build/locales'}
{
from: 'src/locales',
to: 'build/locales'
},
{
from: 'node_modules/minecraft-schemas/src/locales',
to: 'build/locales-schema'
}
]
})
]