1
0

Rename SkullEntity to MobHeadEntity

This commit is contained in:
Howaner 2014-02-19 14:45:09 +01:00
parent 823ee3a125
commit d63ce62f3b
23 changed files with 254 additions and 256 deletions

View File

@ -22,7 +22,7 @@
#include "../BlockEntities/FurnaceEntity.h" #include "../BlockEntities/FurnaceEntity.h"
#include "../BlockEntities/HopperEntity.h" #include "../BlockEntities/HopperEntity.h"
#include "../BlockEntities/NoteEntity.h" #include "../BlockEntities/NoteEntity.h"
#include "../BlockEntities/SkullEntity.h" #include "../BlockEntities/MobHeadEntity.h"
#include "md5/md5.h" #include "md5/md5.h"
#include "../LineBlockTracer.h" #include "../LineBlockTracer.h"
#include "../WorldStorage/SchematicFileSerializer.h" #include "../WorldStorage/SchematicFileSerializer.h"
@ -2417,7 +2417,7 @@ void ManualBindings::Bind(lua_State * tolua_S)
tolua_function(tolua_S, "DoWithFurnaceAt", tolua_DoWithXYZ<cWorld, cFurnaceEntity, &cWorld::DoWithFurnaceAt>); tolua_function(tolua_S, "DoWithFurnaceAt", tolua_DoWithXYZ<cWorld, cFurnaceEntity, &cWorld::DoWithFurnaceAt>);
tolua_function(tolua_S, "DoWithNoteBlockAt", tolua_DoWithXYZ<cWorld, cNoteEntity, &cWorld::DoWithNoteBlockAt>); tolua_function(tolua_S, "DoWithNoteBlockAt", tolua_DoWithXYZ<cWorld, cNoteEntity, &cWorld::DoWithNoteBlockAt>);
tolua_function(tolua_S, "DoWithCommandBlockAt", tolua_DoWithXYZ<cWorld, cCommandBlockEntity, &cWorld::DoWithCommandBlockAt>); tolua_function(tolua_S, "DoWithCommandBlockAt", tolua_DoWithXYZ<cWorld, cCommandBlockEntity, &cWorld::DoWithCommandBlockAt>);
tolua_function(tolua_S, "DoWithSkullBlockAt", tolua_DoWithXYZ<cWorld, cSkullEntity, &cWorld::DoWithSkullBlockAt>); tolua_function(tolua_S, "DoWithMobHeadBlockAt", tolua_DoWithXYZ<cWorld, cMobHeadEntity, &cWorld::DoWithMobHeadBlockAt>);
tolua_function(tolua_S, "DoWithPlayer", tolua_DoWith< cWorld, cPlayer, &cWorld::DoWithPlayer>); tolua_function(tolua_S, "DoWithPlayer", tolua_DoWith< cWorld, cPlayer, &cWorld::DoWithPlayer>);
tolua_function(tolua_S, "FindAndDoWithPlayer", tolua_DoWith< cWorld, cPlayer, &cWorld::FindAndDoWithPlayer>); tolua_function(tolua_S, "FindAndDoWithPlayer", tolua_DoWith< cWorld, cPlayer, &cWorld::FindAndDoWithPlayer>);
tolua_function(tolua_S, "ForEachBlockEntityInChunk", tolua_ForEachInChunk<cWorld, cBlockEntity, &cWorld::ForEachBlockEntityInChunk>); tolua_function(tolua_S, "ForEachBlockEntityInChunk", tolua_ForEachInChunk<cWorld, cBlockEntity, &cWorld::ForEachBlockEntityInChunk>);

View File

@ -15,7 +15,7 @@
#include "JukeboxEntity.h" #include "JukeboxEntity.h"
#include "NoteEntity.h" #include "NoteEntity.h"
#include "SignEntity.h" #include "SignEntity.h"
#include "SkullEntity.h" #include "MobHeadEntity.h"
@ -30,7 +30,7 @@ cBlockEntity * cBlockEntity::CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE
case E_BLOCK_DISPENSER: return new cDispenserEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); case E_BLOCK_DISPENSER: return new cDispenserEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_DROPPER: return new cDropperEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); case E_BLOCK_DROPPER: return new cDropperEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_ENDER_CHEST: return new cEnderChestEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); case E_BLOCK_ENDER_CHEST: return new cEnderChestEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_HEAD: return new cSkullEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); case E_BLOCK_HEAD: return new cMobHeadEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_LIT_FURNACE: return new cFurnaceEntity (a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_World); case E_BLOCK_LIT_FURNACE: return new cFurnaceEntity (a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_World);
case E_BLOCK_FURNACE: return new cFurnaceEntity (a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_World); case E_BLOCK_FURNACE: return new cFurnaceEntity (a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_World);
case E_BLOCK_HOPPER: return new cHopperEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); case E_BLOCK_HOPPER: return new cHopperEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);

View File

@ -0,0 +1,108 @@
// MobHeadEntity.cpp
// Implements the cMobHeadEntity class representing a single skull/head in the world
#include "Globals.h"
#include "json/json.h"
#include "MobHeadEntity.h"
#include "../Entities/Player.h"
cMobHeadEntity::cMobHeadEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) :
super(E_BLOCK_HEAD, a_BlockX, a_BlockY, a_BlockZ, a_World),
m_Owner("")
{
}
void cMobHeadEntity::UsedBy(cPlayer * a_Player)
{
UNUSED(a_Player);
}
void cMobHeadEntity::SetType(const eMobHeadType & a_Type)
{
if ((!m_Owner.empty()) && (a_Type != SKULL_TYPE_PLAYER))
{
m_Owner = "";
}
m_Type = a_Type;
}
void cMobHeadEntity::SetRotation(eMobHeadRotation a_Rotation)
{
m_Rotation = a_Rotation;
}
void cMobHeadEntity::SetOwner(const AString & a_Owner)
{
if ((a_Owner.length() > 16) || (m_Type != SKULL_TYPE_PLAYER))
{
return;
}
m_Owner = a_Owner;
}
void cMobHeadEntity::SendTo(cClientHandle & a_Client)
{
a_Client.SendUpdateBlockEntity(*this);
}
bool cMobHeadEntity::LoadFromJson(const Json::Value & a_Value)
{
m_PosX = a_Value.get("x", 0).asInt();
m_PosY = a_Value.get("y", 0).asInt();
m_PosZ = a_Value.get("z", 0).asInt();
m_Type = static_cast<eMobHeadType>(a_Value.get("Type", 0).asInt());
m_Rotation = static_cast<eMobHeadRotation>(a_Value.get("Rotation", 0).asInt());
m_Owner = a_Value.get("Owner", "").asString();
return true;
}
void cMobHeadEntity::SaveToJson(Json::Value & a_Value)
{
a_Value["x"] = m_PosX;
a_Value["y"] = m_PosY;
a_Value["z"] = m_PosZ;
a_Value["Type"] = m_Type;
a_Value["Rotation"] = m_Rotation;
a_Value["Owner"] = m_Owner;
}

View File

@ -0,0 +1,79 @@
// MobHeadEntity.h
// Declares the cMobHeadEntity class representing a single skull/head in the world
#pragma once
#include "BlockEntity.h"
namespace Json
{
class Value;
}
// tolua_begin
class cMobHeadEntity :
public cBlockEntity
{
typedef cBlockEntity super;
public:
// tolua_end
/** Creates a new mob head entity at the specified block coords. a_World may be NULL */
cMobHeadEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
bool LoadFromJson( const Json::Value& a_Value );
virtual void SaveToJson(Json::Value& a_Value ) override;
// tolua_begin
/** Set the Type */
void SetType(const eMobHeadType & a_SkullType);
/** Set the Rotation */
void SetRotation(eMobHeadRotation a_Rotation);
/** Set the Player Name for Mobheads with Player type */
void SetOwner(const AString & a_Owner);
/** Get the Type */
eMobHeadType GetType(void) const { return m_Type; }
/** Get the Rotation */
eMobHeadRotation GetRotation(void) const { return m_Rotation; }
/** Get the setted Player Name */
AString GetOwner(void) const { return m_Owner; }
// tolua_end
virtual void UsedBy(cPlayer * a_Player) override;
virtual void SendTo(cClientHandle & a_Client) override;
static const char * GetClassStatic(void) { return "cMobHeadEntity"; }
private:
eMobHeadType m_Type;
eMobHeadRotation m_Rotation;
AString m_Owner;
} ; // tolua_export

View File

@ -1,108 +0,0 @@
// SkullEntity.cpp
// Implements the cSkullEntity class representing a single skull/head in the world
#include "Globals.h"
#include "json/json.h"
#include "SkullEntity.h"
#include "../Entities/Player.h"
cSkullEntity::cSkullEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) :
super(E_BLOCK_HEAD, a_BlockX, a_BlockY, a_BlockZ, a_World),
m_Owner("")
{
}
void cSkullEntity::UsedBy(cPlayer * a_Player)
{
UNUSED(a_Player);
}
void cSkullEntity::SetSkullType(const eSkullType & a_SkullType)
{
if ((!m_Owner.empty()) && (a_SkullType != SKULL_TYPE_PLAYER))
{
m_Owner = "";
}
m_SkullType = a_SkullType;
}
void cSkullEntity::SetRotation(eSkullRotation a_Rotation)
{
m_Rotation = a_Rotation;
}
void cSkullEntity::SetOwner(const AString & a_Owner)
{
if ((a_Owner.length() > 16) || (m_SkullType != SKULL_TYPE_PLAYER))
{
return;
}
m_Owner = a_Owner;
}
void cSkullEntity::SendTo(cClientHandle & a_Client)
{
a_Client.SendUpdateBlockEntity(*this);
}
bool cSkullEntity::LoadFromJson(const Json::Value & a_Value)
{
m_PosX = a_Value.get("x", 0).asInt();
m_PosY = a_Value.get("y", 0).asInt();
m_PosZ = a_Value.get("z", 0).asInt();
m_SkullType = static_cast<eSkullType>(a_Value.get("SkullType", 0).asInt());
m_Rotation = static_cast<eSkullRotation>(a_Value.get("Rotation", 0).asInt());
m_Owner = a_Value.get("Owner", "").asString();
return true;
}
void cSkullEntity::SaveToJson(Json::Value & a_Value)
{
a_Value["x"] = m_PosX;
a_Value["y"] = m_PosY;
a_Value["z"] = m_PosZ;
a_Value["SkullType"] = m_SkullType;
a_Value["Rotation"] = m_Rotation;
a_Value["Owner"] = m_Owner;
}

View File

@ -1,79 +0,0 @@
// SkullEntity.h
// Declares the cSkullEntity class representing a single skull/head in the world
#pragma once
#include "BlockEntity.h"
namespace Json
{
class Value;
}
// tolua_begin
class cSkullEntity :
public cBlockEntity
{
typedef cBlockEntity super;
public:
// tolua_end
/** Creates a new skull entity at the specified block coords. a_World may be NULL */
cSkullEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
bool LoadFromJson( const Json::Value& a_Value );
virtual void SaveToJson(Json::Value& a_Value ) override;
// tolua_begin
/** Set the Skull Type */
void SetSkullType(const eSkullType & a_SkullType);
/** Set the Rotation */
void SetRotation(eSkullRotation a_Rotation);
/** Set the Player Name for Player Skull */
void SetOwner(const AString & a_Owner);
/** Get the Skull Type */
eSkullType GetSkullType(void) const { return m_SkullType; }
/** Get the Rotation */
eSkullRotation GetRotation(void) const { return m_Rotation; }
/** Get the setted Player Name */
AString GetOwner(void) const { return m_Owner; }
// tolua_end
virtual void UsedBy(cPlayer * a_Player) override;
virtual void SendTo(cClientHandle & a_Client) override;
static const char * GetClassStatic(void) { return "cSkullEntity"; }
private:
eSkullType m_SkullType;
eSkullRotation m_Rotation;
AString m_Owner;
} ; // tolua_export

View File

@ -34,7 +34,7 @@
#include "BlockGlass.h" #include "BlockGlass.h"
#include "BlockGlowstone.h" #include "BlockGlowstone.h"
#include "BlockGravel.h" #include "BlockGravel.h"
#include "BlockSkull.h" #include "BlockMobHead.h"
#include "BlockHopper.h" #include "BlockHopper.h"
#include "BlockIce.h" #include "BlockIce.h"
#include "BlockLadder.h" #include "BlockLadder.h"
@ -147,7 +147,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_GRASS: return new cBlockDirtHandler (a_BlockType); case E_BLOCK_GRASS: return new cBlockDirtHandler (a_BlockType);
case E_BLOCK_GRAVEL: return new cBlockGravelHandler (a_BlockType); case E_BLOCK_GRAVEL: return new cBlockGravelHandler (a_BlockType);
case E_BLOCK_HAY_BALE: return new cBlockSidewaysHandler (a_BlockType); case E_BLOCK_HAY_BALE: return new cBlockSidewaysHandler (a_BlockType);
case E_BLOCK_HEAD: return new cBlockSkullHandler (a_BlockType); case E_BLOCK_HEAD: return new cBlockMobHeadHandler (a_BlockType);
case E_BLOCK_HOPPER: return new cBlockHopperHandler (a_BlockType); case E_BLOCK_HOPPER: return new cBlockHopperHandler (a_BlockType);
case E_BLOCK_ICE: return new cBlockIceHandler (a_BlockType); case E_BLOCK_ICE: return new cBlockIceHandler (a_BlockType);
case E_BLOCK_INACTIVE_COMPARATOR: return new cBlockComparatorHandler (a_BlockType); case E_BLOCK_INACTIVE_COMPARATOR: return new cBlockComparatorHandler (a_BlockType);

View File

@ -2,17 +2,17 @@
#pragma once #pragma once
#include "BlockEntity.h" #include "BlockEntity.h"
#include "../BlockEntities/SkullEntity.h" #include "../BlockEntities/MobHeadEntity.h"
class cBlockSkullHandler : class cBlockMobHeadHandler :
public cBlockEntityHandler public cBlockEntityHandler
{ {
public: public:
cBlockSkullHandler(BLOCKTYPE a_BlockType) cBlockMobHeadHandler(BLOCKTYPE a_BlockType)
: cBlockEntityHandler(a_BlockType) : cBlockEntityHandler(a_BlockType)
{ {
} }
@ -29,13 +29,13 @@ public:
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
) override ) override
{ {
class cCallback : public cSkullBlockCallback class cCallback : public cMobHeadBlockCallback
{ {
cPlayer * m_Player; cPlayer * m_Player;
NIBBLETYPE m_OldBlockMeta; NIBBLETYPE m_OldBlockMeta;
NIBBLETYPE m_NewBlockMeta; NIBBLETYPE m_NewBlockMeta;
virtual bool Item (cSkullEntity * a_SkullEntity) virtual bool Item (cMobHeadEntity * a_MobHeadEntity)
{ {
int Rotation = 0; int Rotation = 0;
if (m_NewBlockMeta == 1) if (m_NewBlockMeta == 1)
@ -43,8 +43,8 @@ public:
Rotation = (int) floor(m_Player->GetYaw() * 16.0F / 360.0F + 0.5) & 0xF; Rotation = (int) floor(m_Player->GetYaw() * 16.0F / 360.0F + 0.5) & 0xF;
} }
a_SkullEntity->SetSkullType(static_cast<eSkullType>(m_OldBlockMeta)); a_MobHeadEntity->SetType(static_cast<eMobHeadType>(m_OldBlockMeta));
a_SkullEntity->SetRotation(static_cast<eSkullRotation>(Rotation)); a_MobHeadEntity->SetRotation(static_cast<eMobHeadRotation>(Rotation));
return false; return false;
} }
@ -59,7 +59,7 @@ public:
a_BlockMeta = a_BlockFace; a_BlockMeta = a_BlockFace;
cWorld * World = (cWorld *) &a_WorldInterface; cWorld * World = (cWorld *) &a_WorldInterface;
World->DoWithSkullBlockAt(a_BlockX, a_BlockY, a_BlockZ, Callback); World->DoWithMobHeadBlockAt(a_BlockX, a_BlockY, a_BlockZ, Callback);
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, a_BlockMeta); a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, a_BlockMeta);
} }
} ; } ;

View File

@ -39,7 +39,7 @@ if (NOT MSVC)
BlockEntities/JukeboxEntity.h BlockEntities/JukeboxEntity.h
BlockEntities/NoteEntity.h BlockEntities/NoteEntity.h
BlockEntities/SignEntity.h BlockEntities/SignEntity.h
BlockEntities/SkullEntity.h BlockEntities/MobHeadEntity.h
BlockID.h BlockID.h
BoundingBox.h BoundingBox.h
ChatColor.h ChatColor.h

View File

@ -19,7 +19,7 @@
#include "BlockEntities/JukeboxEntity.h" #include "BlockEntities/JukeboxEntity.h"
#include "BlockEntities/NoteEntity.h" #include "BlockEntities/NoteEntity.h"
#include "BlockEntities/SignEntity.h" #include "BlockEntities/SignEntity.h"
#include "BlockEntities/SkullEntity.h" #include "BlockEntities/MobHeadEntity.h"
#include "Entities/Pickup.h" #include "Entities/Pickup.h"
#include "Item.h" #include "Item.h"
#include "Noise.h" #include "Noise.h"
@ -2312,7 +2312,7 @@ bool cChunk::DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCom
bool cChunk::DoWithSkullBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cSkullBlockCallback & a_Callback) bool cChunk::DoWithMobHeadBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cMobHeadBlockCallback & a_Callback)
{ {
// The blockentity list is locked by the parent chunkmap's CS // The blockentity list is locked by the parent chunkmap's CS
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2)
@ -2329,7 +2329,7 @@ bool cChunk::DoWithSkullBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cSkull
} }
// The correct block entity is here, // The correct block entity is here,
if (a_Callback.Item((cSkullEntity *)*itr)) if (a_Callback.Item((cMobHeadEntity *)*itr))
{ {
return false; return false;
} }

View File

@ -31,7 +31,7 @@ class cChestEntity;
class cDispenserEntity; class cDispenserEntity;
class cFurnaceEntity; class cFurnaceEntity;
class cNoteEntity; class cNoteEntity;
class cSkullEntity; class cMobHeadEntity;
class cBlockArea; class cBlockArea;
class cPawn; class cPawn;
class cPickup; class cPickup;
@ -48,7 +48,7 @@ typedef cItemCallback<cDispenserEntity> cDispenserCallback;
typedef cItemCallback<cFurnaceEntity> cFurnaceCallback; typedef cItemCallback<cFurnaceEntity> cFurnaceCallback;
typedef cItemCallback<cNoteEntity> cNoteBlockCallback; typedef cItemCallback<cNoteEntity> cNoteBlockCallback;
typedef cItemCallback<cCommandBlockEntity> cCommandBlockCallback; typedef cItemCallback<cCommandBlockEntity> cCommandBlockCallback;
typedef cItemCallback<cSkullEntity> cSkullBlockCallback; typedef cItemCallback<cMobHeadEntity> cMobHeadBlockCallback;
@ -245,8 +245,8 @@ public:
/** Calls the callback for the command block at the specified coords; returns false if there's no command block at those coords or callback returns true, returns true if found */ /** Calls the callback for the command block at the specified coords; returns false if there's no command block at those coords or callback returns true, returns true if found */
bool DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback & a_Callback); bool DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback & a_Callback);
/** Calls the callback for the skull block at the specified coords; returns false if there's no skull block at those coords or callback returns true, returns true if found */ /** Calls the callback for the mob head block at the specified coords; returns false if there's no mob header block at those coords or callback returns true, returns true if found */
bool DoWithSkullBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cSkullBlockCallback & a_Callback); bool DoWithMobHeadBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cMobHeadBlockCallback & a_Callback);
/** Retrieves the test on the sign at the specified coords; returns false if there's no sign at those coords, true if found */ /** Retrieves the test on the sign at the specified coords; returns false if there's no sign at those coords, true if found */
bool GetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); // Lua-accessible bool GetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); // Lua-accessible

View File

@ -2121,7 +2121,7 @@ bool cChunkMap::DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, c
bool cChunkMap::DoWithSkullBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cSkullBlockCallback & a_Callback) bool cChunkMap::DoWithMobHeadBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cMobHeadBlockCallback & a_Callback)
{ {
int ChunkX, ChunkZ; int ChunkX, ChunkZ;
int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ;
@ -2132,7 +2132,7 @@ bool cChunkMap::DoWithSkullBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cSk
{ {
return false; return false;
} }
return Chunk->DoWithSkullBlockAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); return Chunk->DoWithMobHeadBlockAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
} }

View File

@ -25,7 +25,7 @@ class cDropSpenserEntity;
class cFurnaceEntity; class cFurnaceEntity;
class cNoteEntity; class cNoteEntity;
class cCommandBlockEntity; class cCommandBlockEntity;
class cSkullEntity; class cMobHeadEntity;
class cPawn; class cPawn;
class cPickup; class cPickup;
class cChunkDataSerializer; class cChunkDataSerializer;
@ -44,7 +44,7 @@ typedef cItemCallback<cDropSpenserEntity> cDropSpenserCallback;
typedef cItemCallback<cFurnaceEntity> cFurnaceCallback; typedef cItemCallback<cFurnaceEntity> cFurnaceCallback;
typedef cItemCallback<cNoteEntity> cNoteBlockCallback; typedef cItemCallback<cNoteEntity> cNoteBlockCallback;
typedef cItemCallback<cCommandBlockEntity> cCommandBlockCallback; typedef cItemCallback<cCommandBlockEntity> cCommandBlockCallback;
typedef cItemCallback<cSkullEntity> cSkullBlockCallback; typedef cItemCallback<cMobHeadEntity> cMobHeadBlockCallback;
typedef cItemCallback<cChunk> cChunkCallback; typedef cItemCallback<cChunk> cChunkCallback;
@ -247,8 +247,8 @@ public:
/** Calls the callback for the command block at the specified coords; returns false if there's no command block at those coords or callback returns true, returns true if found */ /** Calls the callback for the command block at the specified coords; returns false if there's no command block at those coords or callback returns true, returns true if found */
bool DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback & a_Callback); // Lua-accessible bool DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback & a_Callback); // Lua-accessible
/** Calls the callback for the skull block at the specified coords; returns false if there's no skull block at those coords or callback returns true, returns true if found */ /** Calls the callback for the mob head block at the specified coords; returns false if there's no mob head block at those coords or callback returns true, returns true if found */
bool DoWithSkullBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cSkullBlockCallback & a_Callback); // Lua-accessible bool DoWithMobHeadBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cMobHeadBlockCallback & a_Callback); // Lua-accessible
/** Retrieves the test on the sign at the specified coords; returns false if there's no sign at those coords, true if found */ /** Retrieves the test on the sign at the specified coords; returns false if there's no sign at those coords, true if found */
bool GetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); // Lua-accessible bool GetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); // Lua-accessible

View File

@ -174,7 +174,7 @@ enum eWeather
enum eSkullType enum eMobHeadType
{ {
SKULL_TYPE_SKELETON = 0, SKULL_TYPE_SKELETON = 0,
SKULL_TYPE_WITHER = 1, SKULL_TYPE_WITHER = 1,
@ -187,7 +187,7 @@ enum eSkullType
enum eSkullRotation enum eMobHeadRotation
{ {
SKULL_ROTATION_NORTH = 0, SKULL_ROTATION_NORTH = 0,
SKULL_ROTATION_NORTH_NORTH_EAST = 1, SKULL_ROTATION_NORTH_NORTH_EAST = 1,

View File

@ -35,7 +35,7 @@
#include "ItemShears.h" #include "ItemShears.h"
#include "ItemShovel.h" #include "ItemShovel.h"
#include "ItemSign.h" #include "ItemSign.h"
#include "ItemSkull.h" #include "ItemMobHead.h"
#include "ItemSpawnEgg.h" #include "ItemSpawnEgg.h"
#include "ItemSugarcane.h" #include "ItemSugarcane.h"
#include "ItemSword.h" #include "ItemSword.h"
@ -111,7 +111,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
case E_ITEM_REDSTONE_REPEATER: return new cItemRedstoneRepeaterHandler(a_ItemType); case E_ITEM_REDSTONE_REPEATER: return new cItemRedstoneRepeaterHandler(a_ItemType);
case E_ITEM_SHEARS: return new cItemShearsHandler(a_ItemType); case E_ITEM_SHEARS: return new cItemShearsHandler(a_ItemType);
case E_ITEM_SIGN: return new cItemSignHandler(a_ItemType); case E_ITEM_SIGN: return new cItemSignHandler(a_ItemType);
case E_ITEM_HEAD: return new cItemSkullHandler(a_ItemType); case E_ITEM_HEAD: return new cItemMobHeadHandler(a_ItemType);
case E_ITEM_SNOWBALL: return new cItemSnowballHandler(); case E_ITEM_SNOWBALL: return new cItemSnowballHandler();
case E_ITEM_SPAWN_EGG: return new cItemSpawnEggHandler(a_ItemType); case E_ITEM_SPAWN_EGG: return new cItemSpawnEggHandler(a_ItemType);
case E_ITEM_SUGARCANE: return new cItemSugarcaneHandler(a_ItemType); case E_ITEM_SUGARCANE: return new cItemSugarcaneHandler(a_ItemType);

View File

@ -8,11 +8,11 @@
class cItemSkullHandler : class cItemMobHeadHandler :
public cItemHandler public cItemHandler
{ {
public: public:
cItemSkullHandler(int a_ItemType) : cItemMobHeadHandler(int a_ItemType) :
cItemHandler(a_ItemType) cItemHandler(a_ItemType)
{ {
} }
@ -31,10 +31,8 @@ public:
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override
{ {
a_BlockType = E_BLOCK_HEAD; a_BlockType = E_BLOCK_HEAD;
a_BlockMeta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage & 0x0f); a_BlockMeta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage & 0x0f);
return true; return true;
} }
} ; } ;

View File

@ -26,7 +26,7 @@ Implements the 1.7.x protocol classes:
#include "../Mobs/IncludeAllMonsters.h" #include "../Mobs/IncludeAllMonsters.h"
#include "../UI/Window.h" #include "../UI/Window.h"
#include "../BlockEntities/CommandBlockEntity.h" #include "../BlockEntities/CommandBlockEntity.h"
#include "../BlockEntities/SkullEntity.h" #include "../BlockEntities/MobHeadEntity.h"
#include "../CompositeChat.h" #include "../CompositeChat.h"
@ -1043,7 +1043,7 @@ void cProtocol172::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity)
{ {
case E_BLOCK_MOB_SPAWNER: Action = 1; break; // Update mob spawner spinny mob thing case E_BLOCK_MOB_SPAWNER: Action = 1; break; // Update mob spawner spinny mob thing
case E_BLOCK_COMMAND_BLOCK: Action = 2; break; // Update command block text case E_BLOCK_COMMAND_BLOCK: Action = 2; break; // Update command block text
case E_BLOCK_HEAD: Action = 4; break; // Update Skull entity case E_BLOCK_HEAD: Action = 4; break; // Update Mobhead entity
default: ASSERT(!"Unhandled or unimplemented BlockEntity update request!"); break; default: ASSERT(!"Unhandled or unimplemented BlockEntity update request!"); break;
} }
Pkt.WriteByte(Action); Pkt.WriteByte(Action);
@ -2273,14 +2273,14 @@ void cProtocol172::cPacketizer::WriteBlockEntity(const cBlockEntity & a_BlockEnt
} }
case E_BLOCK_HEAD: case E_BLOCK_HEAD:
{ {
cSkullEntity & SkullEntity = (cSkullEntity &)a_BlockEntity; cMobHeadEntity & MobHeadEntity = (cMobHeadEntity &)a_BlockEntity;
Writer.AddInt("x", SkullEntity.GetPosX()); Writer.AddInt("x", MobHeadEntity.GetPosX());
Writer.AddInt("y", SkullEntity.GetPosY()); Writer.AddInt("y", MobHeadEntity.GetPosY());
Writer.AddInt("z", SkullEntity.GetPosZ()); Writer.AddInt("z", MobHeadEntity.GetPosZ());
Writer.AddByte("SkullType", SkullEntity.GetSkullType() & 0xFF); Writer.AddByte("SkullType", MobHeadEntity.GetType() & 0xFF);
Writer.AddByte("Rot", SkullEntity.GetRotation() & 0xFF); Writer.AddByte("Rot", MobHeadEntity.GetRotation() & 0xFF);
Writer.AddString("ExtraType", SkullEntity.GetOwner().c_str()); Writer.AddString("ExtraType", MobHeadEntity.GetOwner().c_str());
Writer.AddString("id", "Skull"); // "Tile Entity ID" - MC wiki; vanilla server always seems to send this though Writer.AddString("id", "Skull"); // "Tile Entity ID" - MC wiki; vanilla server always seems to send this though
break; break;
} }

View File

@ -1165,9 +1165,9 @@ bool cWorld::DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCom
bool cWorld::DoWithSkullBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cSkullBlockCallback & a_Callback) bool cWorld::DoWithMobHeadBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cMobHeadBlockCallback & a_Callback)
{ {
return m_ChunkMap->DoWithSkullBlockAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); return m_ChunkMap->DoWithMobHeadBlockAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
} }

View File

@ -45,7 +45,7 @@ class cChestEntity;
class cDispenserEntity; class cDispenserEntity;
class cFurnaceEntity; class cFurnaceEntity;
class cNoteEntity; class cNoteEntity;
class cSkullEntity; class cMobHeadEntity;
class cMobCensus; class cMobCensus;
class cCompositeChat; class cCompositeChat;
@ -58,7 +58,7 @@ typedef cItemCallback<cDispenserEntity> cDispenserCallback;
typedef cItemCallback<cFurnaceEntity> cFurnaceCallback; typedef cItemCallback<cFurnaceEntity> cFurnaceCallback;
typedef cItemCallback<cNoteEntity> cNoteBlockCallback; typedef cItemCallback<cNoteEntity> cNoteBlockCallback;
typedef cItemCallback<cCommandBlockEntity> cCommandBlockCallback; typedef cItemCallback<cCommandBlockEntity> cCommandBlockCallback;
typedef cItemCallback<cSkullEntity> cSkullBlockCallback; typedef cItemCallback<cMobHeadEntity> cMobHeadBlockCallback;
@ -512,8 +512,8 @@ public:
/** Calls the callback for the command block at the specified coords; returns false if there's no command block at those coords or callback returns true, returns true if found */ /** Calls the callback for the command block at the specified coords; returns false if there's no command block at those coords or callback returns true, returns true if found */
bool DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback & a_Callback); // Exported in ManualBindings.cpp bool DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback & a_Callback); // Exported in ManualBindings.cpp
/** Calls the callback for the skull block at the specified coords; returns false if there's no skull block at those coords or callback returns true, returns true if found */ /** Calls the callback for the mob head block at the specified coords; returns false if there's no mob head block at those coords or callback returns true, returns true if found */
bool DoWithSkullBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cSkullBlockCallback & a_Callback); // Exported in ManualBindings.cpp bool DoWithMobHeadBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cMobHeadBlockCallback & a_Callback); // Exported in ManualBindings.cpp
/** Retrieves the test on the sign at the specified coords; returns false if there's no sign at those coords, true if found */ /** Retrieves the test on the sign at the specified coords; returns false if there's no sign at those coords, true if found */
bool GetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); // Exported in ManualBindings.cpp bool GetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); // Exported in ManualBindings.cpp

View File

@ -19,7 +19,7 @@
#include "../BlockEntities/JukeboxEntity.h" #include "../BlockEntities/JukeboxEntity.h"
#include "../BlockEntities/NoteEntity.h" #include "../BlockEntities/NoteEntity.h"
#include "../BlockEntities/SignEntity.h" #include "../BlockEntities/SignEntity.h"
#include "../BlockEntities/SkullEntity.h" #include "../BlockEntities/MobHeadEntity.h"
#include "../Entities/Entity.h" #include "../Entities/Entity.h"
#include "../Entities/FallingBlock.h" #include "../Entities/FallingBlock.h"
@ -261,13 +261,13 @@ void cNBTChunkSerializer::AddSignEntity(cSignEntity * a_Sign)
void cNBTChunkSerializer::AddSkullEntity(cSkullEntity * a_Skull) void cNBTChunkSerializer::AddMobHeadEntity(cMobHeadEntity * a_MobHead)
{ {
m_Writer.BeginCompound(""); m_Writer.BeginCompound("");
AddBasicTileEntity(a_Skull, "Skull"); AddBasicTileEntity(a_MobHead, "Skull");
m_Writer.AddByte ("SkullType", a_Skull->GetSkullType() & 0xFF); m_Writer.AddByte ("SkullType", a_MobHead->GetType() & 0xFF);
m_Writer.AddByte ("Rot", a_Skull->GetRotation() & 0xFF); m_Writer.AddByte ("Rot", a_MobHead->GetRotation() & 0xFF);
m_Writer.AddString("ExtraType", a_Skull->GetOwner()); m_Writer.AddString("ExtraType", a_MobHead->GetOwner());
m_Writer.EndCompound(); m_Writer.EndCompound();
} }
@ -681,7 +681,7 @@ void cNBTChunkSerializer::BlockEntity(cBlockEntity * a_Entity)
case E_BLOCK_HOPPER: AddHopperEntity ((cHopperEntity *) a_Entity); break; case E_BLOCK_HOPPER: AddHopperEntity ((cHopperEntity *) a_Entity); break;
case E_BLOCK_SIGN_POST: case E_BLOCK_SIGN_POST:
case E_BLOCK_WALLSIGN: AddSignEntity ((cSignEntity *) a_Entity); break; case E_BLOCK_WALLSIGN: AddSignEntity ((cSignEntity *) a_Entity); break;
case E_BLOCK_HEAD: AddSkullEntity ((cSkullEntity *) a_Entity); break; case E_BLOCK_HEAD: AddMobHeadEntity ((cMobHeadEntity *) a_Entity); break;
case E_BLOCK_NOTE_BLOCK: AddNoteEntity ((cNoteEntity *) a_Entity); break; case E_BLOCK_NOTE_BLOCK: AddNoteEntity ((cNoteEntity *) a_Entity); break;
case E_BLOCK_JUKEBOX: AddJukeboxEntity ((cJukeboxEntity *) a_Entity); break; case E_BLOCK_JUKEBOX: AddJukeboxEntity ((cJukeboxEntity *) a_Entity); break;
case E_BLOCK_COMMAND_BLOCK: AddCommandBlockEntity((cCommandBlockEntity *) a_Entity); break; case E_BLOCK_COMMAND_BLOCK: AddCommandBlockEntity((cCommandBlockEntity *) a_Entity); break;

View File

@ -29,7 +29,7 @@ class cHopperEntity;
class cJukeboxEntity; class cJukeboxEntity;
class cNoteEntity; class cNoteEntity;
class cSignEntity; class cSignEntity;
class cSkullEntity; class cMobHeadEntity;
class cFallingBlock; class cFallingBlock;
class cMinecart; class cMinecart;
class cMinecartWithChest; class cMinecartWithChest;
@ -94,7 +94,7 @@ protected:
void AddJukeboxEntity (cJukeboxEntity * a_Jukebox); void AddJukeboxEntity (cJukeboxEntity * a_Jukebox);
void AddNoteEntity (cNoteEntity * a_Note); void AddNoteEntity (cNoteEntity * a_Note);
void AddSignEntity (cSignEntity * a_Sign); void AddSignEntity (cSignEntity * a_Sign);
void AddSkullEntity (cSkullEntity * a_Skull); void AddMobHeadEntity (cMobHeadEntity * a_MobHead);
void AddCommandBlockEntity(cCommandBlockEntity * a_CmdBlock); void AddCommandBlockEntity(cCommandBlockEntity * a_CmdBlock);
// Entities: // Entities:

View File

@ -24,7 +24,7 @@
#include "../BlockEntities/JukeboxEntity.h" #include "../BlockEntities/JukeboxEntity.h"
#include "../BlockEntities/NoteEntity.h" #include "../BlockEntities/NoteEntity.h"
#include "../BlockEntities/SignEntity.h" #include "../BlockEntities/SignEntity.h"
#include "../BlockEntities/SkullEntity.h" #include "../BlockEntities/MobHeadEntity.h"
#include "../Mobs/Monster.h" #include "../Mobs/Monster.h"
@ -600,7 +600,7 @@ void cWSSAnvil::LoadBlockEntitiesFromNBT(cBlockEntityList & a_BlockEntities, con
} }
else if (strncmp(a_NBT.GetData(sID), "Skull", a_NBT.GetDataLength(sID)) == 0) else if (strncmp(a_NBT.GetData(sID), "Skull", a_NBT.GetDataLength(sID)) == 0)
{ {
LoadSkullFromNBT(a_BlockEntities, a_NBT, Child); LoadMobHeadFromNBT(a_BlockEntities, a_NBT, Child);
} }
else if (strncmp(a_NBT.GetData(sID), "Trap", a_NBT.GetDataLength(sID)) == 0) else if (strncmp(a_NBT.GetData(sID), "Trap", a_NBT.GetDataLength(sID)) == 0)
{ {
@ -932,7 +932,7 @@ void cWSSAnvil::LoadSignFromNBT(cBlockEntityList & a_BlockEntities, const cParse
void cWSSAnvil::LoadSkullFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) void cWSSAnvil::LoadMobHeadFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx)
{ {
ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound);
int x, y, z; int x, y, z;
@ -940,27 +940,27 @@ void cWSSAnvil::LoadSkullFromNBT(cBlockEntityList & a_BlockEntities, const cPars
{ {
return; return;
} }
std::auto_ptr<cSkullEntity> Skull(new cSkullEntity(x, y, z, m_World)); std::auto_ptr<cMobHeadEntity> MobHead(new cMobHeadEntity(x, y, z, m_World));
int currentLine = a_NBT.FindChildByName(a_TagIdx, "SkullType"); int currentLine = a_NBT.FindChildByName(a_TagIdx, "SkullType");
if (currentLine >= 0) if (currentLine >= 0)
{ {
Skull->SetSkullType(static_cast<eSkullType>(a_NBT.GetByte(currentLine))); MobHead->SetType(static_cast<eMobHeadType>(a_NBT.GetByte(currentLine)));
} }
currentLine = a_NBT.FindChildByName(a_TagIdx, "Rot"); currentLine = a_NBT.FindChildByName(a_TagIdx, "Rot");
if (currentLine >= 0) if (currentLine >= 0)
{ {
Skull->SetRotation(static_cast<eSkullRotation>(a_NBT.GetByte(currentLine))); MobHead->SetRotation(static_cast<eMobHeadRotation>(a_NBT.GetByte(currentLine)));
} }
currentLine = a_NBT.FindChildByName(a_TagIdx, "ExtraType"); currentLine = a_NBT.FindChildByName(a_TagIdx, "ExtraType");
if (currentLine >= 0) if (currentLine >= 0)
{ {
Skull->SetOwner(a_NBT.GetString(currentLine)); MobHead->SetOwner(a_NBT.GetString(currentLine));
} }
a_BlockEntities.push_back(Skull.release()); a_BlockEntities.push_back(MobHead.release());
} }

View File

@ -139,7 +139,7 @@ protected:
void LoadJukeboxFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadJukeboxFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx);
void LoadNoteFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadNoteFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx);
void LoadSignFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadSignFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx);
void LoadSkullFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadMobHeadFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx);
void LoadCommandBlockFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadCommandBlockFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx);
void LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_EntityTagIdx, const char * a_IDTag, int a_IDTagLength); void LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_EntityTagIdx, const char * a_IDTag, int a_IDTagLength);