1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #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);
- };
|