Jump to content

Recommended Posts

Posted

Okay, after a long time, my custom recipe type works, or at least implicitly, because I don't know how to apply it to my block, I don't know what to overwrite my block to accept my recipe type and not vanilla. 

 

Posted

This time I get such a bug and I don't really know where to look for the bug. What class.

[18:39:56] [Render thread/WARN] [minecraft/ClientRecipeBook]: Unknown recipe category: [!!!com.mojang.logging.LogUtils$1ToString@41a18b54=>java.lang.NullPointerException:Cannot invoke "Object.toString()" because the return value of "java.util.function.Supplier.get()" is null!!!]/anymod:oak_stairs_from_woodcutter

Posted

Only this shows up in the console.

public class WoodcutterRecipe implements Recipe<Container> {
    protected final Ingredient ingredient;
    protected final ItemStack result;
    protected final ResourceLocation id;
    protected final String group;

    public WoodcutterRecipe(Ingredient ingredient, ItemStack result, ResourceLocation id, String group) {
        this.ingredient = ingredient;
        this.result = result;
        this.id = id;
        this.group = group;
    }

    public RecipeType<?> getType() {
        return Type.TYPE;
    }

    public RecipeSerializer<?> getSerializer() {
        return Serializer.INSTANCE;
    }

    public ResourceLocation getId() {
        return this.id;
    }

    public String getGroup() {
        return this.group;
    }

    public ItemStack getResultItem() {
        return this.result;
    }

    public NonNullList<Ingredient> getIngredients() {
        NonNullList<Ingredient> nonnulllist = NonNullList.create();
        nonnulllist.add(this.ingredient);
        return nonnulllist;
    }

    public boolean canCraftInDimensions(int pWidth, int pHeight) {
        return true;
    }

    @Override
    public boolean matches(Container pContainer, Level pLevel) {
        return false;
    }

    public ItemStack assemble(Container pInv) {
        return this.result.copy();
    }

    public static class Type implements RecipeType<WoodcutterRecipe>{
        public static final Type TYPE = new Type();
    }

    public static class Serializer implements RecipeSerializer<WoodcutterRecipe> {
        public static final Serializer INSTANCE = new Serializer();
        public static final ResourceLocation ID = new ResourceLocation(AnyMod.MOD_ID, "woodcutter");
        public WoodcutterRecipe fromJson(ResourceLocation pRecipeId, JsonObject pJson) {
            String s = GsonHelper.getAsString(pJson, "group", "");
            Ingredient ingredient;
            if (GsonHelper.isArrayNode(pJson, "ingredient")) {
                ingredient = Ingredient.fromJson(GsonHelper.getAsJsonArray(pJson, "ingredient"));
            } else {
                ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient"));
            }

            String s1 = GsonHelper.getAsString(pJson, "result");
            int i = GsonHelper.getAsInt(pJson, "count");
            ItemStack itemstack = new ItemStack(Registry.ITEM.get(new ResourceLocation(s1)), i);
            return new WoodcutterRecipe(ingredient, itemstack, pRecipeId, s);
        }

        public WoodcutterRecipe fromNetwork(ResourceLocation pRecipeId, FriendlyByteBuf pBuffer) {
            String s = pBuffer.readUtf();
            Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
            ItemStack itemstack = pBuffer.readItem();
            return new WoodcutterRecipe(ingredient, itemstack, pRecipeId, s);
        }

        public void toNetwork(FriendlyByteBuf pBuffer, WoodcutterRecipe pRecipe) {
            pBuffer.writeUtf(pRecipe.group);
            pRecipe.ingredient.toNetwork(pBuffer);
            pBuffer.writeItem(pRecipe.result);
        }

        @Override
        public RecipeSerializer<?> setRegistryName(ResourceLocation name) {
            return INSTANCE;
        }

        @Nullable
        @Override
        public ResourceLocation getRegistryName() {
            return ID;
        }

        @Override
        public Class<RecipeSerializer<?>> getRegistryType() {
            return Serializer.castClass(RecipeSerializer.class);
        }

        @SuppressWarnings("unchecked")
        private static <G> Class<G> castClass(Class<?> cls) {
            return (Class<G>)cls;
        }
    }
}

This is what my Recipe Type looks like.

Posted

I wonder whether not to extend it with the SingeItemRecipe class as it is in vanilla and use the access transormer to change the interface which is in the Serializer class which is in the above-mentioned class, which would allow to register the serializer in DeferredRegister.

Posted (edited)
34 minuty temu diesieben07 powiedział:

Dotyczy również tego typu RecipeType.

In this way? Because I really don't know.

 

Edited by Squander
Posted

[18:24:54] [Render thread/WARN] [minecraft/Minecraft]: Failed to load datapacks, can't proceed with server load
java.util.concurrent.ExecutionException: java.lang.NullPointerException: Registry Object not present: anymod:woodcutter
    at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396) ~[?:?] {}
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073) ~[?:?] {}
    at net.minecraft.client.Minecraft.makeWorldStem(Minecraft.java:2123) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.doLoadLevel(Minecraft.java:1949) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.lambda$doLoadLevel$36(Minecraft.java:1953) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screens.DatapackLoadFailureScreen.lambda$init$0(DatapackLoadFailureScreen.java:24) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.components.Button.onPress(Button.java:29) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.components.AbstractButton.onClick(AbstractButton.java:17) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.components.AbstractWidget.mouseClicked(AbstractWidget.java:111) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.components.events.ContainerEventHandler.mouseClicked(ContainerEventHandler.java:31) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.MouseHandler.lambda$onPress$0(MouseHandler.java:93) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screens.Screen.wrapScreenError(Screen.java:528) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.MouseHandler.onPress(MouseHandler.java:90) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.MouseHandler.lambda$setup$4(MouseHandler.java:195) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.client.MouseHandler.lambda$setup$5(MouseHandler.java:194) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar%2354!/:build 10] {}
    at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar%2360!/:build 10] {}
    at org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:3174) ~[lwjgl-glfw-3.2.2.jar%2354!/:build 10] {}
    at com.mojang.blaze3d.systems.RenderSystem.limitDisplayFPS(RenderSystem.java:187) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1095) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:668) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:205) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {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.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:24) ~[fmlloader-1.18.2-40.0.51.jar%230!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.3.jar%2310!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.3.jar%2310!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.3.jar%2310!/:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.3.jar%2310!/:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.3.jar%2310!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.3.jar%2310!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.3.jar%2310!/:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?] {}
Caused by: java.lang.NullPointerException: Registry Object not present: anymod:woodcutter
    at java.util.Objects.requireNonNull(Objects.java:334) ~[?:?] {}
    at net.minecraftforge.registries.RegistryObject.get(RegistryObject.java:320) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2375%2381!/:?] {re:classloading,xf:fml:forge:registry_object_binary_compat}
    at me.squander.anymod.recipe.WoodcutterRecipe.getType(WoodcutterRecipe.java:29) ~[%2380!/:?] {re:classloading}
    at net.minecraft.world.item.crafting.RecipeManager.apply(RecipeManager.java:72) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading}
    at net.minecraft.world.item.crafting.RecipeManager.apply(RecipeManager.java:34) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading}
    at net.minecraft.server.packs.resources.SimplePreparableReloadListener.lambda$reload$1(SimplePreparableReloadListener.java:12) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading}
    at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?] {}
    at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {}
    at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:65) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading}
    at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:146) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:22) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading}
    at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:116) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:129) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.client.Minecraft.makeWorldStem(Minecraft.java:2122) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    ... 33 more

Posted
2 minutes ago, Squander said:

Registry Object not present: anymod:woodcutter

did you register the DeferredRegister to the ModEventBos in your main mod class constructor

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Forge only supports Java Edition, you'll need to ask elsewhere for Pocket Edition support. Also, don't post in unrelated topics. I've split your post into its own topic.
    • How do I download mods for minecraft pe
    • I've tried multiple ways to get the chunk coordinates and none of them have worked, so I'm guessing it may be getChunk().  Is there another way to forcibly load a chunk on that same tick? If all else fails I guess I can just delay my action by a tick, but that's a pain in the butt and makes it more complex to provide appropriate feedback... Also welcome, Zander.  If you're searching for a similar solution, I hope this (eventually) helps you too 😅
    • My guess would be that you are not getting the chunk coordinates right, or getChunk dosnt work.
    • Hello, Recently I have been hosting an RLcraft server on Minecraft Forge Version 1.12.2 - 14.23.5.2860 I originally had lag issues and I chalked it up to playing on less than perfect hardware so I moved the server to better hardware(i9-9900k with 64GB of RAM for 1 player.) After lots of troubleshooting I discovered a couple of things. World saving was causing the MSPT to spike to over 2000Miliseconds and was happening every minute. This kind of makes sense as the world was pre-generated and is over 100GB. I learned that I could turn off world saving and just schedule that and that resolved that issue. After that issue was resolved I discovered another issue. It appears that when exploring chunks, any chunks explored stay loaded. They persist. I was originally thinking that this had to be a mod issue, but it didn't seem like anyone was talking about it. This isn't really a problem on packs with few worldgen mods or just few mods in general, but on beefier packs it becomes a problem. I went through forge changelogs and found this line. Build: 1.12.2-14.23.5.2841 - Thu Aug 29 01:58:50 GMT 2019 bs2609: Improve performance of persistent chunk checks (#5706) Is this a related item to what I am dealing with or just something else?   I went ahead and created a new dedicated server with Just Forge 14.23.5.2860, spark reforged, and it's core mods. I was able to replicate the issue and log it with spark. Hopefully you're able to see this spark profile. It basically shows that as I explored the chunk loading persisted(2000 chunks loaded over 10 minutes with one player)The view distance is set to 10 so that should be 200 chunks per player. If I don't move the loaded chunks are 200. I was however able to fix the persistent chunk issue if I save the world more frequently. My question is, is this intended function of the game or is this a bug? Everywhere I read seems to indicate Minecraft servers save every 5 minutes and not every minute. Can chunks not unload if the world does not autosave. Additionally. Autosave specifically appears to fix this issue. Manually running save-all does not resolve the issue.   I realize this is kind of a log one, sorry. Please let me know if you require further information. Thanks in advance for your time. https://spark.lucko.me/NvlMtC39Yt https://imgur.com/a/K0oyukx https://pastebin.com/z0qGu1Vh  
  • Topics

×
×
  • Create New...

Important Information

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