iron431 / irons-spells-n-spellbooks

Other
77 stars 60 forks source link

[Bug] Server Disconnect when casting Lob Creeper Spell #643

Closed alfredggttv closed 3 weeks ago

alfredggttv commented 3 weeks ago

Observed behaviour

When casting "Lob Creeper" on a group of enemies, the server immediately disconnects the player with "Network Protocol Error".

Here is a clip: https://www.twitch.tv/ftb/clip/SparklingCourageousShrewThunBeast-ZzzkLmCpxcialyfU

Expected behaviour

The spell casts, and does not disconnect the player.

Steps to reproduce

  1. Equip "Lob Creeper" spell to a spellbook. The spellbook that was used was "Flimsy Journal."
  2. Cast the spell on mobs, and eventually get disconnected right as the spell connects.

Server Type

Dedicated Server

Crashlog

https://gist.github.com/alfredggttv/d5288a5d16968570333861aa3252952c

Iron's Spells N Spellbooks version

irons_spellbooks-1.21-3.7.1

Forge version

Neoforge 21.1.71

Other mods

No response

SiverDX commented 3 weeks ago

Looks more like it was caused by https://www.curseforge.com/minecraft/mc-mods/explosive-enhancement-reforged

[24Oct2024 13:54:23.682] [Render thread/ERROR] [net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl/]: Failed to handle packet net.minecraft.network.protocol.game.ClientboundExplodePacket@43101471
net.minecraft.ReportedException: Exception while adding particle
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.renderer.LevelRenderer.addParticle(LevelRenderer.java:2630) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.renderer.LevelRenderer.addParticle(LevelRenderer.java:2605) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.multiplayer.ClientLevel.addParticle(ClientLevel.java:714) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/explosiveenhancement@1.0.1/dev.xylonity.explosiveenhancement.ExplosiveHandler.spawnParticles(ExplosiveHandler.java:55) ~[explosiveenhancement-1.0.1.jar%23660!/:?]
    at TRANSFORMER/explosiveenhancement@1.0.1/dev.xylonity.explosiveenhancement.api.ExplosiveConfig.spawnParticles(ExplosiveConfig.java:39) ~[explosiveenhancement-1.0.1.jar%23660!/:?]
    at TRANSFORMER/explosiveenhancement@1.0.1/dev.xylonity.explosiveenhancement.api.ExplosiveConfig.spawnParticles(ExplosiveConfig.java:24) ~[explosiveenhancement-1.0.1.jar%23660!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.world.level.Explosion.handler$dee000$explosiveenhancement$finalizeExplosion(Explosion.java:549) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.world.level.Explosion.finalizeExplosion(Explosion.java:343) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.multiplayer.ClientPacketListener.handleExplosion(ClientPacketListener.java:1218) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.protocol.game.ClientboundExplodePacket.handle(ClientboundExplodePacket.java:121) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.protocol.game.ClientboundExplodePacket.handle(ClientboundExplodePacket.java:20) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:27) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:148) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.util.thread.BlockableEventLoop.runAllTasks(BlockableEventLoop.java:111) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.Minecraft.runTick(Minecraft.java:1155) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.Minecraft.run(Minecraft.java:807) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.main.Main.main(Main.java:230) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
    at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:136) ~[loader-4.0.24.jar%23133!/:4.0]
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.loading.targets.CommonLaunchHandler.clientService(CommonLaunchHandler.java:124) ~[loader-4.0.24.jar%23133!/:4.0]
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.loading.targets.CommonClientLaunchHandler.runService(CommonClientLaunchHandler.java:32) ~[loader-4.0.24.jar%23133!/:4.0]
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.loading.targets.CommonLaunchHandler.lambda$launchService$4(CommonLaunchHandler.java:118) ~[loader-4.0.24.jar%23133!/:4.0]
    at MC-BOOTSTRAP/cpw.mods.modlauncher@11.0.4/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-11.0.4.jar%23101!/:?]
    at MC-BOOTSTRAP/cpw.mods.modlauncher@11.0.4/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-11.0.4.jar%23101!/:?]
    at MC-BOOTSTRAP/cpw.mods.modlauncher@11.0.4/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-11.0.4.jar%23101!/:?]
    at MC-BOOTSTRAP/cpw.mods.modlauncher@11.0.4/cpw.mods.modlauncher.Launcher.run(Launcher.java:103) [modlauncher-11.0.4.jar%23101!/:?]
    at MC-BOOTSTRAP/cpw.mods.modlauncher@11.0.4/cpw.mods.modlauncher.Launcher.main(Launcher.java:74) [modlauncher-11.0.4.jar%23101!/:?]
    at MC-BOOTSTRAP/cpw.mods.modlauncher@11.0.4/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-11.0.4.jar%23101!/:?]
    at MC-BOOTSTRAP/cpw.mods.modlauncher@11.0.4/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-11.0.4.jar%23101!/:?]
    at cpw.mods.bootstraplauncher@2.0.2/cpw.mods.bootstraplauncher.BootstrapLauncher.run(BootstrapLauncher.java:210) [bootstraplauncher-2.0.2.jar:?]
    at cpw.mods.bootstraplauncher@2.0.2/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:69) [bootstraplauncher-2.0.2.jar:?]
Caused by: java.lang.ArithmeticException: / by zero
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.particle.ParticleEngine$MutableSpriteSet.get(ParticleEngine.java:621) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.particle.TextureSheetParticle.setSpriteFromAge(TextureSheetParticle.java:47) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/explosiveenhancement@1.0.1/dev.xylonity.explosiveenhancement.particle.custom.SmokeParticle.<init>(SmokeParticle.java:39) ~[explosiveenhancement-1.0.1.jar%23660!/:?]
    at TRANSFORMER/explosiveenhancement@1.0.1/dev.xylonity.explosiveenhancement.particle.custom.SmokeParticle$Provider.createParticle(SmokeParticle.java:85) ~[explosiveenhancement-1.0.1.jar%23660!/:?]
    at TRANSFORMER/explosiveenhancement@1.0.1/dev.xylonity.explosiveenhancement.particle.custom.SmokeParticle$Provider.createParticle(SmokeParticle.java:74) ~[explosiveenhancement-1.0.1.jar%23660!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.particle.ParticleEngine.handler$def000$explosiveenhancement$onMakeParticle(ParticleEngine.java:1710) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.particle.ParticleEngine.makeParticle(ParticleEngine.java:374) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.particle.ParticleEngine.createParticle(ParticleEngine.java:361) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.renderer.LevelRenderer.addParticleInternal(LevelRenderer.java:2675) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.renderer.LevelRenderer.addParticle(LevelRenderer.java:2620) ~[client-1.21.1-20240808.144430-srg.jar%23551!/:?]
    ... 33 more
SiverDX commented 3 weeks ago

To be more specific, this part

https://github.com/Xylonity/Explosive-Enhancement-Reforged/blob/98918f8db823c476a32e582a22a9e11c53fdd5a1/src/main/java/dev/xylonity/explosiveenhancement/particle/custom/SmokeParticle.java#L19

can roll 0, resulting in this failing

(the follow-up addition in that code also potentially fail to push the value above 1 (it's an integer), if they even get called in all cases)

public TextureAtlasSprite get(int pParticleAge, int pParticleMaxAge) {
   return this.sprites.get(pParticleAge * (this.sprites.size() - 1) / pParticleMaxAge);
}

which is called from:

public void setSpriteFromAge(SpriteSet pSprite) {
   if (!this.removed) {
      this.setSprite(pSprite.get(this.age, this.lifetime));
   }
}
iron431 commented 3 weeks ago

yeah i can reproduce this just by summoning vanilla fireballs with explosion power of 0, seems to be an issue with explosive enhancement

alfredggttv commented 3 weeks ago

Thank you so much for finding this! I have submitted and issue with that mod. I appreciate it!