summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--VC2013/MCServer.vcxproj8
-rw-r--r--VC2013/MCServer.vcxproj.filters21
-rw-r--r--src/Blocks/BlockButton.cpp32
-rw-r--r--src/Blocks/BlockButton.h26
-rw-r--r--src/Blocks/BlockComparator.cpp53
-rw-r--r--src/Blocks/BlockComparator.h24
-rw-r--r--src/Blocks/BlockLever.cpp31
-rw-r--r--src/Blocks/BlockLever.h14
-rw-r--r--src/Blocks/BlockRedstone.cpp27
-rw-r--r--src/Blocks/BlockRedstone.h7
-rw-r--r--src/Blocks/BlockRedstoneRepeater.cpp50
-rw-r--r--src/Blocks/BlockRedstoneRepeater.h33
-rw-r--r--src/Blocks/BlockStems.h1
13 files changed, 82 insertions, 245 deletions
diff --git a/VC2013/MCServer.vcxproj b/VC2013/MCServer.vcxproj
index 251d401c9..0b0c13d81 100644
--- a/VC2013/MCServer.vcxproj
+++ b/VC2013/MCServer.vcxproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug profiled|Win32">
@@ -185,6 +185,7 @@
<ResourceCompile Include="MCServer.rc" />
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="..\src\Blocks\BlockTrapdoor.h" />
<ClInclude Include="resource_MCServer.h" />
<ClInclude Include="..\src\Authenticator.h" />
<ClInclude Include="..\src\BlockArea.h" />
@@ -794,14 +795,9 @@
<ClCompile Include="..\src\Generating\StructGen.cpp" />
<ClCompile Include="..\src\Generating\Trees.cpp" />
<ClCompile Include="..\src\Blocks\BlockBed.cpp" />
- <ClCompile Include="..\src\Blocks\BlockButton.cpp" />
- <ClCompile Include="..\src\Blocks\BlockComparator.cpp" />
<ClCompile Include="..\src\blocks\BlockDoor.cpp" />
<ClCompile Include="..\src\blocks\BlockHandler.cpp" />
- <ClCompile Include="..\src\Blocks\BlockLever.cpp" />
<ClCompile Include="..\src\blocks\BlockPiston.cpp" />
- <ClCompile Include="..\src\blocks\BlockRedstone.cpp" />
- <ClCompile Include="..\src\blocks\BlockRedstoneRepeater.cpp" />
<ClCompile Include="..\src\items\ItemHandler.cpp" />
<ClCompile Include="..\src\Protocol\ChunkDataSerializer.cpp" />
<ClCompile Include="..\src\Protocol\Protocol125.cpp" />
diff --git a/VC2013/MCServer.vcxproj.filters b/VC2013/MCServer.vcxproj.filters
index 196d767dd..f84fdf1a5 100644
--- a/VC2013/MCServer.vcxproj.filters
+++ b/VC2013/MCServer.vcxproj.filters
@@ -942,6 +942,9 @@
<ClInclude Include="..\src\HTTPServer\NameValueParser.h">
<Filter>Source Files\HTTPServer</Filter>
</ClInclude>
+ <ClInclude Include="..\src\Blocks\BlockTrapdoor.h">
+ <Filter>Source Files\Blocks</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\webadmin\template.html">
@@ -1555,30 +1558,15 @@
<ClCompile Include="..\src\Blocks\BlockBed.cpp">
<Filter>Source Files\Blocks</Filter>
</ClCompile>
- <ClCompile Include="..\src\Blocks\BlockButton.cpp">
- <Filter>Source Files\Blocks</Filter>
- </ClCompile>
- <ClCompile Include="..\src\Blocks\BlockComparator.cpp">
- <Filter>Source Files\Blocks</Filter>
- </ClCompile>
<ClCompile Include="..\src\blocks\BlockDoor.cpp">
<Filter>Source Files\Blocks</Filter>
</ClCompile>
<ClCompile Include="..\src\blocks\BlockHandler.cpp">
<Filter>Source Files\Blocks</Filter>
</ClCompile>
- <ClCompile Include="..\src\Blocks\BlockLever.cpp">
- <Filter>Source Files\Blocks</Filter>
- </ClCompile>
<ClCompile Include="..\src\blocks\BlockPiston.cpp">
<Filter>Source Files\Blocks</Filter>
</ClCompile>
- <ClCompile Include="..\src\blocks\BlockRedstone.cpp">
- <Filter>Source Files\Blocks</Filter>
- </ClCompile>
- <ClCompile Include="..\src\blocks\BlockRedstoneRepeater.cpp">
- <Filter>Source Files\Blocks</Filter>
- </ClCompile>
<ClCompile Include="..\src\items\ItemHandler.cpp">
<Filter>Source Files\Items</Filter>
</ClCompile>
@@ -1666,9 +1654,6 @@
<ClCompile Include="..\src\HTTPServer\NameValueParser.cpp">
<Filter>Source Files\HTTPServer</Filter>
</ClCompile>
- <ClCompile Include="..\source\BlockEntities\BlockEntity.cpp">
- <Filter>Source Files\BlockEntities</Filter>
- </ClCompile>
</ItemGroup>
<ItemGroup>
<Text Include="..\MCServer\API.txt">
diff --git a/src/Blocks/BlockButton.cpp b/src/Blocks/BlockButton.cpp
deleted file mode 100644
index a48e82f4d..000000000
--- a/src/Blocks/BlockButton.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-#include "Globals.h"
-#include "BlockButton.h"
-
-
-
-
-
-cBlockButtonHandler::cBlockButtonHandler(BLOCKTYPE a_BlockType)
- : cBlockHandler(a_BlockType)
-{
-}
-
-
-
-
-
-void cBlockButtonHandler::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)
-{
- // Flip the ON bit on/off using the XOR bitwise operation
- NIBBLETYPE Meta = (a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) | 0x08);
-
- a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, Meta);
- a_World->BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f);
-
- // Queue a button reset (unpress)
- a_World->QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, (a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0x07), m_BlockType == E_BLOCK_STONE_BUTTON ? 20 : 30);
-}
-
-
-
-
diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h
index e2c60002b..ec897835a 100644
--- a/src/Blocks/BlockButton.h
+++ b/src/Blocks/BlockButton.h
@@ -10,9 +10,23 @@ class cBlockButtonHandler :
public cBlockHandler
{
public:
- cBlockButtonHandler(BLOCKTYPE a_BlockType);
+ cBlockButtonHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
+ {
+ }
+
- 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;
+ 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
+ {
+ // Flip the ON bit on/off using the XOR bitwise operation
+ NIBBLETYPE Meta = (a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) | 0x08);
+
+ a_World->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
+ a_World->BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f);
+
+ // Queue a button reset (unpress)
+ a_World->QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, (a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0x07), m_BlockType == E_BLOCK_STONE_BUTTON ? 20 : 30);
+ }
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
@@ -51,10 +65,10 @@ public:
{
switch (a_BlockFace)
{
- case BLOCK_FACE_ZM: { return 0x4; }
- case BLOCK_FACE_ZP: { return 0x3; }
- case BLOCK_FACE_XM: { return 0x2; }
- case BLOCK_FACE_XP: { return 0x1; }
+ case BLOCK_FACE_ZM: return 0x4;
+ case BLOCK_FACE_ZP: return 0x3;
+ case BLOCK_FACE_XM: return 0x2;
+ case BLOCK_FACE_XP: return 0x1;
default:
{
ASSERT(!"Unhandled block face!");
diff --git a/src/Blocks/BlockComparator.cpp b/src/Blocks/BlockComparator.cpp
deleted file mode 100644
index 8bc0ac5ac..000000000
--- a/src/Blocks/BlockComparator.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-
-#include "Globals.h"
-#include "BlockComparator.h"
-#include "BlockRedstoneRepeater.h"
-#include "../Entities/Player.h"
-
-
-
-
-
-cBlockComparatorHandler::cBlockComparatorHandler(BLOCKTYPE a_BlockType)
- : cBlockHandler(a_BlockType)
-{
-}
-
-
-
-
-
-void cBlockComparatorHandler::OnDestroyed(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
-{
- // Nothing needed yet
-}
-
-
-
-
-
-void cBlockComparatorHandler::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)
-{
- NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
- Meta ^= 0x04; // Toggle 3rd (addition/subtraction) bit with XOR
- a_World->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
-}
-
-
-
-
-bool cBlockComparatorHandler::GetPlacementBlockTypeMeta(
- 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,
- BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
-)
-{
- a_BlockType = m_BlockType;
- a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetRotation());
- return true;
-}
-
-
-
-
diff --git a/src/Blocks/BlockComparator.h b/src/Blocks/BlockComparator.h
index cb2941d3c..e7e18bac9 100644
--- a/src/Blocks/BlockComparator.h
+++ b/src/Blocks/BlockComparator.h
@@ -2,6 +2,7 @@
#pragma once
#include "BlockHandler.h"
+#include "BlockRedstoneRepeater.h"
@@ -11,10 +12,18 @@ class cBlockComparatorHandler :
public cBlockHandler
{
public:
- cBlockComparatorHandler(BLOCKTYPE a_BlockType);
- virtual void OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ cBlockComparatorHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
+ {
+ }
+
- 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;
+ 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 Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
+ Meta ^= 0x04; // Toggle 3rd (addition/subtraction) bit with XOR
+ a_World->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
+ }
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
@@ -38,10 +47,15 @@ public:
virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player,
- int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
+ int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
- ) override;
+ ) override
+ {
+ a_BlockType = m_BlockType;
+ a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetRotation());
+ return true;
+ }
virtual const char * GetStepSound(void) override
diff --git a/src/Blocks/BlockLever.cpp b/src/Blocks/BlockLever.cpp
deleted file mode 100644
index c482b0246..000000000
--- a/src/Blocks/BlockLever.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-#include "Globals.h"
-#include "BlockLever.h"
-#include "../Entities/Player.h"
-#include "../Simulator/RedstoneSimulator.h"
-
-
-
-
-
-cBlockLeverHandler::cBlockLeverHandler(BLOCKTYPE a_BlockType)
- : cBlockHandler(a_BlockType)
-{
-}
-
-
-
-
-
-void cBlockLeverHandler::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)
-{
- // Flip the ON bit on/off using the XOR bitwise operation
- NIBBLETYPE Meta = (a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08);
-
- a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, Meta);
- a_World->BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f);
-}
-
-
-
-
diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h
index 5e6a3bd1e..15fe2071c 100644
--- a/src/Blocks/BlockLever.h
+++ b/src/Blocks/BlockLever.h
@@ -10,9 +10,19 @@ class cBlockLeverHandler :
public cBlockHandler
{
public:
- cBlockLeverHandler(BLOCKTYPE a_BlockType);
+ cBlockLeverHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
+ {
+ }
- 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;
+ 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
+ {
+ // Flip the ON bit on/off using the XOR bitwise operation
+ NIBBLETYPE Meta = (a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08);
+
+ a_World->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
+ a_World->BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f);
+ }
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
diff --git a/src/Blocks/BlockRedstone.cpp b/src/Blocks/BlockRedstone.cpp
deleted file mode 100644
index 35cdc34cf..000000000
--- a/src/Blocks/BlockRedstone.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-#include "Globals.h"
-#include "BlockRedstone.h"
-#include "../Item.h"
-#include "../World.h"
-
-
-
-
-
-cBlockRedstoneHandler::cBlockRedstoneHandler(BLOCKTYPE a_BlockType)
- : cBlockHandler(a_BlockType)
-{
-}
-
-
-
-
-
-void cBlockRedstoneHandler::OnDestroyed(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
-{
- // Nothing needed yet
-}
-
-
-
-
diff --git a/src/Blocks/BlockRedstone.h b/src/Blocks/BlockRedstone.h
index f28f3f2d6..57bd91b46 100644
--- a/src/Blocks/BlockRedstone.h
+++ b/src/Blocks/BlockRedstone.h
@@ -12,9 +12,10 @@ class cBlockRedstoneHandler :
public cBlockHandler
{
public:
- cBlockRedstoneHandler(BLOCKTYPE a_BlockType);
-
- virtual void OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ cBlockRedstoneHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
+ {
+ }
virtual bool CanBeAt(int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
diff --git a/src/Blocks/BlockRedstoneRepeater.cpp b/src/Blocks/BlockRedstoneRepeater.cpp
deleted file mode 100644
index 3ab5bc559..000000000
--- a/src/Blocks/BlockRedstoneRepeater.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-
-#include "Globals.h"
-#include "BlockRedstoneRepeater.h"
-#include "../Entities/Player.h"
-
-
-
-
-
-cBlockRedstoneRepeaterHandler::cBlockRedstoneRepeaterHandler(BLOCKTYPE a_BlockType)
- : cBlockHandler(a_BlockType)
-{
-}
-
-
-
-
-
-void cBlockRedstoneRepeaterHandler::OnDestroyed(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
-{
- // Nothing needed yet
-}
-
-
-
-
-
-void cBlockRedstoneRepeaterHandler::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)
-{
- a_World->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, ((a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) + 0x04) & 0x0f));
-}
-
-
-
-
-bool cBlockRedstoneRepeaterHandler::GetPlacementBlockTypeMeta(
- 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,
- BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
-)
-{
- a_BlockType = m_BlockType;
- a_BlockMeta = RepeaterRotationToMetaData(a_Player->GetRotation());
- return true;
-}
-
-
-
-
diff --git a/src/Blocks/BlockRedstoneRepeater.h b/src/Blocks/BlockRedstoneRepeater.h
index a61121d3a..1fcddd4f8 100644
--- a/src/Blocks/BlockRedstoneRepeater.h
+++ b/src/Blocks/BlockRedstoneRepeater.h
@@ -11,10 +11,29 @@ class cBlockRedstoneRepeaterHandler :
public cBlockHandler
{
public:
- cBlockRedstoneRepeaterHandler(BLOCKTYPE a_BlockType);
- virtual void OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ cBlockRedstoneRepeaterHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
+ {
+ }
+
+
+ virtual bool GetPlacementBlockTypeMeta(
+ 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,
+ BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
+ ) override
+ {
+ a_BlockType = m_BlockType;
+ a_BlockMeta = RepeaterRotationToMetaData(a_Player->GetRotation());
+ return true;
+ }
- 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;
+
+ 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
+ {
+ a_World->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, ((a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) + 0x04) & 0x0f));
+ }
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
@@ -34,14 +53,6 @@ public:
{
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR));
}
-
-
- virtual bool GetPlacementBlockTypeMeta(
- 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,
- BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
- ) override;
virtual const char * GetStepSound(void) override
diff --git a/src/Blocks/BlockStems.h b/src/Blocks/BlockStems.h
index ce02d9cb8..90dd90bbc 100644
--- a/src/Blocks/BlockStems.h
+++ b/src/Blocks/BlockStems.h
@@ -2,7 +2,6 @@
#pragma once
#include "BlockHandler.h"
-#include "../MersenneTwister.h"
#include "../World.h"