From 85a2a2e6612eba61a15b57434b5480c888276e18 Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 17 Nov 2016 11:37:08 -0800 Subject: [PATCH] Fix issues with ZombieVillagers Closes #3398 1.11 doesn't intertwine zombie types anymore so our edits to split them out for custom professions are not needed. --- .../entity/monster/EntityZombie.java.patch | 22 ++------ .../monster/EntityZombieVillager.java.patch | 2 +- .../entity/passive/EntityVillager.java.patch | 53 +++++-------------- .../fml/common/registry/VillagerRegistry.java | 28 ++-------- 4 files changed, 22 insertions(+), 83 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch index 995850185..ca8eaf9de 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch @@ -1,14 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java -@@ -60,6 +60,7 @@ - private static final DataParameter field_184737_bv = EntityDataManager.func_187226_a(EntityZombie.class, DataSerializers.field_187198_h); - private static final DataParameter field_184738_bw = EntityDataManager.func_187226_a(EntityZombie.class, DataSerializers.field_187192_b); - private static final DataParameter field_184740_by = EntityDataManager.func_187226_a(EntityZombie.class, DataSerializers.field_187198_h); -+ private static final DataParameter VILLAGER_TYPE_STR = EntityDataManager.func_187226_a(EntityZombie.class, DataSerializers.field_187194_d); - private final EntityAIBreakDoor field_146075_bs = new EntityAIBreakDoor(this); - private boolean field_146076_bu; - private float field_146074_bv = -1.0F; -@@ -98,7 +99,7 @@ +@@ -98,7 +98,7 @@ this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.23000000417232513D); this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111128_a(3.0D); this.func_110148_a(SharedMonsterAttributes.field_188791_g).func_111128_a(2.0D); @@ -17,15 +9,7 @@ } protected void func_70088_a() -@@ -106,6 +107,7 @@ - super.func_70088_a(); - this.func_184212_Q().func_187214_a(field_184737_bv, Boolean.valueOf(false)); - this.func_184212_Q().func_187214_a(field_184738_bw, Integer.valueOf(0)); -+ this.func_184212_Q().func_187214_a(VILLAGER_TYPE_STR, ""); - this.func_184212_Q().func_187214_a(field_184740_by, Boolean.valueOf(false)); - } - -@@ -239,12 +241,24 @@ +@@ -239,12 +239,24 @@ entitylivingbase = (EntityLivingBase)p_70097_1_.func_76346_g(); } @@ -55,7 +39,7 @@ for (int l = 0; l < 50; ++l) { -@@ -252,14 +266,14 @@ +@@ -252,14 +264,14 @@ int j1 = j + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1); int k1 = k + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombieVillager.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombieVillager.java.patch index 5767d3d42..c7a607982 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityZombieVillager.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityZombieVillager.java.patch @@ -16,7 +16,7 @@ + public void setForgeProfession(net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof) + { + this.prof = prof; -+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, prof); ++ this.func_190733_a(net.minecraftforge.fml.common.registry.VillagerRegistry.getId(prof)); + } + + public net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession getForgeProfession() diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch index f36ed2c5b..6dc391676 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -1,14 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java -@@ -94,6 +94,7 @@ - { - private static final Logger field_190674_bx = LogManager.getLogger(); - private static final DataParameter field_184752_bw = EntityDataManager.func_187226_a(EntityVillager.class, DataSerializers.field_187192_b); -+ private static final DataParameter PROFESSION_STR = EntityDataManager.func_187226_a(EntityVillager.class, DataSerializers.field_187194_d); - private int field_70955_e; - private boolean field_70952_f; - private boolean field_70953_g; -@@ -111,6 +112,7 @@ +@@ -111,6 +111,7 @@ private boolean field_82190_bM; private boolean field_175564_by; private final InventoryBasic field_175560_bz; @@ -16,15 +8,7 @@ private static final EntityVillager.ITradeList[][][][] field_175561_bA = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.field_151015_O, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.field_151174_bG, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.field_151172_bF, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.field_151025_P, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150423_aK), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.field_151158_bO, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150440_ba), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.field_151034_e, new EntityVillager.PriceInfo(-7, -5))}, {new EntityVillager.ListItemForEmeralds(Items.field_151106_aX, new EntityVillager.PriceInfo(-10, -6)), new EntityVillager.ListItemForEmeralds(Items.field_151105_aU, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.field_151007_F, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.field_151115_aP, new EntityVillager.PriceInfo(6, 6), Items.field_179566_aV, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151112_aM, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150325_L), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.field_151097_aZ, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L)), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.field_151007_F, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.field_151032_g, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.field_151031_f, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.func_150898_a(Blocks.field_150351_n), new EntityVillager.PriceInfo(10, 10), Items.field_151145_ak, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151121_aF, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.field_151122_aG, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.field_151111_aL, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150342_X), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.field_151164_bB, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.field_151113_aN, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150359_w), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.field_151057_cb, new EntityVillager.PriceInfo(20, 22))}}, {{new EntityVillager.EmeraldForItems(Items.field_151121_aF, new EntityVillager.PriceInfo(24, 36))}, {new EntityVillager.EmeraldForItems(Items.field_151111_aL, new EntityVillager.PriceInfo(1, 1))}, {new EntityVillager.ListItemForEmeralds(Items.field_151148_bJ, new EntityVillager.PriceInfo(7, 11))}, {new EntityVillager.TreasureMapForEmeralds(new EntityVillager.PriceInfo(12, 20), "Monument", MapDecoration.Type.MONUMENT), new EntityVillager.TreasureMapForEmeralds(new EntityVillager.PriceInfo(16, 28), "Mansion", MapDecoration.Type.MANSION)}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151078_bh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.field_151043_k, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.field_151137_ax, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.field_151100_aR, 1, EnumDyeColor.BLUE.func_176767_b()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.field_151079_bi, new EntityVillager.PriceInfo(4, 7)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150426_aN), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.field_151062_by, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151028_Y, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.field_151030_Z, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151163_ad, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.field_151029_X, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.field_151022_W, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.field_151020_U, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.field_151023_V, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151036_c, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151040_l, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151048_u, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151056_x, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151037_a, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151035_b, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151046_w, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151147_al, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.field_151076_bf, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151157_am, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.field_151077_bg, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.field_151116_aA, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.field_151026_S, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151027_R, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.field_151141_av, new EntityVillager.PriceInfo(8, 10))}}}, {new EntityVillager.ITradeList[0][]}}; public EntityVillager(World p_i1747_1_) -@@ -285,6 +287,7 @@ - { - super.func_70088_a(); - this.field_70180_af.func_187214_a(field_184752_bw, Integer.valueOf(0)); -+ this.field_70180_af.func_187214_a(PROFESSION_STR, "minecraft:farmer"); - } - - public static void func_189785_b(DataFixer p_189785_0_) -@@ -323,6 +326,7 @@ +@@ -323,6 +324,7 @@ { super.func_70014_b(p_70014_1_); p_70014_1_.func_74768_a("Profession", this.func_70946_n()); @@ -32,7 +16,7 @@ p_70014_1_.func_74768_a("Riches", this.field_70956_bz); p_70014_1_.func_74768_a("Career", this.field_175563_bv); p_70014_1_.func_74768_a("CareerLevel", this.field_175562_bw); -@@ -352,6 +356,14 @@ +@@ -352,6 +354,14 @@ { super.func_70037_a(p_70037_1_); this.func_70938_b(p_70037_1_.func_74762_e("Profession")); @@ -47,7 +31,7 @@ this.field_70956_bz = p_70037_1_.func_74762_e("Riches"); this.field_175563_bv = p_70037_1_.func_74762_e("Career"); this.field_175562_bw = p_70037_1_.func_74762_e("CareerLevel"); -@@ -408,13 +420,52 @@ +@@ -408,13 +418,43 @@ public void func_70938_b(int p_70938_1_) { this.field_70180_af.func_187227_b(field_184752_bw, Integer.valueOf(p_70938_1_)); @@ -63,20 +47,17 @@ + private net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof; + public void setProfession(net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof) + { -+ this.field_70180_af.func_187227_b(PROFESSION_STR, prof.getRegistryName().toString()); + this.prof = prof; -+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, prof); ++ this.func_70938_b(net.minecraftforge.fml.common.registry.VillagerRegistry.getId(prof)); + } + + public net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession getProfessionForge() + { + if (this.prof == null) + { -+ String p = this.field_70180_af.func_187225_a(PROFESSION_STR); -+ net.minecraft.util.ResourceLocation res = new net.minecraft.util.ResourceLocation(p == null ? "minecraft:farmer" : p); -+ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.instance().getRegistry().getValue(res); ++ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.getById(this.func_70946_n()); + if (this.prof == null) -+ return net.minecraftforge.fml.common.registry.VillagerRegistry.instance().getRegistry().getValue(new net.minecraft.util.ResourceLocation("minecraft:farmer")); ++ return net.minecraftforge.fml.common.registry.VillagerRegistry.getById(0); //Farmer + } + return this.prof; + } @@ -85,13 +66,7 @@ + public void func_184206_a(DataParameter key) + { + super.func_184206_a(key); -+ if (key.equals(PROFESSION_STR)) -+ { -+ String p = this.field_70180_af.func_187225_a(PROFESSION_STR); -+ net.minecraft.util.ResourceLocation res = new net.minecraft.util.ResourceLocation(p == null ? "minecraft:farmer" : p); -+ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.instance().getRegistry().getValue(res); -+ } -+ else if (key.equals(field_184752_bw)) ++ if (key.equals(field_184752_bw)) + { + net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, this.field_70180_af.func_187225_a(field_184752_bw)); + } @@ -100,7 +75,7 @@ public boolean func_70941_o() { return this.field_70952_f; -@@ -607,15 +658,13 @@ +@@ -607,15 +647,13 @@ private void func_175554_cu() { @@ -117,7 +92,7 @@ this.field_175562_bw = 1; } -@@ -626,19 +675,13 @@ +@@ -626,19 +664,13 @@ int i = this.field_175563_bv - 1; int j = this.field_175562_bw - 1; @@ -141,7 +116,7 @@ } } } -@@ -748,7 +791,7 @@ +@@ -748,7 +780,7 @@ s1 = "nitwit"; } @@ -150,7 +125,7 @@ { ITextComponent itextcomponent = new TextComponentTranslation("entity.Villager." + s1, new Object[0]); itextcomponent.func_150256_b().func_150209_a(this.func_174823_aP()); -@@ -761,10 +804,6 @@ +@@ -761,10 +793,6 @@ return itextcomponent; } @@ -161,7 +136,7 @@ } } -@@ -818,7 +857,7 @@ +@@ -818,7 +846,7 @@ if (p_190672_3_) { @@ -170,7 +145,7 @@ } this.func_175552_ct(); -@@ -1071,6 +1110,8 @@ +@@ -1071,6 +1099,8 @@ p_190888_2_.add(new MerchantRecipe(itemstack, itemstack1)); } } 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 382316699..fb652ad42 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java @@ -323,10 +323,7 @@ public class VillagerRegistry List entries = INSTANCE.professions.getValues(); entity.setProfession(entries.get(rand.nextInt(entries.size()))); } - public static void setRandomProfession(EntityZombieVillager entity, Random rand) - { - List entries = INSTANCE.professions.getValues(); - } + @@ -335,17 +332,6 @@ public class VillagerRegistry //Below this is INTERNAL USE ONLY DO NOT USE MODDERS - public static void onSetProfession(EntityVillager entity, VillagerProfession prof) - { - int network = INSTANCE.professions.getId(prof); - if (network == -1 || prof != INSTANCE.professions.getObjectById(network)) - { - throw new RuntimeException("Attempted to set villager profession to unregistered profession: " + network + " " + prof); - } - - if (network != entity.getProfession()) - entity.setProfession(network); - } public static void onSetProfession(EntityVillager entity, int network) { VillagerProfession prof = INSTANCE.professions.getObjectById(network); @@ -358,18 +344,12 @@ public class VillagerRegistry entity.setProfession(prof); } - @SuppressWarnings("deprecation") - public static void onSetProfession(EntityZombieVillager entity, VillagerProfession prof) - { - } - public static void onSetProfession(EntityZombieVillager entity, int network) { - int realID = network; - VillagerProfession prof = INSTANCE.professions.getObjectById(realID); - if (prof == null && network != 0 || INSTANCE.professions.getId(prof) != realID) + VillagerProfession prof = INSTANCE.professions.getObjectById(network); + if (prof == null && network != -1 || INSTANCE.professions.getId(prof) != network) { - throw new RuntimeException("Attempted to set villager profession to unregistered profession: " + realID + " " + prof); + throw new RuntimeException("Attempted to set villager profession to unregistered profession: " + network + " " + prof); } if (prof != entity.getForgeProfession())