1
0
Fork 0

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:
Franklin Kong 2020-06-26 16:34:22 -04:00 committed by GitHub
parent 60c10ef248
commit 868e28b44f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 45 additions and 306 deletions

View File

@ -10,10 +10,7 @@ target_sources(
ItemBoat.h
ItemBottle.h
ItemBow.h
ItemBrewingStand.h
ItemBucket.h
ItemCake.h
ItemCauldron.h
ItemChest.h
ItemCloth.h
ItemComparator.h
@ -22,7 +19,6 @@ target_sources(
ItemDye.h
ItemEmptyMap.h
ItemFishingRod.h
ItemFlowerPot.h
ItemFood.h
ItemFoodSeeds.h
ItemGoldenApple.h
@ -56,8 +52,7 @@ target_sources(
ItemSoup.h
ItemSpawnEgg.h
ItemSpiderEye.h
ItemString.h
ItemSugarcane.h
ItemSword.h
ItemThrowable.h
SimplePlaceableItemHandler.h
)

View File

@ -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;
}
} ;

View File

@ -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;
}
} ;

View File

@ -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;
}
} ;

View File

@ -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;
}
} ;

View File

@ -15,10 +15,7 @@
#include "ItemBoat.h"
#include "ItemBottle.h"
#include "ItemBow.h"
#include "ItemBrewingStand.h"
#include "ItemBucket.h"
#include "ItemCake.h"
#include "ItemCauldron.h"
#include "ItemChest.h"
#include "ItemCloth.h"
#include "ItemComparator.h"
@ -28,7 +25,6 @@
#include "ItemEmptyMap.h"
#include "ItemEyeOfEnder.h"
#include "ItemFishingRod.h"
#include "ItemFlowerPot.h"
#include "ItemFood.h"
#include "ItemFoodSeeds.h"
#include "ItemGoldenApple.h"
@ -61,12 +57,11 @@
#include "ItemSoup.h"
#include "ItemSpawnEgg.h"
#include "ItemSpiderEye.h"
#include "ItemString.h"
#include "ItemSugarcane.h"
#include "ItemSword.h"
#include "ItemThrowable.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_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_CAKE: return new cItemCakeHandler(a_ItemType);
case E_ITEM_CAULDRON: return new cItemCauldronHandler(a_ItemType);
case E_ITEM_BREWING_STAND: return new cSimplePlaceableItemHandler(a_ItemType, E_BLOCK_BREWING_STAND);
case E_ITEM_CAKE: return new cSimplePlaceableItemHandler(a_ItemType, E_BLOCK_CAKE);
case E_ITEM_CAULDRON: return new cSimplePlaceableItemHandler(a_ItemType, E_BLOCK_CAULDRON);
case E_ITEM_COMPARATOR: return new cItemComparatorHandler(a_ItemType);
case E_ITEM_DYE: return new cItemDyeHandler(a_ItemType);
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_FISHING_ROD: return new cItemFishingRodHandler(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_MAP: return new cItemMapHandler();
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_SNOWBALL: return new cItemSnowballHandler();
case E_ITEM_SPAWN_EGG: return new cItemSpawnEggHandler(a_ItemType);
case E_ITEM_STRING: return new cItemStringHandler(a_ItemType);
case E_ITEM_SUGARCANE: return new cItemSugarcaneHandler(a_ItemType);
case E_ITEM_STRING: return new cSimplePlaceableItemHandler(a_ItemType, E_BLOCK_TRIPWIRE);
case E_ITEM_SUGARCANE: return new cSimplePlaceableItemHandler(a_ItemType, E_BLOCK_SUGARCANE);
case E_ITEM_WOODEN_HOE:
case E_ITEM_STONE_HOE:

View File

@ -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;
}
};

View File

@ -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;
}
} ;

View 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;
};