#Any way to make fortune work on a custom ore?

110 messages · Page 1 of 1 (latest)

polar sand
#

So i'm trying to make fortune work on an ore from another mod. I tried to ask AI for help but no luck sadly. Can someone explain or make this script for me?

dusky grottoBOT
#

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

desert atlas
polar sand
#

i'm a literal noob cause i've never done this before

desert atlas
polar sand
#

i will try to make it work, but i need to edit the json inside the mod or create a new js file?

#

||sorry if i'm annoying lol||

#

This is what i did so far (i have no clue what most of the code does so forgive me if i did something really stupid)

desert atlas
#

say, if you have a custom ore called kubejs:some_ore, you should create the file at this path
(YOUR MODPACK)/kubejs/data/kubejs/loot_tables/blocks/some_ore.json

polar sand
#

ahhh

#

okay

#

i had to create the blocks folder manually

#

is that okay?

desert atlas
#

yes

#

but you named the file wrong

polar sand
#

what it needs to be?

desert atlas
#

It should be the name of your ore block

polar sand
#

good?

desert atlas
#

oh wait, you create the block in a different namespace?

polar sand
#

ummm, i'm not sure what this means

desert atlas
#

(YOUR MODPACK)/kubejs/data/majruszsdifficulty/loot_tables/blocks/some_ore.json

polar sand
#

no, that folder for the mod does not exist

#

should i create it and move the file to that folder?

desert atlas
#

yes

polar sand
#

okay

#

okay, i did it

#

i check if it works

#

the modpack loaded up without any error, but somehow it doesn't work

desert atlas
#

Does the block drop itself when mined with silk touch?

polar sand
#

yes

#

is this line needed?

desert atlas
#

Have you registered the shard item?

polar sand
#

likeee how?

desert atlas
#

like how you did with the block

polar sand
#

i don't think so

#

this is an existing mod in the pack, i just wanted fortune to work on this ore bc it does not works on it by basic

desert atlas
#

then it shouldn't be called custom ore

polar sand
#

my bad for that

#

english is not my first language

#

sooo is it still possible somehow or should i just stop trying?

desert atlas
#

Have you reload or reboot the game?

polar sand
#

launched for the first time today

#

but i reboot it every time when i change something

desert atlas
#

and you tested it in your single player world, right?

polar sand
#

yes

desert atlas
#

post the path where the json now locates

polar sand
desert atlas
#

and the name

polar sand
#

i copied the ore name from the mod

#

i got the mod jar open with winrar

desert atlas
#

send the latest log

quaint meteorBOT
#

Please send your Minecraft log. It can be found at ./logs/latest.log.
Note! Minecraft and KubeJS logs differ. Please send the latest.log, not a KubeJS log.
Please send the file directly, without links or snippets.

polar sand
quaint meteorBOT
#

Paste version of latest.log from @polar sand

desert atlas
#

weirdly I see nothing wrong

polar sand
#

oh... nice

#

but also not

#

weird

desert atlas
#

The block still only drops one shard?

polar sand
#

yes

#

i tried with: luck V tinkers pick (acts as fortune 5), netherite pick with fortune 3 / silk touch

desert atlas
#

well then, I have a small cursed trick for this

polar sand
#

let's see

#

||cursed movements needed? Like in hotel transylvania when the mummy tried to summon a sandstorm? xD||

desert atlas
# polar sand let's see

oh, but before that, change the item name in the loot table json into something else, like minecraft:emerald and check if the block starts to drop emerald.

polar sand
#

okay

#

like this?

desert atlas
#

yeah

polar sand
#

i reboot the pack

desert atlas
#

oh wait

#

wait

#

send the json here

polar sand
#

well... task manager than

quaint meteorBOT
#

Paste version of enderium_shard_ore.json from @polar sand

desert atlas
#

ok, seems right

polar sand
#

nice

desert atlas
#

btw you don't have to reboot

#

you can use /reload command

#

and the loot will be updated

polar sand
#

it just sits under the code line which should activate fortune (but it doesn't lol)

#

just weird for me to see "explosion decay" in a code like this

desert atlas
#

It's to determine how the loot will be affected by explosion

#

And some gamerule stuff

polar sand
#

oh, okay

#

drop does not changed

desert atlas
polar sand
#

tried with all 3 picks again

desert atlas
#

I can only guess the mod does something to prevent the loot from being overwritten

#

So one way is to listen to block broken event and add the bonus loot in the event

polar sand
#

sounds fine

#

and how can we do taht? pepethink

polar sand
#

i think i just give up on this...

desert atlas
# polar sand i think i just give up on this...
BlockEvents.broken("majruszsdifficulty:enderium_shard_ore", event => {
    const placeHolder = "minecraft:emerald"
    const desiredMaterial = "majruszsdifficulty:enderium_shard"
    const {level, player, player:{mainHandItem}, block} = event
    const $Block = Java.loadClass("net.minecraft.world.level.block.Block")
    const emeraldOre = Blocks.EMERALD_ORE
    const pseudoDrops = $Block.getDrops(emeraldOre.defaultBlockState(), level, block.pos, null, player, mainHandItem)
    pseudoDrops.forEach(drop => {
        if(drop.id != "minecraft:emerald") return;
        block.popItem(Item.of(desiredMaterial).withCount(drop.count))
    })
})

#

Put this in server script

polar sand
#

okay

#

it works

#

Thanks you!!!

#

i tried to understand the script

#

i can tell... my brain is not braining