Re-add some missing villager profession patches (#5200)

* Fix zombie villagers only spawning with vanilla professions
* Fix spawning modded villagers that do not have their own building
This commit is contained in:
Ben Staddon authored and mezz committed 2018-11-23 15:19:44 -08:00
1 parent 2fef75c1de
commit 3a64cb8985
3 files changed
+18 -9

No files matched your search

@@ -37,6 +37,15 @@
if (p_70037_1_.func_150297_b("ConversionTime", 99) && p_70037_1_.func_74762_e("ConversionTime") > -1)
{
@@ -91,7 +101,7 @@
@Nullable
public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, @Nullable IEntityLivingData p_180482_2_)
{
- 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_180482_a(p_180482_1_, p_180482_2_);
}
@@ -175,7 +185,7 @@
{
EntityVillager entityvillager = new EntityVillager(this.field_70170_p);
@@ -52,24 +52,26 @@
}
}
@@ -1770,7 +1780,6 @@
@@ -1770,7 +1780,7 @@
EntityZombieVillager entityzombievillager = new EntityZombieVillager(p_74893_1_);
entityzombievillager.func_70012_b((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F);
entityzombievillager.func_180482_a(p_74893_1_.func_175649_E(new BlockPos(entityzombievillager)), (IEntityLivingData)null);
- entityzombievillager.func_190733_a(this.func_180779_c(i, 0));
+ entityzombievillager.setForgeProfession(this.chooseForgeProfession(i, net.minecraftforge.fml.common.registry.VillagerRegistry.FARMER));
entityzombievillager.func_110163_bv();
p_74893_1_.func_72838_d(entityzombievillager);
}
@@ -1778,7 +1787,7 @@
@@ -1778,7 +1788,8 @@
{
EntityVillager entityvillager = new EntityVillager(p_74893_1_);
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_.field_73012_v.nextInt(6)));
+ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(entityvillager, p_74893_1_.field_73012_v);
+ entityvillager.setProfession(this.chooseForgeProfession(i, entityvillager.getProfessionForge()));
entityvillager.func_190672_a(p_74893_1_.func_175649_E(new BlockPos(entityvillager)), (IEntityLivingData)null, false);
p_74893_1_.func_72838_d(entityvillager);
}
@@ -1786,13 +1795,21 @@
@@ -1786,13 +1797,21 @@
}
}
@@ -318,12 +318,10 @@ public class VillagerRegistry
entity.setProfession(INSTANCE.REGISTRY.getRandomObject(rand));
}
public static void setRandomProfession(EntityZombieVillager entity, Random rand)
{
entity.setForgeProfession(INSTANCE.REGISTRY.getRandomObject(rand));
}
//Below this is INTERNAL USE ONLY DO NOT USE MODDERS
public static void onSetProfession(EntityVillager entity, int network)