12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #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);
- BasicBlockType(int typeId, int itemTypeId, ModelInfo model, std::function<Block* (Framework::Vec3<int>)> creatBlockCustom);
- virtual Block* createBlock(Framework::Vec3<int> position) const override;
- virtual Item* createItem() const override;
- BasicBlockType* setHardness(float hardness);
- };
|