Is there a way to make a script that allows me to pump out [insert liquid] from the Botania Manapool and update the contents in the pool itself?
Like iirc the Pool stores an integer value of max 1'000'000 Mana. Is there a way to write it so that 1 MB = 10 mana when it's pulled out from the pool?
I have a script already that creates a new fluid that i obviously labeled Mana, but I don't know how I would be able to write a script to make any Fluid Pipe interact with the Manapool, pump out the Mana and convert it immediately to the Mana Liquid for transportation.
#make a script to pump out Liquid from Botania Manapool
45 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Maybe even make the Manapool register as a tank
Adds Forge's Capability system integration for KubeJS. With PowerfulJS, you can retrieve, attach capabilities supported for ItemStacks, Block Entities and so on!
@ashen ermine thanks man!
there is no documentation for me to look up anything tho....
ProbeJS is an addon mod for KubeJS that generates typings files for VSCode, allowing VSCode to offer autocompletions for a ton of things!
Mod by @glacial rune
well, i wish i had the experience required to just look at anything ProbeJS gives you in VSCode and know what to do with it
sadly i dont and need to rely on documentation and explanations to guide me
Well, you can get documentation with the KubeJSOffline mod; just remember to run the /kubejsoffline command after you add more kubejs plugins.
It's not easy documentation to read, though.
Instead of documentation, are you looking for more like a tutorial?
not really a tutorial, more like example scripts where i can see what is done, how its written and explained what is happening.
I understand the very basics of KubeJS, i'm able to make my own recipes without an issue, create variables and write very basic functions.
But doing advanced things leave me very confused
@rancid compass sorry for bothering, can you help me in some way shape or form?
I'm not really good at writing guides, or tutorials, or creating examples. I also haven't worked with Capabilities at all.
damn... guess i'll just have to scrap the idea then
i haven't had time to look at this but i will try... let me cook
just editing the example
CapabilityEvents.blockEntity(event => {
event.attach("create:fluid_tank",
BotaniaCapabilityBuilder.MANA.blockEntity()
.receiveMana((be, amount) => {
let fluid = be.getCapability(ForgeCapabilities.FLUID_HANDLER).orElse(null)
fluid.fill(Fluid.water(amount), 'execute')
})
.getCurrentMana(be => {
let fluid = be.getCapability(ForgeCapabilities.FLUID_HANDLER).orElse(null)
return fluid.getFluidInTank(0).amount
})
.isFull(be => {
let fluid = be.getCapability(ForgeCapabilities.FLUID_HANDLER).orElse(null)
return fluid.getFluidInTank(0).amount >= fluid.getTankCapacity(0)
})
)
})```
but i think you want to use normal pipes or pumps to remove the liquid from the mana pool, right?
okay, this doesn't work but might be the idea
event.attach('botania:mana_pool',
CapabilityBuilder.FLUID.customBlockEntity()
.getCapacity(be => {
return be.persistentData.getInt('manaCap')
})
.getFluid(be => {
return Fluid.of('lava', be.persistentData.getInt('manaCap'))
})
.onDrain((be, fluidStack, simulate) => {
if(!(fluidStack.id == 'minecraft:lava')) return 0
let mana = be.persistentData.getInt('mana')
let extracted = Math.min(mana, fluidStack.amount)
if(!simulate){
be.persistentData.putInt('mana', mana - extracted)
}
return extracted
})
.onFill((be, fluidStack, simulate) => {
if(!(fluidStack.id == 'minecraft:lava')) return 0
let mana = be.persistentData.getInt('mana')
let received = Math.min(be.persistentData.getInt('manaCap') - mana, fluidStack.amount)
if(!simulate){
be.persistentData.putInt('mana', mana + received)
}
return received
})
)
Okay still doesn't work but getting there, you can pump and remove lava from the mana pool but the the mana doesn't change
event.attach('botania:mana_pool',
CapabilityBuilder.FLUID.customBlockEntity()
.getCapacity(be => {
return be.updateTag.getInt('manaCap')
})
.getFluid(be => {
return Fluid.of('lava', be.updateTag.getInt('manaCap'))
})
.onDrain((be, fluidStack, simulate) => {
if(!(fluidStack.id == 'minecraft:lava')) return 0
//let fluid = be.getCapability(ForgeCapabilities.FLUID_HANDLER).orElse(null)
let mana = be.updateTag.getInt('mana')
let extracted = Math.min(mana, fluidStack.amount)
if(!simulate){
be.updateTag.putInt('mana', mana - extracted)
//fluid.drain(fluidStack, 'execute')
}
return extracted
})
.onFill((be, fluidStack, simulate) => {
if(!(fluidStack.id == 'minecraft:lava')) return 0
//let fluid = be.getCapability(ForgeCapabilities.FLUID_HANDLER).orElse(null)
let mana = be.updateTag.getInt('mana')
let received = Math.min(be.updateTag.getInt('manaCap') - mana, fluidStack.amount)
if(!simulate){
be.updateTag.putInt('mana', mana + received)
//fluid.fill(fluidStack, 'execute')
}
return received
})
)```
event.attach('botania:mana_pool',
CapabilityBuilder.FLUID.customBlockEntity()
.getCapacity(be => {
return be.updateTag.getInt('manaCap')
})
.getFluid(be => {
return Fluid.of('lava', be.updateTag.getInt('manaCap'))
})
.onDrain((be, fluidStack, simulate) => {
if(!(fluidStack.id == 'minecraft:lava')) return 0
//let fluid = be.getCapability(ForgeCapabilities.FLUID_HANDLER).orElse(null)
let mana = be.updateTag.getInt('mana')
let extracted = Math.min(mana, fluidStack.amount)
if(!simulate){
be.updateTag.putInt('mana', mana - extracted)
be.setChanged()
//fluid.drain(fluidStack, 'execute')
}
return extracted
})
.onFill((be, fluidStack, simulate) => {
if(!(fluidStack.id == 'minecraft:lava')) return 0
//let fluid = be.getCapability(ForgeCapabilities.FLUID_HANDLER).orElse(null)
let mana = be.updateTag.getInt('mana')
let received = Math.min(be.updateTag.getInt('manaCap') - mana, fluidStack.amount)
if(!simulate){
be.updateTag.putInt('mana', mana + received)
be.setChanged()
//fluid.fill(fluidStack, 'execute')
}
return received
})
)```
still doesn't work
it ain't working yet, i'll see if i can try again tomorrow
but do you want to pump liquid in and out, like basically transport mana in liquid form or just pump out?
no, mostly out
I thought of only being able to have it pump out into any fluid container, so that i could use it for crafting recipes in machines and stuff.
It's not required to be able to put it back in.
I noticed that the Manapool holds an Int of 1'000'000 mana and i thought of making it be basically 1'000'000 mB of mana, aka 1'000 Buckets, to make things easier to track.
okay, i finally had some time to do this and it works now. i was having trouble with the nbt data not updating but now it works. maybe you have to filter if is the server side or client side to work on server but just create a new post here
CapabilityEvents.blockEntity(event => {
event.attach('botania:mana_pool',
CapabilityBuilder.FLUID.customBlockEntity()
.getCapacity(be => {
return be.updateTag.getInt('manaCap')
})
.getFluid(be => {
return Fluid.of('lava', be.updateTag.getInt('mana'))
})
.onDrain((be, fluidStack, simulate) => {
if(!(fluidStack.id == 'minecraft:lava')) return 0
//let fluid = be.getCapability(ForgeCapabilities.FLUID_HANDLER).orElse(null)
let mana = be.updateTag.getInt('mana')
let extracted = Math.min(mana, fluidStack.amount)
if(!simulate){
let data = Utils.server.getLevel('minecraft:overworld').getBlock(be.blockPos).entityData
data.merge({'mana':mana - extracted})
Utils.server.getLevel('minecraft:overworld').getBlock(be.blockPos).setEntityData(data)
}
return extracted
})
)
})
you just need to change lava for your mana fluid
Oh damn thank you so much man!
you really saved a whole idea chain for my project!
I see that it's specified which Mana Pool can be extracted from, would the script go insane if i'd just copy paste it and implement it for the creative pool and the upgraded Mana pool?
i remember seeing the creative mana pool with the 1kB in jade, but i forgot to test on it. but i should be as simple as copy pasting and changing the name of the block
okay i just notice something, this will only work in the overworld, damn
okay, so it works on all dimensions now but there still have a small visual bug that if you pump fluid out of the mana pool, it will still look like it has mana
CapabilityEvents.blockEntity(event => {
event.attach('botania:mana_pool',
CapabilityBuilder.FLUID.customBlockEntity()
.getCapacity(be => {
return be.updateTag.getInt('manaCap')
})
.getFluid(be => {
return Fluid.of('lava', be.updateTag.getInt('mana'))
})
.onDrain((be, fluidStack, simulate) => {
if(!(fluidStack.id == 'minecraft:lava')) return 0
let mana = be.updateTag.getInt('mana')
let extracted = Math.min(mana, fluidStack.amount)
if(!simulate){
if(be.level.isClientSide()) return extracted
let data = Utils.server.getLevel(be.level.dimension).getBlock(be.blockPos).entityData
data.merge({'mana':mana - extracted})
Utils.server.getLevel(be.level.dimension).getBlock(be.blockPos).setEntityData(data)
}
return extracted
})
)
})```
but it does work in all 3 mana pools that vanilla botania has
incluiding the creative one
