#Spartan Weaponry Custom Weapon Tiers

207 messages · Page 1 of 1 (latest)

chrome isle
#

Trying to make custom spartan resonarium weapons for all material types in deeper and darker but the DDtiers doesn't exist

/*
[14:07:35] [ERROR] ! Caused by: java.lang.NullPointerException: Registry Object not present: deeperdarker:resonarium
[14:07:35] [ERROR] !   at net.minecraftforge.registries.RegistryObject.get(RegistryObject.java:572)
[14:07:35] [ERROR] !   at com.kyanite.deeperdarker.util.DDTiers.<clinit>(DDTiers.java:10)
*/
/*
The DDTiers Class Doesn't Exist For Some reason But IN the Github It Does....
[19Feb2026 14:07:54.370] [Render thread/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Caught exception during event RegisterEvent dispatch for modid deeperdarker
java.lang.NoClassDefFoundError: Could not initialize class com.kyanite.deeperdarker.util.DDTiers
*/
const $DDTIERS = Java.loadClass("com.kyanite.deeperdarker.util.DDTiers")
const $WEAPONAPI = Java.loadClass("com.oblivioussp.spartanweaponry.api")
const $WEAPONMATERIAL = Java.loadClass("com.oblivioussp.spartanweaponry.api.WeaponMaterial")
const $ModItemTags = Java.loadClass("com.oblivioussp.spartanweaponry.api.tags.ModItemTags")
const $ItemTags = Java.loadClass("net.minecraft.tags.ItemTags")
const $ModWeaponTraitTags = Java.loadClass("com.oblivioussp.spartanweaponry.api.tags.ModWeaponTraitTags")
const $RESONARIUM_PLATE = new $ModItemTags($ItemTags.create(), () => Ingredient.of("deeperdarker:resonarium_plate"))
$WEAPONMATERIAL.constructor("resonarium", "spartandeeperdarker", $DDTIERS.RESONARIUM, $ModItemTags.$RESONARIUM_PLATE, $ModWeaponTraitTags.IRON);
StartupEvents.registry('item', event => {
  event.createCustom('resonarium_dagger', () => new $daggeritem())
    let $daggeritem = $WEAPONAPI.createDagger($WEAPONMATERIAL.resonarium);
});

solemn jasperBOT
#

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

compact tulip
#

It can automatically create entire weapons based on material

#

and if it doesn't exist that most likely means you are using the wrong version

#

like the path could be wrong

compact tulip
compact tulip
#

ok but what version of the mod are you using? and you need to link it up to the correct github repo commit

#

because currently that is the latest commit

chrome isle
compact tulip
#

It only works if KubeJS has like a mod something tag

compact tulip
chrome isle
fluid finchBOT
#

Paste version of DDTiers.java from @chrome isle

chrome isle
#

deeperdarker-forge-1.20.1-1.3.3.jar

compact tulip
#

try to match up the github repo commit dates to your mod release date

chrome isle
#

the github update date is 2 years ago

compact tulip
#

ok and what about the github commit?

chrome isle
#

wait

#

yea right version

compact tulip
#

welp idk then. 🤷‍♂️ your code looks correct based on what I skimmed over

#

Perhaps try using ProbeJS to dump the classes

#

see what autocomplete tells you

chrome isle
#

i did and it just did not show 🫠

#

like????

compact tulip
#

so either it's ProbeJS being bad or maybe there's a typo?

chrome isle
#

probejs being bad

compact tulip
#

Makes things relatively simple

chrome isle
#

yea its crazy

#

the other classes load it just the tiers being evil

chrome isle
compact tulip
#

idk then 🤷‍♂️

#

If you want to use it purely with KubeJS scripts I don't believe it is possible but you could give it a try

compact tulip
chrome isle
#

:(

compact tulip
fluid finchBOT
#

[➤](#1471306844310867968 message)
The syntax:

  • Extending a class
new JavaAdapter(superclass, {
  override1() {/*     */},
  override2() {/* ... */},
  /* ... */
}, constructorArg1, constructorArg2, /* ... */, constructorArgN)
  • Extending a class while implementing interfaces
new JavaAdapter(superclass, interface1, interface2, /* ... */, interfaceN, {
  override1() {/*     */},
  override2() {/* ... */}
  /* ... */
  implementation1() {/* ... */},
  implementation2() {/* ... */},
  /* ... */
}, constructorArg1, constructorArg2, /* ... */, constructorArgN)
  • Extending an anonymous class or an interface(s)
new JavaAdapter(superclass, {
  override1() {/*     */},
  override2() {/* ... */},
})
new JavaAdapter(superclass, interface1, interface2, /* ... */, interfaceN, {
  override1() {/*     */},
  override2() {/* ... */}
  /* ... */
  implementation1() {/* ... */},
  implementation2() {/* ... */},
  /* ... */
})
new JavaAdapter(interface1, interface2, /* ... */, interfaceN, {
  implementation1() {/* ... */},
  implementation2() {/* ... */},
  /* ... */
})
compact tulip
#

I just made a script to add custom spartan weaponry traits so feel free to reference that

chrome isle
#
SpartanMaterial(String name, String modid, Tier tier, TagKey<Item> repairMaterial,
                           RegistryObject<WeaponTrait>... traits) {
        this(name, modid, tier, repairMaterial, List.of(traits), Map.of()) 

i cant read this properly

jaunty dawn
chrome isle
#

ooh

#

so i have to import class then tagkey.placeholder ?

jaunty dawn
#

I think you can get this with KubeJS

#

I don't see any type wrappers which would let you implicitly convert string to TagKey<Item>

#

Though it doesn't hurt to try

#

Alternatively:

const $Tags = Java.loadClass("dev.latvian.mods.kubejs.util.Tags")
$Tags.item("minecraft:signs") // will give a TagKey<Item>
chrome isle
#

hmm ok

jaunty dawn
#

And the traits is a vararg (so zero or more RegistryObject<WeaponTrait> objects)

chrome isle
#

I'll take a nap first and continue tomorrow

compact tulip
#

oh wait this is the one time when offline KubeJS docs is good

#

You can use it to see if that class actually exists/being loaded

#

ProbeJS not dumping the class might just be a ProbeJS issue

jaunty dawn
#

Java.loadClass it first, then re-dump

#

Or use ProbeJS Legacy, which I think can do a full dump - you must enable it with a command

compact tulip
jaunty dawn
#

If the class can't be Java.loadClass'd then it doesn't exist in the mod

compact tulip
#

true but it's in the github hence their confusion

jaunty dawn
#

GitHub may have a newer version of the mod than the one that is available right now

compact tulip
#

yes that's what I told him as well but the mod hasn't been updated in 2 years along with github

#

and he checked the right commit I believe

chrome isle
#

its nearly done but im struggling with registerSpartanWeapon

fluid finchBOT
#

Paste version of near.js from @chrome isle

chrome isle
#

is this normal?

#

[00:12:26] [ERROR] ! …rhino.EvaluatorException: Java class "krelox.spartantoolkit.WeaponItem" has no public instance field or method named "getMaterials". (startup_scripts:blue_phs_tier_example.js#14)

#

wait wrong error i think i fixed this one

chrome isle
#

Oh it's bad

#

I'm now stuck in the tagkey registration thing

chrome isle
fluid finchBOT
#

Paste version of message.js from @chrome isle

chrome isle
#
why?
#

idk how $registerSpartanWeapons works and idk why ForgeRegistries.ITEMS randomy manifests

#

the MATERIALS did not show an error so it prob works

#

the ITEM is the one i am stuck on currently

chrome isle
#
ITEMS = itemRegister(MODID)

 public SpartanCataclysm() {
        ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, Config.SPEC);

        IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
        SCEffects.register(modEventBus);
        SCSounds.register(modEventBus);

        registerSpartanWeapons(ITEMS);
        ITEMS.register(modEventBus);
        TRAITS.register(modEventBus);
        TABS.register(modEventBus);
    }
chrome isle
chrome isle
fluid finchBOT
#

Paste version of message.js from @chrome isle

chrome isle
#

@compact tulip can you please help ive been stuck for days 🫠 idk what i am doing

chrome isle
#

oh my

#

i think there was a custom weapons tier script but i can't find it

#

they made a custom toolset simmilar to this

#

but for another mod

#

🫠

#

this is for 1.16 but it "might" work

chrome isle
#
// priority: 0
const $TierSortingRegistry = Java.loadClass("net.minecraftforge.common.TierSortingRegistry")
const $Tiers = Java.loadClass("net.minecraft.world.item.Tiers")
const $ForgeTier = Java.loadClass("net.minecraftforge.common.ForgeTier")
const $BlockTags = Java.loadClass("net.minecraft.tags.BlockTags")
const $ItemTags = Java.loadClass("net.minecraft.tags.ItemTags")

// SPARTAN!!!
const $WEAPONAPI = Java.loadClass("com.oblivioussp.spartanweaponry.api.SpartanWeaponryAPI");
const $MATERIAL = Java.loadClass("com.oblivioussp.spartanweaponry.api.WeaponMaterial");
const $ModWeaponTraitTags = Java.loadClass("com.oblivioussp.spartanweaponry.api.tags.ModWeaponTraitTags")

const RESONARIUM_TIER = new $ForgeTier(3, 1193, 8, 3, 15, $BlockTags.create("forge:needs_resonarium_tool"), () => Ingredient.of("deeperdarker:resonarium_plate"))
$TierSortingRegistry.registerTier(RESONARIUM_TIER, "resonarium", [$Tiers.DIAMOND], [$Tiers.DIAMOND])

const WARDEN_TIER = new $ForgeTier(5, 2519, 10, 5, 18, $BlockTags.create("forge:needs_warden_tool"), () => Ingredient.of("deeperdarker:reinforced_echo_shard"))
$TierSortingRegistry.registerTier(WARDEN_TIER, "warden", [$Tiers.NETHERITE], [$Tiers.NETHERITE])
const RESONARIUM_MATERIAL = new $MATERIAL("resonarium", SpartanWeaponryAPI.MOD_ID, $TierSortingRegistry.byName("resonarium"), $ItemTags.create("deeperdarker:resonarium_plate"), $ModWeaponTraitTags.create("materials/resonarium"))
const WARDEN_MATERIAL = new $MATERIAL("resonarium", SpartanWeaponryAPI.MOD_ID, $TierSortingRegistry.byName("warden"), $ItemTags.create("deeperdarker:reinforced_echo_shard"), $ModWeaponTraitTags.create("materials/warden"))
const dagger = $WEAPONAPI.createDagger($MATERIAL.RESONARIUM_MATERIAL);

StartupEvents.registry("item", (e) => {
        event.createCustom("spartandeeperdarker:resonarium_spear", () => new dagger())
})```
jaunty dawn
#

Change java to Java.loadClass

chrome isle
#

oh yea oops

#

forgot abt hat

#

i have a feeling it might just kaboom

#

wait a second i dont need to use this tier bs

#
1) blue_phs_tier_example.js#18: The choice of Java method com.oblivioussp.spartanweaponry.api.tags.ModWeaponTraitTags.create matching JavaScript argument types (string) is ambiguous; candidate methods are: 
    class net.minecraft.tags.TagKey create(net.minecraft.resources.ResourceLocation)
    class net.minecraft.tags.TagKey create(java.lang.String)
jaunty dawn
#

String is implicitly convertible to both string and ResourceLocation, so KubeJS can't decide which overload to use

chrome isle
#

seems right?

#

ohh

jaunty dawn
#
$ModWeaponTraitTags['create(net.minecraft.resources.ResourceLocation)']("materials/resonarium")

Also, I see that you aren't providing a namespace here - so minecraft will be implicitly the namespace

#

Use your namespace instead of mod's namespace

chrome isle
#
ReferenceError: "SpartanWeaponryAPI" is not defined.
#

im so ass at this

jaunty dawn
#

SpartanWeaponryAPI.MOD_ID
Why are you trying to use Spartan's namespace anyway?

#

Use your own, like kubejs

chrome isle
#

im using spartandeeperdarker

jaunty dawn
#

Yeah, but in general don't try to register things under different mods' namespaces

chrome isle
#

oh yea im an idiot i forgot to change that 🫠

#

sorry

chrome isle
#
 Wrapped java.lang.IllegalStateException: Registry is already frozen

my code is cold? i guess, how do i heat it up

chrome isle
#

it kees freezing my god

chrome isle
jaunty dawn
#

I think the scripts related to registries fire too early/too late

#

So the registry is frozen during that time

#

Now I also noticed, that even if everything worked fine, you used the wrong name in the startup event:

StartupEvents.registry("item", (e) => {
        event.createCustom("spartandeeperdarker:resonarium_spear", () => new dagger())
})

You are using e as a parameter, but use event which isn't declared anywhere

#

Also, $WEAPONAPI.createDagger($MATERIAL.RESONARIUM_MATERIAL) already returns an instance of Item

#

No need to new it

#
const $TierSortingRegistry = Java.loadClass('net.minecraftforge.common.TierSortingRegistry')
const $Tiers = Java.loadClass('net.minecraft.world.item.Tiers')
const $ForgeTier = Java.loadClass('net.minecraftforge.common.ForgeTier')
const $BlockTags = Java.loadClass('net.minecraft.tags.BlockTags')
const $ItemTags = Java.loadClass('net.minecraft.tags.ItemTags')

// SPARTAN!!!
const $WEAPONAPI = Java.loadClass('com.oblivioussp.spartanweaponry.api.SpartanWeaponryAPI')
const $MATERIAL = Java.loadClass('com.oblivioussp.spartanweaponry.api.WeaponMaterial')
const $ModWeaponTraitTags = Java.loadClass('com.oblivioussp.spartanweaponry.api.tags.ModWeaponTraitTags')

StartupEvents.registry('item', event => {
  event.createCustom('spartandeeperdarker:resonarium_spear', () => {
    const RESONARIUM_TIER = new $ForgeTier(3, 1193, 8, 3, 15, $BlockTags.create('forge:needs_resonarium_tool'), () =>
      Ingredient.of('deeperdarker:resonarium_plate')
    )
    $TierSortingRegistry.registerTier(RESONARIUM_TIER, 'resonarium', [$Tiers.DIAMOND], [$Tiers.DIAMOND])

    const WARDEN_TIER = new $ForgeTier(5, 2519, 10, 5, 18, $BlockTags.create('forge:needs_warden_tool'), () =>
      Ingredient.of('deeperdarker:reinforced_echo_shard')
    )
    $TierSortingRegistry.registerTier(WARDEN_TIER, 'warden', [$Tiers.NETHERITE], [$Tiers.NETHERITE])
    const RESONARIUM_MATERIAL = new $MATERIAL(
      'resonarium',
      SpartanWeaponryAPI.MOD_ID,
      $TierSortingRegistry.byName('resonarium'),
      $ItemTags.create('deeperdarker:resonarium_plate'),
      $ModWeaponTraitTags.create('materials/resonarium')
    )
    const WARDEN_MATERIAL = new $MATERIAL(
      'resonarium',
      SpartanWeaponryAPI.MOD_ID,
      $TierSortingRegistry.byName('warden'),
      $ItemTags.create('deeperdarker:reinforced_echo_shard'),
      $ModWeaponTraitTags.create('materials/warden')
    )
    return $WEAPONAPI.createDagger(RESONARIUM_MATERIAL)
  })
})
#

I have no idea whether it's right though

chrome isle
#

It's been an hour

#

I just came back

#

It's stuck in 26%

#

Kjs did not produce any worthwhile logs

jaunty dawn
#

Hmm, infinite loop? 💀

chrome isle
fluid finchBOT
#

Paste version of mclo.gs/hzY0C0p from @chrome isle

chrome isle
#

yea

#

imma relaunch to double check

chrome isle
#

I need to tweak the script a little

#

[23:37:22] [Forge Version Check/INFO] [ne.mi.fm.VersionChecker/]: [corpse] Starting version check at https://update.maxhenkel.de/forge/corpse
[23:37:29] [Render thread/INFO] [de.ke.fa.cu.la.ScreenCustomizationLayerHandler/]: [FANCYMENU] ScreenCustomizationLayer registered: select_world_screen
[23:37:32] [Render thread/INFO] [de.ke.fa.cu.la.ScreenCustomizationLayerHandler/]: [FANCYMENU] ScreenCustomizationLayer registered: generic_dirt_message_screen
[23:37:33] [Render thread/INFO] [co.si.cr.Create/]: Created 551 recipes which will be injected into the game
[23:37:33] [Render thread/INFO] [co.si.cr.Create/]: Created 3 tags which will be injected into the game
[23:37:35] [Render thread/WARN] [ne.mi.re.ForgeRegistry/REGISTRIES]: Registry minecraft:item: Object did not get ID it asked for. Name: spartandeeperdarker:resonarium_dagger Expected: 5661 Got: 2381
[23:37:37] [Forge Version Check/WARN] [ne.mi.fm.VersionChecker/]: Failed to process update information

#
// priority: 0
const $TierSortingRegistry = Java.loadClass('net.minecraftforge.common.TierSortingRegistry')
const $Tiers = Java.loadClass('net.minecraft.world.item.Tiers')
const $ForgeTier = Java.loadClass('net.minecraftforge.common.ForgeTier')
const $BlockTags = Java.loadClass('net.minecraft.tags.BlockTags')
const $ItemTags = Java.loadClass('net.minecraft.tags.ItemTags')

// SPARTAN!!!
const MOD_ID = "spartandeeperdarker"
const $WEAPONAPI = Java.loadClass('com.oblivioussp.spartanweaponry.api.SpartanWeaponryAPI')
const $MATERIAL = Java.loadClass('com.oblivioussp.spartanweaponry.api.WeaponMaterial')
const $ModWeaponTraitTags = Java.loadClass('com.oblivioussp.spartanweaponry.api.tags.ModWeaponTraitTags')
    
const WARDEN_TIER = new $ForgeTier(5, 2519, 10, 5, 18, $BlockTags.create('forge:needs_warden_tool'), () =>
Ingredient.of('deeperdarker:reinforced_echo_shard'))
$TierSortingRegistry.registerTier(WARDEN_TIER, 'warden', [$Tiers.NETHERITE], [$Tiers.NETHERITE])



const WARDEN_MATERIAL = new $MATERIAL('warden',MOD_ID,$TierSortingRegistry.byName('warden'),
$ItemTags.create('deeperdarker:reinforced_echo_shard'), $ModWeaponTraitTags['create(net.minecraft.resources.ResourceLocation)']("materials/resonarium"))
 

StartupEvents.registry('item', event => {
  event.createCustom('spartandeeperdarker:resonarium_dagger', () => {

    const RESONARIUM_TIER = new $ForgeTier(3, 1193, 8, 3, 15, $BlockTags.create('forge:needs_resonarium_tool'), () =>
    Ingredient.of('deeperdarker:resonarium_plate'))
    $TierSortingRegistry.registerTier(RESONARIUM_TIER, 'resonarium', [$Tiers.DIAMOND], [$Tiers.DIAMOND])
   
    const RESONARIUM_MATERIAL = new $MATERIAL('resonarium',MOD_ID,$TierSortingRegistry.byName('resonarium'),
    $ItemTags.create('deeperdarker:resonarium_plate'), $ModWeaponTraitTags['create(net.minecraft.resources.ResourceLocation)']("materials/warden"))

    return $WEAPONAPI.createDagger(RESONARIUM_MATERIAL)
  })
})
#

its nearly working

#

it showed me a datapack error screen witch is very interesting...

jaunty dawn
#

This means an exception occured while loading the world

#

Look in console to see the exception

chrome isle
#

Caused by: net.minecraftforge.fml.loading.toposort.CyclePresentException: Cycles present in graph: [[ForgeTier[level=5, uses=2519, speed=10.0, attackDamageBonus=5.0, enchantmentValue=18, tag=TagKey[minecraft:block / forge:needs_warden_tool], repairIngredient=Proxy[ArrowFunction (0) => {...}]], NETHERITE], [ForgeTier[level=3, uses=1193, speed=8.0, attackDamageBonus=3.0, enchantmentValue=15, tag=TagKey[minecraft:block / forge:needs_resonarium_tool], repairIngredient=Proxy[ArrowFunction (0) => {...}]], DIAMOND]]

#

[22Feb2026 23:39:38.224] [Render thread/ERROR] [net.minecraft.client.Minecraft/FATAL]: Reported exception thrown!
net.minecraft.ReportedException: mouseClicked event handler

jaunty dawn
#

I think the second array should be empty here:

const WARDEN_TIER = new $ForgeTier(5, 2519, 10, 5, 18, $BlockTags.create('forge:needs_warden_tool'), () =>
Ingredient.of('deeperdarker:reinforced_echo_shard'))
$TierSortingRegistry.registerTier(WARDEN_TIER, 'warden', [$Tiers.NETHERITE], [])
#

Maybe the fact that you specified the tier to be both better and worse than Netherite

chrome isle
#

ohh

#

i tought you need two tiers so i just copy pasted netherite

#

ok here we come!

#

imma go pass out for a few hours brb

#

thankss!!!

jaunty dawn
#

Please fill in the namespace, else it will be implicitly minecraft

chrome isle
#

yea i fixed that a min ago

compact tulip
chrome isle
#

its not done yet i have to make the model paths

compact tulip
#

I might use your script for a modpack or just make it a spartan weaponry trait lol

chrome isle
#

and i want to mass register all weapons

#

im going to sleep byeee

chrome isle
#

i have no idea how to make constrcutor arrays it keeps saying "Java constructor for "com.oblivioussp.spartanweaponry.api.SpartanWeaponryAPI" with arguments "string" not found."

ignore the commented error ('StartupEvents.registry': Duplicate key 'spartandeeperdarker:resonarium_dagger') that was fixed

fluid finchBOT
#

Paste version of message.js from @chrome isle

compact tulip
#

This is where you might want to learn JavaAdapter

chrome isle
#

oh yea forgot about that

compact tulip
#

The syntax is provided in #1474144029435367576 by KonSola5

chrome isle
#
    let generator = new JavaAdapter($WEAPONAPI, {}, createweapon, RESONARIUM_MATERIAL)
    return generator

idk if i am doing it right

#
    let generator = new JavaAdapter($WEAPONAPI, {createweapon}, RESONARIUM_MATERIAL)
#
    let generator = new JavaAdapter($WEAPONAPI, createweapon, RESONARIUM_MATERIAL)

chrome isle
#

My array is an interface right?

chrome isle
#

Idk what am yapping abt

#

Keeps on combusting for fun

compact tulip
#

reference my custom geckolib armor or custom spartan weaponry weapon trait script to have a better idea of JavaAdapter

chrome isle
#

Hmm

#

Ok

#

Yea it's something to do with functions I see

chrome isle
#
    everyweapon.forEach((createweapon) => {
    let generator = new JavaAdapter($WEAPONAPI, {
             weaponcreator: function () {
                return new createweapon
        },
    }, RESONARIUM_MATERIAL)
    return generator
})

it said the adapter1 is not found

compact tulip
#

Can you send your entire code again?

chrome isle
#

Yea wait

fluid finchBOT
#

Paste version of Untitled.js from @chrome isle

compact tulip
#

you could try copying how the spartan weaponry addon toolkit does this. since one of the features says it does this automatically

chrome isle
fluid finchBOT
#

Paste version of message.java from @chrome isle

chrome isle
#
    protected final void registerSpartanWeapons(DeferredRegister<Item> items) {
        var bus = FMLJavaModLoadingContext.get().getModEventBus();

        for (WeaponType type : WeaponType.values()) {
            for (SpartanMaterial material : materials) {
                if (getBlacklist().contains(Pair.of(material, type))) continue;
                registerSpartanWeapon(items, material, type);
            }
        }
        bus.addListener(this::gatherData);
    }
#

i think they make a large array of weapontypes

compact tulip
#

yeah you're probably right

chrome isle
#

its neary done

#

!!!!!!!

#

!!!!!!!!

#

i only have texturing issues

#

idk why i did everything right

#

the flint looking ones are placeholders btw

#

the only problems is that the tools are "slightly" faster then normal

compact tulip
#

you can modify the attack speed

chrome isle
#

yea but its like nearly undectable

#

really small decimals

chrome isle
#

Oh it's fixed