summaryrefslogtreecommitdiffstats
path: root/src/Items
diff options
context:
space:
mode:
authorAlexander Harkness <bearbin@gmail.com>2013-11-24 15:37:03 +0100
committerAlexander Harkness <bearbin@gmail.com>2013-11-24 15:37:03 +0100
commitc3cd436ec3526962f0f0698ab2d75774247c340b (patch)
treeaf5fa89e891ede194f981399af8b830afc6dec97 /src/Items
parentRemoved pedantic build and added optimisation to debug builds. (diff)
parentRCONClient: Initial implementation. (diff)
downloadcuberite-c3cd436ec3526962f0f0698ab2d75774247c340b.tar
cuberite-c3cd436ec3526962f0f0698ab2d75774247c340b.tar.gz
cuberite-c3cd436ec3526962f0f0698ab2d75774247c340b.tar.bz2
cuberite-c3cd436ec3526962f0f0698ab2d75774247c340b.tar.lz
cuberite-c3cd436ec3526962f0f0698ab2d75774247c340b.tar.xz
cuberite-c3cd436ec3526962f0f0698ab2d75774247c340b.tar.zst
cuberite-c3cd436ec3526962f0f0698ab2d75774247c340b.zip
Diffstat (limited to 'src/Items')
-rw-r--r--src/Items/ItemComparator.h4
-rw-r--r--src/Items/ItemHandler.cpp2
-rw-r--r--src/Items/ItemRedstoneRepeater.h4
-rw-r--r--src/Items/ItemThrowable.h44
4 files changed, 50 insertions, 4 deletions
diff --git a/src/Items/ItemComparator.h b/src/Items/ItemComparator.h
index 53dbd020d..3fbb7603d 100644
--- a/src/Items/ItemComparator.h
+++ b/src/Items/ItemComparator.h
@@ -2,7 +2,7 @@
#pragma once
#include "ItemHandler.h"
-#include "../Simulator/RedstoneSimulator.h"
+#include "../Blocks/BlockRedstoneRepeater.h"
@@ -30,7 +30,7 @@ public:
) override
{
a_BlockType = E_BLOCK_INACTIVE_COMPARATOR;
- a_BlockMeta = cRedstoneSimulator::RepeaterRotationToMetaData(a_Player->GetRotation());
+ a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetRotation());
return true;
}
} ;
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index 13f5293b9..92ba94999 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -90,6 +90,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
case E_BLOCK_WOOL: return new cItemClothHandler(a_ItemType);
case E_ITEM_BED: return new cItemBedHandler(a_ItemType);
case E_ITEM_BOAT: return new cItemBoatHandler(a_ItemType);
+ case E_ITEM_BOTTLE_O_ENCHANTING: return new cItemBottleOEnchantingHandler();
case E_ITEM_BOW: return new cItemBowHandler;
case E_ITEM_BREWING_STAND: return new cItemBrewingStandHandler(a_ItemType);
case E_ITEM_CAULDRON: return new cItemCauldronHandler(a_ItemType);
@@ -97,6 +98,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
case E_ITEM_DYE: return new cItemDyeHandler(a_ItemType);
case E_ITEM_EGG: return new cItemEggHandler();
case E_ITEM_ENDER_PEARL: return new cItemEnderPearlHandler();
+ case E_ITEM_FIREWORK_ROCKET: return new cItemFireworkHandler();
case E_ITEM_FLINT_AND_STEEL: return new cItemLighterHandler(a_ItemType);
case E_ITEM_FLOWER_POT: return new cItemFlowerPotHandler(a_ItemType);
case E_ITEM_REDSTONE_DUST: return new cItemRedstoneDustHandler(a_ItemType);
diff --git a/src/Items/ItemRedstoneRepeater.h b/src/Items/ItemRedstoneRepeater.h
index 459070579..f69f24eb8 100644
--- a/src/Items/ItemRedstoneRepeater.h
+++ b/src/Items/ItemRedstoneRepeater.h
@@ -2,7 +2,7 @@
#pragma once
#include "ItemHandler.h"
-#include "../Simulator/RedstoneSimulator.h"
+#include "../Blocks/BlockRedstoneRepeater.h"
@@ -30,7 +30,7 @@ public:
) override
{
a_BlockType = E_BLOCK_REDSTONE_REPEATER_OFF;
- a_BlockMeta = cRedstoneSimulator::RepeaterRotationToMetaData(a_Player->GetRotation());
+ a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetRotation());
return true;
}
} ;
diff --git a/src/Items/ItemThrowable.h b/src/Items/ItemThrowable.h
index 85579daf2..fc24e775a 100644
--- a/src/Items/ItemThrowable.h
+++ b/src/Items/ItemThrowable.h
@@ -94,3 +94,47 @@ public:
+
+class cItemBottleOEnchantingHandler :
+ public cItemThrowableHandler
+{
+ typedef cItemThrowableHandler super;
+public:
+ cItemBottleOEnchantingHandler(void) :
+ super(E_ITEM_BOTTLE_O_ENCHANTING, cProjectileEntity::pkExpBottle, 10)
+ {
+ }
+};
+
+
+
+
+
+class cItemFireworkHandler :
+ public cItemThrowableHandler
+{
+ typedef cItemThrowableHandler super;
+public:
+ cItemFireworkHandler(void) :
+ super(E_ITEM_FIREWORK_ROCKET, cProjectileEntity::pkFirework, 0)
+ {
+ }
+
+ virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
+ {
+ if (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_AIR)
+ {
+ return false;
+ }
+
+ if (!a_Player->IsGameModeCreative())
+ {
+ a_Player->GetInventory().RemoveOneEquippedItem();
+ }
+
+ a_World->CreateProjectile(a_BlockX + 0.5, a_BlockY + 1, a_BlockZ + 0.5, m_ProjectileKind, a_Player, 0);
+
+ return true;
+ }
+
+}; \ No newline at end of file