Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
Fix: running spawn checks as target, not source
Browse files Browse the repository at this point in the history
  • Loading branch information
0ffz committed Jan 28, 2024
1 parent 518c19f commit 60ec9b0
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.github.shynixn.mccoroutine.bukkit.minecraftDispatcher
import com.mineinabyss.geary.components.RequestCheck
import com.mineinabyss.geary.components.events.FailedCheck
import com.mineinabyss.geary.datatypes.GearyEntity
import com.mineinabyss.geary.helpers.temporaryEntity
import com.mineinabyss.geary.papermc.bridge.config.inputs.Input
import com.mineinabyss.geary.papermc.bridge.config.inputs.Variables
import com.mineinabyss.idofront.time.inWholeTicks
Expand Down Expand Up @@ -108,15 +109,17 @@ class SpawnTask {
//TODO this should be immutable but bukkit doesn't have an immutable location!
val spawnLoc = spawnInfo.getSpawnFor(choice.get() ?: SpawnPosition.GROUND)
val spawnCheckLoc = spawnLoc.clone().add(0.0, -1.0, 0.0)
val success = choice.callEvent({
set(spawnInfo)
set(
Variables.Evaluated(
entries = mapOf("location" to Input.of(spawnCheckLoc))
val success = temporaryEntity { target -> //TODO should just pass null for target
target.callEvent(init = {
set(spawnInfo)
set(
Variables.Evaluated(
entries = mapOf("location" to Input.of(spawnCheckLoc))
)
)
)
add<RequestCheck>()
}) { !it.has<FailedCheck>() }
add<RequestCheck>()
}, source = choice) { !it.has<FailedCheck>() }
}
if (success) {
// Must spawn mobs on main thread
if (mobzy.plugin.isEnabled) choice.callEvent(spawnInfo, DoSpawn(spawnLoc))
Expand Down

0 comments on commit 60ec9b0

Please sign in to comment.