ForgePatch/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch

39 lines
2.3 KiB
Diff

--- a/net/minecraft/entity/merchant/villager/VillagerEntity.java
+++ b/net/minecraft/entity/merchant/villager/VillagerEntity.java
@@ -241,7 +241,7 @@
public ActionResultType func_230254_b_(PlayerEntity p_230254_1_, Hand p_230254_2_) {
ItemStack itemstack = p_230254_1_.func_184586_b(p_230254_2_);
- if (itemstack.func_77973_b() != Items.field_196172_da && this.func_70089_S() && !this.func_213716_dX() && !this.func_70608_bn()) {
+ if (itemstack.func_77973_b() != Items.field_196172_da && this.func_70089_S() && !this.func_213716_dX() && !this.func_70608_bn() && !p_230254_1_.func_226563_dT_()) {
if (this.func_70631_g_()) {
this.func_213756_es();
return ActionResultType.func_233537_a_(this.field_70170_p.field_72995_K);
@@ -634,7 +634,8 @@
}
protected ITextComponent func_225513_by_() {
- return new TranslationTextComponent(this.func_200600_R().func_210760_d() + '.' + Registry.field_218370_L.func_177774_c(this.func_213700_eh().func_221130_b()).func_110623_a());
+ net.minecraft.util.ResourceLocation profName = this.func_213700_eh().func_221130_b().getRegistryName();
+ return new TranslationTextComponent(this.func_200600_R().func_210760_d() + '.' + (!"minecraft".equals(profName.func_110624_b()) ? profName.func_110624_b() + '.' : "") + profName.func_110623_a());
}
@OnlyIn(Dist.CLIENT)
@@ -687,7 +688,7 @@
}
public void func_241841_a(ServerWorld p_241841_1_, LightningBoltEntity p_241841_2_) {
- if (p_241841_1_.func_175659_aa() != Difficulty.PEACEFUL) {
+ if (p_241841_1_.func_175659_aa() != Difficulty.PEACEFUL && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.field_200759_ay, (timer) -> {})) {
field_184243_a.info("Villager {} was struck by lightning {}.", this, p_241841_2_);
WitchEntity witchentity = EntityType.field_200759_ay.func_200721_a(p_241841_1_);
witchentity.func_70012_b(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), this.field_70177_z, this.field_70125_A);
@@ -699,6 +700,7 @@
}
witchentity.func_110163_bv();
+ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, witchentity);
p_241841_1_.func_242417_l(witchentity);
this.func_242369_fq();
this.func_70106_y();