summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities
diff options
context:
space:
mode:
authorJoannisO <Joannis.Orlandos@gmail.com>2014-06-04 12:35:45 +0200
committerJoannisO <Joannis.Orlandos@gmail.com>2014-06-04 12:35:45 +0200
commit2c103a713e0ce77ccb8b86c98e2571d5ba6dd9c0 (patch)
tree374e742725ecc59a06040f1d5d9df08c2f13426b /src/BlockEntities
parent- Fixed an issue where there were 2 "DispChunk"-s in the same function. (diff)
downloadcuberite-2c103a713e0ce77ccb8b86c98e2571d5ba6dd9c0.tar
cuberite-2c103a713e0ce77ccb8b86c98e2571d5ba6dd9c0.tar.gz
cuberite-2c103a713e0ce77ccb8b86c98e2571d5ba6dd9c0.tar.bz2
cuberite-2c103a713e0ce77ccb8b86c98e2571d5ba6dd9c0.tar.lz
cuberite-2c103a713e0ce77ccb8b86c98e2571d5ba6dd9c0.tar.xz
cuberite-2c103a713e0ce77ccb8b86c98e2571d5ba6dd9c0.tar.zst
cuberite-2c103a713e0ce77ccb8b86c98e2571d5ba6dd9c0.zip
Diffstat (limited to '')
-rw-r--r--src/BlockEntities/DispenserEntity.cpp26
-rw-r--r--src/BlockEntities/DispenserEntity.h5
2 files changed, 17 insertions, 14 deletions
diff --git a/src/BlockEntities/DispenserEntity.cpp b/src/BlockEntities/DispenserEntity.cpp
index a4a660034..242ac4024 100644
--- a/src/BlockEntities/DispenserEntity.cpp
+++ b/src/BlockEntities/DispenserEntity.cpp
@@ -10,7 +10,6 @@
#include "../Entities/ArrowEntity.h"
#include "../Entities/FireChargeEntity.h"
#include "../Entities/ProjectileEntity.h"
-#include "../Matrix4.h"
@@ -150,7 +149,6 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_FIRE_CHARGE:
{
SpawnProjectileFromDispenser(BlockX, DispY, BlockZ, cProjectileEntity::pkFireCharge, GetShootVector(Meta) * 20);
-
m_Contents.ChangeSlotCount(a_SlotNum, -1);
break;
@@ -159,7 +157,6 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_ARROW:
{
SpawnProjectileFromDispenser(BlockX, DispY, BlockZ, cProjectileEntity::pkArrow, GetShootVector(Meta) * 20);
-
m_Contents.ChangeSlotCount(a_SlotNum, -1);
break;
@@ -168,7 +165,6 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_SNOWBALL:
{
SpawnProjectileFromDispenser(BlockX, DispY, BlockZ, cProjectileEntity::pkSnowball, GetShootVector(Meta) * 20);
-
m_Contents.ChangeSlotCount(a_SlotNum, -1);
break;
@@ -177,7 +173,6 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_EGG:
{
SpawnProjectileFromDispenser(BlockX, DispY, BlockZ, cProjectileEntity::pkEgg, GetShootVector(Meta) * 20);
-
m_Contents.ChangeSlotCount(a_SlotNum, -1);
break;
@@ -202,10 +197,12 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
-void cDispenserEntity::SpawnProjectileFromDispenser(int & a_BlockX, int & a_BlockY, int & a_BlockZ, cProjectileEntity::eKind a_kind, Vector3d a_ShootVector)
+void cDispenserEntity::SpawnProjectileFromDispenser(int & a_BlockX, int & a_BlockY, int & a_BlockZ, cProjectileEntity::eKind a_Kind, Vector3d a_ShootVector)
{
- if(a_kind != cProjectileEntity::pkFireCharge)
+ if( a_kind != cProjectileEntity::pkFireCharge )
+ {
a_ShootVector.y = a_ShootVector.y + 1;
+ }
m_World->CreateProjectile((double) a_BlockX + 0.5, (double) a_BlockY + 0.5, (double) a_BlockZ + 0.5, a_kind, NULL, NULL, &a_ShootVector);
}
@@ -215,14 +212,14 @@ Vector3d cDispenserEntity::GetShootVector(NIBBLETYPE & a_Meta)
{
switch(a_Meta)
{
- case E_META_DROPSPENSER_FACING_YP: return Vector3d(0, 1, 0); // UP
- case E_META_DROPSPENSER_FACING_YM: return Vector3d(0, -1, 0); // DOWN
+ case E_META_DROPSPENSER_FACING_YP: return Vector3d(0, 1, 0); // UP
+ case E_META_DROPSPENSER_FACING_YM: return Vector3d(0, -1, 0); // DOWN
- case E_META_DROPSPENSER_FACING_XM: return Vector3d(-1, 0, 0); // WEST
- case E_META_DROPSPENSER_FACING_XP: return Vector3d(1, 0, 0); // EAST
+ case E_META_DROPSPENSER_FACING_XM: return Vector3d(-1, 0, 0); // WEST
+ case E_META_DROPSPENSER_FACING_XP: return Vector3d(1, 0, 0); // EAST
- case E_META_DROPSPENSER_FACING_ZM: return Vector3d(0, 0, -1);
- case E_META_DROPSPENSER_FACING_ZP: return Vector3d(0, 0, 1);
+ case E_META_DROPSPENSER_FACING_ZM: return Vector3d(0, 0, -1);
+ case E_META_DROPSPENSER_FACING_ZP: return Vector3d(0, 0, 1);
}
return Vector3d(0, 1, 0);
@@ -290,3 +287,6 @@ bool cDispenserEntity::EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum
m_Contents.AddItem(EmptyBucket);
return true;
}
+
+
+
diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h
index 5a2de7965..9410a1129 100644
--- a/src/BlockEntities/DispenserEntity.h
+++ b/src/BlockEntities/DispenserEntity.h
@@ -23,7 +23,7 @@ public:
static const char * GetClassStatic(void) { return "cDispenserEntity"; }
/** Spawns a projectile of the given kind in front of the dispenser */
- void SpawnProjectileFromDispenser(int & a_BlockX, int & a_BlockY, int & a_BlockZ, cProjectileEntity::eKind a_kind, Vector3d a_ShootVector);
+ void SpawnProjectileFromDispenser(int & a_BlockX, int & a_BlockY, int & a_BlockZ, cProjectileEntity::eKind a_Kind, Vector3d a_ShootVector);
/** Returns how to aim the projectile */
Vector3d GetShootVector(NIBBLETYPE & a_Meta);
@@ -38,3 +38,6 @@ private:
/// If the a_BlockInFront is liquidable and the empty bucket can fit, does the m_Contents processing and returns true
bool EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum);
} ; // tolua_export
+
+
+