#Make a throwable item
30 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
const $TridentItem = Java.loadClass(`net.minecraft.world.item.TridentItem`)
const $ItemProperties = Java.loadClass(`net.minecraft.world.item.Item$Properties`)
StartupEvents.registry('item', event => {
event.custom(`kubejs:my_trident`, new $TridentItem(new $ItemProperties().defaultDurability(600)))
})
Havent tested this but it should work I think
Oh wait you are on fabric
yeah lol; is there any reason that shouldn't work though?
Not sure, ive never written anything for fabric and those are regular minecraft classes I dont think they are forge specific. You can try
thank you so much!
just to check; that makes an item into a trident, it doesn't create an item right?
It would create a new item with the id kubejs:my_trident that works like a trident
It wont show up in JEI since we are using event.custom so you would need to add a client script for that
JEIEvents.addItems(event => {
event.add('kubejs:my_trident')
});
how would I give it a texture and a damage value?
The damage value comes from the .defaultDurability(600) method in the code above, the texture would be in kubejs\assets\kubejs\textures\item\my_trident.png
Youre welcome, let me know if u run into any issues
The texture implementation isn't working ^^
Also, the thrown item has a trident texture ^^
Yeah I was thinking that may happen, you probably need a json model file as well since event.custom doesnt do it for you.
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "kubejs:item/my_trident"
}
}
assets/kubejs/models/item/my_trident.json
Is that inside of assets?
yep
cheers!
Awesome, the texture works! Unfortunately, throwing my custom trident creates a regular trident projectile. Is there any way to change this?
Ooh, yeah that would make sense. You would have to register a new trident entity and doing that in kubejs is a bit scary and janky. Heres an example of that but understand that it creates an arrow and it uses an already made arrow renderer class to work. I dont believe its possible to make an entirely new rendering class in KubeJS. If you wanted it to look different from a regular trident you would probably need to make a new renderer.
??notpossible
Just because someone said it isn't possible doesn't mean it actually is. Instead they meant that no one has successfully done it yet.
Be the first!

And even if you got the new trident entity working you would have to make it so that your custom trident spawns the custom trident entity, not the default one
auuugh alright