27 lines
1.1 KiB
Java
27 lines
1.1 KiB
Java
package com.thebrokenrail.slightlyvanilla.mixin;
|
|
|
|
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
|
import net.minecraft.entity.EntityType;
|
|
import net.minecraft.entity.passive.MerchantEntity;
|
|
import net.minecraft.entity.passive.PassiveEntity;
|
|
import net.minecraft.entity.player.PlayerEntity;
|
|
import net.minecraft.world.World;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
import org.spongepowered.asm.mixin.injection.Inject;
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
|
|
@SuppressWarnings("unused")
|
|
@Mixin(MerchantEntity.class)
|
|
public abstract class MixinAbstractTraderEntity extends PassiveEntity {
|
|
protected MixinAbstractTraderEntity(EntityType<? extends PassiveEntity> entityType, World world) {
|
|
super(entityType, world);
|
|
}
|
|
|
|
@Inject(at = @At("HEAD"), method = "canBeLeashedBy", cancellable = true)
|
|
public void canBeLeashedBy(PlayerEntity player, CallbackInfoReturnable<Boolean> info) {
|
|
if (SlightlyVanilla.getConfig().allowLeashingVillagers) {
|
|
info.setReturnValue(super.canBeLeashedBy(player));
|
|
}
|
|
}
|
|
} |