Jump to content

(SOLVED) Custom Crafting Table recipes not working


Recommended Posts

It's me again. I got the custom crafting table to work – it appears in the world, I can open it, and it doesn't close right away, which is always a plus. However, it doesn't seem my new recipe type has registered. Here is a picture of my directory to see which classes I copied over.

How am I supposed to register a new recipe type?

Screen Shot 2020-05-14 at 7.45.10 PM.png

Edited by TheThorneCorporation
  • Thanks 1
Link to comment
Share on other sites

debug.logBumping because I can't figure out how to register the Recipe/RecipeSerializer.

I have this class to store the advanced crafting recipe type:

public interface IThorneRecipeType<T extends IRecipe<?>> extends IRecipeType<T> {
   IRecipeType<IAdvancedCraftingRecipe> ADVANCED_CRAFTING = register("advanced_crafting");

   static <T extends IRecipe<?>> IThorneRecipeType<T> register(final String key) {
      return Registry.register(Registry.RECIPE_TYPE, new ResourceLocation(key), new IThorneRecipeType<T>() {
         public String toString() {
            return key;
         }
      });
   }

   default <C extends IInventory> Optional<T> matches(IRecipe<C> recipe, World worldIn, C inv) {
      return recipe.matches(inv, worldIn) ? Optional.of((T)recipe) : Optional.empty();
   }
}

which should have registered the recipe type. (I'm doing both shapeless and shaped advanced crafting recipes.)

I also have this class which should have registered the advanced recipe type serializers:

public interface IThorneRecipeSerializer<T extends IRecipe<?>> extends IRecipeSerializer<T> {

	IRecipeSerializer<ShapelessAdvancedRecipe> ADVANCED_CRAFTING_SHAPELESS = register("advanced_crafting_shapeless", new ShapelessAdvancedRecipe.Serializer());
	IRecipeSerializer<ShapedAdvancedRecipe> ADVANCED_CRAFTING_SHAPED = register("advanced_crafting_shaped", new ShapedAdvancedRecipe.Serializer());

	static <S extends IRecipeSerializer<T>, T extends IRecipe<?>> S register(String key, S recipeSerializer) {
		return IRecipeSerializer.register(key, recipeSerializer);
	}
}

The recipe still isn't registering, though. Am I supposed to use a RegistryEvent or something?

 

Edited by TheThorneCorporation
Oops, wrong log.
Link to comment
Share on other sites

First, extending an interface is arbitrary the way you are doing it. IRecipeType does not need to be extended and can be just declared a static final variable using IRecipeType#register. Second, IRecipeSerializer needs to be extended on a ForgeRegistryEntry class. The reason I say this is even though you might have already done it is that if you looked at the original class, you can see it extends a basic implementation of a registry. So yes, you do need a RegistryEvent using the old method or could update to using DeferredRegister and RegistryObject.

 

 

  • Like 1
Link to comment
Share on other sites

Okay, I rewrote IThorneRecipeSerializer like this:

public interface IThorneRecipeSerializer<T extends IRecipe<?>> extends IRecipeSerializer<T> {

	public static IRecipeSerializer<ShapelessAdvancedRecipe> ADVANCED_CRAFTING_SHAPELESS = register("advanced_crafting_shapeless", new ShapelessAdvancedRecipe.Serializer());
	public static IRecipeSerializer<ShapedAdvancedRecipe> ADVANCED_CRAFTING_SHAPED = register("advanced_crafting_shaped", new ShapedAdvancedRecipe.Serializer());

	static <S extends IRecipeSerializer<T>, T extends IRecipe<?>> S register(String key, S recipeSerializer) {
		return IRecipeSerializer.register(key, recipeSerializer);
	}
}

 

and added this to my RegistryEvents:

@SubscribeEvent
public static void registerRecipeSerializers(final RegistryEvent.Register<IRecipeSerializer<?>> event) {
	event.getRegistry().registerAll
	(
		IThorneRecipeSerializer.ADVANCED_CRAFTING_SHAPED,
		IThorneRecipeSerializer.ADVANCED_CRAFTING_SHAPELESS
	);
}

 

but it's still not working.

I'll work on getting a GitHub repo up.

Edited by TheThorneCorporation
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I tried installing several mods that improves fps with other several gameplay mods that i have added previously and tested to be playable. But when I have added the new mods that improves the fps, Java crashes. (version is 1.20.1)   Here is the crash log:    ---- Minecraft Crash Report ---- // But it works on my machine. Time: 2023-12-08 17:22:22 Description: Initializing game java.lang.IncompatibleClassChangeError: class net.coderbot.iris.gui.option.ShadowDistanceOption cannot inherit from final class net.minecraft.client.OptionInstance     at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?] {}     at java.lang.ClassLoader.defineClass(ClassLoader.java:1017) ~[?:?] {}     at cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:119) ~[securejarhandler-2.1.10.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.lambda$findClass$15(ModuleClassLoader.java:219) ~[securejarhandler-2.1.10.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:229) ~[securejarhandler-2.1.10.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:219) ~[securejarhandler-2.1.10.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:135) ~[securejarhandler-2.1.10.jar:?] {}     at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?] {}     at net.coderbot.iris.config.IrisConfig.load(IrisConfig.java:142) ~[oculus-mc1.20.1-1.6.9.jar%23179!/:?] {re:classloading}     at net.coderbot.iris.config.IrisConfig.initialize(IrisConfig.java:58) ~[oculus-mc1.20.1-1.6.9.jar%23179!/:?] {re:classloading}     at net.coderbot.iris.Iris.onEarlyInitialize(Iris.java:146) ~[oculus-mc1.20.1-1.6.9.jar%23179!/:?] {re:mixin,re:classloading}     at net.minecraft.client.Options.handler$zgi000$iris$beforeLoadOptions(Options.java:1430) ~[client-1.20.1-20230612.114412-srg.jar%23189!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:mixins.oculus.json:MixinOptions_Entrypoint,pl:mixin:APP:mixins.oculus.fixes.maxfpscrash.json:MixinMaxFpsCrashFix,pl:mixin:APP:mixins.oculus.json:sky.MixinOptions_CloudsOverride,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.client.Options.m_92140_(Options.java) ~[client-1.20.1-20230612.114412-srg.jar%23189!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:mixins.oculus.json:MixinOptions_Entrypoint,pl:mixin:APP:mixins.oculus.fixes.maxfpscrash.json:MixinMaxFpsCrashFix,pl:mixin:APP:mixins.oculus.json:sky.MixinOptions_CloudsOverride,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.client.Options.<init>(Options.java:888) ~[client-1.20.1-20230612.114412-srg.jar%23189!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:mixins.oculus.json:MixinOptions_Entrypoint,pl:mixin:APP:mixins.oculus.fixes.maxfpscrash.json:MixinMaxFpsCrashFix,pl:mixin:APP:mixins.oculus.json:sky.MixinOptions_CloudsOverride,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.<init>(Minecraft.java:425) ~[client-1.20.1-20230612.114412-srg.jar%23189!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:rubidium_extras.mixins.json:FrameCounter.FpsAccessorMixin,pl:mixin:APP:rubidium.mixins.json:core.MinecraftClientMixin,pl:mixin:APP:mixins.oculus.json:MixinMinecraft_PipelineManagement,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.client.main.Main.main(Main.java:182) ~[1.20.1-forge-47.2.0.jar:?] {re:classloading,pl:runtimedistcleaner:A}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}     at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}     at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111) ~[fmlloader-1.20.1-47.2.0.jar:?] {}     at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.clientService(CommonLaunchHandler.java:99) ~[fmlloader-1.20.1-47.2.0.jar:?] {}     at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$makeService$0(CommonClientLaunchHandler.java:25) ~[fmlloader-1.20.1-47.2.0.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) ~[modlauncher-10.0.9.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) ~[modlauncher-10.0.9.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) ~[modlauncher-10.0.9.jar:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:108) ~[modlauncher-10.0.9.jar:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.9.jar:?] {}     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace:     at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?] {}     at java.lang.ClassLoader.defineClass(ClassLoader.java:1017) ~[?:?] {}     at cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:119) ~[securejarhandler-2.1.10.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.lambda$findClass$15(ModuleClassLoader.java:219) ~[securejarhandler-2.1.10.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:229) ~[securejarhandler-2.1.10.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:219) ~[securejarhandler-2.1.10.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:135) ~[securejarhandler-2.1.10.jar:?] {}     at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?] {}     at net.coderbot.iris.config.IrisConfig.load(IrisConfig.java:142) ~[oculus-mc1.20.1-1.6.9.jar%23179!/:?] {re:classloading}     at net.coderbot.iris.config.IrisConfig.initialize(IrisConfig.java:58) ~[oculus-mc1.20.1-1.6.9.jar%23179!/:?] {re:classloading}     at net.coderbot.iris.Iris.onEarlyInitialize(Iris.java:146) ~[oculus-mc1.20.1-1.6.9.jar%23179!/:?] {re:mixin,re:classloading}     at net.minecraft.client.Options.handler$zgi000$iris$beforeLoadOptions(Options.java:1430) ~[client-1.20.1-20230612.114412-srg.jar%23189!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:mixins.oculus.json:MixinOptions_Entrypoint,pl:mixin:APP:mixins.oculus.fixes.maxfpscrash.json:MixinMaxFpsCrashFix,pl:mixin:APP:mixins.oculus.json:sky.MixinOptions_CloudsOverride,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.client.Options.m_92140_(Options.java) ~[client-1.20.1-20230612.114412-srg.jar%23189!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:mixins.oculus.json:MixinOptions_Entrypoint,pl:mixin:APP:mixins.oculus.fixes.maxfpscrash.json:MixinMaxFpsCrashFix,pl:mixin:APP:mixins.oculus.json:sky.MixinOptions_CloudsOverride,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.client.Options.<init>(Options.java:888) ~[client-1.20.1-20230612.114412-srg.jar%23189!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:mixins.oculus.json:MixinOptions_Entrypoint,pl:mixin:APP:mixins.oculus.fixes.maxfpscrash.json:MixinMaxFpsCrashFix,pl:mixin:APP:mixins.oculus.json:sky.MixinOptions_CloudsOverride,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.<init>(Minecraft.java:425) ~[client-1.20.1-20230612.114412-srg.jar%23189!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:rubidium_extras.mixins.json:FrameCounter.FpsAccessorMixin,pl:mixin:APP:rubidium.mixins.json:core.MinecraftClientMixin,pl:mixin:APP:mixins.oculus.json:MixinMinecraft_PipelineManagement,pl:mixin:A,pl:runtimedistcleaner:A} -- Initialization -- Details:     Modules:  Stacktrace:     at net.minecraft.client.main.Main.main(Main.java:182) ~[1.20.1-forge-47.2.0.jar:?] {re:classloading,pl:runtimedistcleaner:A}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}     at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}     at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111) ~[fmlloader-1.20.1-47.2.0.jar:?] {}     at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.clientService(CommonLaunchHandler.java:99) ~[fmlloader-1.20.1-47.2.0.jar:?] {}     at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$makeService$0(CommonClientLaunchHandler.java:25) ~[fmlloader-1.20.1-47.2.0.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) ~[modlauncher-10.0.9.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) ~[modlauncher-10.0.9.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) ~[modlauncher-10.0.9.jar:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:108) ~[modlauncher-10.0.9.jar:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.9.jar:?] {}     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?] {} -- System Details -- Details:     Minecraft Version: 1.20.1     Minecraft Version ID: 1.20.1     Operating System: Mac OS X (aarch64) version 14.1.2     Java Version: 17.0.8, Microsoft     Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Microsoft     Memory: 285189552 bytes (271 MiB) / 536870912 bytes (512 MiB) up to 2147483648 bytes (2048 MiB)     CPUs: 8     Processor Vendor: Apple Inc.     Processor Name: Apple M1     Identifier: Apple Inc. Family 0x1b588bb3 Model 0 Stepping 0     Microarchitecture: ARM64 SoC: Firestorm + Icestorm     Frequency (GHz): 3.20     Number of physical packages: 1     Number of physical CPUs: 8     Number of logical CPUs: 8     Graphics card #0 name: Apple M1     Graphics card #0 vendor: Apple (0x106b)     Graphics card #0 VRAM (MB): 0.00     Graphics card #0 deviceId: unknown     Graphics card #0 versionInfo: unknown     Memory slot #0 capacity (MB): 0.00     Memory slot #0 clockSpeed (GHz): 0.00     Memory slot #0 type: unknown     Virtual memory max (MB): 11264.00     Virtual memory used (MB): 7656.59     Swap memory total (MB): 3072.00     Swap memory used (MB): 1509.94     JVM Flags: 7 total; -Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M     Launched Version: 1.20.1-forge-47.2.0     Backend library: LWJGL version 3.3.1 build 7     Backend API: Unknown     Window size: <not initialized>     GL Caps: Using framebuffer using OpenGL 3.2     GL debug messages: <disabled>     Using VBOs: Yes     Is Modded: Definitely; Client brand changed to 'forge'     Type: Client (map_client.txt)     CPU: <unknown>
    • I have created a mod which applies x shader to the player after consuming x item for a certain time, but if the player presses f5 to change the camera the shader stops working. The only way I have found to prevent the shader from being deactivated is to load it on all ticks until it is disabled but this greatly reduces the performance of the game. I have also tried to cancel the event of changing the camera but this is not cancelable. Any advice, I've been trying to solve this for several days 😵‍💫  
    • Minecraft 1.20.1 Forge 47.2.0 log and crash report: https://pastebin.com/P7tQymQS ; (crash report) I launch the game and i got this error: Someone could help me please?  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.