| Total Complexity | 2 |
| Total Lines | 15 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package de.pewpewproject.lasertag.mixin; |
||
| 17 | @Mixin(ItemStack.class) |
||
| 18 | public abstract class ItemStackMixin { |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Inject into the useOnBlock() which is called when the player tries to place an item stack |
||
| 22 | * |
||
| 23 | * @param context |
||
| 24 | * @param cir |
||
| 25 | */ |
||
| 26 | @Inject(method = "useOnBlock(Lnet/minecraft/item/ItemUsageContext;)Lnet/minecraft/util/ActionResult;", at = @At("HEAD"), cancellable = true) |
||
| 27 | private void onUseOnBlock(ItemUsageContext context, CallbackInfoReturnable<ActionResult> cir) { |
||
| 28 | |||
| 29 | // If this stack is of lasertag flag |
||
| 30 | if (((ItemStack)(Object)this).isOf(Items.LASERTAG_FLAG)) { |
||
| 31 | cir.setReturnValue(ActionResult.PASS); |
||
| 32 | } |
||
| 35 |