Safe-cast to ServerPlayerEntity

This commit is contained in:
charlotte ✨ 2022-04-10 17:33:35 +01:00
parent ddfbf4593d
commit 50745d7923
1 changed files with 13 additions and 12 deletions

View File

@ -16,7 +16,7 @@ public abstract class MixinSlot {
// Denying item moving etc.
@Inject(method = "canTakeItems(Lnet/minecraft/entity/player/PlayerEntity;)Z", at = @At(value = "HEAD"), cancellable = true)
private void canTakeItems(PlayerEntity playerEntity, CallbackInfoReturnable<Boolean> cir) {
ServerPlayerEntity player = (ServerPlayerEntity) playerEntity;
if (playerEntity instanceof ServerPlayerEntity player) {
ActionResult result = AuthEventHandler.onTakeItem(player);
if (result == ActionResult.FAIL) {
@ -32,3 +32,4 @@ public abstract class MixinSlot {
}
}
}
}