Fix villager goal mixins (#878 #887 #893)

Close #894.
This commit is contained in:
IzzelAliz 2023-01-17 18:23:50 +08:00
parent 2e0eef4a2d
commit 3833931e95
2 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(InteractWithDoor.class)
public abstract class InteractWithDoorMixin {
@Eject(method = "desc=/B$/", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/DoorBlock;setOpen(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Z)V"))
@Eject(method = "desc=/Z$/", require = 2, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/DoorBlock;setOpen(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Z)V"))
private static void arclight$openDoor1(DoorBlock instance, Entity entity, Level p_153167_, BlockState p_153168_, BlockPos pos, boolean p_153170_, CallbackInfoReturnable<Boolean> cir) {
var event = new EntityInteractEvent(((EntityBridge) entity).bridge$getBukkitEntity(), CraftBlock.at(entity.getLevel(), pos));
Bukkit.getPluginManager().callEvent(event);

View File

@ -15,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
public class ResetProfessionMixin {
@Redirect(method = "*", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/npc/Villager;setVillagerData(Lnet/minecraft/world/entity/npc/VillagerData;)V"))
private void arclight$careerChangeHook(Villager villagerEntity, VillagerData villagerData) {
private static void arclight$careerChangeHook(Villager villagerEntity, VillagerData villagerData) {
VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(villagerEntity,
CraftVillager.nmsToBukkitProfession(VillagerProfession.NONE),
VillagerCareerChangeEvent.ChangeReason.LOSING_JOB); // 这里本来是 EMPLOYED 但是我怀疑他打错了