From aa7013a14fc9231626da83a5ac12e7ca11c85372 Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Fri, 12 Feb 2021 13:27:49 +0100 Subject: [PATCH] port kubejs scripts to haxe! --- .gitignore | 4 +- README.md | 17 ++ buildhaxe.sh | 6 + src/kubejs/server/build.hxml | 5 + src/kubejs/server/src/Main.hx | 136 ++++++++++++++ src/modpack.json | 7 +- src/overrides/kubejs/server_scripts/script.js | 169 ------------------ 7 files changed, 173 insertions(+), 171 deletions(-) create mode 100644 README.md create mode 100755 buildhaxe.sh create mode 100644 src/kubejs/server/build.hxml create mode 100644 src/kubejs/server/src/Main.hx delete mode 100644 src/overrides/kubejs/server_scripts/script.js diff --git a/.gitignore b/.gitignore index e767daf..3c0b02c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .mpt -build \ No newline at end of file +build +.vim +haxeout diff --git a/README.md b/README.md new file mode 100644 index 0000000..5fe57af --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# Notex-3 +MZTE fork of the notex3 modpack + +## building +Compiling requires [the haxe toolkit](https://haxe.org) to be installed, in order to compile KubeJS scripts and [modpacktools](https://github.com/Anvilcraft/modpacktools) to build the modpack. + +Run these commands +```sh +# (only required on first build) install kubejs-haxe bindings +haxelib install kubejs +# build haxe scripts +./buildhaxe.sh +# use modpacktools to compile modpack +mpt buildtwitch +``` +exports can be found in `build` + diff --git a/buildhaxe.sh b/buildhaxe.sh new file mode 100755 index 0000000..88dc9c5 --- /dev/null +++ b/buildhaxe.sh @@ -0,0 +1,6 @@ +#!/bin/sh +#REQUIRES https://haxe.org to be installed! +cd src/kubejs/server +haxe build.hxml +cd ../../.. + diff --git a/src/kubejs/server/build.hxml b/src/kubejs/server/build.hxml new file mode 100644 index 0000000..9c2292e --- /dev/null +++ b/src/kubejs/server/build.hxml @@ -0,0 +1,5 @@ +-cp src +-main Main +-lib kubejs +-js ../../../haxeout/kubejs/server_scripts/script.js + diff --git a/src/kubejs/server/src/Main.hx b/src/kubejs/server/src/Main.hx new file mode 100644 index 0000000..27bbaff --- /dev/null +++ b/src/kubejs/server/src/Main.hx @@ -0,0 +1,136 @@ +package; + +import kubejs.Events; +import kubejs.Settings; +import kubejs.events.GeneralEvents.RecipesEvent; +import kubejs.Events.EventType; +import kubejs.Item; + +class Main { + static function main() { + Settings.logAddedRecipes = true; + Settings.logRemovedRecipes = true; + Settings.logSkippedRecipes = false; + Settings.logErroringRecipes = true; + + Events.onEvent(EventType.RecipesEventType, onRecipesEvent); + } + + static function onRecipesEvent(event:RecipesEvent) { + // @formatter:off + var removeByOutput = [ + "angelring:itemring", + "angelring:itemdiamondring", + "alchemistry:chemical_combiner", + "alchemistry:chemical_dissolver", + "compactmachines:wall", + "compactmachines:machine_tiny", + "compactmachines:machine_small", + "compactmachines:machine_normal", + "compactmachines:machine_large", + "compactmachines:machine_giant", + "compactmachines:machine_large", + "compactmachines:machine_maximum", + "compactmachines:personal_shrinking_device", + "ring_of_teleport:ring_of_teleport", + "ring_of_enderchest:ring_of_enderchest", + "ring_of_repair:ring_of_repair", + "ring_of_blink:ring_of_blink" + ]; + // @formatter:on + for (i in removeByOutput) { + event.remove({output: i}); + } + + // SHAPED RECIPES + event.shaped("alchemistry:chemical_combiner", ["SSS", "ACA", "SSS"], { + S: "#forge:ingots/steel", + C: "mekanism:chemical_crystallizer", + A: "mekanism:alloy_atomic" + }); + + event.shaped("alchemistry:chemical_dissolver", ["SSS", "ACA", "SSS"], { + S: "#forge:ingots/steel", + C: "mekanism:chemical_dissolution_chamber", + A: "mekanism:alloy_atomic" + }); + + event.shaped("compactmachines:wall", ["TTT", "TCT", "TTT"], { + T: "chemlib:ingot_thorium", + C: "#forge:ingots/chromium" + }); + + event.shaped("compactmachines:machine_tiny", ["CCC", "CTC", "CCC"], { + T: "mekanism:teleportation_core", + C: "compactmachines:wall" + }); + + event.shaped("compactmachines:machine_small", ["CCC", "CMC", "CCC"], { + M: "compactmachines:machine_tiny", + C: "compactmachines:wall" + }); + + event.shaped("compactmachines:machine_normal", ["CCC", "CMC", "CCC"], { + M: "compactmachines:machine_small", + C: "compactmachines:wall" + }); + + event.shaped("compactmachines:machine_large", ["CCC", "CMC", "CCC"], { + M: "compactmachines:machine_normal", + C: "compactmachines:wall" + }); + + event.shaped("compactmachines:machine_giant", ["CCC", "CMC", "CCC"], { + M: "compactmachines:machine_large", + C: "compactmachines:wall" + }); + + event.shaped("compactmachines:machine_maximum", ["CCC", "CMC", "CCC"], { + M: "compactmachines:machine_giant", + C: "compactmachines:wall" + }); + + event.shaped("compactmachines:personal_shrinking_device", ["III", "ICI", "TTT"], { + T: "mekanism:teleportation_core", + C: "#forge:ingots/chromium", + I: "#forge:ingots" + }); + + event.shaped("ring_of_teleport:ring_of_teleport", ["EM ", "M M", " M "], { + E: "#forge:ender_pearls", + M: "botania:manasteel_ingot" + }); + + event.shaped("ring_of_enderchest:ring_of_enderchest", ["EM ", "M M", " M "], { + E: "#forge:chests/ender", + M: "botania:manasteel_ingot" + }); + + event.shaped("ring_of_repair:ring_of_repair", ["ME ", "E E", " E "], { + M: Item.of("minecraft:enchanted_book", 1, {StoredEnchantments: [{lvl: 1, id: "minecraft:mending"}]}), + E: "botania:elementium_ingot" + }); + + event.shaped("angelring:itemring", ["WGW", "GRG", "TGT"], { + G: "minecraft:gold_ingot", + R: "angelring:itemdiamondring", + W: "forbidden_arcanus:bat_wing", + T: "minecraft:ghast_tear" + }); + + event.shaped("angelring:itemdiamondring", ["DED", "ECE", "DED"], { + C: "minecraft:nether_star", + E: "botania:manasteel_ingot", + D: "minecraft:diamond_block" + }); + + event.shaped("angelring:itemdiamondring", ["DED", "ECE", "DED"], { + C: "minecraft:elytra", + E: "botania:manasteel_ingot", + D: "minecraft:diamond_block" + }); + + // SHAPELESS RECIPES + event.shapeless("ring_of_blink:ring_of_blink", ["ring_of_teleport:ring_of_teleport", "botania:terrasteel_ingot"]); + } +} diff --git a/src/modpack.json b/src/modpack.json index 7f3a707..d0dd6af 100644 --- a/src/modpack.json +++ b/src/modpack.json @@ -13,6 +13,11 @@ "id": "overrides", "installer": "internal.override", "link": "file://overrides" + }, + { + "id": "kubejs_scripts", + "installer": "internal.override", + "link": "file://../haxeout" } ], "relations": [ @@ -1969,4 +1974,4 @@ ] }, "asversion": 1 -} \ No newline at end of file +} diff --git a/src/overrides/kubejs/server_scripts/script.js b/src/overrides/kubejs/server_scripts/script.js deleted file mode 100644 index 6082ed5..0000000 --- a/src/overrides/kubejs/server_scripts/script.js +++ /dev/null @@ -1,169 +0,0 @@ -// priority: 0 - -settings.logAddedRecipes = true -settings.logRemovedRecipes = true -settings.logSkippedRecipes = false -settings.logErroringRecipes = true - -console.info('Hello, World! (You will see this line every time server resources reload)') - -events.listen('recipes', event => { - event.remove({output: "angelring:itemring"}) - event.remove({output: "angelring:itemdiamondring"}) - event.remove({output: "alchemistry:chemical_combiner"}) - event.remove({output: "alchemistry:chemical_dissolver"}) - event.remove({output: "compactmachines:wall"}) - event.remove({output: "compactmachines:machine_tiny"}) - event.remove({output: "compactmachines:machine_small"}) - event.remove({output: "compactmachines:machine_normal"}) - event.remove({output: "compactmachines:machine_large"}) - event.remove({output: "compactmachines:machine_giant"}) - event.remove({output: "compactmachines:machine_large"}) - event.remove({output: "compactmachines:machine_maximum"}) - event.remove({output: "compactmachines:personal_shrinking_device"}) - event.remove({output: 'ring_of_teleport:ring_of_teleport'}) - event.remove({output: 'ring_of_enderchest:ring_of_enderchest'}) - event.remove({output: 'ring_of_repair:ring_of_repair'}) - event.remove({output: 'ring_of_blink:ring_of_blink'}) - - event.shaped('alchemistry:chemical_combiner', [ - 'SSS', - 'ACA', - 'SSS' - ], { - S: '#forge:ingots/steel', - C: 'mekanism:chemical_crystallizer', - A: 'mekanism:alloy_atomic' - }) - event.shaped('alchemistry:chemical_dissolver', [ - 'SSS', - 'ACA', - 'SSS' - ], { - S: '#forge:ingots/steel', - C: 'mekanism:chemical_dissolution_chamber', - A: 'mekanism:alloy_atomic' - }) - event.shaped('compactmachines:wall', [ - 'TTT', - 'TCT', - 'TTT' - ], { - T: 'chemlib:ingot_thorium', - C: '#forge:ingots/chromium' - }) - event.shaped('compactmachines:machine_tiny', [ - 'CCC', - 'CTC', - 'CCC' - ], { - T: 'mekanism:teleportation_core', - C: 'compactmachines:wall' - }) - event.shaped('compactmachines:machine_small', [ - 'CCC', - 'CMC', - 'CCC' - ], { - M: 'compactmachines:machine_tiny', - C: 'compactmachines:wall' - }) - event.shaped('compactmachines:machine_normal', [ - 'CCC', - 'CMC', - 'CCC' - ], { - M: 'compactmachines:machine_small', - C: 'compactmachines:wall' - }) - event.shaped('compactmachines:machine_large', [ - 'CCC', - 'CMC', - 'CCC' - ], { - M: 'compactmachines:machine_normal', - C: 'compactmachines:wall' - }) - event.shaped('compactmachines:machine_giant', [ - 'CCC', - 'CMC', - 'CCC' - ], { - M: 'compactmachines:machine_large', - C: 'compactmachines:wall' - }) - event.shaped('compactmachines:machine_maximum', [ - 'CCC', - 'CMC', - 'CCC' - ], { - M: 'compactmachines:machine_giant', - C: 'compactmachines:wall' - }) - event.shaped('compactmachines:personal_shrinking_device', [ - 'III', - 'ICI', - 'TTT' - ], { - T: 'mekanism:teleportation_core', - C: '#forge:ingots/chromium', - I: '#forge:ingots' - }) - event.shaped('ring_of_teleport:ring_of_teleport', [ - 'EM ', - 'M M', - ' M ' - ], { - E: '#forge:ender_pearls', - M: 'botania:manasteel_ingot' - }) - event.shaped('ring_of_enderchest:ring_of_enderchest', [ - 'EM ', - 'M M', - ' M ' - ], { - E: '#forge:chests/ender', - M: 'botania:manasteel_ingot' - }) - event.shaped('ring_of_repair:ring_of_repair', [ - 'ME ', - 'E E', - ' E ' - ], { - M: Item.of('minecraft:enchanted_book', {StoredEnchantments:[{lvl:1,id:"minecraft:mending"}]}), - E: 'botania:elementium_ingot' - }) - event.shapeless('ring_of_blink:ring_of_blink', ['ring_of_teleport:ring_of_teleport', 'botania:terrasteel_ingot']) - - event.shaped('angelring:itemring', [ - 'WGW', - 'GRG', - 'TGT' - ], { - G: 'minecraft:gold_ingot', - R: 'angelring:itemdiamondring', - W: 'forbidden_arcanus:bat_wing', - T: 'minecraft:ghast_tear' - }) - - event.shaped('angelring:itemdiamondring', [ - 'DED', - 'ECE', - 'DED' - ], { - C: 'minecraft:nether_star', - E: 'botania:manasteel_ingot', - D: 'minecraft:diamond_block' - }) - - event.shaped('angelring:itemdiamondring', [ - 'DED', - 'ECE', - 'DED' - ], { - C: 'minecraft:elytra', - E: 'botania:manasteel_ingot', - D: 'minecraft:diamond_block' - }) - -})