#Adding a Redstone Flux capability to another script
49 messages · Page 1 of 1 (latest)
Paste version of flight_ring.js from @mint shard
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
I did look for documentation for PowerfulJS, but the only thing I could find was insufficient for my purposes
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
wait, what is curioTick()? Maybe you should be using that function instead
oh the documentation for this energy stuff is pretty bad
I almost got it working, but I'm having a problem with the unequip function being called whenever the items nbt is changed
@mint shard I got a working rf powered angel ring (this script doesn't work properly if multiple angel rings are equipped though)
Paste version of angel_ring.js from @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
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".
here is the crash log: https://mclo.gs/lsTsDBW
Paste version of mclo.gs/lsTsDBW from @mint shard
so it's the unequip funtion that trips it up
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
maybe the script could treat a player not wearing a flight ring as if they are wearing a dead one.
@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;
Wait a minute, Making an energy bar is possible in kubejs
Here's an improved script that has energy bars and might work in 1.19
Paste version of angel_ring.js from @frigid plinth
I'm not home at this moment, but I will test it when I do get home
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()
])
})
})
line #11 reports item undefined
Paste version of flight_ring.js from @mint shard
Paste version of mclo.gs/H27a2tyAA from @mint shard
Crashlog
you wrote .barWidth((slot)=>{
instead of .barWidth((item)=>{
can not find function isEquiped on line #86
Paste version of flight_ring.js from @mint shard
Paste version of mclo.gs/l4vku6w from @mint shard
You do not need to try and recreate that function, I do not need a flight ring.
I appologize on further thought, this response could have come off as rude and dismissive, that was not my intention.
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
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
did you know that there is already an angel ring mod.
https://www.curseforge.com/minecraft/mc-mods/angel-ring
and it has a 1.19.2 version
🤦♂️
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.
My pack has thermal expansion already so the thermal rings have recipes by default
I might decide to change them, but I wouldn't need to add them