1
0

Code formatting fixes.

This commit is contained in:
Howaner 2014-08-19 22:14:37 +02:00
parent e4fc05574b
commit b5ffe06f88
29 changed files with 83 additions and 152 deletions

View File

@ -37,7 +37,7 @@ public:
{ {
NIBBLETYPE Meta = a_BlockMeta & 0x7; NIBBLETYPE Meta = a_BlockMeta & 0x7;
if ((Meta == 2) || (Meta == 3)) if ((Meta == E_META_BIG_FLOWER_DOUBLE_TALL_GRASS) || (Meta == E_META_BIG_FLOWER_LARGE_FERN))
{ {
return; return;
} }
@ -63,11 +63,11 @@ public:
if (r1.randInt(10) == 5) if (r1.randInt(10) == 5)
{ {
cItems Pickups; cItems Pickups;
if (FlowerMeta == 2) if (FlowerMeta == E_META_BIG_FLOWER_DOUBLE_TALL_GRASS)
{ {
Pickups.Add(E_BLOCK_TALL_GRASS, 2, 1); Pickups.Add(E_BLOCK_TALL_GRASS, 2, 1);
} }
else if (FlowerMeta == 3) else if (FlowerMeta == E_META_BIG_FLOWER_LARGE_FERN)
{ {
Pickups.Add(E_BLOCK_TALL_GRASS, 2, 2); Pickups.Add(E_BLOCK_TALL_GRASS, 2, 2);
} }

View File

@ -19,7 +19,7 @@ public:
{ {
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
if (!a_Player->Feed(2, 0.1)) if (!a_Player->Feed(2, 0.4))
{ {
return; return;
} }

View File

@ -81,7 +81,7 @@ public:
Chunk->GetBlockTypeMeta(BlockX, BlockY + 1, BlockZ, AboveDest, AboveMeta); Chunk->GetBlockTypeMeta(BlockX, BlockY + 1, BlockZ, AboveDest, AboveMeta);
if (cBlockInfo::GetHandler(AboveDest)->CanDirtGrowGrass(AboveMeta)) if (cBlockInfo::GetHandler(AboveDest)->CanDirtGrowGrass(AboveMeta))
{ {
if (!cRoot::Get()->GetPluginManager()->CallHookBlockSpread((cWorld*) &a_WorldInterface, BlockX * cChunkDef::Width, BlockY, BlockZ * cChunkDef::Width, ssGrassSpread)) if (!cRoot::Get()->GetPluginManager()->CallHookBlockSpread(Chunk->GetWorld(), Chunk->GetPosX() * cChunkDef::Width + BlockX, BlockY, Chunk->GetPosZ() * cChunkDef::Width + BlockZ, ssGrassSpread))
{ {
Chunk->FastSetBlock(BlockX, BlockY, BlockZ, E_BLOCK_GRASS, 0); Chunk->FastSetBlock(BlockX, BlockY, BlockZ, E_BLOCK_GRASS, 0);
} }

View File

@ -54,10 +54,7 @@ public:
BLOCKTYPE * BlockTypes = Area.GetBlockTypes(); BLOCKTYPE * BlockTypes = Area.GetBlockTypes();
for (size_t i = 0; i < NumBlocks; i++) for (size_t i = 0; i < NumBlocks; i++)
{ {
if ( if (IsBlockWater(BlockTypes[i]))
(BlockTypes[i] == E_BLOCK_WATER) ||
(BlockTypes[i] == E_BLOCK_STATIONARY_WATER)
)
{ {
Found = true; Found = true;
break; break;

View File

@ -35,6 +35,7 @@ public:
NIBBLETYPE OldMetaData = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); NIBBLETYPE OldMetaData = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
NIBBLETYPE NewMetaData = PlayerYawToMetaData(a_Player->GetYaw()); NIBBLETYPE NewMetaData = PlayerYawToMetaData(a_Player->GetYaw());
OldMetaData ^= 4; // Toggle the gate OldMetaData ^= 4; // Toggle the gate
if ((OldMetaData & 1) == (NewMetaData & 1)) if ((OldMetaData & 1) == (NewMetaData & 1))
{ {
// Standing in front of the gate - apply new direction // Standing in front of the gate - apply new direction

View File

@ -60,8 +60,8 @@ public:
return "step.wood"; return "step.wood";
} }
/// Traces along YP until it finds an obsidian block, returns Y difference or 0 if no portal, and -1 for border /** Traces along YP until it finds an obsidian block, returns Y difference or 0 if no portal, and -1 for border
/// Takes the X, Y, and Z of the base block; with an optional MaxY for portal border finding Takes the X, Y, and Z of the base block; with an optional MaxY for portal border finding */
int FindObsidianCeiling(int X, int Y, int Z, cChunkInterface & a_ChunkInterface, int MaxY = 0) int FindObsidianCeiling(int X, int Y, int Z, cChunkInterface & a_ChunkInterface, int MaxY = 0)
{ {
if (a_ChunkInterface.GetBlock(X, Y, Z) != E_BLOCK_OBSIDIAN) if (a_ChunkInterface.GetBlock(X, Y, Z) != E_BLOCK_OBSIDIAN)
@ -91,13 +91,12 @@ public:
return newY; return newY;
} }
} }
else { return 0; }
} }
return 0; return 0;
} }
/// Evaluates if coords have a valid border on top, based on MaxY /** Evaluates if coords have a valid border on top, based on MaxY */
bool EvaluatePortalBorder(int X, int FoundObsidianY, int Z, int MaxY, cChunkInterface & a_ChunkInterface) bool EvaluatePortalBorder(int X, int FoundObsidianY, int Z, int MaxY, cChunkInterface & a_ChunkInterface)
{ {
for (int checkBorder = FoundObsidianY + 1; checkBorder <= MaxY - 1; checkBorder++) // FoundObsidianY + 1: FoundObsidianY has already been checked in FindObsidianCeiling; MaxY - 1: portal doesn't need corners for (int checkBorder = FoundObsidianY + 1; checkBorder <= MaxY - 1; checkBorder++) // FoundObsidianY + 1: FoundObsidianY has already been checked in FindObsidianCeiling; MaxY - 1: portal doesn't need corners
@ -149,8 +148,8 @@ public:
return; return;
} }
/// Evaluates if coordinates are a portal going XP/XM; returns true if so, and writes boundaries to variable /** Evaluates if coordinates are a portal going XP/XM; returns true if so, and writes boundaries to variable
/// Takes coordinates of base block and Y coord of target obsidian ceiling Takes coordinates of base block and Y coord of target obsidian ceiling */
bool FindPortalSliceX(int X1, int X2, int Y, int Z, int MaxY, cChunkInterface & a_ChunkInterface) bool FindPortalSliceX(int X1, int X2, int Y, int Z, int MaxY, cChunkInterface & a_ChunkInterface)
{ {
Dir = 1; // Set assumed direction (will change if portal turns out to be facing the other direction) Dir = 1; // Set assumed direction (will change if portal turns out to be facing the other direction)
@ -168,7 +167,8 @@ public:
{ {
return false; // Not valid slice, no portal can be formed return false; // Not valid slice, no portal can be formed
} }
} XZP = X1 - 1; // Set boundary of frame interior }
XZP = X1 - 1; // Set boundary of frame interior
for (; ((a_ChunkInterface.GetBlock(X2, Y, Z) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface.GetBlock(X2, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X2--) // Go the other direction (XM) for (; ((a_ChunkInterface.GetBlock(X2, Y, Z) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface.GetBlock(X2, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X2--) // Go the other direction (XM)
{ {
int Value = FindObsidianCeiling(X2, Y, Z, a_ChunkInterface, MaxY); int Value = FindObsidianCeiling(X2, Y, Z, a_ChunkInterface, MaxY);
@ -182,7 +182,9 @@ public:
{ {
return false; return false;
} }
} XZM = X2 + 1; // Set boundary, see previous }
XZM = X2 + 1; // Set boundary, see previous
return (FoundFrameXP && FoundFrameXM); return (FoundFrameXP && FoundFrameXM);
} }
@ -204,7 +206,8 @@ public:
{ {
return false; return false;
} }
} XZP = Z1 - 1; }
XZP = Z1 - 1;
for (; ((a_ChunkInterface.GetBlock(X, Y, Z2) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface.GetBlock(X, Y + 1, Z2) == E_BLOCK_OBSIDIAN)); Z2--) for (; ((a_ChunkInterface.GetBlock(X, Y, Z2) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface.GetBlock(X, Y + 1, Z2) == E_BLOCK_OBSIDIAN)); Z2--)
{ {
int Value = FindObsidianCeiling(X, Y, Z2, a_ChunkInterface, MaxY); int Value = FindObsidianCeiling(X, Y, Z2, a_ChunkInterface, MaxY);
@ -218,7 +221,9 @@ public:
{ {
return false; return false;
} }
} XZM = Z2 + 1; }
XZM = Z2 + 1;
return (FoundFrameZP && FoundFrameZM); return (FoundFrameZP && FoundFrameZM);
} }
}; };

View File

@ -19,7 +19,7 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
// Reset meta to 0 // Reset meta to zero
a_Pickups.push_back(cItem(m_BlockType, 1, 0)); a_Pickups.push_back(cItem(m_BlockType, 1, 0));
} }

View File

@ -15,13 +15,13 @@ public:
: cBlockHandler(a_BlockType) : cBlockHandler(a_BlockType)
{ {
} }
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
// Reset meta to 0 // Reset meta to 0
MTRand r1; cFastRandom Random;
a_Pickups.push_back(cItem(E_ITEM_GLOWSTONE_DUST, (char)(2 + r1.randInt(2)), 0)); a_Pickups.push_back(cItem(E_ITEM_GLOWSTONE_DUST, (char)(2 + Random.NextInt(3)), 0));
} }
} ; } ;

View File

@ -45,13 +45,11 @@
#include "BlockLadder.h" #include "BlockLadder.h"
#include "BlockLeaves.h" #include "BlockLeaves.h"
#include "BlockLilypad.h" #include "BlockLilypad.h"
#include "BlockNewLeaves.h"
#include "BlockLever.h" #include "BlockLever.h"
#include "BlockMelon.h" #include "BlockMelon.h"
#include "BlockMushroom.h" #include "BlockMushroom.h"
#include "BlockMycelium.h" #include "BlockMycelium.h"
#include "BlockNetherWart.h" #include "BlockNetherWart.h"
#include "BlockNote.h"
#include "BlockOre.h" #include "BlockOre.h"
#include "BlockPiston.h" #include "BlockPiston.h"
#include "BlockPlanks.h" #include "BlockPlanks.h"
@ -251,9 +249,9 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_NETHER_PORTAL: return new cBlockPortalHandler (a_BlockType); case E_BLOCK_NETHER_PORTAL: return new cBlockPortalHandler (a_BlockType);
case E_BLOCK_NETHER_WART: return new cBlockNetherWartHandler (a_BlockType); case E_BLOCK_NETHER_WART: return new cBlockNetherWartHandler (a_BlockType);
case E_BLOCK_NETHER_QUARTZ_ORE: return new cBlockOreHandler (a_BlockType); case E_BLOCK_NETHER_QUARTZ_ORE: return new cBlockOreHandler (a_BlockType);
case E_BLOCK_NEW_LEAVES: return new cBlockNewLeavesHandler (a_BlockType); case E_BLOCK_NEW_LEAVES: return new cBlockLeavesHandler (a_BlockType);
case E_BLOCK_NEW_LOG: return new cBlockSidewaysHandler (a_BlockType); case E_BLOCK_NEW_LOG: return new cBlockSidewaysHandler (a_BlockType);
case E_BLOCK_NOTE_BLOCK: return new cBlockNoteHandler (a_BlockType); case E_BLOCK_NOTE_BLOCK: return new cBlockEntityHandler (a_BlockType);
case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType); case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType);
case E_BLOCK_PISTON_EXTENSION: return new cBlockPistonHeadHandler; case E_BLOCK_PISTON_EXTENSION: return new cBlockPistonHeadHandler;
case E_BLOCK_PLANKS: return new cBlockPlanksHandler (a_BlockType); case E_BLOCK_PLANKS: return new cBlockPlanksHandler (a_BlockType);

View File

@ -19,8 +19,8 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
MTRand r1; cFastRandom Random;
a_Pickups.push_back(cItem(E_ITEM_MELON_SLICE, (char)(3 + r1.randInt(4)), 0)); a_Pickups.push_back(cItem(E_ITEM_MELON_SLICE, (char)(3 + Random.NextInt(5)), 0));
} }

View File

@ -1,42 +0,0 @@
#pragma once
#include "BlockHandler.h"
#include "BlockLeaves.h"
#include "../World.h"
class cBlockNewLeavesHandler :
public cBlockLeavesHandler
{
public:
cBlockNewLeavesHandler(BLOCKTYPE a_BlockType)
: cBlockLeavesHandler(a_BlockType)
{
}
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
MTRand rand;
// Only the first 2 bits contain the display information, the others are for growing
if (rand.randInt(5) == 0)
{
a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, (a_BlockMeta & 3) + 4));
}
}
void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
cBlockHandler::OnDestroyed(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ);
}
} ;

View File

@ -1,13 +0,0 @@
#pragma once
#include "BlockHandler.h"
#include "BlockEntity.h"
class cBlockNoteHandler : public cBlockEntityHandler
{
public:
cBlockNoteHandler(BLOCKTYPE a_BlockType)
: cBlockEntityHandler(a_BlockType)
{
}
};

View File

@ -2,7 +2,6 @@
#pragma once #pragma once
#include "BlockHandler.h" #include "BlockHandler.h"
#include "../MersenneTwister.h"
#include "../World.h" #include "../World.h"
@ -20,58 +19,41 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
short ItemType = m_BlockType; cFastRandom Random;
char Count = 1;
short Meta = 0;
MTRand r1;
switch (m_BlockType) switch (m_BlockType)
{ {
case E_BLOCK_LAPIS_ORE: case E_BLOCK_LAPIS_ORE:
{ {
ItemType = E_ITEM_DYE; a_Pickups.push_back(cItem(E_ITEM_DYE, (char)(4 + Random.NextInt(5)), 4));
Count = 4 + (char)r1.randInt(4);
Meta = 4;
break; break;
} }
case E_BLOCK_REDSTONE_ORE: case E_BLOCK_REDSTONE_ORE:
case E_BLOCK_REDSTONE_ORE_GLOWING: case E_BLOCK_REDSTONE_ORE_GLOWING:
{ {
Count = 4 + (char)r1.randInt(1); a_Pickups.push_back(cItem(E_ITEM_REDSTONE_DUST, (char)(4 + Random.NextInt(2)), 0));
break; break;
} }
default:
{
Count = 1;
break;
}
}
switch (m_BlockType)
{
case E_BLOCK_DIAMOND_ORE: case E_BLOCK_DIAMOND_ORE:
{ {
ItemType = E_ITEM_DIAMOND; a_Pickups.push_back(cItem(E_ITEM_DIAMOND));
break;
}
case E_BLOCK_REDSTONE_ORE:
case E_BLOCK_REDSTONE_ORE_GLOWING:
{
ItemType = E_ITEM_REDSTONE_DUST;
break; break;
} }
case E_BLOCK_EMERALD_ORE: case E_BLOCK_EMERALD_ORE:
{ {
ItemType = E_ITEM_EMERALD; a_Pickups.push_back(cItem(E_ITEM_EMERALD));
break; break;
} }
case E_BLOCK_COAL_ORE: case E_BLOCK_COAL_ORE:
{ {
ItemType = E_ITEM_COAL; a_Pickups.push_back(cItem(E_ITEM_COAL));
break; break;
} }
default:
{
ASSERT(!"Unhandled ore!");
}
} }
a_Pickups.push_back(cItem(ItemType, Count, Meta));
} }
} ; } ;

View File

@ -24,8 +24,7 @@ public:
) override ) override
{ {
a_BlockType = m_BlockType; a_BlockType = m_BlockType;
NIBBLETYPE Meta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage); a_BlockMeta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage);
a_BlockMeta = Meta;
return true; return true;
} }

View File

@ -36,7 +36,7 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
return; // No pickups // No pickups
} }
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
@ -47,15 +47,15 @@ public:
return; return;
} }
int PosX = a_Chunk.GetPosX() * 16 + a_RelX; int PosX = a_Chunk.GetPosX() * cChunkDef::Width + a_RelX;
int PosZ = a_Chunk.GetPosZ() * 16 + a_RelZ; int PosZ = a_Chunk.GetPosZ() * cChunkDef::Width + a_RelZ;
a_WorldInterface.SpawnMob(PosX, a_RelY, PosZ, cMonster::mtZombiePigman); a_WorldInterface.SpawnMob(PosX, a_RelY, PosZ, cMonster::mtZombiePigman);
} }
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{ {
if ((a_RelY - 1 < 0) || (a_RelY + 1 > cChunkDef::Height)) if ((a_RelY <= 0) || (a_RelY >= cChunkDef::Height))
{ {
return false; // In case someone places a portal with meta 1 or 2 at boundaries, and server tries to get invalid coords at Y - 1 or Y + 1 return false; // In case someone places a portal with meta 1 or 2 at boundaries, and server tries to get invalid coords at Y - 1 or Y + 1
} }

View File

@ -17,7 +17,7 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
// Reset meta to 0 // Reset meta to zero
a_Pickups.push_back(cItem(m_BlockType, 1, 0)); a_Pickups.push_back(cItem(m_BlockType, 1, 0));
} }
@ -29,7 +29,7 @@ public:
} }
BLOCKTYPE BlockBelow = a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ); BLOCKTYPE BlockBelow = a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ);
return ((BlockBelow == E_BLOCK_FENCE_GATE) || (BlockBelow == E_BLOCK_FENCE) || cBlockInfo::IsSolid(BlockBelow)); return (cBlockInfo::IsSolid(BlockBelow));
} }
} ; } ;

View File

@ -25,6 +25,7 @@ public:
{ {
a_BlockType = m_BlockType; a_BlockType = m_BlockType;
NIBBLETYPE Meta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage); NIBBLETYPE Meta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage);
if (Meta != E_META_QUARTZ_PILLAR) // Check if the block is a pillar block. if (Meta != E_META_QUARTZ_PILLAR) // Check if the block is a pillar block.
{ {
a_BlockMeta = Meta; a_BlockMeta = Meta;

View File

@ -26,8 +26,8 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
// Reset meta to 0 // Reset meta to zero
a_Pickups.push_back(cItem(E_ITEM_REDSTONE_DUST, 1)); a_Pickups.push_back(cItem(E_ITEM_REDSTONE_DUST, 1, 0));
} }
} ; } ;

View File

@ -23,7 +23,7 @@ public:
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
int a_CursorX, int a_CursorY, int a_CursorZ, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override
{ {
a_BlockType = m_BlockType; a_BlockType = m_BlockType;
a_BlockMeta = RepeaterRotationToMetaData(a_Player->GetYaw()); a_BlockMeta = RepeaterRotationToMetaData(a_Player->GetYaw());
@ -46,7 +46,7 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
// Reset meta to 0 // Reset meta to zero
a_Pickups.push_back(cItem(E_ITEM_REDSTONE_REPEATER, 1, 0)); a_Pickups.push_back(cItem(E_ITEM_REDSTONE_REPEATER, 1, 0));
} }
@ -59,7 +59,7 @@ public:
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{ {
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR)); return ((a_RelY > 0) && cBlockInfo::IsSolid(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ)));
} }

View File

@ -16,8 +16,8 @@ public:
{ {
} }
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
@ -53,8 +53,8 @@ public:
} }
return true; return true;
} }
virtual const char * GetStepSound(void) override virtual const char * GetStepSound(void) override
{ {
if ( if (
@ -64,7 +64,7 @@ public:
(m_BlockType == E_BLOCK_ACACIA_WOOD_STAIRS) || (m_BlockType == E_BLOCK_ACACIA_WOOD_STAIRS) ||
(m_BlockType == E_BLOCK_BIRCH_WOOD_STAIRS) || (m_BlockType == E_BLOCK_BIRCH_WOOD_STAIRS) ||
(m_BlockType == E_BLOCK_DARK_OAK_WOOD_STAIRS) (m_BlockType == E_BLOCK_DARK_OAK_WOOD_STAIRS)
) )
{ {
return "step.wood"; return "step.wood";
} }
@ -72,17 +72,20 @@ public:
return "step.stone"; return "step.stone";
} }
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
// Reset meta to 0 // Reset meta to zero
a_Pickups.push_back(cItem(m_BlockType, 1, 0)); a_Pickups.push_back(cItem(m_BlockType, 1, 0));
} }
virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) override virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) override
{ {
return true; return true;
} }
static NIBBLETYPE RotationToMetaData(double a_Rotation) static NIBBLETYPE RotationToMetaData(double a_Rotation)
{ {
a_Rotation += 90 + 45; // So its not aligned with axis a_Rotation += 90 + 45; // So its not aligned with axis
@ -108,14 +111,11 @@ public:
} }
} }
virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) override virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) override
{ {
// Toggle bit 3: // Toggle bit 3:
return (a_Meta & 0x0b) | ((~a_Meta) & 0x04); return (a_Meta & 0x0b) | ((~a_Meta) & 0x04);
} }
} ; } ;

View File

@ -29,6 +29,7 @@ public:
{ {
return false; return false;
} }
switch (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ)) switch (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ))
{ {
case E_BLOCK_DIRT: case E_BLOCK_DIRT:

View File

@ -126,7 +126,7 @@ public:
(BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) || (BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) ||
(BlockInQuestion == E_BLOCK_COBBLESTONE_WALL)) && (BlockInQuestion == E_BLOCK_COBBLESTONE_WALL)) &&
(Face == BLOCK_FACE_TOP) (Face == BLOCK_FACE_TOP)
) )
{ {
return Face; return Face;
} }
@ -162,7 +162,7 @@ public:
(BlockInQuestion == E_BLOCK_END_PORTAL_FRAME) || // Actual vanilla behaviour (BlockInQuestion == E_BLOCK_END_PORTAL_FRAME) || // Actual vanilla behaviour
(BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) || (BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) ||
(BlockInQuestion == E_BLOCK_COBBLESTONE_WALL) (BlockInQuestion == E_BLOCK_COBBLESTONE_WALL)
) )
{ {
// Torches can be placed on tops of glass and fences, despite them being 'untorcheable' // Torches can be placed on tops of glass and fences, despite them being 'untorcheable'
// No need to check for upright orientation, it was done when the torch was placed // No need to check for upright orientation, it was done when the torch was placed

View File

@ -23,7 +23,7 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
// Reset meta to 0 // Reset meta to zero
a_Pickups.push_back(cItem(m_BlockType, 1, 0)); a_Pickups.push_back(cItem(m_BlockType, 1, 0));
} }
@ -53,7 +53,7 @@ public:
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
int a_CursorX, int a_CursorY, int a_CursorZ, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override
{ {
a_BlockType = m_BlockType; a_BlockType = m_BlockType;
a_BlockMeta = BlockFaceToMetaData(a_BlockFace); a_BlockMeta = BlockFaceToMetaData(a_BlockFace);
@ -103,9 +103,10 @@ public:
a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta); a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta);
AddFaceDirection(a_RelX, a_RelY, a_RelZ, BlockMetaDataToBlockFace(Meta), true); AddFaceDirection(a_RelX, a_RelY, a_RelZ, BlockMetaDataToBlockFace(Meta), true);
BLOCKTYPE BlockIsOn; a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, BlockIsOn); BLOCKTYPE BlockIsOn;
a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, BlockIsOn);
return (a_RelY > 0) && cBlockInfo::IsSolid(BlockIsOn); return ((a_RelY > 0) && cBlockInfo::IsSolid(BlockIsOn));
} }
}; };

View File

@ -21,10 +21,9 @@ public:
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
int a_CursorX, int a_CursorY, int a_CursorZ, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override
{ {
a_BlockType = m_BlockType; a_BlockType = m_BlockType;
a_BlockMeta = DirectionToMetadata(a_BlockFace); a_BlockMeta = DirectionToMetadata(a_BlockFace);
return true; return true;
@ -56,7 +55,7 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
// Reset meta to 0 // Reset meta to zero
a_Pickups.push_back(cItem(E_BLOCK_TRIPWIRE_HOOK, 1, 0)); a_Pickups.push_back(cItem(E_BLOCK_TRIPWIRE_HOOK, 1, 0));
} }
@ -66,9 +65,10 @@ public:
a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta); a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta);
AddFaceDirection(a_RelX, a_RelY, a_RelZ, MetadataToDirection(Meta), true); AddFaceDirection(a_RelX, a_RelY, a_RelZ, MetadataToDirection(Meta), true);
BLOCKTYPE BlockIsOn; a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, BlockIsOn); BLOCKTYPE BlockIsOn;
a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, BlockIsOn);
return (a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(BlockIsOn); return ((a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(BlockIsOn));
} }
virtual const char * GetStepSound(void) override virtual const char * GetStepSound(void) override

View File

@ -46,7 +46,7 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
// Reset meta to 0 // Reset meta to zero
a_Pickups.push_back(cItem(E_BLOCK_VINES, 1, 0)); a_Pickups.push_back(cItem(E_BLOCK_VINES, 1, 0));
} }
@ -80,7 +80,7 @@ public:
/// Returns true if the specified block type is good for vines to attach to /// Returns true if the specified block type is good for vines to attach to
static bool IsBlockAttachable(BLOCKTYPE a_BlockType) static bool IsBlockAttachable(BLOCKTYPE a_BlockType)
{ {
return (a_BlockType == E_BLOCK_LEAVES) || (a_BlockType == E_BLOCK_NEW_LEAVES) || cBlockInfo::IsSolid(a_BlockType); return ((a_BlockType == E_BLOCK_LEAVES) || (a_BlockType == E_BLOCK_NEW_LEAVES) || cBlockInfo::IsSolid(a_BlockType));
} }
@ -182,7 +182,7 @@ public:
a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY - 1, a_RelZ, Block); a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY - 1, a_RelZ, Block);
if (Block == E_BLOCK_AIR) if (Block == E_BLOCK_AIR)
{ {
if (!cRoot::Get()->GetPluginManager()->CallHookBlockSpread((cWorld*) &a_WorldInterface, a_RelX * cChunkDef::Width, a_RelY - 1, a_RelZ * cChunkDef::Width, ssVineSpread)) if (!cRoot::Get()->GetPluginManager()->CallHookBlockSpread((cWorld*) &a_WorldInterface, a_RelX + a_Chunk.GetPosX() * cChunkDef::Width, a_RelY - 1, a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width, ssVineSpread))
{ {
a_Chunk.UnboundedRelSetBlock(a_RelX, a_RelY - 1, a_RelZ, E_BLOCK_VINES, a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ)); a_Chunk.UnboundedRelSetBlock(a_RelX, a_RelY - 1, a_RelZ, E_BLOCK_VINES, a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ));
} }

View File

@ -1,3 +1,4 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#ifndef _WIN32 #ifndef _WIN32

View File

@ -29,7 +29,7 @@ public:
a_Player->AddEntityEffect(cEntityEffect::effRegeneration, 100, 1); a_Player->AddEntityEffect(cEntityEffect::effRegeneration, 100, 1);
// When the apple is a 'notch apple', give extra effects: // When the apple is a 'notch apple', give extra effects:
if (a_Item->m_ItemDamage > 0) if (a_Item->m_ItemDamage >= E_META_GOLDEN_APPLE_ENCHANTED)
{ {
a_Player->AddEntityEffect(cEntityEffect::effRegeneration, 600, 4); a_Player->AddEntityEffect(cEntityEffect::effRegeneration, 600, 4);
a_Player->AddEntityEffect(cEntityEffect::effResistance, 6000, 0); a_Player->AddEntityEffect(cEntityEffect::effResistance, 6000, 0);

View File

@ -19,7 +19,6 @@ public:
cItemShovelHandler(int a_ItemType) cItemShovelHandler(int a_ItemType)
: cItemHandler(a_ItemType) : cItemHandler(a_ItemType)
{ {
} }
virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override

View File

@ -1,3 +1,4 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "BlockID.h" #include "BlockID.h"