Merged trivial item handlers into cSimplePlaceableItemHandler (#4766)
- Remove unused files Co-authored-by: aiugai <aiugai@umich.edu> Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
This commit is contained in:
parent
60c10ef248
commit
868e28b44f
@ -10,10 +10,7 @@ target_sources(
|
|||||||
ItemBoat.h
|
ItemBoat.h
|
||||||
ItemBottle.h
|
ItemBottle.h
|
||||||
ItemBow.h
|
ItemBow.h
|
||||||
ItemBrewingStand.h
|
|
||||||
ItemBucket.h
|
ItemBucket.h
|
||||||
ItemCake.h
|
|
||||||
ItemCauldron.h
|
|
||||||
ItemChest.h
|
ItemChest.h
|
||||||
ItemCloth.h
|
ItemCloth.h
|
||||||
ItemComparator.h
|
ItemComparator.h
|
||||||
@ -22,7 +19,6 @@ target_sources(
|
|||||||
ItemDye.h
|
ItemDye.h
|
||||||
ItemEmptyMap.h
|
ItemEmptyMap.h
|
||||||
ItemFishingRod.h
|
ItemFishingRod.h
|
||||||
ItemFlowerPot.h
|
|
||||||
ItemFood.h
|
ItemFood.h
|
||||||
ItemFoodSeeds.h
|
ItemFoodSeeds.h
|
||||||
ItemGoldenApple.h
|
ItemGoldenApple.h
|
||||||
@ -56,8 +52,7 @@ target_sources(
|
|||||||
ItemSoup.h
|
ItemSoup.h
|
||||||
ItemSpawnEgg.h
|
ItemSpawnEgg.h
|
||||||
ItemSpiderEye.h
|
ItemSpiderEye.h
|
||||||
ItemString.h
|
|
||||||
ItemSugarcane.h
|
|
||||||
ItemSword.h
|
ItemSword.h
|
||||||
ItemThrowable.h
|
ItemThrowable.h
|
||||||
|
SimplePlaceableItemHandler.h
|
||||||
)
|
)
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "ItemHandler.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class cItemBrewingStandHandler:
|
|
||||||
public cItemHandler
|
|
||||||
{
|
|
||||||
using Super = cItemHandler;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
cItemBrewingStandHandler(int a_ItemType):
|
|
||||||
Super(a_ItemType)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool IsPlaceable(void) override
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
|
||||||
const Vector3i a_PlacedBlockPos,
|
|
||||||
eBlockFace a_ClickedBlockFace,
|
|
||||||
const Vector3i a_CursorPos,
|
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
|
||||||
) override
|
|
||||||
{
|
|
||||||
a_BlockType = E_BLOCK_BREWING_STAND;
|
|
||||||
a_BlockMeta = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
|||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "ItemHandler.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class cItemCakeHandler:
|
|
||||||
public cItemHandler
|
|
||||||
{
|
|
||||||
using Super = cItemHandler;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
cItemCakeHandler(int a_ItemType):
|
|
||||||
Super(a_ItemType)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool IsPlaceable(void) override
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
|
||||||
const Vector3i a_PlacedBlockPos,
|
|
||||||
eBlockFace a_ClickedBlockFace,
|
|
||||||
const Vector3i a_CursorPos,
|
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
|
||||||
) override
|
|
||||||
{
|
|
||||||
a_BlockType = E_BLOCK_CAKE;
|
|
||||||
a_BlockMeta = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
|||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "ItemHandler.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class cItemCauldronHandler:
|
|
||||||
public cItemHandler
|
|
||||||
{
|
|
||||||
using Super = cItemHandler;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
cItemCauldronHandler(int a_ItemType):
|
|
||||||
Super(a_ItemType)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool IsPlaceable(void) override
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
|
||||||
const Vector3i a_PlacedBlockPos,
|
|
||||||
eBlockFace a_ClickedBlockFace,
|
|
||||||
const Vector3i a_CursorPos,
|
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
|
||||||
) override
|
|
||||||
{
|
|
||||||
a_BlockType = E_BLOCK_CAULDRON;
|
|
||||||
a_BlockMeta = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
|||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "ItemHandler.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class cItemFlowerPotHandler:
|
|
||||||
public cItemHandler
|
|
||||||
{
|
|
||||||
using Super = cItemHandler;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
cItemFlowerPotHandler(int a_ItemType):
|
|
||||||
Super(a_ItemType)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool IsPlaceable(void) override
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
|
||||||
const Vector3i a_PlacedBlockPos,
|
|
||||||
eBlockFace a_ClickedBlockFace,
|
|
||||||
const Vector3i a_CursorPos,
|
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
|
||||||
) override
|
|
||||||
{
|
|
||||||
a_BlockType = E_BLOCK_FLOWER_POT;
|
|
||||||
a_BlockMeta = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -15,10 +15,7 @@
|
|||||||
#include "ItemBoat.h"
|
#include "ItemBoat.h"
|
||||||
#include "ItemBottle.h"
|
#include "ItemBottle.h"
|
||||||
#include "ItemBow.h"
|
#include "ItemBow.h"
|
||||||
#include "ItemBrewingStand.h"
|
|
||||||
#include "ItemBucket.h"
|
#include "ItemBucket.h"
|
||||||
#include "ItemCake.h"
|
|
||||||
#include "ItemCauldron.h"
|
|
||||||
#include "ItemChest.h"
|
#include "ItemChest.h"
|
||||||
#include "ItemCloth.h"
|
#include "ItemCloth.h"
|
||||||
#include "ItemComparator.h"
|
#include "ItemComparator.h"
|
||||||
@ -28,7 +25,6 @@
|
|||||||
#include "ItemEmptyMap.h"
|
#include "ItemEmptyMap.h"
|
||||||
#include "ItemEyeOfEnder.h"
|
#include "ItemEyeOfEnder.h"
|
||||||
#include "ItemFishingRod.h"
|
#include "ItemFishingRod.h"
|
||||||
#include "ItemFlowerPot.h"
|
|
||||||
#include "ItemFood.h"
|
#include "ItemFood.h"
|
||||||
#include "ItemFoodSeeds.h"
|
#include "ItemFoodSeeds.h"
|
||||||
#include "ItemGoldenApple.h"
|
#include "ItemGoldenApple.h"
|
||||||
@ -61,12 +57,11 @@
|
|||||||
#include "ItemSoup.h"
|
#include "ItemSoup.h"
|
||||||
#include "ItemSpawnEgg.h"
|
#include "ItemSpawnEgg.h"
|
||||||
#include "ItemSpiderEye.h"
|
#include "ItemSpiderEye.h"
|
||||||
#include "ItemString.h"
|
|
||||||
#include "ItemSugarcane.h"
|
|
||||||
#include "ItemSword.h"
|
#include "ItemSword.h"
|
||||||
#include "ItemThrowable.h"
|
#include "ItemThrowable.h"
|
||||||
|
|
||||||
#include "../Blocks/BlockHandler.h"
|
#include "../Blocks/BlockHandler.h"
|
||||||
|
#include "SimplePlaceableItemHandler.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -132,9 +127,9 @@ cItemHandler * cItemHandler::CreateItemHandler(int a_ItemType)
|
|||||||
case E_ITEM_BED: return new cItemBedHandler(a_ItemType);
|
case E_ITEM_BED: return new cItemBedHandler(a_ItemType);
|
||||||
case E_ITEM_BOTTLE_O_ENCHANTING: return new cItemBottleOEnchantingHandler();
|
case E_ITEM_BOTTLE_O_ENCHANTING: return new cItemBottleOEnchantingHandler();
|
||||||
case E_ITEM_BOW: return new cItemBowHandler();
|
case E_ITEM_BOW: return new cItemBowHandler();
|
||||||
case E_ITEM_BREWING_STAND: return new cItemBrewingStandHandler(a_ItemType);
|
case E_ITEM_BREWING_STAND: return new cSimplePlaceableItemHandler(a_ItemType, E_BLOCK_BREWING_STAND);
|
||||||
case E_ITEM_CAKE: return new cItemCakeHandler(a_ItemType);
|
case E_ITEM_CAKE: return new cSimplePlaceableItemHandler(a_ItemType, E_BLOCK_CAKE);
|
||||||
case E_ITEM_CAULDRON: return new cItemCauldronHandler(a_ItemType);
|
case E_ITEM_CAULDRON: return new cSimplePlaceableItemHandler(a_ItemType, E_BLOCK_CAULDRON);
|
||||||
case E_ITEM_COMPARATOR: return new cItemComparatorHandler(a_ItemType);
|
case E_ITEM_COMPARATOR: return new cItemComparatorHandler(a_ItemType);
|
||||||
case E_ITEM_DYE: return new cItemDyeHandler(a_ItemType);
|
case E_ITEM_DYE: return new cItemDyeHandler(a_ItemType);
|
||||||
case E_ITEM_EGG: return new cItemEggHandler();
|
case E_ITEM_EGG: return new cItemEggHandler();
|
||||||
@ -145,7 +140,7 @@ cItemHandler * cItemHandler::CreateItemHandler(int a_ItemType)
|
|||||||
case E_ITEM_FIREWORK_ROCKET: return new cItemFireworkHandler();
|
case E_ITEM_FIREWORK_ROCKET: return new cItemFireworkHandler();
|
||||||
case E_ITEM_FISHING_ROD: return new cItemFishingRodHandler(a_ItemType);
|
case E_ITEM_FISHING_ROD: return new cItemFishingRodHandler(a_ItemType);
|
||||||
case E_ITEM_FLINT_AND_STEEL: return new cItemLighterHandler(a_ItemType);
|
case E_ITEM_FLINT_AND_STEEL: return new cItemLighterHandler(a_ItemType);
|
||||||
case E_ITEM_FLOWER_POT: return new cItemFlowerPotHandler(a_ItemType);
|
case E_ITEM_FLOWER_POT: return new cSimplePlaceableItemHandler(a_ItemType, E_BLOCK_FLOWER_POT);
|
||||||
case E_ITEM_GLASS_BOTTLE: return new cItemBottleHandler();
|
case E_ITEM_GLASS_BOTTLE: return new cItemBottleHandler();
|
||||||
case E_ITEM_MAP: return new cItemMapHandler();
|
case E_ITEM_MAP: return new cItemMapHandler();
|
||||||
case E_ITEM_MILK: return new cItemMilkHandler();
|
case E_ITEM_MILK: return new cItemMilkHandler();
|
||||||
@ -160,8 +155,8 @@ cItemHandler * cItemHandler::CreateItemHandler(int a_ItemType)
|
|||||||
case E_ITEM_HEAD: return new cItemMobHeadHandler(a_ItemType);
|
case E_ITEM_HEAD: return new cItemMobHeadHandler(a_ItemType);
|
||||||
case E_ITEM_SNOWBALL: return new cItemSnowballHandler();
|
case E_ITEM_SNOWBALL: return new cItemSnowballHandler();
|
||||||
case E_ITEM_SPAWN_EGG: return new cItemSpawnEggHandler(a_ItemType);
|
case E_ITEM_SPAWN_EGG: return new cItemSpawnEggHandler(a_ItemType);
|
||||||
case E_ITEM_STRING: return new cItemStringHandler(a_ItemType);
|
case E_ITEM_STRING: return new cSimplePlaceableItemHandler(a_ItemType, E_BLOCK_TRIPWIRE);
|
||||||
case E_ITEM_SUGARCANE: return new cItemSugarcaneHandler(a_ItemType);
|
case E_ITEM_SUGARCANE: return new cSimplePlaceableItemHandler(a_ItemType, E_BLOCK_SUGARCANE);
|
||||||
|
|
||||||
case E_ITEM_WOODEN_HOE:
|
case E_ITEM_WOODEN_HOE:
|
||||||
case E_ITEM_STONE_HOE:
|
case E_ITEM_STONE_HOE:
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "ItemHandler.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class cItemStringHandler:
|
|
||||||
public cItemHandler
|
|
||||||
{
|
|
||||||
using Super = cItemHandler;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
cItemStringHandler(int a_ItemType):
|
|
||||||
Super(a_ItemType)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool IsPlaceable(void) override
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
|
||||||
const Vector3i a_PlacedBlockPos,
|
|
||||||
eBlockFace a_ClickedBlockFace,
|
|
||||||
const Vector3i a_CursorPos,
|
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
|
||||||
) override
|
|
||||||
{
|
|
||||||
a_BlockType = E_BLOCK_TRIPWIRE;
|
|
||||||
a_BlockMeta = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
|||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "ItemHandler.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class cItemSugarcaneHandler:
|
|
||||||
public cItemHandler
|
|
||||||
{
|
|
||||||
using Super = cItemHandler;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
cItemSugarcaneHandler(int a_ItemType):
|
|
||||||
Super(a_ItemType)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool IsPlaceable(void) override
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
|
||||||
const Vector3i a_PlacedBlockPos,
|
|
||||||
eBlockFace a_ClickedBlockFace,
|
|
||||||
const Vector3i a_CursorPos,
|
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
|
||||||
) override
|
|
||||||
{
|
|
||||||
a_BlockType = E_BLOCK_SUGARCANE;
|
|
||||||
a_BlockMeta = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
37
src/Items/SimplePlaceableItemHandler.h
Normal file
37
src/Items/SimplePlaceableItemHandler.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
#include "ItemHandler.h"
|
||||||
|
|
||||||
|
class cSimplePlaceableItemHandler :
|
||||||
|
public cItemHandler
|
||||||
|
{
|
||||||
|
using Super = cItemHandler;
|
||||||
|
|
||||||
|
public:
|
||||||
|
cSimplePlaceableItemHandler(int a_ItemType, BLOCKTYPE a_BlockType) :
|
||||||
|
Super(a_ItemType)
|
||||||
|
{
|
||||||
|
m_BlockType = a_BlockType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virtual bool IsPlaceable(void) override
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
|
cWorld * a_World, cPlayer * a_Player, const Vector3i a_PlacedBlockPos,
|
||||||
|
eBlockFace a_ClickedBlockFace, const Vector3i a_CursorPos,
|
||||||
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) override
|
||||||
|
{
|
||||||
|
a_BlockType = m_BlockType;
|
||||||
|
a_BlockMeta = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
BLOCKTYPE m_BlockType;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user