package com.tiedup.remake.mixin; import com.tiedup.remake.compat.mca.MCACompat; import com.tiedup.remake.v2.bondage.CollarHelper; import com.tiedup.remake.state.IBondageState; import com.tiedup.remake.v2.BodyRegionV2; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; /** * Mixin to allow vanilla leash attachment to MCA villagers when tied or collar owner. * *
By default, MCA villagers cannot be leashed. This mixin overrides * the canBeLeashed check to allow leashing when: *
Uses @Pseudo annotation - mixin is optional and will be skipped if MCA is not installed. */ @Pseudo @Mixin(targets = "forge.net.mca.entity.VillagerEntityMCA", remap = false) public class MixinMCAVillagerLeash { /** * Override canBeLeashed to allow TiedUp leash mechanics. * *
The canBeLeashed method is a vanilla method (remapped), so we use remap = true.
*
* @param player The player trying to leash
* @param cir Callback info for returning the result
*/
@Inject(
method = "canBeLeashed",
at = @At("HEAD"),
cancellable = true,
remap = true
)
private void tiedup$overrideCanBeLeashed(
Player player,
CallbackInfoReturnable