1
0
Fork 0

Removed obsoleted functions

This commit is contained in:
Tiger Wang 2014-01-16 19:00:49 +00:00
parent 5d03e49c13
commit 74645fdfaa
34 changed files with 67 additions and 74 deletions

View File

@ -307,7 +307,7 @@ void cFurnaceEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
/// Updates the current recipe, based on the current input
void cFurnaceEntity::UpdateInput(void)
{
if (!m_Contents.GetSlot(fsInput).IsStackableWith(m_LastInput))
if (!m_Contents.GetSlot(fsInput).IsEqual(m_LastInput))
{
// The input is different from what we had before, reset the cooking time
m_TimeCooked = 0;
@ -417,7 +417,7 @@ bool cFurnaceEntity::CanCookInputToOutput(void) const
return true;
}
if (!m_Contents.GetSlot(fsOutput).IsStackableWith(*m_CurrentRecipe->Out))
if (!m_Contents.GetSlot(fsOutput).IsEqual(*m_CurrentRecipe->Out))
{
// The output slot is blocked with something that cannot be stacked with the recipe's output
return false;

View File

@ -407,7 +407,7 @@ bool cHopperEntity::MoveItemsFromSlot(cBlockEntityWithItems & a_Entity, int a_Sl
m_Contents.SetSlot(i, One);
return true;
}
else if (m_Contents.GetSlot(i).IsStackableWith(One))
else if (m_Contents.GetSlot(i).IsEqual(One))
{
if (cPluginManager::Get()->CallHookHopperPullingItem(*m_World, *this, i, a_Entity, a_SlotNum))
{
@ -544,7 +544,7 @@ bool cHopperEntity::MoveItemsToSlot(cBlockEntityWithItems & a_Entity, int a_DstS
}
for (int i = 0; i < ContentsWidth * ContentsHeight; i++)
{
if (m_Contents.GetSlot(i).IsStackableWith(DestSlot))
if (m_Contents.GetSlot(i).IsEqual(DestSlot))
{
if (cPluginManager::Get()->CallHookHopperPushingItem(*m_World, *this, i, a_Entity, a_DstSlotNum))
{

View File

@ -42,7 +42,7 @@ public:
{
return false;
}
double rot = a_Player->GetRotation();
double rot = a_Player->GetRot().x;
if (
(Area.GetRelBlockType(0, 0, 1) == E_BLOCK_CHEST) ||
(Area.GetRelBlockType(2, 0, 1) == E_BLOCK_CHEST)
@ -80,7 +80,7 @@ public:
return;
}
double rot = a_Player->GetRotation();
double rot = a_Player->GetRot().x;
// Choose meta from player rotation, choose only between 2 or 3
NIBBLETYPE NewMeta = ((rot >= -90) && (rot < 90)) ? 2 : 3;
if (

View File

@ -53,7 +53,7 @@ public:
) override
{
a_BlockType = m_BlockType;
a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetRotation());
a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetRot().x);
return true;
}

View File

@ -42,7 +42,7 @@ public:
}
a_BlockType = m_BlockType;
a_BlockMeta = PlayerYawToMetaData(a_Player->GetRotation());
a_BlockMeta = PlayerYawToMetaData(a_Player->GetRot().x);
return true;
}

View File

@ -31,7 +31,7 @@ public:
a_BlockType = m_BlockType;
// FIXME: Do not use cPiston class for dispenser placement!
a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetRotation(), a_Player->GetPitch());
a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetRot().x, a_Player->GetPitch());
return true;
}
} ;

View File

@ -30,7 +30,7 @@ public:
) override
{
a_BlockType = m_BlockType;
a_BlockMeta = RotationToMetaData(a_Player->GetRotation());
a_BlockMeta = RotationToMetaData(a_Player->GetRot().x);
return true;
}

View File

@ -25,7 +25,7 @@ public:
) override
{
a_BlockType = m_BlockType;
a_BlockMeta = PlayerYawToMetaData(a_Player->GetRotation());
a_BlockMeta = PlayerYawToMetaData(a_Player->GetRot().x);
return true;
}
@ -33,7 +33,7 @@ public:
virtual void OnUse(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
{
NIBBLETYPE OldMetaData = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
NIBBLETYPE NewMetaData = PlayerYawToMetaData(a_Player->GetRotation());
NIBBLETYPE NewMetaData = PlayerYawToMetaData(a_Player->GetRot().x);
OldMetaData ^= 4; // Toggle the gate
if ((OldMetaData & 1) == (NewMetaData & 1))
{

View File

@ -35,7 +35,7 @@ public:
a_BlockType = m_BlockType;
// FIXME: Do not use cPiston class for furnace placement!
a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetRotation(), 0);
a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetRot().x, 0);
return true;
}

View File

@ -60,7 +60,7 @@ bool cBlockPistonHandler::GetPlacementBlockTypeMeta(
)
{
a_BlockType = m_BlockType;
a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetRotation(), a_Player->GetPitch());
a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetRot().x, a_Player->GetPitch());
return true;
}

View File

@ -86,7 +86,7 @@ public:
) override
{
a_BlockType = m_BlockType;
a_BlockMeta = PlayerYawToMetaData(a_Player->GetRotation());
a_BlockMeta = PlayerYawToMetaData(a_Player->GetRot().x);
return true;
}

View File

@ -25,7 +25,7 @@ public:
) override
{
a_BlockType = m_BlockType;
a_BlockMeta = RepeaterRotationToMetaData(a_Player->GetRotation());
a_BlockMeta = RepeaterRotationToMetaData(a_Player->GetRot().x);
return true;
}

View File

@ -26,7 +26,7 @@ public:
) override
{
a_BlockType = m_BlockType;
a_BlockMeta = RotationToMetaData(a_Player->GetRotation());
a_BlockMeta = RotationToMetaData(a_Player->GetRot().x);
switch (a_BlockFace)
{
case BLOCK_FACE_TOP: break;

View File

@ -1037,7 +1037,7 @@ void cClientHandle::HandlePlayerLook(float a_Rotation, float a_Pitch, bool a_IsO
return;
}
m_Player->SetRotation (a_Rotation);
m_Player->SetYaw (a_Rotation);
m_Player->SetHeadYaw (a_Rotation);
m_Player->SetPitch (a_Pitch);
m_Player->SetTouchGround(a_IsOnGround);
@ -1069,7 +1069,7 @@ void cClientHandle::HandlePlayerMoveLook(double a_PosX, double a_PosY, double a_
m_Player->SetStance (a_Stance);
m_Player->SetTouchGround(a_IsOnGround);
m_Player->SetHeadYaw (a_Rotation);
m_Player->SetRotation (a_Rotation);
m_Player->SetYaw (a_Rotation);
m_Player->SetPitch (a_Pitch);
}

View File

@ -256,16 +256,16 @@ void cEntity::TakeDamage(eDamageType a_DamageType, cEntity * a_Attacker, int a_R
void cEntity::SetRotationFromSpeed(void)
void cEntity::SetYawFromSpeed(void)
{
const double EPS = 0.0000001;
if ((abs(m_Speed.x) < EPS) && (abs(m_Speed.z) < EPS))
{
// atan2() may overflow or is undefined, pick any number
SetRotation(0);
SetYaw(0);
return;
}
SetRotation(atan2(m_Speed.x, m_Speed.z) * 180 / PI);
SetYaw(atan2(m_Speed.x, m_Speed.z) * 180 / PI);
}

View File

@ -155,7 +155,6 @@ public:
double GetPosY (void) const { return m_Pos.y; }
double GetPosZ (void) const { return m_Pos.z; }
const Vector3d & GetRot (void) const { return m_Rot; }
OBSOLETE double GetRotation (void) const { return m_Rot.x; } // OBSOLETE, use GetYaw() instead
double GetYaw (void) const { return m_Rot.x; }
double GetPitch (void) const { return m_Rot.y; }
double GetRoll (void) const { return m_Rot.z; }
@ -178,7 +177,6 @@ public:
void SetPosition(double a_PosX, double a_PosY, double a_PosZ);
void SetPosition(const Vector3d & a_Pos) { SetPosition(a_Pos.x, a_Pos.y, a_Pos.z); }
void SetRot (const Vector3f & a_Rot);
OBSOLETE void SetRotation(double a_Rotation) { SetYaw(a_Rotation); } // OBSOLETE, use SetYaw() instead
void SetYaw (double a_Yaw);
void SetPitch (double a_Pitch);
void SetRoll (double a_Roll);
@ -223,7 +221,7 @@ public:
void SetGravity(float a_Gravity) { m_Gravity = a_Gravity; }
/// Sets the rotation to match the speed vector (entity goes "face-forward")
void SetRotationFromSpeed(void);
void SetYawFromSpeed(void);
/// Sets the pitch to match the speed vector (entity gies "face-forward")
void SetPitchFromSpeed(void);

View File

@ -148,7 +148,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
{
case E_META_RAIL_ZM_ZP: // NORTHSOUTH
{
SetRotation(270);
SetYaw(270);
SetPosY(floor(GetPosY()) + 0.55);
SetSpeedY(0); // Don't move vertically as on ground
SetSpeedX(0); // Correct diagonal movement from curved rails
@ -172,7 +172,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_XM_XP: // EASTWEST
{
SetRotation(180);
SetYaw(180);
SetPosY(floor(GetPosY()) + 0.55);
SetSpeedY(0);
SetSpeedZ(0);
@ -194,7 +194,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_ASCEND_ZM: // ASCEND NORTH
{
SetRotation(270);
SetYaw(270);
SetSpeedX(0);
if (GetSpeedZ() >= 0)
@ -216,7 +216,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_ASCEND_ZP: // ASCEND SOUTH
{
SetRotation(270);
SetYaw(270);
SetSpeedX(0);
if (GetSpeedZ() > 0)
@ -238,7 +238,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_ASCEND_XM: // ASCEND EAST
{
SetRotation(180);
SetYaw(180);
SetSpeedZ(0);
if (GetSpeedX() >= 0)
@ -258,7 +258,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_ASCEND_XP: // ASCEND WEST
{
SetRotation(180);
SetYaw(180);
SetSpeedZ(0);
if (GetSpeedX() > 0)
@ -278,7 +278,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_CURVED_ZM_XM: // Ends pointing NORTH and WEST
{
SetRotation(315); // Set correct rotation server side
SetYaw(315); // Set correct rotation server side
SetPosY(floor(GetPosY()) + 0.55); // Levitate dat cart
if (TestBlockCollision(a_RailMeta)) return;
@ -303,7 +303,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_CURVED_ZM_XP: // Curved NORTH EAST
{
SetRotation(225);
SetYaw(225);
SetPosY(floor(GetPosY()) + 0.55);
if (TestBlockCollision(a_RailMeta)) return;
@ -326,7 +326,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_CURVED_ZP_XM: // Curved SOUTH WEST
{
SetRotation(135);
SetYaw(135);
SetPosY(floor(GetPosY()) + 0.55);
if (TestBlockCollision(a_RailMeta)) return;
@ -349,7 +349,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_CURVED_ZP_XP: // Curved SOUTH EAST
{
SetRotation(45);
SetYaw(45);
SetPosY(floor(GetPosY()) + 0.55);
if (TestBlockCollision(a_RailMeta)) return;
@ -398,7 +398,7 @@ void cMinecart::HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta)
{
case E_META_RAIL_ZM_ZP: // NORTHSOUTH
{
SetRotation(270);
SetYaw(270);
SetPosY(floor(GetPosY()) + 0.55);
SetSpeedY(0);
SetSpeedX(0);
@ -420,7 +420,7 @@ void cMinecart::HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta)
}
case E_META_RAIL_XM_XP: // EASTWEST
{
SetRotation(180);
SetYaw(180);
SetPosY(floor(GetPosY()) + 0.55);
SetSpeedY(0);
SetSpeedZ(0);

View File

@ -1396,7 +1396,7 @@ void cPlayer::TossItem(
}
}
double vX = 0, vY = 0, vZ = 0;
EulerToVector(-GetRotation(), GetPitch(), vZ, vX, vY);
EulerToVector(-GetRot().x, GetPitch(), vZ, vX, vY);
vY = -vY * 2 + 1.f;
m_World->SpawnItemPickups(Drops, GetPosX(), GetEyeHeight(), GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because created by player
}
@ -1528,7 +1528,7 @@ bool cPlayer::LoadFromDisk()
Json::Value & JSON_PlayerRotation = root["rotation"];
if (JSON_PlayerRotation.size() == 3)
{
SetRotation ((float)JSON_PlayerRotation[(unsigned int)0].asDouble());
SetYaw ((float)JSON_PlayerRotation[(unsigned int)0].asDouble());
SetPitch ((float)JSON_PlayerRotation[(unsigned int)1].asDouble());
SetRoll ((float)JSON_PlayerRotation[(unsigned int)2].asDouble());
}
@ -1591,7 +1591,7 @@ bool cPlayer::SaveToDisk()
JSON_PlayerPosition.append(Json::Value(GetPosZ()));
Json::Value JSON_PlayerRotation;
JSON_PlayerRotation.append(Json::Value(GetRotation()));
JSON_PlayerRotation.append(Json::Value(GetRot().x));
JSON_PlayerRotation.append(Json::Value(GetPitch()));
JSON_PlayerRotation.append(Json::Value(GetRoll()));

View File

@ -206,7 +206,7 @@ cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Ve
m_IsInGround(false)
{
SetSpeed(a_Speed);
SetRotationFromSpeed();
SetYawFromSpeed();
SetPitchFromSpeed();
}
@ -350,7 +350,7 @@ void cProjectileEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
NewSpeed.y += m_Gravity / 20;
NewSpeed *= TracerCallback.GetSlowdownCoeff();
SetSpeed(NewSpeed);
SetRotationFromSpeed();
SetYawFromSpeed();
SetPitchFromSpeed();
// DEBUG:
@ -358,7 +358,7 @@ void cProjectileEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
m_UniqueID,
GetPosX(), GetPosY(), GetPosZ(),
GetSpeedX(), GetSpeedY(), GetSpeedZ(),
GetRotation(), GetPitch()
GetRot().x, GetPitch()
);
}
@ -369,7 +369,7 @@ void cProjectileEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
void cProjectileEntity::SpawnOn(cClientHandle & a_Client)
{
// Default spawning - use the projectile kind to spawn an object:
a_Client.SendSpawnObject(*this, m_ProjectileKind, 12, ANGLE_TO_PROTO(GetRotation()), ANGLE_TO_PROTO(GetPitch()));
a_Client.SendSpawnObject(*this, m_ProjectileKind, 12, ANGLE_TO_PROTO(GetRot().x), ANGLE_TO_PROTO(GetPitch()));
a_Client.SendEntityMetadata(*this);
}
@ -402,11 +402,11 @@ cArrowEntity::cArrowEntity(cEntity * a_Creator, double a_X, double a_Y, double a
{
SetSpeed(a_Speed);
SetMass(0.1);
SetRotationFromSpeed();
SetYawFromSpeed();
SetPitchFromSpeed();
LOGD("Created arrow %d with speed {%.02f, %.02f, %.02f} and rot {%.02f, %.02f}",
m_UniqueID, GetSpeedX(), GetSpeedY(), GetSpeedZ(),
GetRotation(), GetPitch()
GetRot().x, GetPitch()
);
}

View File

@ -83,7 +83,7 @@ int cInventory::HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int
{
NumLeft -= MaxStack;
}
else if (Slot.IsStackableWith(a_ItemStack))
else if (Slot.IsEqual(a_ItemStack))
{
NumLeft -= MaxStack - Slot.m_ItemCount;
}

View File

@ -153,11 +153,6 @@ public:
inline bool IsDamageable(void) const { return (GetMaxDamage() > 0); }
/* Returns true if this itemstack can stack with the specified stack (types match, enchantments etc.) ItemCounts are ignored!
THIS FUNCTION IS OBSOLETE; USE ISEQUAL INSTEAD
*/
OBSOLETE bool IsStackableWith(const cItem & a_OtherStack) const { return IsEqual(a_OtherStack); }
/// Returns true if the item is stacked up to its maximum stacking.
bool IsFullStack(void) const;

View File

@ -226,7 +226,7 @@ int cItemGrid::HowManyCanFit(const cItem & a_ItemStack, bool a_AllowNewStacks)
NumLeft -= MaxStack;
}
}
else if (m_Slots[i].IsStackableWith(a_ItemStack))
else if (m_Slots[i].IsEqual(a_ItemStack))
{
NumLeft -= MaxStack - m_Slots[i].m_ItemCount;
}
@ -275,7 +275,7 @@ int cItemGrid::AddItem(cItem & a_ItemStack, bool a_AllowNewStacks, int a_Priorit
(a_PrioritarySlot != -1) &&
(
m_Slots[a_PrioritarySlot].IsEmpty() ||
m_Slots[a_PrioritarySlot].IsStackableWith(a_ItemStack)
m_Slots[a_PrioritarySlot].IsEqual(a_ItemStack)
)
)
{
@ -285,7 +285,7 @@ int cItemGrid::AddItem(cItem & a_ItemStack, bool a_AllowNewStacks, int a_Priorit
// Scan existing stacks:
for (int i = m_NumSlots - 1; i >= 0; i--)
{
if (m_Slots[i].IsStackableWith(a_ItemStack))
if (m_Slots[i].IsEqual(a_ItemStack))
{
NumLeft -= AddItemToSlot(a_ItemStack, i, NumLeft, MaxStack);
}
@ -438,7 +438,7 @@ int cItemGrid::HowManyItems(const cItem & a_Item)
int res = 0;
for (int i = 0; i < m_NumSlots; i++)
{
if (m_Slots[i].IsStackableWith(a_Item))
if (m_Slots[i].IsEqual(a_Item))
{
res += m_Slots[i].m_ItemCount;
}

View File

@ -37,7 +37,7 @@ public:
return false;
}
a_BlockMeta = cBlockBedHandler::RotationToMetaData(a_Player->GetRotation());
a_BlockMeta = cBlockBedHandler::RotationToMetaData(a_Player->GetRot().x);
// Check if there is empty space for the foot section:
Vector3i Direction = cBlockBedHandler::MetaDataToDirection(a_BlockMeta);

View File

@ -30,7 +30,7 @@ public:
) override
{
a_BlockType = E_BLOCK_INACTIVE_COMPARATOR;
a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetRotation());
a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetRot().x);
return true;
}
} ;

View File

@ -30,7 +30,7 @@ public:
) override
{
a_BlockType = E_BLOCK_REDSTONE_REPEATER_OFF;
a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetRotation());
a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetRot().x);
return true;
}
} ;

View File

@ -34,7 +34,7 @@ public:
{
if (a_BlockFace == BLOCK_FACE_TOP)
{
a_BlockMeta = cBlockSignHandler::RotationToMetaData(a_Player->GetRotation());
a_BlockMeta = cBlockSignHandler::RotationToMetaData(a_Player->GetRot().x);
a_BlockType = E_BLOCK_SIGN_POST;
}
else

View File

@ -208,7 +208,7 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk)
Distance.Normalize();
VectorToEuler( Distance.x, Distance.y, Distance.z, Rotation, Pitch );
SetHeadYaw (Rotation);
SetRotation( Rotation );
SetYaw( Rotation );
SetPitch( -Pitch );
}

View File

@ -354,7 +354,7 @@ void cProtocol125::SendEntityLook(const cEntity & a_Entity)
cCSLock Lock(m_CSPacket);
WriteByte(PACKET_ENT_LOOK);
WriteInt (a_Entity.GetUniqueID());
WriteByte((char)((a_Entity.GetRotation() / 360.f) * 256));
WriteByte((char)((a_Entity.GetRot().x / 360.f) * 256));
WriteByte((char)((a_Entity.GetPitch() / 360.f) * 256));
Flush();
}
@ -423,7 +423,7 @@ void cProtocol125::SendEntityRelMoveLook(const cEntity & a_Entity, char a_RelX,
WriteByte(a_RelX);
WriteByte(a_RelY);
WriteByte(a_RelZ);
WriteByte((char)((a_Entity.GetRotation() / 360.f) * 256));
WriteByte((char)((a_Entity.GetRot().x / 360.f) * 256));
WriteByte((char)((a_Entity.GetPitch() / 360.f) * 256));
Flush();
}
@ -664,7 +664,7 @@ void cProtocol125::SendPlayerMoveLook(void)
WriteDouble(Player->GetStance() + 0.03); // Add a small amount so that the player doesn't start inside a block
WriteDouble(Player->GetPosY() + 0.03); // Add a small amount so that the player doesn't start inside a block
WriteDouble(Player->GetPosZ());
WriteFloat ((float)(Player->GetRotation()));
WriteFloat ((float)(Player->GetRot().x));
WriteFloat ((float)(Player->GetPitch()));
WriteBool (Player->IsOnGround());
Flush();
@ -864,7 +864,7 @@ void cProtocol125::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleTyp
WriteInt ((int)(a_Vehicle.GetPosY() * 32));
WriteInt ((int)(a_Vehicle.GetPosZ() * 32));
WriteByte ((Byte)((a_Vehicle.GetPitch() / 360.f) * 256));
WriteByte ((Byte)((a_Vehicle.GetRotation() / 360.f) * 256));
WriteByte ((Byte)((a_Vehicle.GetRot().x / 360.f) * 256));
WriteInt (a_VehicleSubType);
if (a_VehicleSubType != 0)
{
@ -897,7 +897,7 @@ void cProtocol125::SendTeleportEntity(const cEntity & a_Entity)
WriteInt ((int)(floor(a_Entity.GetPosX() * 32)));
WriteInt ((int)(floor(a_Entity.GetPosY() * 32)));
WriteInt ((int)(floor(a_Entity.GetPosZ() * 32)));
WriteByte ((char)((a_Entity.GetRotation() / 360.f) * 256));
WriteByte ((char)((a_Entity.GetRot().x / 360.f) * 256));
WriteByte ((char)((a_Entity.GetPitch() / 360.f) * 256));
Flush();
}

View File

@ -421,7 +421,7 @@ void cProtocol132::SendSpawnMob(const cMonster & a_Mob)
WriteInt (a_Mob.GetUniqueID());
WriteByte (a_Mob.GetMobType());
WriteVectorI((Vector3i)(a_Mob.GetPosition() * 32));
WriteByte ((Byte)((a_Mob.GetRotation() / 360.f) * 256));
WriteByte ((Byte)((a_Mob.GetRot().x / 360.f) * 256));
WriteByte ((Byte)((a_Mob.GetPitch() / 360.f) * 256));
WriteByte ((Byte)((a_Mob.GetHeadYaw() / 360.f) * 256));
WriteShort ((short)(a_Mob.GetSpeedX() * 400));

View File

@ -250,7 +250,7 @@ void cProtocol146::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleTyp
WriteInt ((int)(a_Vehicle.GetPosY() * 32));
WriteInt ((int)(a_Vehicle.GetPosZ() * 32));
WriteByte ((Byte)((a_Vehicle.GetPitch() / 360.f) * 256));
WriteByte ((Byte)((a_Vehicle.GetRotation() / 360.f) * 256));
WriteByte ((Byte)((a_Vehicle.GetRot().x / 360.f) * 256));
WriteInt (a_VehicleSubType);
if (a_VehicleSubType != 0)
{

View File

@ -226,7 +226,7 @@ void cSlotArea::DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_
for (int i = 0; i < m_NumSlots; i++)
{
const cItem * Slot = GetSlot(i, a_Player);
if (!Slot->IsStackableWith(a_ItemStack) && (!Slot->IsEmpty() || a_KeepEmptySlots))
if (!Slot->IsEqual(a_ItemStack) && (!Slot->IsEmpty() || a_KeepEmptySlots))
{
// Different items
continue;
@ -265,7 +265,7 @@ bool cSlotArea::CollectItemsToHand(cItem & a_Dragging, cPlayer & a_Player, bool
for (int i = 0; i < NumSlots; i++)
{
const cItem & SlotItem = *GetSlot(i, a_Player);
if (!SlotItem.IsStackableWith(a_Dragging))
if (!SlotItem.IsEqual(a_Dragging))
{
continue;
}
@ -908,7 +908,7 @@ void cSlotAreaTemporary::TossItems(cPlayer & a_Player, int a_Begin, int a_End)
} // for i - itr->second[]
double vX = 0, vY = 0, vZ = 0;
EulerToVector(-a_Player.GetRotation(), a_Player.GetPitch(), vZ, vX, vY);
EulerToVector(-a_Player.GetRot().x, a_Player.GetPitch(), vZ, vX, vY);
vY = -vY * 2 + 1.f;
a_Player.GetWorld()->SpawnItemPickups(Drops, a_Player.GetPosX(), a_Player.GetPosY() + 1.6f, a_Player.GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because player created
}

View File

@ -642,7 +642,7 @@ int cWindow::DistributeItemToSlots(cPlayer & a_Player, const cItem & a_Item, int
Area->SetSlot(LocalSlotNum, a_Player, ToStore);
NumDistributed += ToStore.m_ItemCount;
}
else if (AtSlot.IsStackableWith(a_Item))
else if (AtSlot.IsEqual(a_Item))
{
// Occupied, add and cap at MaxStack:
int CanStore = std::min(a_NumToEachSlot, (int)MaxStack - AtSlot.m_ItemCount);

View File

@ -257,7 +257,7 @@ void cNBTChunkSerializer::AddBasicEntity(cEntity * a_Entity, const AString & a_C
m_Writer.AddDouble("", a_Entity->GetSpeedZ());
m_Writer.EndList();
m_Writer.BeginList("Rotation", TAG_Double);
m_Writer.AddDouble("", a_Entity->GetRotation());
m_Writer.AddDouble("", a_Entity->GetRot().x);
m_Writer.AddDouble("", a_Entity->GetPitch());
m_Writer.EndList();
}

View File

@ -1891,7 +1891,7 @@ bool cWSSAnvil::LoadEntityBaseFromNBT(cEntity & a_Entity, const cParsedNBT & a_N
{
return false;
}
a_Entity.SetRotation(Rotation[0]);
a_Entity.SetYaw(Rotation[0]);
a_Entity.SetRoll (Rotation[1]);
return true;