Skip to content

Commit c5823b7

Browse files
authored
7.0 Doc Work (#3010)
1 parent 9f923ec commit c5823b7

4 files changed

Lines changed: 316 additions & 150 deletions

File tree

docs/content/Modpacks/Other-Topics/Modifying-Crafting-Components.md

Lines changed: 0 additions & 150 deletions
This file was deleted.
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
title: "Crafting Components"
3+
---
4+
5+
# Crafting Components
6+
7+
Crafting Components are a way to organize and simplify the various similar recipes that GregTech generates. For example: writing out the recipes for all tiers of an alloy smelter can be done iteratively rather than one by one.
8+
9+
Crafting Components are a map pairing a Voltage tier (the tier number) to a value. The value can be a `MaterialEntry`, `ItemStack`, or `TagPrefix<Item>`.
10+
11+
## Changing a single entry
12+
13+
With KubeJS it is possible to modify the predefined components of existing GTCEu Modern machine crafting recipes.
14+
You can replace singular entries, or do bulk modification of components.
15+
-1 is defined as a fallback value if no other entries exist.
16+
17+
```js title="startup/modification.js"
18+
const Map = Java.loadClass("java.util.Map")
19+
20+
GTCEuStartupEvents.craftingComponents(event => {
21+
event.setItem(GTCraftingComponents.CIRCUIT, GTValues.MV, Item.of('minecraft:dirt')) // (1)
22+
event.setItems(GTCraftingComponents.PUMP, Map.of(
23+
GTValues.LV, Item.of('gtceu:lv_robot_arm'),
24+
GTValues.MV, Item.of('gtceu:mv_robot_arm'),
25+
GTValues.HV, Item.of('gtceu:hv_robot_arm'),
26+
GTValues.EV, Item.of('gtceu:ev_robot_arm'),
27+
GTValues.IV, Item.of('gtceu:iv_robot_arm'),
28+
GTValues.LuV, Item.of('gtceu:luv_robot_arm'),
29+
GTValues.ZPM, Item.of('gtceu:zpm_robot_arm'),
30+
GTValues.UV, Item.of('gtceu:uv_robot_arm'),
31+
)) // (2)
32+
event.setTag(GTCraftingComponents.CASING, GTValues.EV, 'minecraft:logs') // (3)
33+
event.setMaterialEntry(GTCraftingComponents.PLATE, GTValues.UEV, new MaterialEntry('plate', 'gtceu:infinity')) // (4)
34+
event.removeTier("sensor", 3) // (5)
35+
})
36+
```
37+
1. Replaces the MV circuit tag in all GT machine crafting recipes with a single block of `minecraft:dirt`.
38+
2. Modifies all pumps in GT machine crafting recipes by replacing the pump with a robot arm.
39+
3. Replaces the EV casing with the `#minecraft:logs` tag. note the lack of `#` at the beginning of the tag!
40+
4. Adds a new entry to the plate component for UEV with prefix `plate` and material `gtceu:infinity`.
41+
5. Removes the 3rd offset entry `(HV Tier)` of the sensor crafting component, will default to the fallback `(LV Sensor)`
42+
43+
44+
## Creating new components
45+
46+
It's also possible to create new crafting components with KubeJS.
47+
The crafting component is constructed with a id and a fallback value. You can add entries by chaining `.add(tier, value)` methods after your construction.
48+
49+
```js title="creation.js"
50+
const Map = Java.loadClass("java.util.Map")
51+
52+
let ITEM_CRAFTING_COMPONENT = null
53+
let TAG_CRAFTING_COMPONENT = null
54+
let UNIFICATION_CRAFTING_COMPONENT = null
55+
56+
GTCEuServerEvents.craftingComponents(event => {
57+
ITEM_CRAFTING_COMPONENT = event.createItem("item_component", 'minecraft:cyan_stained_glass')
58+
.addItem(GTValues.LV, Item.of('minecraft:cyan_stained_glass'))
59+
.addItem(GTValues.MV, Item.of('minecraft:cyan_stained_glass'))
60+
.addItem(GTValues.HV, Item.of('minecraft:cyan_stained_glass'))
61+
.addItem(GTValues.EV, Item.of('minecraft:lime_stained_glass'))
62+
.addItem(GTValues.IV, Item.of('minecraft:lime_stained_glass'))
63+
.addItem(GTValues.LuV, Item.of('minecraft:lime_stained_glass'))
64+
.addItem(GTValues.ZPM, Item.of('minecraft:magenta_stained_glass'))
65+
.addItem(GTValues.UV, Item.of('minecraft:magenta_stained_glass'))
66+
// (1)
67+
TAG_CRAFTING_COMPONENT = event.createTag("tag_component", 'forge:barrels/wooden')
68+
.addTag(GTValues.LV, 'forge:chests/wooden')
69+
.addTag(GTValues.MV, 'forge:chests/trapped')
70+
.addTag(GTValues.HV, 'forge:chests/ender')
71+
.addTag(GTValues.EV, 'forge:cobblestone')
72+
.addTag(GTValues.IV, 'forge:cobblestone/normal')
73+
.addTag(GTValues.LuV, 'forge:cobblestone/infested')
74+
.addTag(GTValues.ZPM, 'forge:cobblestone/mossy')
75+
.addTag(GTValues.UV, 'forge:cobblestone/deepslate')
76+
// (2)
77+
UNIFICATION_CRAFTING_COMPONENT = event.createMaterialEntry("material_entry_component", new MaterialEntry('plate', 'gtceu:infinity'))
78+
.addMaterialEntry(GTValues.LV, new MaterialEntry('block', 'gtceu:infinity'))
79+
.addMaterialEntry(GTValues.MV, 'ingot', 'gtceu:infinity')
80+
.addMaterialEntry(GTValues.HV, new MaterialEntry('dust', 'gtceu:infinity'))
81+
.addMaterialEntry(GTValues.EV, new MaterialEntry('round', 'gtceu:infinity'))
82+
.addMaterialEntry(GTValues.IV, new MaterialEntry('foil', 'gtceu:infinity'))
83+
.addMaterialEntry(GTValues.LuV, 'longRod', 'gtceu:infinity')
84+
.addMaterialEntry(GTValues.ZPM, new MaterialEntry('rod', 'gtceu:infinity'))
85+
.addMaterialEntry(GTValues.UV, new MaterialEntry('bolt', 'gtceu:infinity'))
86+
// (3)
87+
})
88+
```
89+
90+
1. Creates a new crafting component with item stack entries.
91+
2. Creates a new crafting component with item tag entries. note the lack of `#` at the beginning of the tag!
92+
3. Creates a new crafting component with UnificationEntry entries.
93+
94+
## Retrieving existing crafting components
95+
96+
All `remove`, `modify*`, and `setFallback*` methods use a Crafting Component as its first argument, you can supply that argument with just a string matching the id of the crafting component
97+
98+
```js title="modify.js"
99+
100+
GTCEuServerEvents.craftingComponents(event => {
101+
event.removeTier('robot_arm', GTValues.EV) // (1)
102+
103+
event.removeTiers('pump', GTValues.EV, GTValues.IV, GTValues.LuV) // (2)
104+
})
105+
```
106+
107+
1. Finds the crafting component with id `robot_arm` and removes the entry for `EV` tier
108+
2. Finds the crafting component with id `pump` and removes the entry for `EV, IV & LuV` tiers
109+
110+
### Builtin Crafting Components
111+
112+
- `CIRCUIT 'circuit'`
113+
- `BETTER_CIRCUIT 'better_circuit'`
114+
- `WIRE_ELECTRIC 'wire_single'`
115+
- `WIRE_QUAD 'wire_quad'`
116+
- `WIRE_OCT 'wire_oct'`
117+
- `WIRE_HEX 'wire_hex'`
118+
- `CABLE 'cable_single'`
119+
- `CABLE_DOUBLE 'cable_double'`
120+
- `CABLE_QUAD 'cable_quad'`
121+
- `CABLE_OCT 'cable_oct'`
122+
- `CABLE_HEX 'cable_hex'`
123+
- `CABLE_TIER_UP 'cable_tier_up_single'`
124+
- `CABLE_TIER_UP_DOUBLE 'cable_tier_up_double'`
125+
- `CABLE_TIER_UP_QUAD 'cable_tier_up_quad'`
126+
- `CABLE_TIER_UP_OCT 'cable_tier_up_oct'`
127+
- `CABLE_TIER_UP_HEX 'cable_tier_up_hex'`
128+
- `CASING 'casing'`
129+
- `HULL 'hull'`
130+
- `PIPE_NORMAL 'normal_pipe'`
131+
- `PIPE_LARGE 'large_pipe'`
132+
- `PIPE_NONUPLE 'nonuple_pipe'`
133+
- `GLASS 'glass'`
134+
- `PLATE 'plate'`
135+
- `HULL_PLATE 'hull_plate'`
136+
- `ROTOR 'rotor'`
137+
- `GRINDER 'grinder'`
138+
- `SAWBLADE 'sawblade'`
139+
- `DIAMOND 'diamond'`
140+
- `MOTOR 'motor'`
141+
- `PUMP 'pump'`
142+
- `PISTON 'piston'`
143+
- `EMITTER 'emitter'`
144+
- `SENSOR 'sensor'`
145+
- `CONVEYOR 'conveyor'`
146+
- `ROBOT_ARM 'robot_arm'`
147+
- `FIELD_GENERATOR 'field_generator'`
148+
- `COIL_HEATING 'coil_heating'`
149+
- `COIL_HEATING_DOUBLE 'coil_heating_double'`
150+
- `COIL_ELECTRIC 'coil_electric'`
151+
- `STICK_MAGNETIC 'rod_magnetic'`
152+
- `STICK_DISTILLATION 'rod_distillation'`
153+
- `STICK_ELECTROMAGNETIC 'rod_electromagnetic'`
154+
- `STICK_RADIOACTIVE 'rod_radioactive'`
155+
- `PIPE_REACTOR 'pipe_reactor'`
156+
- `POWER_COMPONENT 'power_component'`
157+
- `VOLTAGE_COIL 'voltage_coil'`
158+
- `SPRING 'spring'`
159+
- `CRATE 'crate'`
160+
- `DRUM 'drum'`
161+
- `FRAME 'frame'`
162+
- `SMALL_SPRING_TRANSFORMER 'small_spring_transformer'`
163+
- `SPRING_TRANSFORMER 'spring_transformer'`

0 commit comments

Comments
 (0)