Safe-cast to ServerPlayerEntity in MixinSlot #1

已合併
sorceress 將 2 次提交從 videogame-hacker/EasyAuth:architectury 合併至 architectury 2022-04-10 18:12:17 +00:00
共有 1 個檔案被更改,包括 13 行新增12 行删除
Showing only changes of commit 50745d7923 - Show all commits

查看文件

@ -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 {
}
}
}
}