Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
63c4b94
docs changes
gustovafing Aug 18, 2026
5599c2b
more docs stuff
gustovafing Aug 18, 2026
5d8b1dc
delete IMaterialRegistry
gustovafing Aug 18, 2026
1edf978
update pattern errors
gustovafing Aug 18, 2026
c41214e
add the cached registry access back
gustovafing Aug 19, 2026
9f9b16b
remove reference to 1.20 registration
gustovafing Aug 24, 2026
68fdb1d
remove old registration docs
gustovafing Aug 24, 2026
79314eb
spotless
gustovafing Aug 24, 2026
990516f
update some registry usage
gustovafing Aug 27, 2026
9cc4504
update docs
gustovafing Aug 27, 2026
1a89d58
e
gustovafing Aug 27, 2026
c298e99
spotless
gustovafing Aug 27, 2026
802fcbb
make test optional
gustovafing Aug 27, 2026
feec299
Update CommonProxy.java
gustovafing Aug 27, 2026
5779509
Update CommonProxy.java
gustovafing Aug 27, 2026
7cd9162
spotless
gustovafing Aug 28, 2026
cecf11c
fix registration errors
gustovafing Aug 28, 2026
fd595f4
switch codec to map codec in docs
gustovafing Aug 28, 2026
519ba37
make deferred registers private, remove gtinitcomplete callback
gustovafing Aug 28, 2026
d43b1c2
remove unnecessary kjs event
gustovafing Aug 28, 2026
d5c8047
update recipe capabilities
gustovafing Aug 29, 2026
1cf7bc7
switch covers to use holders
gustovafing Aug 29, 2026
55bbb92
update tool behaviours
gustovafing Aug 29, 2026
d127575
update placement modifier types
gustovafing Aug 29, 2026
57b9c50
switch recipe conditions to be deferred
gustovafing Aug 29, 2026
238fa17
update world gen layers
gustovafing Aug 29, 2026
0e7ab09
move builders to their own folder
gustovafing Aug 29, 2026
a5bbb80
convert sounds to be deferred
gustovafing Aug 29, 2026
7c19aed
build fixes
gustovafing Aug 29, 2026
45f7dd8
make chancelogic deferred
gustovafing Aug 29, 2026
f0f83d1
defer placeholder registration
gustovafing Aug 29, 2026
518e00e
defer dimension markers
gustovafing Aug 29, 2026
b0cf829
spotless
gustovafing Aug 29, 2026
18f66eb
a
gustovafing Aug 29, 2026
70f863d
update medical conditions to use holders
gustovafing Aug 29, 2026
d0eacb6
Merge branch '1.21' into gus/use-holders-1.21
gustovafing Aug 30, 2026
ff50162
Merge branch '1.21' into gus/use-holders-1.21
gustovafing Aug 31, 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 docs/content/Modpacks/Examples/Parallel-Hatch-Part.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ title: "Custom Parallel Hatch"
GTMachineModels.createWorkableTieredHullMachineModel(
GTCEu.id("block/machines/parallel_hatch_mk4") // (6)
)[
"andThen(com.gregtechceu.gtceu.api.registry.registrate.MachineBuilder$ModelInitializer)"
"andThen(com.gregtechceu.gtceu.api.registry.registrate.builder.MachineBuilder$ModelInitializer)"
]((ctx, prov, model) => {
model.addReplaceableTextures("bottom", "top", "side");
})
Expand Down
6 changes: 3 additions & 3 deletions docs/content/Modpacks/Other-Topics/Ambiguous-Methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ GTCEuStartupEvents.registry('gtceu:machine', event => {

you'd get the error:
```
Error in 'GTCEuStartupEvents.registry': The choice of Java method com.gregtechceu.gtceu.api.registry.registrate.MultiblockMachineBuilder.tooltips matching JavaScript argument types (net.minecraft.network.chat.MutableComponent) is ambiguous; candidate methods are:
class com.gregtechceu.gtceu.api.registry.registrate.MachineBuilder tooltips(java.util.List)
class com.gregtechceu.gtceu.api.registry.registrate.MachineBuilder tooltips(net.minecraft.network.chat.Component[])
Error in 'GTCEuStartupEvents.registry': The choice of Java method com.gregtechceu.gtceu.api.registry.registrate.builder.MultiblockMachineBuilder.tooltips matching JavaScript argument types (net.minecraft.network.chat.MutableComponent) is ambiguous; candidate methods are:
class com.gregtechceu.gtceu.api.registry.registrate.builder.MachineBuilder tooltips(java.util.List)
class com.gregtechceu.gtceu.api.registry.registrate.builder.MachineBuilder tooltips(net.minecraft.network.chat.Component[])
```

In this case, there's ambiguity between the following 2 java functions:
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ public interface IGTAddon {
*/
GTRegistrate getRegistrate();

/**
* This runs after GTCEu has set up it's content. Set up GT loading-dependent (but NOT ones dependent on
*
* @apiNote DO NOT REGISTER ANY OF YOUR OWN CONTENT HERE, AS IF YOU DO, IT'LL REGISTER AS IF GTCEu REGISTERED IT
* AND YOUR DATAGEN AND EVENTS WILL <b><i>NOT</i></b> WORK AS EXPECTED, IF AT ALL.
*/
void gtInitComplete();

/**
* Call init on your custom VeinGenerator class(es) here
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.gregtechceu.gtceu.api.capability.recipe;

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.api.machine.MetaMachine;
import com.gregtechceu.gtceu.api.machine.trait.notifiable.NotifiableRecipeHandlerTrait;
import com.gregtechceu.gtceu.api.recipe.GTRecipe;
Expand Down Expand Up @@ -63,15 +62,6 @@ protected RecipeCapability(ResourceLocation id, int color, boolean doRenderSlot,
this.serializer = serializer;
}

/**
* @deprecated Use {@link #RecipeCapability(ResourceLocation, int, boolean, int, IContentSerializer)}
*/
@Deprecated(forRemoval = true, since = "8.0.0")
protected RecipeCapability(String name, int color, boolean doRenderSlot, int sortIndex,
IContentSerializer<T> serializer) {
this(GTCEu.id(name), color, doRenderSlot, sortIndex, serializer);
}

public static Codec<List<Content>> contentCodec(RecipeCapability<?> capability) {
return Content.codec(capability).listOf().xmap(ArrayList::new, Function.identity());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.gregtechceu.gtceu.utils.GTMath;
import com.gregtechceu.gtceu.utils.TagUtil;

import net.minecraft.core.Holder;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.resources.ResourceKey;
Expand Down Expand Up @@ -1488,7 +1489,7 @@ public Builder radioactiveHazard(float multiplier) {
* @param trigger The trigger type for this hazard.
* @param condition The condition applied by this hazard.
*/
public Builder hazard(HazardProperty.HazardTrigger trigger, MedicalCondition condition) {
public Builder hazard(HazardProperty.HazardTrigger trigger, Holder<MedicalCondition> condition) {
properties.setProperty(PropertyKey.HAZARD, new HazardProperty(trigger, condition, 1, false));
return this;
}
Expand All @@ -1504,7 +1505,7 @@ public Builder hazard(HazardProperty.HazardTrigger trigger, MedicalCondition con
* @param condition The condition applied by this hazard.
* @param progressionMultiplier Multiplier for how quickly the condition will progress.
*/
public Builder hazard(HazardProperty.HazardTrigger trigger, MedicalCondition condition,
public Builder hazard(HazardProperty.HazardTrigger trigger, Holder<MedicalCondition> condition,
float progressionMultiplier) {
properties.setProperty(PropertyKey.HAZARD,
new HazardProperty(trigger, condition, progressionMultiplier, false));
Expand All @@ -1521,7 +1522,7 @@ public Builder hazard(HazardProperty.HazardTrigger trigger, MedicalCondition con
* @param applyToDerivatives Whether the Hazard should be applied to materials with this Material in its
* components list.
*/
public Builder hazard(HazardProperty.HazardTrigger trigger, MedicalCondition condition,
public Builder hazard(HazardProperty.HazardTrigger trigger, Holder<MedicalCondition> condition,
float progressionMultiplier, boolean applyToDerivatives) {
properties.setProperty(PropertyKey.HAZARD,
new HazardProperty(trigger, condition, progressionMultiplier, applyToDerivatives));
Expand All @@ -1540,7 +1541,7 @@ public Builder hazard(HazardProperty.HazardTrigger trigger, MedicalCondition con
* @param applyToDerivatives Whether the Hazard should be applied to materials with this Material in its
* components list.
*/
public Builder hazard(HazardProperty.HazardTrigger trigger, MedicalCondition condition,
public Builder hazard(HazardProperty.HazardTrigger trigger, Holder<MedicalCondition> condition,
boolean applyToDerivatives) {
properties.setProperty(PropertyKey.HAZARD, new HazardProperty(trigger, condition, 1, applyToDerivatives));
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.data.recipe.CustomTags;

import net.minecraft.core.Holder;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.StringRepresentable;
Expand All @@ -31,12 +32,12 @@

public class HazardProperty implements IMaterialProperty {

public final MedicalCondition condition;
public final Holder<MedicalCondition> condition;
public final HazardTrigger hazardTrigger;
public final boolean applyToDerivatives;
public final float progressionMultiplier;

public HazardProperty(HazardTrigger hazardTrigger, MedicalCondition condition, float progressionMultiplier,
public HazardProperty(HazardTrigger hazardTrigger, Holder<MedicalCondition> condition, float progressionMultiplier,
boolean applyToDerivatives) {
this.hazardTrigger = hazardTrigger;
this.condition = condition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
import net.minecraft.world.damagesource.DamageType;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.jetbrains.annotations.NotNull;

import java.util.*;
import java.util.function.Consumer;
Expand Down Expand Up @@ -47,13 +45,11 @@ public class MedicalCondition {
* condition.
*/
@Getter
@Setter
@NotNull
public Consumer<GTRecipeBuilder> recipeModifier = builder -> {};
public final Consumer<GTRecipeBuilder> recipeModifier;

public MedicalCondition(ResourceLocation id, int color,
int maxProgression, IdleProgressionType progressionType, float progressionRate,
boolean canBePermanent,
boolean canBePermanent, Consumer<GTRecipeBuilder> recipeModifier,
Symptom.ConfiguredSymptom... symptoms) {
this.id = id;
this.color = color;
Expand All @@ -67,6 +63,14 @@ public MedicalCondition(ResourceLocation id, int color,
this.idleProgressionType = progressionType;
this.idleProgressionRate = progressionRate;
this.canBePermanent = canBePermanent;
this.recipeModifier = recipeModifier;
}

public MedicalCondition(ResourceLocation id, int color,
int maxProgression, IdleProgressionType progressionType, float progressionRate,
boolean canBePermanent,
Symptom.ConfiguredSymptom... symptoms) {
this(id, color, maxProgression, progressionType, progressionRate, canBePermanent, $ -> {}, symptoms);
}

public ResourceKey<DamageType> getDamageType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ public GTOreDefinition layer(IWorldGenLayer layer) {
return this;
}

public GTOreDefinition layer(Holder<IWorldGenLayer> layer) {
return layer(layer.value());
}

public GTOreDefinition dimensions(Set<ResourceKey<Level>> dimensions) {
this.dimensionFilter = dimensions;
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.gregtechceu.gtceu.api.data.worldgen;

import com.gregtechceu.gtceu.api.registry.GTRegistries;

import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.Level;
Expand All @@ -25,8 +23,6 @@ public SimpleWorldGenLayer(ResourceLocation id, IWorldGenLayer.RuleTestSupplier
this.id = id;
this.target = target;
this.levels = levels;

GTRegistries.register(GTRegistries.WORLD_GEN_LAYERS, id, this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.gregtechceu.gtceu.api.data.worldgen;

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.integration.kjs.GTCEuStartupEvents;
import com.gregtechceu.gtceu.integration.kjs.events.WorldGenLayerEventJS;
import com.gregtechceu.gtceu.api.registry.GTRegistries;
import com.gregtechceu.gtceu.common.registry.GTRegistration;

import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest;
Expand All @@ -12,32 +14,27 @@

public class WorldGenLayers {

public static final SimpleWorldGenLayer STONE = new SimpleWorldGenLayer(
GTCEu.id("stone"), () -> new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES),
public static final Holder<IWorldGenLayer> STONE = register("stone",
() -> new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES),
Set.of(Level.OVERWORLD));

public static final SimpleWorldGenLayer DEEPSLATE = new SimpleWorldGenLayer(
GTCEu.id("deepslate"), () -> new TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES),
public static final Holder<IWorldGenLayer> DEEPSLATE = register("deepslate",
() -> new TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES),
Set.of(Level.OVERWORLD));

public static final SimpleWorldGenLayer NETHERRACK = new SimpleWorldGenLayer(
GTCEu.id("netherrack"), () -> new TagMatchTest(BlockTags.NETHER_CARVER_REPLACEABLES),
public static final Holder<IWorldGenLayer> NETHERRACK = register("netherrack",
() -> new TagMatchTest(BlockTags.NETHER_CARVER_REPLACEABLES),
Set.of(Level.NETHER));

public static final SimpleWorldGenLayer ENDSTONE = new SimpleWorldGenLayer(
GTCEu.id("endstone"), () -> WorldGeneratorUtils.END_ORE_REPLACEABLES,
public static final Holder<IWorldGenLayer> ENDSTONE = register("endstone",
() -> WorldGeneratorUtils.END_ORE_REPLACEABLES,
Set.of(Level.END));

public static void init() {
if (GTCEu.Mods.isKubeJSLoaded()) {
KJSCallWrapper.postEvent();
}
private static Holder<IWorldGenLayer> register(String name, IWorldGenLayer.RuleTestSupplier target,
Set<ResourceKey<Level>> levels) {
return GTRegistration.REGISTRATE.simple(name, GTRegistries.Keys.WORLD_GEN_LAYER,
() -> new SimpleWorldGenLayer(GTCEu.id(name), target, levels));
}

private static final class KJSCallWrapper {

private static void postEvent() {
GTCEuStartupEvents.WORLD_GEN_LAYERS.post(new WorldGenLayerEventJS());
}
}
public static void init() {}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gregtechceu.gtceu.api.events;

import com.gregtechceu.gtceu.api.registry.registrate.MachineBuilder;
import com.gregtechceu.gtceu.api.registry.registrate.builder.MachineBuilder;

import net.neoforged.bus.api.Event;
import net.neoforged.fml.event.IModBusEvent;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/gregtechceu/gtceu/api/item/IGTTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public interface IGTTool extends IUIHolder<PlayerInventoryGuiData<?>>, ItemLike
IGTToolDefinition getToolStats();

@Nullable
SoundEntry getSound();
Holder<SoundEntry> getSound();

boolean playSoundOnBlockDestroy();

Expand Down Expand Up @@ -283,7 +283,7 @@ default int getTotalHarvestLevel() {
return;
}
if (!areaOfEffectBlockBreakRoutine(stack, serverPlayer, pos)) {
var behavior = getBehaviorsComponent(stack).getBehavior(GTToolBehaviors.TREE_FELLING);
var behavior = getBehaviorsComponent(stack).getBehavior(GTToolBehaviors.TREE_FELLING.value());
if (behavior != null && behavior.isEnabled() && state.is(BlockTags.LOGS)) {
TreeFellingHelper.fellTree(stack, player.level(), state, pos, player);
}
Expand Down Expand Up @@ -723,7 +723,7 @@ default boolean canPlaySound(ItemStack stack) {

default void playSound(Player player) {
if (ConfigHolder.INSTANCE.client.toolUseSounds && getSound() != null) {
player.level().playSound(null, player, getSound().getMainEvent(), SoundSource.PLAYERS, 1F, 1F);
player.level().playSound(null, player, getSound().value().getMainEvent(), SoundSource.PLAYERS, 1F, 1F);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static void playJetpackSound(@NotNull Player player) {
cons -= 0.4F;
}

player.playSound(GTSoundEntries.JET_ENGINE.getMainEvent(), 0.3F, cons);
player.playSound(GTSoundEntries.JET_ENGINE.value().getMainEvent(), 0.3F, cons);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public boolean isElectric() {

@Nullable
@Override
public SoundEntry getSound() {
public Holder<SoundEntry> getSound() {
return toolType.soundEntry;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.gregtechceu.gtceu.common.item.tool.behavior.*;
import com.gregtechceu.gtceu.data.recipe.CustomTags;

import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
Expand Down Expand Up @@ -198,7 +199,7 @@ public class GTToolType {
.definition(b -> b.blockBreaking().crafting()
.attackDamage(2.0F).attackSpeed(-2.4F)
.sneakBypassUse().behaviors(RotateRailBehavior.INSTANCE))
.sound(new ExistingSoundEntry(SoundEvents.ITEM_BREAK, SoundSource.BLOCKS), true)
.sound(Holder.direct(new ExistingSoundEntry(SoundEvents.ITEM_BREAK, SoundSource.BLOCKS)), true)
.symbol('c')
.defaultAbilities(GTItemAbilities.CROWBAR_DIG, GTItemAbilities.CROWBAR_REMOVE_COVER)
.materialAmount(3 * GTValues.M / 2)
Expand Down Expand Up @@ -571,7 +572,7 @@ public class GTToolType {
public final Set<String> toolClassNames;
public final Set<GTToolType> toolClasses;
@Nullable
public final SoundEntry soundEntry;
public final Holder<SoundEntry> soundEntry;
public final boolean playSoundOnBlockDestroy;
public final char symbol;
public final long materialAmount;
Expand All @@ -585,7 +586,7 @@ public GTToolType(String name, String idFormat, char symbol,
List<TagKey<Item>> itemTags, List<TagKey<Item>> matchTags, List<TagKey<Item>> craftingTags,
List<TagKey<Block>> harvestTags, Set<ItemAbility> defaultAbilities,
Set<String> toolClassNames, ResourceLocation modelLocation,
@Nullable SoundEntry soundEntry, boolean playSoundOnBlockDestroy,
@Nullable Holder<SoundEntry> soundEntry, boolean playSoundOnBlockDestroy,
int electricTier, long materialAmount) {
this.name = name;
this.idFormat = idFormat;
Expand Down Expand Up @@ -661,7 +662,7 @@ public static class Builder {
private ToolConstructor constructor = GTToolItem::new;
@Setter
private ResourceLocation modelLocation;
private SoundEntry sound;
private Holder<SoundEntry> sound;
private boolean playSoundOnBlockDestroy;

public Builder(String name) {
Expand Down Expand Up @@ -727,11 +728,11 @@ public Builder definition(UnaryOperator<ToolDefinitionBuilder> builder) {
return this;
}

public Builder sound(SoundEntry sound) {
public Builder sound(Holder<SoundEntry> sound) {
return this.sound(sound, false);
}

public Builder sound(SoundEntry sound, boolean playSoundOnBlockDestroy) {
public Builder sound(Holder<SoundEntry> sound, boolean playSoundOnBlockDestroy) {
this.sound = sound;
this.playSoundOnBlockDestroy = playSoundOnBlockDestroy;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public static void damageItem(ItemStack stack, @Nullable LivingEntity user, int

public static void playToolSound(@Nullable GTToolType toolType, ServerPlayer player) {
if (toolType != null && toolType.soundEntry != null) {
toolType.soundEntry.playOnServer(player.level(), player.blockPosition());
toolType.soundEntry.value().playOnServer(player.level(), player.blockPosition());
}
}

Expand Down Expand Up @@ -563,7 +563,7 @@ public static void onActionDone(@Nullable Player player, ItemStack stack, Level
IGTTool tool = (IGTTool) stack.getItem();
ToolHelper.damageItem(stack, player);
if (tool.getSound() != null) {
level.playSound(player, pos.x, pos.y, pos.z, tool.getSound().getMainEvent(),
level.playSound(player, pos.x, pos.y, pos.z, tool.getSound().value().getMainEvent(),
SoundSource.PLAYERS, 1.0F, 1.0F);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static void onWorldTick(LevelTickEvent.Pre event) {
if (event.getLevel() == helper.player.level()) {
ItemStack held = helper.player.getMainHandItem();
if (helper.player.isRemoved() || helper.orderedBlocks.isEmpty() || helper.tool.isEmpty() ||
!getBehaviorsComponent(held).hasBehavior(GTToolBehaviors.TREE_FELLING)) {
!getBehaviorsComponent(held).hasBehavior(GTToolBehaviors.TREE_FELLING.value())) {
iterator.remove();
continue;
}
Expand Down
Loading
Loading