#Adding a Redstone Flux capability to another script

49 messages · Page 1 of 1 (latest)

mint shard
open nebulaBOT
#

Paste version of flight_ring.js from @mint shard

crisp gardenBOT
#

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

mint shard
#

I did look for documentation for PowerfulJS, but the only thing I could find was insufficient for my purposes

frigid plinth
#

You'll likely have to use PowerfulJS and change how the flight ring is implemented.
You'll have to read the item in the curios slot every tick to make sure the player has power

#

A smart way of doing it would be to have an "isFlightRingEquiped" variable that toggles and saves the ring's curio slot whenever the curios is equipped/unequiped, that way your code only has to read the cached curios slot with the ring in it

#

Then read and subtract power every tick, and if there isn't enough power then turn off the player's flying ability.
Some items might be able to charge the ring in the curios slot so you should keep isFlightRingEquiped true and restore the flight ability when the ring has power again

frigid plinth
frigid plinth
#

oh the documentation for this energy stuff is pretty bad

frigid plinth
#

I almost got it working, but I'm having a problem with the unequip function being called whenever the items nbt is changed

frigid plinth
#

@mint shard I got a working rf powered angel ring (this script doesn't work properly if multiple angel rings are equipped though)

open nebulaBOT
#

Paste version of angel_ring.js from @frigid plinth

frigid plinth
#

If your pack lets you equip more than one ring then I'd recommend making a single curios slot specifically for the angel ring

#

Let me know if the script doesn't work in 1.19, I was testing it in 1.20

mint shard
#

I just checked, it crashes when I take it off due to the Curios API not having a public instance field or method named "getCuriosInventory".

open nebulaBOT
#

Paste version of mclo.gs/lsTsDBW from @mint shard

mint shard
#

so it's the unequip funtion that trips it up

frigid plinth
#

Oh that function didn't exist back in 1.19

#

I have to get to sleep now but tomorrow I'll try looking for the way to get the curios inventory in 1.19

mint shard
#

maybe the script could treat a player not wearing a flight ring as if they are wearing a dead one.

frigid plinth
#

@mint shard Try changing out the import for this

const $CuriosCapability = Java.loadClass('top.theillusivec4.curios.api.CuriosCapability')

and changing that line that crashes to this

if (player.getCapability($CuriosCapability.INVENTORY).resolve().get().isEquipped(Item.of('kubejs:flight_ring'))) return;
frigid plinth
#

Wait a minute, Making an energy bar is possible in kubejs

open nebulaBOT
#

Paste version of angel_ring.js from @frigid plinth

mint shard
#

I'm not home at this moment, but I will test it when I do get home

frigid plinth
#

This client script might show the energy in the tooltip in 1.19 but I haven't tested it. Forge changed how Energy Capabilities work in 1.20

const $CapabilityEnergy = Java.loadClass('net.minecraftforge.energy.CapabilityEnergy');
ItemEvents.tooltip(event => {
    event.addAdvanced(['kubejs:flight_ring'], (item, advanced, text) => {
        let energyCapability = item.getCapability($CapabilityEnergy.ENERGY).resolve().get();
        text.add(1, [
            Text.of(`Energy: ${energyCapability .getEnergyStored()} / ${energyCapability.getMaxEnergyStored()}`).gray()
        ])
    })
}) 
mint shard
open nebulaBOT
#

Paste version of flight_ring.js from @mint shard

mint shard
open nebulaBOT
#

Paste version of mclo.gs/H27a2tyAA from @mint shard

mint shard
#

Crashlog

frigid plinth
mint shard
open nebulaBOT
#

Paste version of flight_ring.js from @mint shard

mint shard
open nebulaBOT
#

Paste version of mclo.gs/l4vku6w from @mint shard

frigid plinth
#

bruh

#

It's going to take so much code to recreate this in 1.19

mint shard
#

You do not need to try and recreate that function, I do not need a flight ring.

mint shard
#

if you do end up finishing it anyway, may you please post it here. while I don't need one it would be nice to have

frigid plinth
#

If I do eventually go back to finishing it I'll share it here. The fix would require quite a few java imports to recreate the CuriosApi methods that didn't exist in 1.19

mint shard
#

and it has a 1.19.2 version

#

🤦‍♂️

manic hedge
#

And it uses power, you just have to add recipes to the thermal expansion rings and maybe retexture them if you don't like the look and a lang file to rename.

mint shard
#

I might decide to change them, but I wouldn't need to add them