#StartupEvents.registry() related questions.

76 messages · Page 1 of 1 (latest)

fervent shore
#

Heya all again cat_heart_lex
I've read this bit on kjs wiki https://mods.latvian.dev/link/47#bkmrk-folder-method-cancel, custom stat, what does it exactly mean >.>? Can I use modded Registry as the point of execution for the script? if so, how would I do that ^^"?
Also what is exactly Point of interest type and painting variant? Thx in advance SCCUTE
More context: I'm trying to create custom Mekanism Infuse Types mlem

errant saddleBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

sinful granite
#

I think point of interest might be villager related

#

But I have no idea

#

Like when a certain villager will go to some points maybe hmmm

indigo light
#

"POIs are used in minecraft to define different special places across the world. "

fervent shore
#

That is good to know, thx cat_heart_lex

#

Anyway, how about Custo... no wait that is literally statistics for Leadboards am I right?

indigo light
#

(also I'm trying out some things about the mekanism infuse types rn, but I can't get anything to work :/)

indigo light
#

so I think I found a (very hacky) way, but I got an error "class is not allowed by class filter"

#

but in the config there isn't an option to disable the class filter

fervent shore
#

Anything at this point should work nkoGiggle Can you send it here cat_heart_lex?

indigo light
#
const InfuseTypeDeferredRegister = Java.loadClass('mekanism.common.registration.impl.InfuseTypeDeferredRegister')
const JavaModLoadingContext = Java.loadClass('net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext')
const InfuseTypes = new InfuseTypeDeferredRegister('modid')
const TestInfuseType = InfuseTypes.register('test', 4210752)
InfuseTypes.createAndRegisterChemical(JavaModLoadingContext.get().getModEventBus())

note, this doesn't work because of the class filter

#

(the class net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext is blocked)

fervent shore
#
// const MekanismAPI = Java.loadClass('mekanism.api.MekanismAPI')
const InfuseType = Java.loadClass('mekanism.api.chemical.infuse.InfuseType')
const InfuseTypeDeferredRegister = Java.loadClass('mekanism.common.registration.impl.InfuseTypeDeferredRegister')
const InfuseTypeRegistryObject = Java.loadClass('mekanism.common.registration.impl.InfuseTypeRegistryObject')

// StartupEvents.registry(MekanismAPI.infuseTypeRegistryName(), (event) => {
StartupEvents.postInit((event) => {
    console.log("Does this even work? /////////////////////////////////////////////////////////////////////////////////")
    let InfuseTypes = new InfuseTypeDeferredRegister('enigmatica')

    // Registering new Infuse Types
    let zinc = InfuseTypes.register('zinc', 0x3df58a)
})

Pretty similar to what I was trying tot do.. except I didn't use the modloading context mlem

#

(Because I just recently started learning how forge mods work ^^")

indigo light
indigo light
fervent shore
#
public class MekanismInfuseTypes {

    private MekanismInfuseTypes() {
    }

    public static final InfuseTypeDeferredRegister INFUSE_TYPES = new InfuseTypeDeferredRegister(Mekanism.MODID);

    public static final InfuseTypeRegistryObject<InfuseType> CARBON = INFUSE_TYPES.register("carbon", 0x404040);
}
indigo light
#

maybe not 😅

fervent shore
#

So now.. just how we will bypass that registry problem hmm_cat

#

I could technically ask on Mekanism Discord, but not sure if they will not send me here back

indigo light
#

we would have to disable the class filter (which isn't an option in the config)

fervent shore
#

Wait are you sure it isn't an option for this in the config?

#

Or is it broken like half of the KubeJS atm?

#

as.. I have it mlem

indigo light
#

weird

#

I don't...

fervent shore
#

Interesting hmm_cat

#

Well let me boot up the game with your code and see

#

welp

indigo light
#

does it work?

warm drumBOT
#

[Quote ➤](#1058350467878486016 message) Or is it broken like half of the KubeJS atm?

fervent shore
#

Yes it is broken

#

'net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext': Class is not allowed by class filter! (startup_scripts:mekanism_infuse.js#5)****

indigo light
#

:/

fervent shore
#

Welp, time to bother Rid to add Custom Infuse Types Support to Emendatus Enigmatica

indigo light
#

or just make a mod

fervent shore
#

That would make sense as part of the compat to EE tho Pika_Think

#

And there is no way I will learn forge modding enough to make this any time soon myself kek

indigo light
#

I think I would be able to make it myself

#

but anyway

indigo light
fervent shore
#

#560583846509281280 message

#

Oh. Right Mek server doesn't have gnome mlem

fervent shore
#

Anyway, gonna close this, as pretty much we tried to make custom infuse types, but we failed so mlem

errant saddleBOT
#

Ticket closed!

tawdry umbra
#

@fervent shore did Pie get you squared away? just whipped up something that worked

hybrid terrace
#

I lead him onto the right path, that was his working example he made

fervent shore
#

Yup, pretty much what I've sent on Pie dms 😅

#

Again, tanku a lot cat_heart_lex

tawdry umbra
#
const MekanismAPI = Java.loadClass('mekanism.api.MekanismAPI')
const Gas = Java.loadClass('mekanism.api.chemical.gas.Gas')
const GasBuilder = Java.loadClass('mekanism.api.chemical.gas.GasBuilder')

// pick a registry event so we're in the right time frame
StartupEvents.registry("item", event => {
    const GasRegistry = MekanismAPI.gasRegistry()
    let CobaltGasBuilder = GasBuilder.builder().color(3949738)
    let CobaltGas = Gas(CobaltGasBuilder)
    GasRegistry['register(java.lang.String,java.lang.Object)']("cobalt", CobaltGas)
})```
I went this route
fervent shore
#

That is gas however, not Infuse type hmm_cat

tawdry umbra
#

right, still same process

fervent shore
#

Good to know how to do custom gases tho! kibzL

tawdry umbra
#

it's just which of the 4 chemicals you go with

fervent shore
#

o.o

hybrid terrace
#

Those aren’t infuse types, which is slightly different but I still think it’s cool how you did custom gases Enigma

fervent shore
#

It is a lot more of "How you should do it" way than what we found >.>
Our is kinda, hacky mlem

hybrid terrace
#

Ehhh, it’s just using a differed register that already exists to register new infuse types

tawdry umbra
#

I tried in the postinit like you were, but forge bitches it's too late to add stuff to a register

fervent shore
fervent shore
tawdry umbra
#
const MekanismAPI = Java.loadClass('mekanism.api.MekanismAPI')
const InfuseType = Java.loadClass('mekanism.api.chemical.infuse.InfuseType')
const InfuseTypeBuilder = Java.loadClass('mekanism.api.chemical.infuse.InfuseTypeBuilder')

// pick a registry event so we're in the right time frame
StartupEvents.registry("item", event => {
    const InfuseTypeRegistry = MekanismAPI.infuseTypeRegistry()
    let ZincInfuseTypeBuilder = InfuseTypeBuilder.builder().color(4060554)
    let ZincInfuseType = InfuseType(ZincInfuseTypeBuilder)
    InfuseTypeRegistry['register(java.lang.String,java.lang.Object)']("zinc", ZincInfuseType)
})```
infuse types are really no different, the only chemical builder that starts to get a lil more complex is the slurries
fervent shore
#

For the slurries we have EE 😄
Tanku you soo much EnigmaQuip and Pie cat_heart_lex