| Total Complexity | 3 |
| Total Lines | 14 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package de.pewpewproject.lasertag.mixin; |
||
| 16 | @Mixin(PlayerInventory.class) |
||
| 17 | public abstract class PlayerInventoryMixin { |
||
| 18 | |||
| 19 | @Inject(method = "dropSelectedItem(Z)Lnet/minecraft/item/ItemStack;", at = @At("HEAD"), cancellable = true) |
||
| 20 | private void onDropSelectedItem(boolean entireStack, CallbackInfoReturnable<ItemStack> cir) { |
||
| 21 | // Get the main hand stack |
||
| 22 | var mainHandStack = ((PlayerInventory)(Object)this).getMainHandStack(); |
||
| 23 | |||
| 24 | // If is lasertag weapon |
||
| 25 | if (mainHandStack.isOf(Items.LASERTAG_WEAPON) || |
||
| 26 | mainHandStack.isOf(Items.LASERTAG_FLAG)) { |
||
| 27 | |||
| 28 | // Don't drop it |
||
| 29 | cir.setReturnValue(ItemStack.EMPTY); |
||
| 30 | } |
||
| 33 |