summaryrefslogtreecommitdiffstats
path: root/source/Blocks
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-09 15:35:43 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-09 15:35:43 +0100
commit75937077136b9ec2eaba49c74543bdee323f68ff (patch)
treeee8b20b2b3866118dd1187cafa730a9c4e90b82a /source/Blocks
parentCore: added PortsIPv6 setting to webadmin (contributed by STR_Warrior) (diff)
downloadcuberite-75937077136b9ec2eaba49c74543bdee323f68ff.tar
cuberite-75937077136b9ec2eaba49c74543bdee323f68ff.tar.gz
cuberite-75937077136b9ec2eaba49c74543bdee323f68ff.tar.bz2
cuberite-75937077136b9ec2eaba49c74543bdee323f68ff.tar.lz
cuberite-75937077136b9ec2eaba49c74543bdee323f68ff.tar.xz
cuberite-75937077136b9ec2eaba49c74543bdee323f68ff.tar.zst
cuberite-75937077136b9ec2eaba49c74543bdee323f68ff.zip
Diffstat (limited to '')
-rw-r--r--source/Blocks/BlockBed.h8
-rw-r--r--source/Blocks/BlockChest.h6
-rw-r--r--source/Blocks/BlockDispenser.h2
-rw-r--r--source/Blocks/BlockFenceGate.h2
-rw-r--r--source/Blocks/BlockFurnace.h3
5 files changed, 13 insertions, 8 deletions
diff --git a/source/Blocks/BlockBed.h b/source/Blocks/BlockBed.h
index f4e48f195..ab55ffc92 100644
--- a/source/Blocks/BlockBed.h
+++ b/source/Blocks/BlockBed.h
@@ -47,14 +47,14 @@ public:
// Bed specific helper functions
- static NIBBLETYPE RotationToMetaData(float a_Rotation)
+ static NIBBLETYPE RotationToMetaData(double a_Rotation)
{
a_Rotation += 180 + (180/4); // So its not aligned with axis
- if( a_Rotation > 360.f ) a_Rotation -= 360.f;
+ if( a_Rotation > 360 ) a_Rotation -= 360;
- a_Rotation = (a_Rotation/360) * 4;
+ a_Rotation = (a_Rotation / 360) * 4;
- return ((char)a_Rotation+2) % 4;
+ return ((char)a_Rotation + 2) % 4;
}
diff --git a/source/Blocks/BlockChest.h b/source/Blocks/BlockChest.h
index 6de6a8e29..5a64a16bb 100644
--- a/source/Blocks/BlockChest.h
+++ b/source/Blocks/BlockChest.h
@@ -41,7 +41,7 @@ public:
{
return false;
}
- float rot = a_Player->GetRotation();
+ double rot = a_Player->GetRotation();
if (
(Area.GetRelBlockType(0, 0, 1) == E_BLOCK_CHEST) ||
(Area.GetRelBlockType(2, 0, 1) == E_BLOCK_CHEST)
@@ -79,7 +79,7 @@ public:
return;
}
- float rot = a_Player->GetRotation();
+ double rot = a_Player->GetRotation();
// Choose meta from player rotation, choose only between 2 or 3
NIBBLETYPE NewMeta = ((rot >= -90) && (rot < 90)) ? 2 : 3;
if (
@@ -178,7 +178,7 @@ public:
/// Translates player rotation when placing a chest into the chest block metadata. Valid for single chests only
- static NIBBLETYPE RotationToMetaData(float a_Rotation)
+ static NIBBLETYPE RotationToMetaData(double a_Rotation)
{
a_Rotation += 90 + 45; // So its not aligned with axis
diff --git a/source/Blocks/BlockDispenser.h b/source/Blocks/BlockDispenser.h
index a1aa45964..e5cde2fc5 100644
--- a/source/Blocks/BlockDispenser.h
+++ b/source/Blocks/BlockDispenser.h
@@ -28,6 +28,8 @@ public:
) override
{
a_BlockType = m_BlockType;
+
+ // FIXME: Do not use cPiston class for dispenser placement!
a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetRotation(), 0);
return true;
}
diff --git a/source/Blocks/BlockFenceGate.h b/source/Blocks/BlockFenceGate.h
index 0c17a0acc..a84ce8303 100644
--- a/source/Blocks/BlockFenceGate.h
+++ b/source/Blocks/BlockFenceGate.h
@@ -35,7 +35,7 @@ public:
{
NIBBLETYPE OldMetaData = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
NIBBLETYPE NewMetaData = cDoors::RotationToMetaData(a_Player->GetRotation() + 270);
- OldMetaData ^= 4; //Toggle the gate
+ OldMetaData ^= 4; // Toggle the gate
if ((OldMetaData & 1) == (NewMetaData & 1))
{
// Standing in front of the gate - apply new direction
diff --git a/source/Blocks/BlockFurnace.h b/source/Blocks/BlockFurnace.h
index a163c9483..7231c4d65 100644
--- a/source/Blocks/BlockFurnace.h
+++ b/source/Blocks/BlockFurnace.h
@@ -34,7 +34,10 @@ public:
) override
{
a_BlockType = m_BlockType;
+
+ // FIXME: Do not use cPiston class for furnace placement!
a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetRotation(), 0);
+
return true;
}
} ;