Anvil: Wolf collar color is a byte in Vanilla.
Kept the old Int reading for compatibility reasons. Ref.: #1448
This commit is contained in:
parent
d04ab9b703
commit
8d9dfc5d1a
@ -582,7 +582,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
|
|||||||
}
|
}
|
||||||
m_Writer.AddByte("Sitting", Wolf.IsSitting() ? 1 : 0);
|
m_Writer.AddByte("Sitting", Wolf.IsSitting() ? 1 : 0);
|
||||||
m_Writer.AddByte("Angry", Wolf.IsAngry() ? 1 : 0);
|
m_Writer.AddByte("Angry", Wolf.IsAngry() ? 1 : 0);
|
||||||
m_Writer.AddInt("CollarColor", Wolf.GetCollarColor());
|
m_Writer.AddByte("CollarColor", (unsigned char)Wolf.GetCollarColor());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cMonster::mtZombie:
|
case cMonster::mtZombie:
|
||||||
|
@ -2476,10 +2476,24 @@ void cWSSAnvil::LoadWolfFromNBT(cEntityList & a_Entities, const cParsedNBT & a_N
|
|||||||
Monster->SetIsAngry(Angry);
|
Monster->SetIsAngry(Angry);
|
||||||
}
|
}
|
||||||
int CollarColorIdx = a_NBT.FindChildByName(a_TagIdx, "CollarColor");
|
int CollarColorIdx = a_NBT.FindChildByName(a_TagIdx, "CollarColor");
|
||||||
if ((CollarColorIdx > 0) && (a_NBT.GetType(CollarColorIdx) == TAG_Int))
|
if (CollarColorIdx > 0)
|
||||||
{
|
{
|
||||||
int CollarColor = a_NBT.GetInt(CollarColorIdx);
|
switch (a_NBT.GetType(CollarColorIdx))
|
||||||
Monster->SetCollarColor(CollarColor);
|
{
|
||||||
|
case TAG_Byte:
|
||||||
|
{
|
||||||
|
// Vanilla uses this
|
||||||
|
unsigned char CollarColor = a_NBT.GetByte(CollarColorIdx);
|
||||||
|
Monster->SetCollarColor(CollarColor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TAG_Int:
|
||||||
|
{
|
||||||
|
// Old MCS code used this, keep reading it for compatibility reasons:
|
||||||
|
Monster->SetCollarColor(a_NBT.GetInt(CollarColorIdx));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
a_Entities.push_back(Monster.release());
|
a_Entities.push_back(Monster.release());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user