#Custom Recipe Type for Alexs Caves Nuclear Furnace

109 messages · Page 1 of 1 (latest)

normal forge
#

The ultimate in cursed scripts. The main beast is a startup script, and has an optional, but highly reccomended client part to fix JEI. And of course you add the actual new recipes in a server script.
It is for Forge, however requires fabric api through Forgified Fabric API.

Example of adding a golden apple to enchanted golden apple recipe with the scripts provided: (this part is server)

ServerEvents.recipes(event => {
    event.recipes.kubejs.nuclear_furnace('minecraft:enchanted_golden_apple', 'minecraft:golden_apple')
})

It uses exactly the same format as vanilla smelting recipes (including setting cooking time and such).

If you want it to still do blasting recipes as well you can add those to it using forEachRecipe:

ServerEvents.recipes(event => {
    event.forEachRecipe({type: "blasting"}, recipe => {
        const newJson = JsonIO.copy(recipe.json)
        newJson.addProperty('type', 'kubejs:nuclear_furnace')
        event.custom(newJson)
    })
})

NOTE: The recipes do not sync properly to clients in multiplayer, this is not easily fixable

misty fiberBOT
#

Paste version of startup_alexscaves_nuclear_recipe_type.js, client_alexscaves_nuclear_recipe_jeifixin.js from @normal forge

normal forge
#

if anyone has any questions about how any of this mess works feel free to ask

normal forge
#

Note there are three Java.loadClass lines that can be removed from the startup script: $BlockEntity, $AbstractCookingRecipe and $AbstractCookingRecipe as i was using them but am not anymore

candid kelp
#

Alex’s caves is a very good mod with great code practices and no bugs at all

signal lagoon
#

wait what? you have to download forgified fabric to edit the recipes on this thing?? how tf did alex do that

normal forge
#

by default it doesnt have its own recipe type

#

so its recipes are linked to the blast furnace (or normal furnace if you swap the config option)

#

this creates a new recipe type for the furnace

signal lagoon
#

aaah ok and including the fabric api gives you the right event timing to do that, I'm understanding more now, read through the other thread too

normal forge
#

yeah. forge has a similar event but it fires a tad early

#

oof, it seems the same magic cant work with creates blasting recipes, they hardcode it too much

charred salmon
wicked bobcat
#

@normal forge the attach capability mentioned doesn't work even if you try to change priorities of the event? still will be too early? pepethink

normal forge
#

the event fires in the nuclear furnace bock entities super constructor

#

which is before any of the fields in the nuclear furnace block entity have been set

#

priority only changes the timing in relation to other listeners of the event

wicked bobcat
#

oh, so they don't use the event at all?

normal forge
#

the event isnt intended for doing what i was trying to do

#

its for attaching a capability (like item insertion, or fluid extraction) to other mods stuff.
not setting initial values of fields

#

so technically yeah, they dont use the event
but if they did that would be horrible coding practice and would make no sense

topaz harness
#

Oh! This is perfect for what I needed.

indigo totem
#

now to make a recipe schema for it

#

oh wait nvm

#

you already did raha

wicked bobcat
#

he yoinked from blasting, since he didn't change 👍

fresh willow
#

does this work on the current release?

normal forge
#

it should work in latest 1.20.1 version

analog hornet
#

the amount of java access taking place here is concerning

wicked bobcat
#

dude is competing with squoshi

indigo totem
misty fiberBOT
#

Paste version of MagnaRegistry.js from @indigo totem

wicked bobcat
#

1.18

#

just update your game bro

indigo totem
#

nah i already have

#

1.20.1 now

#

that modpack is temporarily discontinued until i find a way to remake it in a newer version

sterile mesa
#

addon dev

muted lantern
#

Oh cool

#

What is the kubejs icon

#

I'm way far behind on this stuff

normal forge
sterile mesa
misty fiberBOT
#

I did it on desktop, but the arrow on the server pane -> linked -> kube then click through until it opens the kube website and verify/log in with discord then come back and press finish

indigo totem
left terrace
#

I dont understand this thing

ServerEvents.recipes(event => {
    event.forEachRecipe({type: "blasting"}, recipe => {
        const newJson = JsonIO.copy(recipe.json)
        newJson.addProperty('type', 'kubejs:nuclear_furnace')
        event.custom(newJson)
    })
})

How i can add custom craft with this?

indigo totem
#

You need the full script

#

The files are named accordingly to the script type

left terrace
#

i have this files

indigo totem
#

Okay, then use the first example

#

It shows you how to use the recipe

left terrace
#

yes, but first script delete all blasting recipes

#

that why i'm asking how use second script

normal forge
#

that server script script loops through all blasting recipes, makes a copy of them, then changes the type of the copy to the nuclear furnace type, then adds it

#

you just add it to your server scripts folder, it doesnt need any modification

left terrace
#

uh oh

#

thanks

valid vapor
#

Any idea how to make this work on a dedicated server without gettin a crash on startup due to loading fabric client classes on the server?

misty fiberBOT
#

Paste version of startup.log from @valid vapor

valid vapor
#

If commenting out the client lines from the startup script only on the server, is there any further handling that can be done to ensure Nuclear furnace recipes will show in JEI?

valid vapor
misty fiberBOT
#

Paste version of alexscaves_nuclear_furnace_recipe_type_clientside_commented.js from @valid vapor

valid vapor
#

feel free to ping

ebon kiln
#

Only a true big brain such as @normal forge can solve this! To the Bat Signal! hermitLUL

normal forge
#

hrm

#

if you /reload do the recipes show up

#

or actually F3 + T

valid vapor
normal forge
#

huh

#

so its probably network serializer related

#

this is probably going to be a massive pita to fix

valid vapor
#

Should we look into having a NuclearFurnaceJS addon made?

normal forge
#

id probably just pr to alexcaves at that point

valid vapor
#

We can explore options if you don't want to invest in this time sink. 😄

normal forge
#

ill see what i can do with kjs

normal forge
normal forge
#

looks like this cant be fixed by kubejs without manually syncing the recipes, which isnt that bad, but its also a lot more work than should be needed

#

the reason this is happening is because the serializer's method to write the recipe to the network uses the recipe class to retrieve the serializer, and because we reuse the smelting recipe class the recipe ends up saying its a smelting recipe, so that is how it is synced over the network

valid vapor
#

makes sense

#

this has been a good exercise in pushing limits to see just where the limits are. 😄

valid vapor
#

LOL

#

not mine

normal forge
#

i messed a bit with trying to get the recipes to sync, but ran into issues with trying to get it to work in all cases (singleplayer, hosting lan, joining lan, server) and not do weird stuff on server reload, so not going to bother pursuing that much further

valid vapor
#

Thanks for all you've done!

muted lantern
normal forge
#

yep, made by a friend of gennies

ebon kiln
#

I appreciate all your help on this Chief, you angel!

fallow summit
#

t

torpid bramble
#

So.... Does this work?

normal forge
#

yes, but it doesnt sync to clients on servers so jei is broken for servers

ebon kiln
#

@torpid bramble ^

torpid bramble
#

Oh that's excellent, thanks

#

I'm only just learning the ropes here, trying to customise a modpack with some friends - 640 mods and it still works 😳

normal forge
ebon kiln
#

you know, I might have misread what he told me...it might have been for a different mod hmmm

valid vapor
ebon kiln
#

same to you buddy!

valid vapor