From eed6f9bb7bd2553a509a7bba7be32436aa96659b Mon Sep 17 00:00:00 2001 From: "luksor111@gmail.com" Date: Sat, 24 Nov 2012 09:50:38 +0000 Subject: Fixed drops for: Stone, Mycelium, Redstone Torch. Fixed item usage for Jukeboxes and Spawn eggs in survival. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1064 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/BlockID.h | 4 ++-- source/Blocks/BlockHandler.cpp | 3 +++ source/Blocks/BlockMycelium.h | 29 +++++++++++++++++++++++++++++ source/Blocks/BlockStone.h | 2 +- source/Items/ItemSpawnEgg.h | 7 +++++-- source/JukeboxEntity.cpp | 2 +- 6 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 source/Blocks/BlockMycelium.h (limited to 'source') diff --git a/source/BlockID.h b/source/BlockID.h index 6dd30a069..11392c509 100644 --- a/source/BlockID.h +++ b/source/BlockID.h @@ -246,8 +246,8 @@ enum ENUM_ITEM_ID E_ITEM_WOODEN_PRESSURE_PLATE = 72, E_ITEM_REDSTONE_ORE = 73, E_ITEM_REDSTONE_ORE_GLOWING = 74, - E_ITEM_REDSTONE_TORCH_ON = 75, - E_ITEM_REDSTONE_TORCH_OFF = 76, + E_ITEM_REDSTONE_TORCH_OFF = 75, + E_ITEM_REDSTONE_TORCH_ON = 76, E_ITEM_STONE_BUTTON = 77, E_ITEM_SNOW = 78, E_ITEM_ICE = 79, diff --git a/source/Blocks/BlockHandler.cpp b/source/Blocks/BlockHandler.cpp index 848a70a19..88f279ff5 100644 --- a/source/Blocks/BlockHandler.cpp +++ b/source/Blocks/BlockHandler.cpp @@ -44,6 +44,7 @@ #include "BlockNote.h" #include "BlockBed.h" #include "BlockFarmland.h" +#include "BlockMycelium.h" @@ -117,6 +118,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_LOG: return new cBlockWoodHandler (a_BlockType); case E_BLOCK_MELON: return new cBlockMelonHandler (a_BlockType); case E_BLOCK_MELON_STEM: return new cBlockStemsHandler (a_BlockType); + case E_BLOCK_MYCELIUM: return new cBlockMyceliumHandler (a_BlockType); case E_BLOCK_NETHER_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType); case E_BLOCK_NOTE_BLOCK: return new cBlockNoteHandler (a_BlockType); case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType); @@ -132,6 +134,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_RED_MUSHROOM: return new cBlockMushroomHandler (a_BlockType); case E_BLOCK_RED_ROSE: return new cBlockFlowerHandler (a_BlockType); case E_BLOCK_SAND: return new cBlockSandHandler (a_BlockType); + case E_ITEM_SANDSTONE_STAIRS: return new cBlockStairsHandler (a_BlockType); case E_BLOCK_SAPLING: return new cBlockSaplingHandler (a_BlockType); case E_BLOCK_SIGN_POST: return new cBlockSignHandler (a_BlockType); case E_BLOCK_SNOW: return new cBlockSnowHandler (a_BlockType); diff --git a/source/Blocks/BlockMycelium.h b/source/Blocks/BlockMycelium.h new file mode 100644 index 000000000..57b45dfe1 --- /dev/null +++ b/source/Blocks/BlockMycelium.h @@ -0,0 +1,29 @@ + +#pragma once + +#include "BlockHandler.h" +#include "../MersenneTwister.h" +#include "../World.h" + + + + + +class cBlockMyceliumHandler : + public cBlockHandler +{ +public: + cBlockMyceliumHandler(BLOCKTYPE a_BlockType) + : cBlockHandler(a_BlockType) + { + } + + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + a_Pickups.push_back(cItem(E_BLOCK_DIRT, 1, 0)); + } +} ; + + + + diff --git a/source/Blocks/BlockStone.h b/source/Blocks/BlockStone.h index 69809c078..89bef5969 100644 --- a/source/Blocks/BlockStone.h +++ b/source/Blocks/BlockStone.h @@ -20,7 +20,7 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - a_Pickups.push_back(cItem(E_BLOCK_STONE, 1, 0)); + a_Pickups.push_back(cItem(E_BLOCK_COBBLESTONE, 1, 0)); } } ; diff --git a/source/Items/ItemSpawnEgg.h b/source/Items/ItemSpawnEgg.h index f3018075b..33a1e1d55 100644 --- a/source/Items/ItemSpawnEgg.h +++ b/source/Items/ItemSpawnEgg.h @@ -35,8 +35,11 @@ public: if (a_World->SpawnMob(a_BlockX + 0.5, a_BlockY, a_BlockZ + 0.5, a_Item->m_ItemDamage) >= 0) { - // The mob was spawned, "use" the item: - a_Player->UseEquippedItem(); + if(a_Player->GetGameMode() != 1) + { + // The mob was spawned, "use" the item: + a_Player->GetInventory().RemoveItem(a_Player->GetInventory().GetEquippedItem()); + } return true; } diff --git a/source/JukeboxEntity.cpp b/source/JukeboxEntity.cpp index c190ffa11..3b4c8e1d9 100644 --- a/source/JukeboxEntity.cpp +++ b/source/JukeboxEntity.cpp @@ -40,7 +40,7 @@ void cJukeboxEntity::UsedBy( cPlayer * a_Player ) if (HeldItem.m_ItemType >= 2256 && HeldItem.m_ItemType <= 2267) { m_Record = HeldItem.m_ItemType; - a_Player->UseEquippedItem(); + a_Player->GetInventory().RemoveItem(a_Player->GetInventory().GetEquippedItem()); PlayRecord(); } } -- cgit v1.2.3