-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGuiApiComponents.java
More file actions
27 lines (22 loc) · 1000 Bytes
/
Copy pathGuiApiComponents.java
File metadata and controls
27 lines (22 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package dev.toolkitmc.guiapi.component;
import dev.toolkitmc.guiapi.GuiApiMod;
import net.minecraft.core.Registry;
import net.minecraft.core.component.DataComponentType;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.Identifier;
/**
* Registers guiAPI's custom item data components.
* Call {@link #register()} once from {@code GuiApiMod#onInitialize()}.
*/
public final class GuiApiComponents {
private GuiApiComponents() {}
public static final DataComponentType<OpenGuiComponent> OPEN_GUI = Registry.register(
BuiltInRegistries.DATA_COMPONENT_TYPE,
Identifier.fromNamespaceAndPath(GuiApiMod.MOD_ID, "open_gui"),
DataComponentType.<OpenGuiComponent>builder()
.persistent(OpenGuiComponent.CODEC)
.build()
);
/** No-op body — referencing this class from the mod initializer is enough to trigger the static init above. */
public static void register() {}
}