Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
cf120ca
These don't have implicit GT ids on 1.20, by the way.
screret May 11, 2026
46025c9
Remove the (Kube)ResourceLocation mixins and their usages
screret May 11, 2026
8449f6d
Add back `GTCEuStartupEvents.registry` and a simple handler for it
screret May 11, 2026
1663764
Move Registrate wrapper handling to RegistryEventHandler
screret May 11, 2026
5ba8db5
Clean up GTResourceLocation type wrapper
screret May 11, 2026
e0bff1f
Nullability annotation cleanup day
screret May 11, 2026
0180ccb
Remove unused field in TagPrefixBuilder
screret May 11, 2026
0fcf0fc
Disallow implicit GT namespace registration for recipe types
screret May 11, 2026
b3afa0c
Otherwise clean up GTRecipeTypeBuilder
screret May 11, 2026
71b27e1
Make RegisterWoodsEventJS not require all parts of the wood set
screret May 11, 2026
734827c
Revert "Make RegisterWoodsEventJS not require all parts of the wood set"
screret May 11, 2026
9cbd9d3
Revert "Otherwise clean up GTRecipeTypeBuilder"
screret May 11, 2026
b51c734
Move client runs to run/client subdirectory
screret May 11, 2026
d86f21e
Oh. right. oops.
screret May 11, 2026
25d3e59
Move KubeJS to extra client
screret May 11, 2026
916d838
Splurdless
screret May 11, 2026
3d075f2
Right yea cant use automatic event listener discovery here
screret May 11, 2026
7540dff
Add doc comments pointing to original source of KJS registry event code
screret May 11, 2026
82f3fbf
Revert "Remove unused field in TagPrefixBuilder"
screret May 11, 2026
025ba7b
Revert "Move client runs to run/client subdirectory"
screret May 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ dependencies {
// extraLocalRuntime(forge.worldstripper)
localRuntime(forge.cc.tweaked.forge.impl)

localRuntime(forge.bundles.kjs)
extraLocalRuntime(forge.bundles.kjs)
Comment thread
screret marked this conversation as resolved.

extraLocalRuntime(forge.ftblibrary)
extraLocalRuntime(forge.ftbteams)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public TYPE getThis() {
return (TYPE) this;
}

public TYPE blockModel(NonNullBiConsumer<DataGenContext<Block, ? extends Block>, GTBlockstateProvider> blockModel) {
public TYPE blockModel(@Nullable NonNullBiConsumer<DataGenContext<Block, ? extends Block>, GTBlockstateProvider> blockModel) {
this.blockModel = blockModel;
return getThis();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import lombok.experimental.Accessors;
import lombok.experimental.Tolerate;
import org.apache.commons.lang3.function.TriFunction;
import org.jetbrains.annotations.Nullable;

import java.util.*;
import java.util.function.*;
Expand All @@ -43,7 +44,7 @@ public class MultiblockMachineBuilder<DEFINITION extends MultiblockMachineDefini
private boolean allowFlip = true;
private final List<Supplier<ItemStack[]>> recoveryItems = new ArrayList<>();
private Function<MultiblockControllerMachine, Comparator<IMultiPart>> partSorter = (c) -> (a, b) -> 0;
private TriFunction<MultiblockControllerMachine, IMultiPart, Direction, BlockState> partAppearance;
private @Nullable TriFunction<MultiblockControllerMachine, IMultiPart, Direction, BlockState> partAppearance;
@Getter
private BiConsumer<MultiblockControllerMachine, List<Component>> additionalDisplay = (m, l) -> {};

Expand Down Expand Up @@ -80,7 +81,7 @@ public TYPE partSorter(Function<MultiblockControllerMachine, Comparator<IMultiPa
return getThis();
}

public TYPE partAppearance(TriFunction<MultiblockControllerMachine, IMultiPart, Direction, BlockState> partAppearance) {
public TYPE partAppearance(@Nullable TriFunction<MultiblockControllerMachine, IMultiPart, Direction, BlockState> partAppearance) {
this.partAppearance = partAppearance;
return getThis();
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
import com.gregtechceu.gtceu.data.recipe.*;
import com.gregtechceu.gtceu.integration.cctweaked.CCTweakedPlugin;
import com.gregtechceu.gtceu.integration.kjs.GTCEuStartupEvents;
import com.gregtechceu.gtceu.integration.kjs.GregTechKubeJSPlugin;
import com.gregtechceu.gtceu.integration.kjs.events.MaterialModificationEventJS;
import com.gregtechceu.gtceu.integration.kjs.helpers.KubeGTRegistryEventHandler;
import com.gregtechceu.gtceu.integration.map.WaypointManager;
import com.gregtechceu.gtceu.utils.input.SyncedKeyMappings;

Expand Down Expand Up @@ -140,7 +140,7 @@ public static void init(final IEventBus modBus) {
if (GTCEu.Mods.isKubeJSLoaded()) {
// initialize this before the class's static listeners
// so KubeJS materials are registered before the material registry is closed.
modBus.addListener(EventPriority.LOW, GregTechKubeJSPlugin::registerWrappers);
modBus.register(KubeGTRegistryEventHandler.class);
}
modBus.register(CommonProxy.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.HolderSet;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.item.ItemStack;
Expand Down Expand Up @@ -664,8 +665,12 @@ public class GTRecipeTypes {
public static final GTRecipeType DUMMY_RECIPES = register("dummy", DUMMY)
.setXEIVisible(false);

public static GTRecipeType register(String name, String group, RecipeType<?>... proxyRecipes) {
var recipeType = new GTRecipeType(GTCEu.id(name), group, proxyRecipes);
protected static GTRecipeType register(String name, String group, RecipeType<?>... proxyRecipes) {
return register(GTCEu.id(name), group, proxyRecipes);
}

public static GTRecipeType register(ResourceLocation id, String group, RecipeType<?>... proxyRecipes) {
var recipeType = new GTRecipeType(id, group, proxyRecipes);
GTRegistries.register(BuiltInRegistries.RECIPE_TYPE, recipeType.registryName, recipeType);
recipeType.setSerializer(GTRegistries.register(BuiltInRegistries.RECIPE_SERIALIZER, recipeType.registryName,
new GTRecipeSerializer()));
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

import com.gregtechceu.gtceu.integration.kjs.events.*;

import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;

import dev.latvian.mods.kubejs.event.EventGroup;
import dev.latvian.mods.kubejs.event.EventHandler;
import dev.latvian.mods.kubejs.event.EventTargetType;
import dev.latvian.mods.kubejs.event.TargetedEventHandler;

public interface GTCEuStartupEvents {

Expand All @@ -12,6 +17,8 @@ public interface GTCEuStartupEvents {
EventHandler MATERIAL_ICON_INFO = GROUP.startup("materialIconInfo", () -> MaterialIconInfoEventJS.class);
EventHandler WORLD_GEN_LAYERS = GROUP.startup("worldGenLayers", () -> WorldGenLayerEventJS.class);

TargetedEventHandler<ResourceKey<Registry<?>>> REGISTRY = GROUP.startup("registry", () -> GTRegistryKubeEvent.class)
.requiredTarget(EventTargetType.REGISTRY);
EventHandler MATERIAL_MODIFICATION = GROUP.startup("materialModification",
() -> MaterialModificationEventJS.class);
EventHandler CRAFTING_COMPONENTS = GROUP.startup("craftingComponents", () -> CraftingComponentsEventJS.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@
import com.gregtechceu.gtceu.common.data.models.GTMachineModels;
import com.gregtechceu.gtceu.common.data.models.GTModels;
import com.gregtechceu.gtceu.common.machine.multiblock.primitive.PrimitiveFancyUIWorkableMachine;
import com.gregtechceu.gtceu.data.pack.GTDynamicDataPack;
import com.gregtechceu.gtceu.data.pack.GTDynamicResourcePack;
import com.gregtechceu.gtceu.data.recipe.CraftingComponent;
import com.gregtechceu.gtceu.data.recipe.GTCraftingComponents;
import com.gregtechceu.gtceu.integration.kjs.builders.ElementBuilder;
Expand All @@ -100,17 +98,13 @@
import com.gregtechceu.gtceu.integration.kjs.recipe.KJSHelpers;
import com.gregtechceu.gtceu.integration.kjs.recipe.components.*;

import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement;
import net.neoforged.neoforge.registries.RegisterEvent;

import dev.latvian.mods.kubejs.DevProperties;
import dev.latvian.mods.kubejs.block.state.BlockStatePredicate;
import dev.latvian.mods.kubejs.event.EventGroupRegistry;
import dev.latvian.mods.kubejs.plugin.ClassFilter;
Expand All @@ -122,51 +116,11 @@
import dev.latvian.mods.kubejs.registry.RegistryObjectStorage;
import dev.latvian.mods.kubejs.registry.ServerRegistryRegistry;
import dev.latvian.mods.kubejs.script.BindingRegistry;
import dev.latvian.mods.kubejs.script.ConsoleJS;
import dev.latvian.mods.kubejs.script.TypeWrapperRegistry;
import dev.latvian.mods.rhino.Wrapper;
import org.jetbrains.annotations.ApiStatus;

public class GregTechKubeJSPlugin implements KubeJSPlugin {

@ApiStatus.Internal
public static void registerWrappers(RegisterEvent event) {
registerWrappers(event, GTRegistries.MACHINE_REGISTRY);
registerWrappers(event, GTRegistries.MATERIAL_REGISTRY);
}

private static <T> void registerWrappers(RegisterEvent event, ResourceKey<Registry<T>> registryKey) {
if (event.getRegistryKey() != registryKey) {
return;
}
var objStorage = RegistryObjectStorage.of(registryKey);
ResourceLocation registryLoc = registryKey.location();

int added = 0;

for (var builder : objStorage) {
if (builder.dummyBuilder) {
// don't actually register anything here, the wrapper builders register themselves with Registrate
builder.createTransformedObject();

if (DevProperties.get().logRegistryEventObjects) {
ConsoleJS.STARTUP.info("+ " + registryLoc + " | " + builder.id);
}
added++;
}

// add all registry objects' namespaces to the dynamic packs so their resources are listed as expected.
// although usually only one namespace is used, it's easier and faster to
// just always add them to the set than to check if they're already added.
if (GTCEu.isClientSide()) GTDynamicResourcePack.addNamespace(builder.id.getNamespace());
GTDynamicDataPack.addNamespace(builder.id.getNamespace());
}

if (!objStorage.objects.isEmpty() && DevProperties.get().logRegistryEventObjects) {
GTCEu.LOGGER.info("Registered {}/{} objects of {}", added, objStorage.objects.size(), registryLoc);
}
}

@Override
public void registerBuilderTypes(BuilderTypeRegistry registry) {
registry.addDefault(GTRegistries.ELEMENT_REGISTRY, ElementBuilder.class, ElementBuilder::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.gregtechceu.gtceu.api.data.chemical.Element;
import com.gregtechceu.gtceu.common.data.GTElements;
import com.gregtechceu.gtceu.integration.kjs.helpers.GTResourceLocation;

import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -26,7 +25,7 @@ public class ElementBuilder extends BuilderBase<Element> {
public transient boolean isIsotope;

public ElementBuilder(ResourceLocation id) {
super(GTResourceLocation.implicitAsGtceu(id));
super(id);
name = id.getPath();
translatableName = Component.translatable(id.toLanguageKey("element"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.gregtechceu.gtceu.api.recipe.category.GTRecipeCategory;
import com.gregtechceu.gtceu.common.data.GTRecipeCategories;
import com.gregtechceu.gtceu.common.data.GTRecipeTypes;
import com.gregtechceu.gtceu.integration.kjs.helpers.GTResourceLocation;
import com.gregtechceu.gtceu.utils.FormattingUtil;

import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture;
Expand Down Expand Up @@ -35,7 +34,7 @@ public class GTRecipeCategoryBuilder extends BuilderBase<GTRecipeCategory> {
private transient String langValue;

public GTRecipeCategoryBuilder(ResourceLocation id) {
super(GTResourceLocation.implicitAsGtceu(id));
super(id);
recipeType = GTRecipeTypes.DUMMY_RECIPES;
icon = null;
isXEIVisible = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.gregtechceu.gtceu.api.recipe.GTRecipeType;
import com.gregtechceu.gtceu.api.sound.SoundEntry;
import com.gregtechceu.gtceu.common.data.GTRecipeTypes;
import com.gregtechceu.gtceu.integration.kjs.helpers.GTResourceLocation;

import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture;
import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture;
Expand Down Expand Up @@ -49,17 +48,14 @@ public class GTRecipeTypeBuilder extends BuilderBase<GTRecipeType> {
protected transient int maxTooltips;

@Setter
@Nullable
private transient GTRecipeType smallRecipeMap;
private transient @Nullable GTRecipeType smallRecipeMap;
@Setter
@Nullable
private transient Supplier<ItemStack> iconSupplier;
@Nullable
private transient @Nullable Supplier<ItemStack> iconSupplier;
@Setter
protected transient BiConsumer<GTRecipe, WidgetGroup> uiBuilder;
protected transient @Nullable BiConsumer<GTRecipe, WidgetGroup> uiBuilder;

public GTRecipeTypeBuilder(ResourceLocation i) {
super(GTResourceLocation.implicitAsGtceu(i));
public GTRecipeTypeBuilder(ResourceLocation id) {
super(id);
name = this.id.getPath();
category = "custom";
maxInputs = new Object2IntOpenHashMap<>();
Expand Down Expand Up @@ -138,7 +134,7 @@ public String getTranslationKeyGroup() {

@Override
public GTRecipeType createObject() {
var type = GTRecipeTypes.register(name, category);
var type = GTRecipeTypes.register(this.id, this.category);
type.maxInputs.putAll(maxInputs);
type.maxOutputs.putAll(maxOutputs);
type.getRecipeUI().getSlotOverlays().putAll(slotOverlays);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.api.block.ActiveBlock;
import com.gregtechceu.gtceu.api.block.property.GTBlockStateProperties;
import com.gregtechceu.gtceu.integration.kjs.helpers.GTResourceLocation;

import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
Expand Down Expand Up @@ -40,7 +39,7 @@ public enum Type {
public transient String activeTexture;

public ActiveBlockBuilder(ResourceLocation id) {
super(GTResourceLocation.implicitAsGtceu(id));
super(id);
property(GTBlockStateProperties.ACTIVE);
renderType(BlockRenderType.CUTOUT_MIPPED);
activeTexture = ACTIVE.apply(baseTexture);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.gregtechceu.gtceu.api.data.chemical.material.Material;
import com.gregtechceu.gtceu.common.block.CoilBlock;
import com.gregtechceu.gtceu.common.data.GTMaterials;
import com.gregtechceu.gtceu.integration.kjs.helpers.GTResourceLocation;

import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
Expand All @@ -29,8 +28,8 @@ public class CoilBlockBuilder extends ActiveBlockBuilder {
@Setter
public transient String texture = "minecraft:missingno";

public CoilBlockBuilder(ResourceLocation i) {
super(GTResourceLocation.implicitAsGtceu(i));
public CoilBlockBuilder(ResourceLocation id) {
super(id);
property(GTBlockStateProperties.ACTIVE);
renderType(BlockRenderType.CUTOUT_MIPPED);
noValidSpawns(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.gregtechceu.gtceu.api.pattern.util.RelativeDirection;
import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate;
import com.gregtechceu.gtceu.api.registry.registrate.MachineBuilder;
import com.gregtechceu.gtceu.integration.kjs.helpers.GTResourceLocation;
import com.gregtechceu.gtceu.utils.FormattingUtil;

import net.minecraft.resources.ResourceLocation;
Expand All @@ -36,7 +35,7 @@ public class KJSSteamMachineBuilder extends BuilderBase<MachineDefinition> imple
private MachineDefinition lpObject = null, hpObject = null;

public KJSSteamMachineBuilder(ResourceLocation id) {
super(GTResourceLocation.implicitAsGtceu(id));
super(id);
this.dummyBuilder = true;
}

Expand Down
Loading
Loading