1.15.2 Incompatible with Immersive Portals (Forge)
TheQKnight opened this issue ยท 0 comments
I have 3 mods installed: KubeJS (and MixinBootstrap), Immersive Portals and Advanced Mining Dimension.
My script should allow the player to teleport to the mining dimension when they go to level 1 in the overworld.
// On world load events
events.listen('world.load', event => {
event.server.runCommand('/gamerule sendCommandFeedback false')
})
// Dimension stacking
events.listen('player.tick', event => {
if (event.player.isFake()) return null
if (event.player.y == '1') {
if (event.player.getWorld().getDimension().toString() == 'DimensionType{minecraft:overworld}') {
event.server.runCommand(`/execute in mining_dimension:mining_world positioned ${event.player.x} ${event.player.y} ${event.player.z} run tp ${event.player} ~ 252 ~`)
event.server.schedule(3, event.server, cb => {
cb.data.runCommand(`/execute in mining_dimension:mining_world positioned ${event.player.x} 252 ${event.player.z} run fill ~ ~ ~ ~ ~1 ~ air replace #forge:stone`)
})
}
if (event.player.getWorld().getDimension().toString() == 'DimensionType{mining_dimension:mining_world}') {
event.server.runCommand(`/execute in minecraft:the_nether positioned ${event.player.x} ${event.player.y} ${event.player.z} run tp ${event.player} ~ 124 ~`)
event.server.schedule(3, event.server, cb => {
cb.data.runCommand(`/execute in minecraft:the_nether positioned ${event.player.x} 124 ${event.player.z} run fill ~ ~ ~ ~ ~1 ~ air replace #forge:stone`)
})
}
}
if (event.player.y == '125') {
if (event.player.getWorld().getDimension().toString() == 'DimensionType{minecraft:the_nether}') {
event.server.runCommand(`/execute in mining_dimension:mining_world positioned ${event.player.x} ${event.player.y} ${event.player.z} run tp ${event.player} ~ 2 ~`)
event.server.schedule(3, event.server, cb => {
cb.data.runCommand(`/execute in mining_dimension:mining_world positioned ${event.player.x} 2 ${event.player.z} run fill ~ ~ ~ ~ ~1 ~ air replace #forge:stone`)
cb.data.runCommand(`/execute in mining_dimension:mining_world positioned ${event.player.x} 1 ${event.player.z} run fill ~ ~ ~ ~ ~ ~ cobblestone_slab replace air`)
})
}
}
if (event.player.y == '253') {
if (event.player.getWorld().getDimension().toString() == 'DimensionType{mining_dimension:mining_world}') {
event.server.runCommand(`/execute in minecraft:overworld positioned ${event.player.x} ${event.player.y} ${event.player.z} run tp ${event.player} ~ 2 ~`)
event.server.schedule(1, event.server, cb => {
cb.data.runCommand(`/execute in minecraft:overworld positioned ${event.player.x} 2 ${event.player.z} run fill ~ ~ ~ ~ ~1 ~ air replace #forge:stone`)
cb.data.runCommand(`/execute in minecraft:overworld positioned ${event.player.x} 1 ${event.player.z} run fill ~ ~ ~ ~ ~ ~ cobblestone_slab replace air`)
})
}
}
})
This script will work perfectly without immersive portals installed, but will fail to run properly with it.
The /reload command also sometimes causes a memory leak (minecraft runs out of memory)