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