Skip to content

Commit cca02f4

Browse files
Fix KubeJS documentation for parallel hatch in 1.7.0 (#3597)
Co-authored-by: screret <68943070+screret@users.noreply.github.com>
1 parent abe5a07 commit cca02f4

1 file changed

Lines changed: 52 additions & 20 deletions

File tree

docs/content/Modpacks/Examples/Parallel-Hatch-Part.md

Lines changed: 52 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,61 @@ title: "Custom Parallel Hatch"
88
## Parallel Hatch
99

1010
```js title="extra_parallel_hatch.js"
11-
1211
const $ParallelHatchPartMachine = Java.loadClass(
13-
'com.gregtechceu.gtceu.common.machine.multiblock.part.ParallelHatchPartMachine'
14-
) // (1)
12+
"com.gregtechceu.gtceu.common.machine.multiblock.part.ParallelHatchPartMachine"
13+
); // (1)
14+
15+
GTCEuStartupEvents.registry("gtceu:machine", (event) => {
16+
event
17+
.create("parallel_hatch", "custom") // (2)
18+
.tiers(GTValues.UHV, GTValues.UIV, GTValues.UEV, GTValues.UXV) // (3)
19+
.machine((holder, tier, tankScaling) => {
20+
return new $ParallelHatchPartMachine(holder, tier); // (4)
21+
})
22+
.definition((tier, builder) => {
23+
let name = "Simple";
24+
switch (tier) {
25+
case GTValues.UHV:
26+
name = "Epic";
27+
break;
28+
case GTValues.UIV:
29+
name = "Legendary";
30+
break;
31+
case GTValues.UEV:
32+
name = "Spectral";
33+
break;
34+
case GTValues.UXV:
35+
name = "Universal";
36+
break;
37+
}
1538

16-
GTCEuStartupEvents.registry('gtceu:machine', event => { // (2)
17-
event.create(
18-
"uhv_parallel_hatch", // (3)
19-
"custom",
20-
(holder, tier) => {
21-
return new $ParallelHatchPartMachine(holder, tier);
22-
},
23-
GTValues.UHV // (4)
24-
)
25-
.abilities(PartAbility.PARALLEL_HATCH) // (5)
26-
.workableTieredHullRenderer(GTCEu.id("block/machines/parallel_hatch_mk4")) // (6)
27-
})
39+
const $RecipeLogic = Java.loadClass(
40+
"com.gregtechceu.gtceu.api.machine.trait.RecipeLogic"
41+
);
42+
builder
43+
.langValue(name + " Parallel Control Hatch")
44+
.rotationState(RotationState.ALL)
45+
.abilities(PartAbility.PARALLEL_HATCH) // (5)
46+
.modelProperty($RecipeLogic.STATUS_PROPERTY, $RecipeLogic.Status.IDLE)
47+
.model(
48+
GTMachineModels.createWorkableTieredHullMachineModel(
49+
GTCEu.id("block/machines/parallel_hatch_mk4") // (6)
50+
)[
51+
"andThen(com.gregtechceu.gtceu.api.registry.registrate.MachineBuilder$ModelInitializer)"
52+
]((ctx, prov, model) => {
53+
model.addReplaceableTextures("bottom", "top", "side");
54+
})
55+
)
56+
}); // (7)
57+
});
2858
```
2959

30-
1. Loading the java class that is required to build the parallel hatch multi part
31-
2. Using the GT registry event to register the multi part, which is part of machine registry
32-
3. The ID for the new parallel hatch
33-
4. The tier used for the parallel hatch
60+
1. Loading the parallel hatch's java class is required
61+
2. Using the GT registry event to register a tiered custom machine
62+
3. The tiers to register the machine for
63+
Here, GT will generate items and blocks named `gtceu:uhv_parallel_hatch`, `gtceu:uev_parallel_hatch`, `gtceu:uiv_parallel_hatch`, and `gtceu:uxv_parallel_hatch`
64+
4. Use the loaded class for creating the machines in the world
3465
5. Specifying the multipart to use parallel hatch ability
3566
6. The texture to use for the multipart, this example just uses the t4 texture as a placeholder
36-
You can look at gtm's assets to see the animations and textures to edit
67+
You can look at gtm's assets to see the animations and textures to edit
68+
7. You can just refer to the code in GCYMMachines.PARALLEL_HATCH here

0 commit comments

Comments
 (0)