Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Killing the wither sometimes results in NPE #360

Closed
redstonekasi opened this issue Feb 27, 2024 · 0 comments
Closed

[BUG] Killing the wither sometimes results in NPE #360

redstonekasi opened this issue Feb 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@redstonekasi
Copy link

redstonekasi commented Feb 27, 2024

Killing the wither sometimes results in a NPE, the cause seems to be here:

Entity attackerEntity = source.getAttacker();
World world = attackerEntity.getWorld();
if (attackerEntity instanceof LivingEntity livingAttacker) {

Moving attackerEntity.getWorld(); into the if body succeeding that line should be a valid fix.

Minecraft version
1.20.1

Mod version
1.7.6

Crash Report

[20:49:42] [Server thread/ERROR]: Encountered an unexpected exception
net.minecraft.util.crash.CrashException: Ticking entity
        at net.minecraft.server.MinecraftServer.tickWorlds(MinecraftServer.java:901) ~[server-intermediary.jar:?]
        at net.minecraft.server.dedicated.MinecraftDedicatedServer.tickWorlds(MinecraftDedicatedServer.java:283) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:824) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:671) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265) ~[server-intermediary.jar:?]
        at java.lang.Thread.run(Thread.java:840) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.entity.Entity.getWorld()" because "attackerEntity" is null
        at net.minecraft.entity.boss.WitherEntity.handler$cmc000$spectrum$spawnEntity(WitherEntity.java:1641) ~[server-intermediary.jar:?]
        at net.minecraft.entity.boss.WitherEntity.dropEquipment(WitherEntity.java:482) ~[server-intermediary.jar:?]
        at net.minecraft.entity.LivingEntity.drop(LivingEntity.java:1411) ~[server-intermediary.jar:?]
        at net.minecraft.entity.LivingEntity.onDeath(LivingEntity.java:1366) ~[server-intermediary.jar:?]
        at net.minecraft.entity.LivingEntity.damage(LivingEntity.java:1222) ~[server-intermediary.jar:?]
        at net.minecraft.entity.boss.WitherEntity.damage(WitherEntity.java:474) ~[server-intermediary.jar:?]
        at net.minecraft.entity.LivingEntity.baseTick(LivingEntity.java:379) ~[server-intermediary.jar:?]
        at net.minecraft.entity.mob.MobEntity.baseTick(MobEntity.java:284) ~[server-intermediary.jar:?]
        at net.minecraft.entity.Entity.tick(Entity.java:474) ~[server-intermediary.jar:?]
        at net.minecraft.entity.LivingEntity.tick(LivingEntity.java:2380) ~[server-intermediary.jar:?]
        at net.minecraft.entity.mob.MobEntity.tick(MobEntity.java:351) ~[server-intermediary.jar:?]
        at net.minecraft.server.world.ServerWorld.tickEntity(ServerWorld.java:739) ~[server-intermediary.jar:?]
        at net.minecraft.world.World.tickEntity(World.java:480) ~[server-intermediary.jar:?]
        at net.minecraft.server.world.ServerWorld.method_31420(ServerWorld.java:385) ~[server-intermediary.jar:?]
        at net.minecraft.world.EntityList.forEach(EntityList.java:54) ~[server-intermediary.jar:?]
        at net.minecraft.server.world.ServerWorld.tick(ServerWorld.java:353) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.tickWorlds(MinecraftServer.java:897) ~[server-intermediary.jar:?]
        ... 5 more
@redstonekasi redstonekasi added the bug Something isn't working label Feb 27, 2024
@DaFuqs DaFuqs closed this as completed in 3323b43 Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant