commit
e751f4ffe3
@ -203,7 +203,7 @@ void cDispenserEntity::SpawnProjectileFromDispenser(int a_BlockX, int a_BlockY,
|
|||||||
|
|
||||||
Vector3d cDispenserEntity::GetShootVector(NIBBLETYPE a_Meta)
|
Vector3d cDispenserEntity::GetShootVector(NIBBLETYPE a_Meta)
|
||||||
{
|
{
|
||||||
switch (a_Meta)
|
switch (a_Meta & 0x7)
|
||||||
{
|
{
|
||||||
case E_META_DROPSPENSER_FACING_YP: return Vector3d( 0, 1, 0);
|
case E_META_DROPSPENSER_FACING_YP: return Vector3d( 0, 1, 0);
|
||||||
case E_META_DROPSPENSER_FACING_YM: return Vector3d( 0, -1, 0);
|
case E_META_DROPSPENSER_FACING_YM: return Vector3d( 0, -1, 0);
|
||||||
|
@ -21,6 +21,21 @@ cHangingEntity::cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cHangingEntity::SetDirection(eBlockFace a_BlockFace)
|
||||||
|
{
|
||||||
|
if ((a_BlockFace < 2) || (a_BlockFace > 5))
|
||||||
|
{
|
||||||
|
ASSERT(!"Tried to set a bad direction!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_BlockFace = a_BlockFace;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cHangingEntity::SpawnOn(cClientHandle & a_ClientHandle)
|
void cHangingEntity::SpawnOn(cClientHandle & a_ClientHandle)
|
||||||
{
|
{
|
||||||
int Dir = 0;
|
int Dir = 0;
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
eBlockFace GetDirection() const { return m_BlockFace; } // tolua_export
|
eBlockFace GetDirection() const { return m_BlockFace; } // tolua_export
|
||||||
|
|
||||||
/** Set the orientation from the hanging entity */
|
/** Set the orientation from the hanging entity */
|
||||||
void SetDirection(eBlockFace a_BlockFace) { m_BlockFace = a_BlockFace; } // tolua_export
|
void SetDirection(eBlockFace a_BlockFace); // tolua_export
|
||||||
|
|
||||||
/** Returns the X coord. */
|
/** Returns the X coord. */
|
||||||
int GetTileX() const { return POSX_TOINT; } // tolua_export
|
int GetTileX() const { return POSX_TOINT; } // tolua_export
|
||||||
|
@ -109,11 +109,11 @@ void cVillager::HandleFarmerPrepareFarmCrops()
|
|||||||
Surrounding.Read(
|
Surrounding.Read(
|
||||||
m_World,
|
m_World,
|
||||||
(int) GetPosX() - 5,
|
(int) GetPosX() - 5,
|
||||||
(int) GetPosX() + 5,
|
(int) GetPosX() + 6,
|
||||||
(int) GetPosY() - 3,
|
(int) GetPosY() - 3,
|
||||||
(int) GetPosY() + 3,
|
(int) GetPosY() + 4,
|
||||||
(int) GetPosZ() - 5,
|
(int) GetPosZ() - 5,
|
||||||
(int) GetPosZ() + 5
|
(int) GetPosZ() + 6
|
||||||
);
|
);
|
||||||
|
|
||||||
for (int I = 0; I < 5; I++)
|
for (int I = 0; I < 5; I++)
|
||||||
|
@ -1394,10 +1394,15 @@ void cProtocol180::SendUpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, cons
|
|||||||
|
|
||||||
cPacketizer Pkt(*this, 0x33);
|
cPacketizer Pkt(*this, 0x33);
|
||||||
Pkt.WritePosition(a_BlockX, a_BlockY, a_BlockZ);
|
Pkt.WritePosition(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
Pkt.WriteString(Printf("{\"text\": \"%s\"}", a_Line1.c_str()));
|
|
||||||
Pkt.WriteString(Printf("{\"text\": \"%s\"}", a_Line2.c_str()));
|
Json::StyledWriter JsonWriter;
|
||||||
Pkt.WriteString(Printf("{\"text\": \"%s\"}", a_Line3.c_str()));
|
AString Lines[] = { a_Line1, a_Line2, a_Line3, a_Line4 };
|
||||||
Pkt.WriteString(Printf("{\"text\": \"%s\"}", a_Line4.c_str()));
|
for (size_t i = 0; i < ARRAYCOUNT(Lines); i++)
|
||||||
|
{
|
||||||
|
Json::Value RootValue;
|
||||||
|
RootValue["text"] = Lines[i];
|
||||||
|
Pkt.WriteString(JsonWriter.write(RootValue).c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -637,9 +637,9 @@ void cNBTChunkSerializer::AddProjectileEntity(cProjectileEntity * a_Projectile)
|
|||||||
{
|
{
|
||||||
cArrowEntity * Arrow = (cArrowEntity *)a_Projectile;
|
cArrowEntity * Arrow = (cArrowEntity *)a_Projectile;
|
||||||
|
|
||||||
m_Writer.AddInt("xTile", (Int16)Arrow->GetBlockHit().x);
|
m_Writer.AddShort("xTile", (Int16)Arrow->GetBlockHit().x);
|
||||||
m_Writer.AddInt("yTile", (Int16)Arrow->GetBlockHit().y);
|
m_Writer.AddShort("yTile", (Int16)Arrow->GetBlockHit().y);
|
||||||
m_Writer.AddInt("zTile", (Int16)Arrow->GetBlockHit().z);
|
m_Writer.AddShort("zTile", (Int16)Arrow->GetBlockHit().z);
|
||||||
m_Writer.AddByte("pickup", Arrow->GetPickupState());
|
m_Writer.AddByte("pickup", Arrow->GetPickupState());
|
||||||
m_Writer.AddDouble("damage", Arrow->GetDamageCoeff());
|
m_Writer.AddDouble("damage", Arrow->GetDamageCoeff());
|
||||||
break;
|
break;
|
||||||
|
@ -1664,7 +1664,7 @@ void cWSSAnvil::LoadHangingFromNBT(cHangingEntity & a_Hanging, const cParsedNBT
|
|||||||
if (Direction > 0)
|
if (Direction > 0)
|
||||||
{
|
{
|
||||||
Direction = (int)a_NBT.GetByte(Direction);
|
Direction = (int)a_NBT.GetByte(Direction);
|
||||||
if ((Direction < 0) || (Direction > 5))
|
if ((Direction < 2) || (Direction > 5))
|
||||||
{
|
{
|
||||||
a_Hanging.SetDirection(BLOCK_FACE_NORTH);
|
a_Hanging.SetDirection(BLOCK_FACE_NORTH);
|
||||||
}
|
}
|
||||||
@ -1752,7 +1752,7 @@ void cWSSAnvil::LoadArrowFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
|
|||||||
|
|
||||||
// Load pickup state:
|
// Load pickup state:
|
||||||
int PickupIdx = a_NBT.FindChildByName(a_TagIdx, "pickup");
|
int PickupIdx = a_NBT.FindChildByName(a_TagIdx, "pickup");
|
||||||
if (PickupIdx > 0)
|
if ((PickupIdx > 0) && (a_NBT.GetType(PickupIdx) == TAG_Byte))
|
||||||
{
|
{
|
||||||
Arrow->SetPickupState((cArrowEntity::ePickupState)a_NBT.GetByte(PickupIdx));
|
Arrow->SetPickupState((cArrowEntity::ePickupState)a_NBT.GetByte(PickupIdx));
|
||||||
}
|
}
|
||||||
@ -1760,7 +1760,7 @@ void cWSSAnvil::LoadArrowFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
|
|||||||
{
|
{
|
||||||
// Try the older "player" tag:
|
// Try the older "player" tag:
|
||||||
int PlayerIdx = a_NBT.FindChildByName(a_TagIdx, "player");
|
int PlayerIdx = a_NBT.FindChildByName(a_TagIdx, "player");
|
||||||
if (PlayerIdx > 0)
|
if ((PlayerIdx > 0) && (a_NBT.GetType(PlayerIdx) == TAG_Byte))
|
||||||
{
|
{
|
||||||
Arrow->SetPickupState((a_NBT.GetByte(PlayerIdx) == 0) ? cArrowEntity::psNoPickup : cArrowEntity::psInSurvivalOrCreative);
|
Arrow->SetPickupState((a_NBT.GetByte(PlayerIdx) == 0) ? cArrowEntity::psNoPickup : cArrowEntity::psInSurvivalOrCreative);
|
||||||
}
|
}
|
||||||
@ -1768,7 +1768,7 @@ void cWSSAnvil::LoadArrowFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
|
|||||||
|
|
||||||
// Load damage:
|
// Load damage:
|
||||||
int DamageIdx = a_NBT.FindChildByName(a_TagIdx, "damage");
|
int DamageIdx = a_NBT.FindChildByName(a_TagIdx, "damage");
|
||||||
if (DamageIdx > 0)
|
if ((DamageIdx > 0) && (a_NBT.GetType(DamageIdx) == TAG_Double))
|
||||||
{
|
{
|
||||||
Arrow->SetDamageCoeff(a_NBT.GetDouble(DamageIdx));
|
Arrow->SetDamageCoeff(a_NBT.GetDouble(DamageIdx));
|
||||||
}
|
}
|
||||||
@ -1779,7 +1779,24 @@ void cWSSAnvil::LoadArrowFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
|
|||||||
int InBlockZIdx = a_NBT.FindChildByName(a_TagIdx, "zTile");
|
int InBlockZIdx = a_NBT.FindChildByName(a_TagIdx, "zTile");
|
||||||
if ((InBlockXIdx > 0) && (InBlockYIdx > 0) && (InBlockZIdx > 0))
|
if ((InBlockXIdx > 0) && (InBlockYIdx > 0) && (InBlockZIdx > 0))
|
||||||
{
|
{
|
||||||
|
if (a_NBT.GetType(InBlockXIdx) == a_NBT.GetType(InBlockYIdx) == a_NBT.GetType(InBlockZIdx))
|
||||||
|
{
|
||||||
|
switch (a_NBT.GetType(InBlockXIdx))
|
||||||
|
{
|
||||||
|
case TAG_Int:
|
||||||
|
{
|
||||||
|
// Old MCS code used this, keep reading it for compatibility reasons:
|
||||||
Arrow->SetBlockHit(Vector3i(a_NBT.GetInt(InBlockXIdx), a_NBT.GetInt(InBlockYIdx), a_NBT.GetInt(InBlockZIdx)));
|
Arrow->SetBlockHit(Vector3i(a_NBT.GetInt(InBlockXIdx), a_NBT.GetInt(InBlockYIdx), a_NBT.GetInt(InBlockZIdx)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TAG_Short:
|
||||||
|
{
|
||||||
|
// Vanilla uses this
|
||||||
|
Arrow->SetBlockHit(Vector3i((int)a_NBT.GetShort(InBlockXIdx), (int)a_NBT.GetShort(InBlockYIdx), (int)a_NBT.GetShort(InBlockZIdx)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the new arrow in the entities list:
|
// Store the new arrow in the entities list:
|
||||||
|
Loading…
Reference in New Issue
Block a user