Skip to content

Commit

Permalink
Improved aoe
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Nov 23, 2023
1 parent a724dd9 commit 354805d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,21 @@ object EffectAOE : Effect<AOECompileData>("aoe") {
}

override fun onTrigger(config: Config, data: TriggerData, compileData: AOECompileData): Boolean {
val location = data.dispatcher.get<LivingEntity>()?.eyeLocation
?: data.dispatcher.location
val location = data.location?.clone()
?: data.dispatcher.location?.clone()
?: return false

val dispatcherLocation = data.dispatcher.location

if (dispatcherLocation != null) {
if (location.world == dispatcherLocation.world
&& location.distanceSquared(dispatcherLocation) <= 1.0
) {
location.add(0.0, data.dispatcher.get<LivingEntity>()?.eyeHeight ?: 0.0, 0.0)
location.direction = dispatcherLocation.direction
}
}

val shape = compileData.shape ?: return false

for (entity in shape.getEntities(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,21 @@ object EffectAOEBlocks : Effect<AOECompileData>("aoe_blocks") {
}

override fun onTrigger(config: Config, data: TriggerData, compileData: AOECompileData): Boolean {
val location = data.dispatcher.get<LivingEntity>()?.eyeLocation
?: data.dispatcher.location
val location = data.location?.clone()
?: data.dispatcher.location?.clone()
?: return false

val dispatcherLocation = data.dispatcher.location

if (dispatcherLocation != null) {
if (location.world == dispatcherLocation.world
&& location.distanceSquared(dispatcherLocation) <= 1.0
) {
location.add(0.0, data.dispatcher.get<LivingEntity>()?.eyeHeight ?: 0.0, 0.0)
location.direction = dispatcherLocation.direction
}
}

val shape = compileData.shape ?: return false

for (block in shape.getBlocks(
Expand Down

0 comments on commit 354805d

Please sign in to comment.