diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombieVillager.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombieVillager.java.patch index da0caeb50..033fe68ce 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityZombieVillager.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityZombieVillager.java.patch @@ -32,7 +32,15 @@ if (p_70037_1_.func_150297_b("ConversionTime", 99) && p_70037_1_.func_74762_e("ConversionTime") > -1) { this.func_191991_a(p_70037_1_.func_186855_b("ConversionPlayer") ? p_70037_1_.func_186857_a("ConversionPlayer") : null, p_70037_1_.func_74762_e("ConversionTime")); } -@@ -145,7 +153,7 @@ +@@ -77,6 +85,7 @@ + @Nullable + public IEntityLivingData func_204210_a(DifficultyInstance p_204210_1_, @Nullable IEntityLivingData p_204210_2_, @Nullable NBTTagCompound p_204210_3_) { + this.func_190733_a(this.field_70170_p.field_73012_v.nextInt(6)); ++ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.field_70170_p.field_73012_v); + return super.func_204210_a(p_204210_1_, p_204210_2_, p_204210_3_); + } + +@@ -145,7 +154,7 @@ protected void func_190738_dp() { EntityVillager entityvillager = new EntityVillager(this.field_70170_p); entityvillager.func_82149_j(this); @@ -41,7 +49,7 @@ entityvillager.func_190672_a(this.field_70170_p.func_175649_E(new BlockPos(entityvillager)), (IEntityLivingData)null, (NBTTagCompound)null, false); entityvillager.func_82187_q(); if (this.func_70631_g_()) { -@@ -224,4 +232,28 @@ +@@ -224,4 +233,28 @@ protected ItemStack func_190732_dj() { return ItemStack.field_190927_a; } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/VillagePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/VillagePieces.java.patch index 231af1482..ae015ba5b 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/VillagePieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/structure/VillagePieces.java.patch @@ -64,22 +64,24 @@ } } -@@ -1480,13 +1492,12 @@ +@@ -1480,13 +1492,14 @@ EntityZombieVillager entityzombievillager = new EntityZombieVillager(p_74893_1_.func_201672_e()); entityzombievillager.func_70012_b((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F); entityzombievillager.func_204210_a(p_74893_1_.func_175649_E(new BlockPos(entityzombievillager)), (IEntityLivingData)null, (NBTTagCompound)null); - entityzombievillager.func_190733_a(this.func_180779_c(i, 0)); ++ entityzombievillager.setProfession(this.chooseForgeProfession(i, net.minecraftforge.fml.common.registry.VillagerRegistry.FARMER.orElseThrow(() -> new IllegalStateException("Farmer profession not initialized?")))); entityzombievillager.func_110163_bv(); p_74893_1_.func_72838_d(entityzombievillager); } else { EntityVillager entityvillager = new EntityVillager(p_74893_1_.func_201672_e()); entityvillager.func_70012_b((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F); - entityvillager.func_70938_b(this.func_180779_c(i, p_74893_1_.func_201674_k().nextInt(6))); ++ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(entityvillager, p_74893_1_.func_201674_k()); + entityvillager.setProfession(this.chooseForgeProfession(i, entityvillager.getProfessionForge())); entityvillager.func_190672_a(p_74893_1_.func_175649_E(new BlockPos(entityvillager)), (IEntityLivingData)null, (NBTTagCompound)null, false); p_74893_1_.func_72838_d(entityvillager); } -@@ -1495,11 +1506,19 @@ +@@ -1495,11 +1508,19 @@ } } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java index b008e724c..d8dc70659 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java @@ -320,12 +320,10 @@ public class VillagerRegistry entity.setProfession(INSTANCE.REGISTRY.getRandom(rand)); } - - - - - - + public static void setRandomProfession(EntityZombieVillager entity, Random rand) + { + entity.setProfession(INSTANCE.REGISTRY.getRandom(rand)); + } //Below this is INTERNAL USE ONLY DO NOT USE MODDERS public static void onSetProfession(EntityVillager entity, int network)