Skip to content

Commit

Permalink
Added an entrypoint for initializing recipe namespaces and groups.
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSVK12 committed Mar 28, 2024
1 parent 8aaf1fa commit 0c1a379
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bta_version=7.1-pre2a
loader_version=0.15.6-babric.4-bta

# Mod
mod_version=3.4.16
mod_version=3.4.17
mod_group=turniplabs
mod_name=halplibe

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package turniplabs.halplibe.mixin.mixins;

import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.core.data.registry.recipe.RecipeRegistry;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import turniplabs.halplibe.util.RecipeEntrypoint;

@Mixin(value = RecipeRegistry.class)
public class RecipeRegistryMixin {

@Inject(method = "<init>", at = @At("TAIL"))
public void init(CallbackInfo ci){
FabricLoader.getInstance().getEntrypoints("recipesReady", RecipeEntrypoint.class).forEach(RecipeEntrypoint::initNamespaces);
}
}
3 changes: 2 additions & 1 deletion src/main/java/turniplabs/halplibe/util/RecipeEntrypoint.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package turniplabs.halplibe.util;

@FunctionalInterface
public interface RecipeEntrypoint {
void onRecipesReady();

void initNamespaces();
}
1 change: 1 addition & 0 deletions src/main/resources/halplibe.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"package": "turniplabs.halplibe.mixin",
"compatibilityLevel": "JAVA_8",
"mixins": [
"mixins.RecipeRegistryMixin",
"accessors.BlockFireAccessor",
"accessors.EntityFireflyFXAccessor",
"accessors.EntityFXAccessor",
Expand Down

0 comments on commit 0c1a379

Please sign in to comment.