KubeJS-Mods / KubeJS

https://kubejs.com
GNU Lesser General Public License v3.0
314 stars 91 forks source link

Fixed NPE due to `spawnerEither` is `null` and chest GUI deleting items picked up #912

Closed Prunoideae closed 1 month ago

Prunoideae commented 1 month ago

Description

Current FinalizeSpawn event has a nullable spawner, so

https://github.com/KubeJS-Mods/KubeJS/blob/eb9b153259f6219adc70f4e8482cd653a9fbd460/src/main/java/dev/latvian/mods/kubejs/level/SpawnerJS.java#L10

will throw NPE since spawner is null.

    @Nullable
    public Either<BlockEntity, Entity> getSpawner() {
        return this.spawner;
    }

Also fixed #911 by preventing player from picking up items if a chest GUI is opened.