use of com.minecraftabnormals.endergetic.common.items.BolloomBalloonItem in project endergetic by team-abnormals.
the class BoatEntityMixin method addBalloonAttachingInteraction.
@Inject(at = @At("HEAD"), method = "interact", cancellable = true)
private void addBalloonAttachingInteraction(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResultType> info) {
ItemStack stack = player.getItemInHand(hand);
Entity boat = this.getEntity();
Item item = stack.getItem();
if (item instanceof BolloomBalloonItem && BolloomBalloonItem.canAttachBalloonToTarget(boat)) {
player.swing(hand, true);
if (!boat.level.isClientSide) {
BolloomBalloonItem.attachToEntity(((BolloomBalloonItem) item).getBalloonColor(), boat);
}
if (!player.isCreative())
stack.shrink(1);
info.setReturnValue(ActionResultType.CONSUME);
}
}
Aggregations