Hex Casting

Hex Casting

6M Downloads

[BUG] Flight spell works indefinitely

sebek2435 opened this issue ยท 2 comments

commented

I haven't tested this much but on my friends fabric server when casting the flight spell I can cast it with values of 0 consuming 0 media and still be able to fly without any limits.

commented

I've also experienced this recently on fabric.

commented

Specific cause :
OpFlight.INSTANCE.tickDownFlight(evt.getEntityLiving()); is only registered as an event for Forge. The closest comparable call in FabricHexInitializer.kt is ServerTickEvents.END_WORLD_TICK.register(PlayerPositionRecorder::updateAllPlayers), which does not eventually touch OpFlight.INSTANCE.tickDownFlight and seems to mostly be focused on adjusting for MC's various player position jankiness.

Adding OpFlight.INSTANCE.tickDownFlight(player); into the main player loop at void updateAllPlayers(ServerLevel world) fixes the problem but kinda violates the Do One Thing Right rule; alternatively, adding into OpFlight and then registering as an EndWorldTick

fun fabricTickDownAllFlight(world: ServerLevel)
   {
       for (player in world.players()) {
           tickDownFlight(player)
       }
   }

Seems to be valid and more 'correct', albeit at the cost of less clear division between Fabric and Forge code.