Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Commit ca8ace9

Browse files
authored
feat: refactor for molang (#271)
* chore(deps): updated all dependencies * commmit part way code * refactor: cleanup settings * refactor: switching out the molang parser * auto: updated tests * refactor: formatted controller * refactor: updating processors to use a molang harvestere * fix: fixing the import path to the molang harvest * refactor: MolangCarrier is no longer generic * refactor: internal definitions to get rid of SMap * removing smap references * refactor: using sets, better utillizing built in functions * refactor: Process -> process * refactor: cleaning up snapshots * refactor: added comments
1 parent 6b429b9 commit ca8ace9

46 files changed

Lines changed: 162 additions & 96 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ end_of_line = crlf
1010
charset = utf-8
1111
trim_trailing_whitespace = false
1212
insert_final_newline = false
13-
max_line_length = 120
13+
max_line_length = 120
14+
15+
[makefile]
16+
indent_style = tab

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const manifests = ["c:\\project\\bp\\manifest.json", "c:\\project\\rp\\manifest.
2121
const packs = Data.addPack(manifests, ProjectFolder);
2222

2323
//process documents into the pacts
24-
Data.Process(...);
24+
Data.process(...);
2525
//OR
2626
packs[0].process(...)
2727
```

makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
tests:
2+
npm run tests
3+
4+
snapshots:
5+
npx jest --update-snapshots

src/project/behavior-pack/animation-controller/__snapshots__/animation-controllers.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

3-
exports[`BehaviorPack - Animation Controller Process 1`] = `
3+
exports[`BehaviorPack - Animation Controller process 1`] = `
44
[
55
{
66
"animations": {

src/project/behavior-pack/animation-controller/animation-controllers.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Process } from './process';
1+
import { process } from "./process";
22

33
describe("BehaviorPack - Animation Controller", () => {
44
const data = `{
@@ -12,8 +12,8 @@ describe("BehaviorPack - Animation Controller", () => {
1212
}
1313
}`;
1414

15-
test("Process", () => {
16-
const controllers = Process({
15+
test("process", () => {
16+
const controllers = process({
1717
getText: () => data,
1818
uri: "example",
1919
});

src/project/behavior-pack/animation-controller/process.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { AnimationController } from "./animation-controller";
1111
* @param doc
1212
* @returns
1313
*/
14-
export function Process(doc: TextDocument): AnimationController[] | undefined {
14+
export function process(doc: TextDocument): AnimationController[] | undefined {
1515
const uri = doc.uri;
1616
const content = doc.getText();
1717
const imp = Json.To<Internal.AnimationControllers>(doc);

src/project/behavior-pack/animation/process.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { harvestMolang } from "../../molang";
66
import { Animation } from "./animation";
77

88
/** */
9-
export function Process(doc: TextDocument): Animation[] | undefined {
9+
export function process(doc: TextDocument): Animation[] | undefined {
1010
const uri = doc.uri;
1111
const content = doc.getText();
1212
const imp = Json.To<Internal.Animations>(doc);

src/project/behavior-pack/behavior-pack.ts

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class BehaviorPack implements Container, Pack {
9292
this.structures = new DataSet();
9393
this.trading = new DataSet();
9494
this.features = new DataSet();
95-
this.features_rules = new DataSet()
95+
this.features_rules = new DataSet();
9696
this.item_groups = new DataSet();
9797
}
9898

@@ -107,47 +107,46 @@ export class BehaviorPack implements Container, Pack {
107107
//If extended, also extend the delete
108108
switch (Type) {
109109
case FileType.animation:
110-
return this.animations.set(Animation.Process(doc));
110+
return this.animations.set(Animation.process(doc));
111111

112112
case FileType.animation_controller:
113-
return this.animation_controllers.set(AnimationController.Process(doc));
113+
return this.animation_controllers.set(AnimationController.process(doc));
114114

115115
case FileType.block:
116-
return this.blocks.set(Block.Process(doc));
116+
return this.blocks.set(Block.process(doc));
117117

118118
case FileType.entity:
119-
return this.entities.set(Entity.Process(doc));
119+
return this.entities.set(Entity.process(doc));
120120

121121
case FileType.function:
122-
return this.functions.set(Function.Process(doc));
122+
return this.functions.set(Function.process(doc));
123123

124124
case FileType.item:
125-
return this.items.set(Item.Process(doc));
125+
return this.items.set(Item.process(doc));
126126

127127
case FileType.loot_table:
128-
return this.loot_tables.set(LootTable.Process(doc));
128+
return this.loot_tables.set(LootTable.process(doc));
129129

130130
case FileType.structure:
131-
return this.structures.set(Structure.Process(doc));
131+
return this.structures.set(Structure.process(doc));
132132

133133
case FileType.trading:
134-
return this.trading.set(Trading.Process(doc));
134+
return this.trading.set(Trading.process(doc));
135135

136136
case FileType.feature:
137-
return this.features.set(Feature.Process(doc));
137+
return this.features.set(Feature.process(doc));
138138

139139
case FileType.feature_rule:
140-
return this.features_rules.set(FeatureRule.Process(doc))
140+
return this.features_rules.set(FeatureRule.process(doc));
141141

142142
case FileType.item_catalog:
143-
return this.item_groups.set(ItemCatalog.Process(doc));
143+
return this.item_groups.set(ItemCatalog.process(doc));
144144

145145
case FileType.biome:
146-
return this.biomes.set(Biome.Process(doc));
146+
return this.biomes.set(Biome.process(doc));
147147

148148
case FileType.recipe:
149-
return this.recipes.set(Recipe.Process(doc));
150-
149+
return this.recipes.set(Recipe.process(doc));
151150
}
152151

153152
return undefined;
@@ -176,7 +175,7 @@ export class BehaviorPack implements Container, Pack {
176175

177176
case FileType.feature:
178177
return this.features;
179-
178+
180179
case FileType.feature_rule:
181180
return this.features_rules;
182181

src/project/behavior-pack/biome/process.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Biome } from "./biome";
99
* @param doc
1010
* @returns
1111
*/
12-
export function Process(doc: TextDocument): Biome | undefined {
12+
export function process(doc: TextDocument): Biome | undefined {
1313
const uri = doc.uri;
1414
const content = doc.getText();
1515
const biome = Json.To<Internal.Biome>(doc);

src/project/behavior-pack/block/process.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { BlockState } from "./block-state";
1111
* @param doc
1212
* @returns
1313
*/
14-
export function Process(doc: TextDocument): Block | undefined {
14+
export function process(doc: TextDocument): Block | undefined {
1515
const uri = doc.uri;
1616
const content = doc.getText();
1717
const imp = Json.To<Internal.Block>(doc);

0 commit comments

Comments
 (0)