mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 04:32:15 +00:00
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.
This commit is contained in:
1 parent
f028ba88f5
commit
85a2a2e661
4 files changed
+22
-83
No files matched your search
@@ -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<Boolean> field_184737_bv = EntityDataManager.<Boolean>func_187226_a(EntityZombie.class, DataSerializers.field_187198_h);
|
||||
private static final DataParameter<Integer> field_184738_bw = EntityDataManager.<Integer>func_187226_a(EntityZombie.class, DataSerializers.field_187192_b);
|
||||
private static final DataParameter<Boolean> field_184740_by = EntityDataManager.<Boolean>func_187226_a(EntityZombie.class, DataSerializers.field_187198_h);
|
||||
+ private static final DataParameter<String> VILLAGER_TYPE_STR = EntityDataManager.<String>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);
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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<Integer> field_184752_bw = EntityDataManager.<Integer>func_187226_a(EntityVillager.class, DataSerializers.field_187192_b);
|
||||
+ private static final DataParameter<String> PROFESSION_STR = EntityDataManager.<String>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), ne
Line truncated
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,10 +323,7 @@ public class VillagerRegistry
|
||||
List<VillagerProfession> entries = INSTANCE.professions.getValues();
|
||||
entity.setProfession(entries.get(rand.nextInt(entries.size())));
|
||||
}
|
||||
public static void setRandomProfession(EntityZombieVillager entity, Random rand)
|
||||
{
|
||||
List<VillagerProfession> 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())
|
||||
|
||||
Reference in new issue
Block a user