terrarium-earth / Cadmus

A land claiming mod that allows users to claim land to protect your home from thieves, bandits and monsters, and admins to claim land with region flags and advanced protection!
MIT License
21 stars 8 forks source link

[Bug]: Crash with botania mod #34

Closed Weylend closed 6 months ago

Weylend commented 6 months ago

Bug Description

Server crashes when placing a Rannuncarpus block in claim

Botania-1.20.1-441-FABRIC.jar

How to Reproduce?

Install botania Place Rannuncarpus

Expected Behavior

No response

Version

1.0.2

Mod Loader Version

1.20.1 0.15.1

Mod Loader

Fabric

Logs or additional context

java.lang.NullPointerException: Cannot invoke "net.minecraft.class_1657.method_5667()" because "player" is null
    at earth.terrarium.cadmus.common.claims.ClaimApiImpl.canPlaceBlock(ClaimApiImpl.java:74)
    at net.minecraft.class_1747.handler$bag000$cadmus$place(class_1747.java:1016)
    at net.minecraft.class_1747.method_7712(class_1747.java)
    at vazkii.botania.common.block.flower.functional.RannuncarpusBlockEntity.tickFlower(RannuncarpusBlockEntity.java:118)
    at vazkii.botania.api.block_entity.SpecialFlowerBlockEntity.commonTick(SpecialFlowerBlockEntity.java:99)
    at net.minecraft.class_2818$class_5563.method_31703(class_2818.java:662)
    at net.minecraft.class_2818$class_5564.method_31703(class_2818.java:716)
    at net.minecraft.class_1937.method_18471(class_1937.java:470)
    at net.minecraft.class_3218.method_18765(class_3218.java:390)
    at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:897)
    at net.minecraft.class_3176.method_3813(class_3176.java:283)
    at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:824)
    at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:671)
    at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265)
    at java.base/java.lang.Thread.run(Thread.java:840)

Code of Conduct

ThatGravyBoat commented 6 months ago

This would also happen with a shulker box in a dispenser, this is due to BlockPlaceContext getPlayer being nullable, it should be assumed that if the player is null that it is from a machine and should use a separate check that does not have an associated player.

AlexNijjar commented 6 months ago

Fixed in 1508e0b