summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoannisO <Joannis.Orlandos@gmail.com>2014-06-03 19:43:15 +0200
committerJoannisO <Joannis.Orlandos@gmail.com>2014-06-03 19:43:15 +0200
commit7993caa553e3317da21763226bf6bd5c2e965f8c (patch)
treecf9c09e8df75a427ae40fcf58af05650d180a54d
parent- Fixed a bug where I didn't return anything in the GetShootVector (diff)
downloadcuberite-7993caa553e3317da21763226bf6bd5c2e965f8c.tar
cuberite-7993caa553e3317da21763226bf6bd5c2e965f8c.tar.gz
cuberite-7993caa553e3317da21763226bf6bd5c2e965f8c.tar.bz2
cuberite-7993caa553e3317da21763226bf6bd5c2e965f8c.tar.lz
cuberite-7993caa553e3317da21763226bf6bd5c2e965f8c.tar.xz
cuberite-7993caa553e3317da21763226bf6bd5c2e965f8c.tar.zst
cuberite-7993caa553e3317da21763226bf6bd5c2e965f8c.zip
-rw-r--r--src/BlockEntities/DispenserEntity.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/BlockEntities/DispenserEntity.cpp b/src/BlockEntities/DispenserEntity.cpp
index bbf924417..a4a660034 100644
--- a/src/BlockEntities/DispenserEntity.cpp
+++ b/src/BlockEntities/DispenserEntity.cpp
@@ -38,7 +38,10 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
// Would dispense into / interact with a non-loaded chunk, ignore the tick
return;
}
+
BLOCKTYPE DispBlock = DispChunk->GetBlock(DispX, DispY, DispZ);
+ int BlockX = (DispX + DispChunk->GetPosX() * cChunkDef::Width);
+ int BlockZ = (DispZ + DispChunk->GetPosZ() * cChunkDef::Width);
// Dispense the item:
switch (m_Contents.GetSlot(a_SlotNum).m_ItemType)
@@ -146,10 +149,6 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_FIRE_CHARGE:
{
- cChunk * DispChunk = a_Chunk.GetRelNeighborChunkAdjustCoords(DispX, DispZ);
- int BlockX = (DispX + DispChunk->GetPosX() * cChunkDef::Width);
- int BlockZ = (DispZ + DispChunk->GetPosZ() * cChunkDef::Width);
-
SpawnProjectileFromDispenser(BlockX, DispY, BlockZ, cProjectileEntity::pkFireCharge, GetShootVector(Meta) * 20);
m_Contents.ChangeSlotCount(a_SlotNum, -1);
@@ -159,10 +158,6 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_ARROW:
{
- cChunk * DispChunk = a_Chunk.GetRelNeighborChunkAdjustCoords(DispX, DispZ);
- int BlockX = (DispX + DispChunk->GetPosX() * cChunkDef::Width);
- int BlockZ = (DispZ + DispChunk->GetPosZ() * cChunkDef::Width);
-
SpawnProjectileFromDispenser(BlockX, DispY, BlockZ, cProjectileEntity::pkArrow, GetShootVector(Meta) * 20);
m_Contents.ChangeSlotCount(a_SlotNum, -1);
@@ -172,10 +167,6 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_SNOWBALL:
{
- cChunk * DispChunk = a_Chunk.GetRelNeighborChunkAdjustCoords(DispX, DispZ);
- int BlockX = (DispX + DispChunk->GetPosX() * cChunkDef::Width);
- int BlockZ = (DispZ + DispChunk->GetPosZ() * cChunkDef::Width);
-
SpawnProjectileFromDispenser(BlockX, DispY, BlockZ, cProjectileEntity::pkSnowball, GetShootVector(Meta) * 20);
m_Contents.ChangeSlotCount(a_SlotNum, -1);
@@ -185,12 +176,10 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_EGG:
{
- cChunk * DispChunk = a_Chunk.GetRelNeighborChunkAdjustCoords(DispX, DispZ);
- int BlockX = (DispX + DispChunk->GetPosX() * cChunkDef::Width);
- int BlockZ = (DispZ + DispChunk->GetPosZ() * cChunkDef::Width);
-
SpawnProjectileFromDispenser(BlockX, DispY, BlockZ, cProjectileEntity::pkEgg, GetShootVector(Meta) * 20);
+ m_Contents.ChangeSlotCount(a_SlotNum, -1);
+
break;
}