1
0

Fixed basic style.

This commit is contained in:
Mattes D 2014-12-25 00:44:09 +01:00
parent f59740b262
commit 3da6e4374e
4 changed files with 71 additions and 23 deletions

View File

@ -28,7 +28,7 @@ void cGuardian::GetDrops(cItems & a_Drops, cEntity * a_Killer)
} }
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_PRISMARINE_SHARD); AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_PRISMARINE_SHARD);
AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_RAW_FISH); AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_RAW_FISH);
AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_PRISMARINE_CRYSTALS); // ToDo: Prismarine Crystals only drop if the raw fish drop is 0 AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_PRISMARINE_CRYSTALS); // TODO: Prismarine Crystals only drop if the raw fish drop is 0
} }

View File

@ -1488,62 +1488,92 @@ bool cIncrementalRedstoneSimulator::IsRepeaterPowered(int a_RelBlockX, int a_Rel
for (const auto & itr : *m_PoweredBlocks) for (const auto & itr : *m_PoweredBlocks)
{ {
if (!itr.a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ))) { continue; } if (!itr.a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
{
continue;
}
switch (a_Meta & 0x3) switch (a_Meta & 0x3)
{ {
case 0x0: case 0x0:
{ {
// Flip the coords to check the back of the repeater // Flip the coords to check the back of the repeater
if (itr.a_SourcePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1)))) { return true; } if (itr.a_SourcePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1))))
{
return true;
}
break; break;
} }
case 0x1: case 0x1:
{ {
if (itr.a_SourcePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ)))) { return true; } if (itr.a_SourcePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ))))
{
return true;
}
break; break;
} }
case 0x2: case 0x2:
{ {
if (itr.a_SourcePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1)))) { return true; } if (itr.a_SourcePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1))))
{
return true;
}
break; break;
} }
case 0x3: case 0x3:
{ {
if (itr.a_SourcePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ)))) { return true; } if (itr.a_SourcePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ))))
{
return true;
}
break; break;
} }
} }
} } // for itr - m_PoweredBlocks[]
for (const auto & itr : *m_LinkedPoweredBlocks) for (const auto & itr : *m_LinkedPoweredBlocks)
{ {
if (!itr.a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ))) { continue; } if (!itr.a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
{
continue;
}
switch (a_Meta & 0x3) switch (a_Meta & 0x3)
{ {
case 0x0: case 0x0:
{ {
if (itr.a_MiddlePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1)))) { return true; } if (itr.a_MiddlePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1))))
{
return true;
}
break; break;
} }
case 0x1: case 0x1:
{ {
if (itr.a_MiddlePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ)))) { return true; } if (itr.a_MiddlePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ))))
{
return true;
}
break; break;
} }
case 0x2: case 0x2:
{ {
if (itr.a_MiddlePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1)))) { return true; } if (itr.a_MiddlePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1))))
{
return true;
}
break; break;
} }
case 0x3: case 0x3:
{ {
if (itr.a_MiddlePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ)))) { return true; } if (itr.a_MiddlePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ))))
{
return true;
}
break; break;
} }
} }
} } // for itr - m_LinkedPoweredBlocks[]
return false; // Couldn't find power source behind repeater return false; // Couldn't find power source behind repeater
} }
@ -1562,7 +1592,10 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB
// Check if eastern (right) neighbor is a powered on repeater who is facing us // Check if eastern (right) neighbor is a powered on repeater who is facing us
BLOCKTYPE Block = 0; BLOCKTYPE Block = 0;
NIBBLETYPE OtherRepeaterDir = 0; NIBBLETYPE OtherRepeaterDir = 0;
if (m_Chunk->UnboundedRelGetBlock(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ, Block, OtherRepeaterDir) && (Block == E_BLOCK_REDSTONE_REPEATER_ON)) // Is right neighbor a powered repeater? if (
m_Chunk->UnboundedRelGetBlock(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ, Block, OtherRepeaterDir) &&
(Block == E_BLOCK_REDSTONE_REPEATER_ON)
)
{ {
if ((OtherRepeaterDir & 0x03) == 0x3) if ((OtherRepeaterDir & 0x03) == 0x3)
{ {
@ -1571,7 +1604,10 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB
} }
// Check if western(left) neighbor is a powered on repeater who is facing us // Check if western(left) neighbor is a powered on repeater who is facing us
if (m_Chunk->UnboundedRelGetBlock(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ, Block, OtherRepeaterDir) && (Block == E_BLOCK_REDSTONE_REPEATER_ON)) if (
m_Chunk->UnboundedRelGetBlock(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ, Block, OtherRepeaterDir) &&
(Block == E_BLOCK_REDSTONE_REPEATER_ON)
)
{ {
if ((OtherRepeaterDir & 0x03) == 0x1) if ((OtherRepeaterDir & 0x03) == 0x1)
{ {
@ -1590,7 +1626,10 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB
BLOCKTYPE Block = 0; BLOCKTYPE Block = 0;
NIBBLETYPE OtherRepeaterDir = 0; NIBBLETYPE OtherRepeaterDir = 0;
if (m_Chunk->UnboundedRelGetBlock(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1, Block, OtherRepeaterDir) && (Block == E_BLOCK_REDSTONE_REPEATER_ON)) if (
m_Chunk->UnboundedRelGetBlock(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1, Block, OtherRepeaterDir) &&
(Block == E_BLOCK_REDSTONE_REPEATER_ON)
)
{ {
if ((OtherRepeaterDir & 0x30) == 0x00) if ((OtherRepeaterDir & 0x30) == 0x00)
{ {
@ -1599,7 +1638,10 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB
} }
// Check if northern(up) neighbor is a powered on repeater who is facing us // Check if northern(up) neighbor is a powered on repeater who is facing us
if (m_Chunk->UnboundedRelGetBlock(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1, Block, OtherRepeaterDir) && (Block == E_BLOCK_REDSTONE_REPEATER_ON)) if (
m_Chunk->UnboundedRelGetBlock(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1, Block, OtherRepeaterDir) &&
(Block == E_BLOCK_REDSTONE_REPEATER_ON)
)
{ {
if ((OtherRepeaterDir & 0x03) == 0x02) if ((OtherRepeaterDir & 0x03) == 0x02)
{ {
@ -1625,7 +1667,10 @@ bool cIncrementalRedstoneSimulator::IsPistonPowered(int a_RelBlockX, int a_RelBl
for (const auto & itr : *m_PoweredBlocks) for (const auto & itr : *m_PoweredBlocks)
{ {
if (!itr.a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ))) { continue; } if (!itr.a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
{
continue;
}
int X = a_RelBlockX, Z = a_RelBlockZ; int X = a_RelBlockX, Z = a_RelBlockZ;
AddFaceDirection(X, a_RelBlockY, Z, Face); AddFaceDirection(X, a_RelBlockY, Z, Face);
@ -1638,7 +1683,10 @@ bool cIncrementalRedstoneSimulator::IsPistonPowered(int a_RelBlockX, int a_RelBl
for (const auto & itr : *m_LinkedPoweredBlocks) for (const auto & itr : *m_LinkedPoweredBlocks)
{ {
if (!itr.a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ))) { continue; } if (!itr.a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
{
continue;
}
int X = a_RelBlockX, Z = a_RelBlockZ; int X = a_RelBlockX, Z = a_RelBlockZ;
AddFaceDirection(X, a_RelBlockY, Z, Face); AddFaceDirection(X, a_RelBlockY, Z, Face);