Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

So I was creating a recipe, and now I have no errors in my code. But it still doesn't work for some reason, could you help me find the error? I'll provide my classes:

ISculptorRecipe (Recipe interface): https://pastebin.com/rX7c0wJP

SculptorRecipe (Recipe class): https://pastebin.com/fkfG41MJ

SculptorRecipeSerializer: (Recipe serializer): https://pastebin.com/kNPgSxcC

RecipeSerializerInit (Initializator for the serializer): https://pastebin.com/ZdfWNWyC

SculptorItemHandler (Item handler for the tile entity): https://pastebin.com/mp2vWqKs

pure_flux_crystal.json (Recipe file): https://pastebin.com/8n4uiHFG

 

Thank you in advance.

  • Author
3 minutes ago, diesieben07 said:

This bypasses the whole concept of DeferredRegister. You must create your registry entries inside the supplier you give to DeferredRegister#register.

 

You register an IRecipeType twice. Once in RecipeSerializerInit and once in ISculptorRecipe.

So it should look like this?:

 

public static final DeferredRegister<IRecipeSerializer<?>> RECIPE_SERIALIZERS = DeferredRegister.create( ForgeRegistries.RECIPE_SERIALIZERS, Humlands.MOD_ID);

public static final RegistryObject<IRecipeSerializer<?>> SCULPTOR_SERIALIZER = RECIPE_SERIALIZERS.register("sculptor", () -> new SculptorRecipeSerializer());

  • Author
Just now, diesieben07 said:

Did you fix the other issue I pointed out as well?

If you mean the duplicate recipe type, yes. I have removed the field in the Init.

8 minutes ago, Dr.Nickenstein said:

If you mean the duplicate recipe type, yes. I have removed the field in the Init

did you added the registration to your mod class constructor like this:

yourClass.RECIPE_SERIALIZERS.register(FMLJavaModLoadingContext.get().getModEventBus());

 

Edited by Luis_ST

  • Author
2 minutes ago, Luis_ST said:

did you added the registration to your mod class constructor like this:


yourClass.RECIPE_SERIALIZERS.register(FMLJavaModLoadingContext.get().getModEventBus());

 

Yes I did.

  • Author
1 minute ago, diesieben07 said:

Post updated code, ideally a Git repo.

Just now, diesieben07 said:

 

I haven't got a github repository, but I have got github on my desktop. Do I send pastebins or create a git repository? (If so, how?)

  • Author
1 minute ago, diesieben07 said:

Either works. A git repository is obviously more useful, as we can clone it and try out your code directly.

So I created the repository, but it's empty. How do I transfer my code in it?

  • Author
1 minute ago, diesieben07 said:

Nothing in your code even attempts to process the input item in your inventory. You made some methods in your TileEntity that find the matching recipe, but you never use them.

Also, do not create the LazyOptional every time in getCapability, create it once and store it in a field.

So what should I do?

  • Author
Just now, diesieben07 said:

I mean... you made the inventory. You decide which slot is which.

The inventory variable is in the tile entity, not in the item handler

  • Author
Just now, diesieben07 said:

What?!

Yep, the inventory variable is in the tile entity, and corresponds to the item handler class (SculptorItemHandler)

  • Author
Just now, diesieben07 said:

In onContentsChagned you check if the slot that changed is the input slot. If it is, you output the output slot based on the matching recipe.

Yes but how do I check if it is the input slot. What number of slot is the input slot?

  • Author
2 minutes ago, diesieben07 said:

I don't know. Its your inventory. You decide it which slot is which.

But I don't have any input or output variables

  • Author
1 minute ago, diesieben07 said:

What?

Like, each slot has an int assigned to it, right? I do not know which it is the input and which is the output

  • Author
1 minute ago, diesieben07 said:

If you don't know then you need to decide.

You made an inventory with two slots. That means you now have slot indices 0 and 1. You are the only person that can decide which is which. Pick one and act accordingly.

So I shouldn't create a variable or anything, I just need to keep it in my mind?

  • Author
1 minute ago, diesieben07 said:

You can make constants for it if you want to.

Ok so let's say that I know that 0 = input and 1 = output. What should I say in the method?

  • Author
1 minute ago, diesieben07 said:

Check if the slot that changed is 0 (input). Then get the matching recipe. Set its output to the output slot.

what was the method to get the matching recipe?

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.