#disable machine function

14 messages · Page 1 of 1 (latest)

jaunty helm
#

can i disable a machine from processing if it is placed in a certain dimension ?

i want to disable pneumaticcraft compressors in ad_astra dimensions because you can't compress an atmosphere that isn't there

tawny shaleBOT
#

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

mellow star
#

just make compressor unplaceable in ad astra dimensions

jaunty helm
#

i was doing this as a temp fix. i want them to work in a pressurized space station

slender mason
#

I don't think it's possible to do that with a pre-built machine (Mekanism, Thermal).
But if you create your own machines with the Custom Machinery mod, I think that method is available.

jaunty helm
#

i'm using this now but i can't get it to work

#

const $OxygenApi = Java.loadClass("earth.terrarium.adastra.api.systems.OxygenApi")

BlockEvents.placed("pneumaticcraft:air_compressor", event => {
if ($OxygenApi.hasOxygen(event.level, event.block.pos)) return
event.cancel()
event.player.give(Item.of('pneumaticcraft:air_compressor', 1))

})
#

this error comes in
testing.js#4: Error in 'BlockEvents.placed': Java class "earth.terrarium.adastra.api.systems.OxygenApi" has no public instance field or method named "hasOxygen".

#

but then i look at the ad astra code
boolean hasOxygen(Level level, BlockPos pos);

/**
 * Returns whether the given entity has oxygen.
 *
 * @param entity The entity to check.
 * @return Whether the entity has oxygen.
 */
sleek fog
#

Can you send the github link to that code?

#

From what you posted, boolean hasOxygen(Level level, BlockPos pos), there's no public boolean and just boolean

jaunty helm
#

const OxygenApi = Java.loadClass("earth.terrarium.adastra.api.systems.OxygenApi")

BlockEvents.placed("pneumaticcraft:air_compressor", event => {
if (!OxygenApi.API.hasOxygen(event.level, event.block.pos)) {
event.player.tell("You can't place this here—no oxygen detected!")
event.cancel()
}
})
this works

#

an extra .api.