port kubejs scripts to haxe!

This commit is contained in:
LordMZTE 2021-02-12 13:27:49 +01:00
parent 31dc4ae1e5
commit ba2e6c1868
8 changed files with 175 additions and 173 deletions

4
.gitignore vendored
View File

@ -1,2 +1,4 @@
.mpt
build
build
.vim
haxeout

17
README.md Normal file
View File

@ -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`

View File

@ -1,5 +1,5 @@
= TODO =
- [ ] Create haxe bindings for kubejs
- [ ] Port kubejs scripts to haxe
- [X] Create haxe bindings for kubejs
- [X] Port kubejs scripts to haxe
- [ ] Add some useful client-side mods

6
buildhaxe.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
#REQUIRES https://haxe.org to be installed!
cd src/kubejs/server
haxe build.hxml
cd ../../..

View File

@ -0,0 +1,5 @@
-cp src
-main Main
-lib kubejs
-js ../../../haxeout/kubejs/server_scripts/script.js

View File

@ -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"]);
}
}

View File

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

View File

@ -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'
})
})