123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #pragma once
- #include "Block.h"
- #include "BlockType.h"
- #include "Item.h"
- class BlockType;
- class ItemType;
- class BasicBlockType;
- class BasicBlock : public Block
- {
- public:
- BasicBlock(int typeId, ItemType* zTool, Framework::Vec3<int> pos);
- virtual bool onTick(
- TickQueue* zQueue, int numTicks, bool& blocked) override;
- virtual void onPostTick() override;
- friend BasicBlockType;
- };
- struct SpawnConfig
- {
- int min;
- int max;
- double chance;
- int itemType;
- };
- class AdditionalItemSpawningBlock : public BasicBlock
- {
- private:
- Framework::Array<SpawnConfig> spawns;
- public:
- AdditionalItemSpawningBlock(
- int typeId, ItemType* zTool, Framework::Vec3<int> pos);
- void addSpawn(SpawnConfig config);
- virtual void onDestroy() override;
- };
- class BasicBlockType : public BlockType
- {
- private:
- int itemType;
- bool transparent;
- bool passable;
- float hardness;
- ItemType* zTool;
- float speedModifier;
- bool interactable;
- std::function<Block*(Framework::Vec3<int>)> creatBlockCustom;
- protected:
- virtual void createSuperBlock(Block* zBlock, Item* zItem) const override;
- public:
- BasicBlockType(
- int typeId, int itemTypeId, ModelInfo model, const char* name);
- BasicBlockType(int typeId,
- int itemTypeId,
- ModelInfo model,
- std::function<Block*(Framework::Vec3<int>)> creatBlockCustom,
- const char* name);
- virtual Block* createBlock(Framework::Vec3<int> position) const override;
- virtual Item* createItem() const override;
- BasicBlockType* setHardness(float hardness);
- BasicBlockType* setTransparent(bool transparent);
- };
|