Chunk getEntities call - Async bug with Crucible items
Summary
Bug that creates a long bug related to async and entity management. It is caused when summoning a cake in a birthday pack, VIA CRUCIBLE ITEMS. The standalone mob summoned will not have this behavior. Once summoned via the item skill, it will not be interactuable and will despawn if you attempt to do so.
Steps to reproduce If you can work on this issue and would like a copy of the pack or more code, please contact me :3 EndesMan#6878 https://www.youtube.com/watch?v=8kCiEQBOkNM Basically, installing the E-magination birthday pack, which, in a generic way, has crucible/mythic/modelengine interaction, and using any cake item to "summon" the cake" However, generically, seems to be reproducible by using any summon mechanic from a crucible item.
- summon{mob=choco_cake_em;amount=1;noise=0;r=0.1;yr=0;sync=true} @TargetLocation{conditions=[ - distance{d=0to4} true ]} ~onUse ?equipslot{slot=HAND}
choco_cake_em:
Type: silverfish
Display: 'Birthday Cake'
AITargetSelectors:
- 0 clear
AIGoalSelectors:
- 0 clear
Health: 40
Faction: Cake
DamageModifiers:
- FIRE 0
- MAGIC 1.1
- PROJECTILE 0.25
Damage: 1
KillMessages:
- '<target.name> was killed by a cake. How? uh... xd'
Drops:
- exp 10-25 1
Skills:
- message{m="Hitrec <caster.var.hitrec> STACKS"} @PlayersNearOrigin{r=75} ~onDamaged 0 #DEBUGMESSAGE
#====== MODEL ASSIGNEMENT =============
- model{mid=em_choco_cake;s=idle;n=false;damagetint=false} @self ~onSpawn 1
- lockmodel{l=true} @Self ~onSpawn
- submodel{mid=em_choco_cake;subpartid=stages;remove=true} @self ~onSpawn 1
- sound{s=entity.chicken.egg;pitch=1.4} @self ~onSpawn
- sound{s=block.honey_block.place;pitch=0.9} @self ~onSpawn
- takeitem{i=choco_cake_em;a=1} @Parent ~onSpawn
#LOCATION ASSIGNEMENT
- setvariable{var=caster.locationx;value="<caster.l.x>";t=integer} @Self ~onSpawn
- setvariable{var=caster.locationy;value="<caster.l.y>";t=integer} @Self ~onSpawn
- setvariable{var=caster.locationz;value="<caster.l.z>";t=integer} @Self ~onSpawn
- teleport{spreadh=0;spreadv=0} @Location{c=<caster.l.x>+0.5,<caster.l.y>+0.3,<caster.var.locationz>+0.5,0,-1;delay=0} ~onSpawn
- look{headOnly=false;immediately=false;repeat=40;repeatInterval=1;delay=0} @Location{c=<caster.l.x>,<caster.l.y>,<caster.var.locationz>+0.5,0,-1} ~onSpawn
- teleport{spreadh=0;spreadv=0} @Location{c=<caster.l.x>+0.5,<caster.l.y>+1,<caster.var.locationz>+0.5,0,-1;delay=2} ~onSpawn ?!inblock{b=air}
#=========
#SLICES MANAGEMENT
- setvariable{var=caster.slices;value="14";t=integer} @Self ~onSpawn
- playanimation{a=0;audience=World} @Trigger ~onSignal:CAKE_SLICE
- skill{s=slice_cake_em_choco_cake;sync=true} ~onSignal:CAKE_SLICE
- skill{s=slice_cake_em_choco_cake;sync=true} ~onDamaged
- skill{s=soplamientum_cako;sync=true} ~onDamaged
- dropitem{i=choco_slice;repeat=<caster.var.slices>;repeatinterval=1} @SelfLocation{y=0.5} ~onDeath
# CANDLE MANAGEMENT
- skill{s=candle_light_em_choco_cake} @self ~onInteract
Options:
Silent: true
AlwaysShowName: false
MovementSpeed: 0.0001
Interactable: true
PreventOtherDrops: true
KnockbackResistance: 1
PreventSunburn: true
Collidable: false
`
```
could be an example.
**Current behavior**
Console outputs this error every single time the "cake mob" is summoned. Firstly, the cake does not teleport to adjust to the grid, nor does any of the above listed skills, for example, removing the "cake item (summoner)" from the parent's hands. (Maybe this has to do with @parent?) It is not interactuable, and when trying to do so, the cake will despawn and produce no console log whatsoever.
`[14:34:11 ERROR]: Thread lumine-scheduler-12 failed main thread check: Chunk getEntities call
java.lang.Throwable: null
at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:15) ~[paper-1.19.4.jar:git-Paper-492]
at net.minecraft.server.level.ServerLevel.getEntities(ServerLevel.java:2416) ~[?:?]
at net.minecraft.server.level.ServerLevel.getEntity(ServerLevel.java:1880) ~[?:?]
at org.bukkit.craftbukkit.v1_19_R3.CraftServer.getEntity(CraftServer.java:2500) ~[paper-1.19.4.jar:git-Paper-492]
at org.bukkit.Bukkit.getEntity(Bukkit.java:2059) ~[paper-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at io.lumine.mythic.bukkit.BukkitBootstrap.getEntity(BukkitBootstrap.java:128) ~[MythicMobs-5.2.5-SNAPSHOT.jar:?]
at io.lumine.mythic.core.mobs.ActiveMob.getParent(ActiveMob.java:332) ~[MythicMobs-5.2.5-SNAPSHOT.jar:?]
at io.lumine.mythic.core.skills.targeters.ParentTargeter.getEntities(ParentTargeter.java:26) ~[MythicMobs-5.2.5-SNAPSHOT.jar:?]
at io.lumine.mythic.core.skills.AbstractSkill.evaluateTargets(AbstractSkill.java:359) ~[MythicMobs-5.2.5-SNAPSHOT.jar:?]
at io.lumine.mythic.core.skills.AbstractSkill.evaluateTargets(AbstractSkill.java:347) ~[MythicMobs-5.2.5-SNAPSHOT.jar:?]
at io.lumine.mythic.core.skills.SkillMechanic.executeSkills(SkillMechanic.java:461) ~[MythicMobs-5.2.5-SNAPSHOT.jar:?]
at io.lumine.mythic.core.skills.SkillMechanic.execute(SkillMechanic.java:425) ~[MythicMobs-5.2.5-SNAPSHOT.jar:?]
at io.lumine.mythic.core.mobs.MobType.lambda$executeSkills$6(MobType.java:1208) ~[MythicMobs-5.2.5-SNAPSHOT.jar:?]
at io.lumine.mythic.bukkit.utils.Delegates$RunnableToSupplier.get(Delegates.java:121) ~[MythicMobs-5.2.5-SNAPSHOT.jar:?]
at io.lumine.mythic.bukkit.utils.promise.LuminePromise$SupplyRunnable.run(LuminePromise.java:654) ~[MythicMobs-5.2.5-SNAPSHOT.jar:?]
at io.lumine.mythic.bukkit.utils.tasks.LumineExecutors$SchedulerWrappedRunnable.run(LumineExecutors.java:70) ~[MythicMobs-5.2.5-SNAPSHOT.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
[14:34:11 ERROR]: [MythicMobs] [SCHEDULER] Exception thrown whilst executing task
[14:34:11 WARN]: java.lang.IllegalStateException: Asynchronous Chunk getEntities call!
[14:34:11 WARN]: at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:16)
[14:34:11 WARN]: at net.minecraft.server.level.WorldServer.E(WorldServer.java:2416)
[14:34:11 WARN]: at net.minecraft.server.level.WorldServer.a(WorldServer.java:1880)
[14:34:11 WARN]: at org.bukkit.craftbukkit.v1_19_R3.CraftServer.getEntity(CraftServer.java:2500)
[14:34:11 WARN]: at org.bukkit.Bukkit.getEntity(Bukkit.java:2059)
[14:34:11 WARN]: at MythicMobs-5.2.5-SNAPSHOT.jar//io.lumine.mythic.bukkit.BukkitBootstrap.getEntity(BukkitBootstrap.java:128)
[14:34:11 WARN]: at MythicMobs-5.2.5-SNAPSHOT.jar//io.lumine.mythic.core.mobs.ActiveMob.getParent(ActiveMob.java:332)
[14:34:11 WARN]: at MythicMobs-5.2.5-SNAPSHOT.jar//io.lumine.mythic.core.skills.targeters.ParentTargeter.getEntities(ParentTargeter.java:26)
[14:34:11 WARN]: at MythicMobs-5.2.5-SNAPSHOT.jar//io.lumine.mythic.core.skills.AbstractSkill.evaluateTargets(AbstractSkill.java:359)
[14:34:11 WARN]: at MythicMobs-5.2.5-SNAPSHOT.jar//io.lumine.mythic.core.skills.AbstractSkill.evaluateTargets(AbstractSkill.java:347)
[14:34:11 WARN]: at MythicMobs-5.2.5-SNAPSHOT.jar//io.lumine.mythic.core.skills.SkillMechanic.executeSkills(SkillMechanic.java:461)
[14:34:11 WARN]: at MythicMobs-5.2.5-SNAPSHOT.jar//io.lumine.mythic.core.skills.SkillMechanic.execute(SkillMechanic.java:425)
[14:34:11 WARN]: at MythicMobs-5.2.5-SNAPSHOT.jar//io.lumine.mythic.core.mobs.MobType.lambda$executeSkills$6(MobType.java:1208)
[14:34:11 WARN]: at MythicMobs-5.2.5-SNAPSHOT.jar//io.lumine.mythic.bukkit.utils.Delegates$RunnableToSupplier.get(Delegates.java:121)
[14:34:11 WARN]: at MythicMobs-5.2.5-SNAPSHOT.jar//io.lumine.mythic.bukkit.utils.promise.LuminePromise$SupplyRunnable.run(LuminePromise.java:654)
[14:34:11 WARN]: at MythicMobs-5.2.5-SNAPSHOT.jar//io.lumine.mythic.bukkit.utils.tasks.LumineExecutors$SchedulerWrappedRunnable.run(LumineExecutors.java:70)
[14:34:11 WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[14:34:11 WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[14:34:11 WARN]: at java.base/java.lang.Thread.run(Thread.java:833)`
**Intended correct behavior**
https://www.youtube.com/watch?v=8kCiEQBOkNM
In earlier versions, it works exactly as the video, you can place down cakes and interact with then to slice them or lit their candles.
The cakes are thus interactuable, and will teleport to adjust to the world grid, which is not happening when this bug occurs.
**Server log file**
https://pastebin.com/6sLWp4wS
**Debug log snippet**
https://pastebin.com/mcUm8v7E
**Proposed fixes**
Maybe the stuff has to do with how crucible is handling async/sync casts, since adding sync=true to the mechanics isn't working, and summoning the desired mobs via /mm m spawn makes them work exactly as intended.