82 lines
4.0 KiB
Diff
82 lines
4.0 KiB
Diff
--- a/net/minecraft/entity/monster/EntityZombieVillager.java
|
|
+++ b/net/minecraft/entity/monster/EntityZombieVillager.java
|
|
@@ -49,15 +49,18 @@
|
|
|
|
public void func_190733_a(int p_190733_1_) {
|
|
this.field_70180_af.func_187227_b(field_190739_c, p_190733_1_);
|
|
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, p_190733_1_);
|
|
}
|
|
|
|
+ @Deprecated // Use Forge Variant below
|
|
public int func_190736_dl() {
|
|
- return Math.max(this.field_70180_af.func_187225_a(field_190739_c) % 6, 0);
|
|
+ return Math.max(this.field_70180_af.func_187225_a(field_190739_c), 0);
|
|
}
|
|
|
|
public void func_70014_b(NBTTagCompound p_70014_1_) {
|
|
super.func_70014_b(p_70014_1_);
|
|
p_70014_1_.func_74768_a("Profession", this.func_190736_dl());
|
|
+ p_70014_1_.func_74778_a("ProfessionName", this.getForgeProfession().getRegistryName().toString());
|
|
p_70014_1_.func_74768_a("ConversionTime", this.func_82230_o() ? this.field_82234_d : -1);
|
|
if (this.field_191992_by != null) {
|
|
p_70014_1_.func_186854_a("ConversionPlayer", this.field_191992_by);
|
|
@@ -68,6 +71,11 @@
|
|
public void func_70037_a(NBTTagCompound p_70037_1_) {
|
|
super.func_70037_a(p_70037_1_);
|
|
this.func_190733_a(p_70037_1_.func_74762_e("Profession"));
|
|
+ if (p_70037_1_.func_74764_b("ProfessionName")) {
|
|
+ net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p = net.minecraftforge.registries.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation(p_70037_1_.func_74779_i("ProfessionName")));
|
|
+ if (p == null) p = net.minecraftforge.fml.common.registry.VillagerRegistry.FARMER.orElseThrow(() -> new IllegalStateException("Farmer profession not initialized?"));
|
|
+ this.setForgeProfession(p);
|
|
+ }
|
|
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 @@
|
|
protected void func_190738_dp() {
|
|
EntityVillager entityvillager = new EntityVillager(this.field_70170_p);
|
|
entityvillager.func_82149_j(this);
|
|
- entityvillager.func_70938_b(this.func_190736_dl());
|
|
+ entityvillager.setProfession(this.getForgeProfession());
|
|
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,37 @@
|
|
protected ItemStack func_190732_dj() {
|
|
return ItemStack.field_190927_a;
|
|
}
|
|
+
|
|
+ /* ======================================== FORGE START =====================================*/
|
|
+
|
|
+ @Nullable
|
|
+ private net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof;
|
|
+ public void setForgeProfession(net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof)
|
|
+ {
|
|
+ this.prof = prof;
|
|
+ this.func_190733_a(net.minecraftforge.fml.common.registry.VillagerRegistry.getId(prof));
|
|
+ }
|
|
+
|
|
+ public net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession getForgeProfession()
|
|
+ {
|
|
+ if (this.prof == null)
|
|
+ {
|
|
+ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.getById(this.func_190736_dl());
|
|
+ if (this.prof == null)
|
|
+ return net.minecraftforge.fml.common.registry.VillagerRegistry.FARMER.orElseThrow(() -> new IllegalStateException("Farmer profession not initialized?"));
|
|
+ }
|
|
+ return this.prof;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void func_184206_a(DataParameter<?> key)
|
|
+ {
|
|
+ super.func_184206_a(key);
|
|
+ if (key.equals(field_190739_c))
|
|
+ {
|
|
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, this.field_70180_af.func_187225_a(field_190739_c));
|
|
+ }
|
|
+ }
|
|
+
|
|
+ /* ======================================== FORGE END =====================================*/
|
|
}
|