Skip to content

Commit 69761f7

Browse files
committed
Merge branch 'Theta-1-Testing' of https://github.com/StarT-Dev-Team/Star-Technology into Theta-1-Testing
2 parents 6df1694 + 146aa82 commit 69761f7

4 files changed

Lines changed: 92 additions & 65 deletions

File tree

config/emi.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/**
1010
* Whether cheating in items is enabled.
1111
*/
12-
cheat-mode: false;
12+
cheat-mode: creative;
1313

1414
/**
1515
* How much EMI should use tooltips and popups to show controls and information.

config/ftbquests/quests/chapters/applied_energistics.snbt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@
440440
}
441441
}
442442
}
443+
match_nbt: true
443444
type: "item"
444445
}
445446
{
@@ -454,6 +455,7 @@
454455
}
455456
}
456457
}
458+
match_nbt: true
457459
type: "item"
458460
}
459461
{
@@ -468,6 +470,7 @@
468470
}
469471
}
470472
}
473+
match_nbt: true
471474
type: "item"
472475
}
473476
{
@@ -482,6 +485,7 @@
482485
}
483486
}
484487
}
488+
match_nbt: true
485489
type: "item"
486490
}
487491
{
@@ -496,6 +500,7 @@
496500
}
497501
}
498502
}
503+
match_nbt: true
499504
type: "item"
500505
}
501506
{
@@ -510,6 +515,7 @@
510515
}
511516
}
512517
}
518+
match_nbt: true
513519
type: "item"
514520
}
515521
]
Lines changed: 59 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,99 @@
11
// priority: -100
22

33
(() => {
4-
/**
5-
* @param {"multiblock"} kind
6-
*/
7-
function getGregtechMachines(kind) {
8-
let $MultiblockMachineDefinition = Java.loadClass(
9-
"com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition"
10-
);
11-
12-
let isInstance = (clz, obj) => clz.__javaObject__.isInstance(obj);
13-
14-
let result = [];
15-
if (kind === "multiblock") {
16-
for (let def of GTRegistries.MACHINES) {
17-
if (isInstance($MultiblockMachineDefinition, def)) {
18-
result.push(def.block.idLocation);
19-
}
20-
}
21-
}
22-
23-
return result;
24-
}
25-
26-
let gtMachines = getGregtechMachines("multiblock"); //Doesnt Work rn / need to fix @n1xx1
27-
let stargateBlocks = [
28-
"sgjourney:classic_stargate",
29-
"sgjourney:classic_stargate_base_block",
30-
"sgjourney:classic_stargate_chevron_block",
31-
"sgjourney:classic_stargate_ring_block",
32-
"sgjourney:crystal_interface",
33-
"sgjourney:classic_dhd",
34-
];
4+
let getInitializationData = lazyGetter(() => {
5+
return {
6+
gregtechMultiblocks: getGregtechMachines("multiblock"),
7+
stargateTravel: [
8+
"sgjourney:classic_stargate",
9+
"sgjourney:classic_stargate_base_block",
10+
"sgjourney:classic_stargate_chevron_block",
11+
"sgjourney:classic_stargate_ring_block",
12+
"sgjourney:crystal_interface",
13+
"sgjourney:classic_dhd",
14+
],
15+
};
16+
});
3517

3618
Ponder.tags((event) => {
3719
event.createTag(
3820
"kubejs:gtceu",
39-
"gtceu:electric_blast_furnace", //use?
21+
"gtceu:electric_blast_furnace",
4022
"GregTech Multiblocks",
4123
"Informations on how to use GregTech Multiblocks",
42-
gtMachines
24+
getInitializationData().gregtechMultiblocks,
4325
);
4426

4527
event.createTag(
4628
"kubejs:stargate",
29+
"sgjourney:classic_stargate",
4730
"Stargate Travel",
4831
"Informations on how to use the Stargates of this modpack",
49-
stargateBlocks
32+
getInitializationData().stargateTravel,
5033
);
5134
});
5235

5336
Ponder.registry((event) => {
5437
event
55-
.create(stargateBlocks)
38+
.create(getInitializationData().stargateTravel)
5639
.scene(
5740
"classic_stargate",
5841
"Classic Stargate",
59-
ponderScenes["classic_stargate"]
42+
ponderScenes["classic_stargate"],
6043
);
6144

6245
event
63-
.create(gtMachines)
46+
.create(getInitializationData().gregtechMultiblocks)
6447
.scene(
6548
"multiblock_introduction",
6649
"Multiblock Introduction",
67-
ponderScenes["multiblock_introduction"]
50+
ponderScenes["multiblock_introduction"],
6851
)
6952
.scene(
7053
"multiblock_construction",
7154
"Multiblock Construction",
72-
ponderScenes["multiblock_construction"]
55+
ponderScenes["multiblock_construction"],
7356
)
7457
.scene(
7558
"multiblock_wallsharing",
7659
"Multiblock Wall Sharing",
77-
ponderScenes["multiblock_wallsharing"]
60+
ponderScenes["multiblock_wallsharing"],
7861
);
7962
});
63+
64+
/**
65+
* @template T
66+
* @param {() => T} init
67+
* @returns {() => T}
68+
*/
69+
function lazyGetter(init) {
70+
let data = null;
71+
return () => {
72+
if (!data) data = init();
73+
return data;
74+
};
75+
}
76+
77+
/**
78+
* @param {"multiblock"} kind
79+
* @returns {string[]}
80+
*/
81+
function getGregtechMachines(kind) {
82+
let $MultiblockMachineDefinition = Java.loadClass(
83+
"com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition",
84+
);
85+
86+
let isInstance = (clz, obj) => clz.__javaObject__.isInstance(obj);
87+
88+
let result = [];
89+
if (kind === "multiblock") {
90+
for (let def of GTRegistries.MACHINES) {
91+
if (isInstance($MultiblockMachineDefinition, def)) {
92+
result.push(def.block.idLocation);
93+
}
94+
}
95+
}
96+
97+
return result;
98+
}
8099
})();

kubejs/server_scripts/utils/calculator.js

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ let calculatorDefinitions = (() => {
467467
implementation: [
468468
{
469469
arguments: ["vec2"],
470-
fn: (v) => ({ t: "number", v: Math.atan2(v[1], v[0]) }),
470+
fn: (v) => ({ t: "number", v: Math.atan2(v.v[1], v.v[0]) }),
471471
},
472472
{
473473
arguments: ["number", "number"],
@@ -566,7 +566,7 @@ let calculatorDefinitions = (() => {
566566
arguments: ["number", "number"],
567567
fn: (base, v) => ({
568568
t: "number",
569-
v: fn(JavaMath.log(v.v) / JavaMath.log(base.v)),
569+
v: JavaMath.log(v.v) / JavaMath.log(base.v),
570570
}),
571571
},
572572
{
@@ -641,25 +641,27 @@ let calculatorDefinitions = (() => {
641641
name: "max",
642642
usage: formatOverloads("max", [[["...values:number[]"]]]),
643643
description: "returns the largest of the numbers given as input",
644-
fn: function () {
645-
let args = Array.from(arguments);
646-
if (args.length === 0) {
647-
throw new Error(
648-
"wrong argument count for max: expected 1 or more, got 0",
649-
);
650-
}
651-
if (args.some((arg) => arg.t !== "number")) {
652-
throw new Error(
653-
"wrong argument types for max: expected all numbers",
654-
);
655-
}
656-
return {
657-
t: "number",
658-
v: Math.max.apply(
659-
null,
660-
args.map((arg) => arg.v),
661-
),
662-
};
644+
implementation: {
645+
fn: function () {
646+
let args = Array.from(arguments);
647+
if (args.length === 0) {
648+
throw new Error(
649+
"wrong argument count for max: expected 1 or more, got 0",
650+
);
651+
}
652+
if (args.some((arg) => arg.t !== "number")) {
653+
throw new Error(
654+
"wrong argument types for max: expected all numbers",
655+
);
656+
}
657+
return {
658+
t: "number",
659+
v: Math.max.apply(
660+
null,
661+
args.map((arg) => arg.v),
662+
),
663+
};
664+
},
663665
},
664666
},
665667
{
@@ -983,7 +985,7 @@ let calculatorDefinitions = (() => {
983985
identifier.length <= 3 &&
984986
identifier.match(/^[xy]+$/)
985987
) {
986-
return vecAccessors(value, identifier.v);
988+
return vecAccessors(value, identifier);
987989
}
988990
throw new Error(
989991
"non-existing member " + identifier + " for type " + value.t,
@@ -1006,7 +1008,7 @@ let calculatorDefinitions = (() => {
10061008
identifier.length <= 3 &&
10071009
identifier.match(/^[xyz]+$/)
10081010
) {
1009-
return vecAccessors(value, identifier.v);
1011+
return vecAccessors(value, identifier);
10101012
}
10111013
throw new Error(
10121014
"non-existing member " + identifier + " for type " + value.t,
@@ -1318,7 +1320,7 @@ let calculatorExec = (() => {
13181320
function execOverloaded(options, args, error) {
13191321
for (let option of options) {
13201322
if (option.arguments) {
1321-
if (args.every((arg, i) => option.arguments[i] === arg.t)) {
1323+
if (args.length === option.arguments.length && args.every((arg, i) => option.arguments[i] === arg.t)) {
13221324
return option.fn.apply(null, args);
13231325
}
13241326
} else {

0 commit comments

Comments
 (0)