#disable machine function
14 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
just make compressor unplaceable in ad astra dimensions
i was doing this as a temp fix. i want them to work in a pressurized space station
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.
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.
*/
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
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.
Ticket closed!