1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #pragma once
- #include "BasicBlocks.h"
- #include "Block.h"
- class GrassBlockType;
- class GrassBlock : public AdditionalItemSpawningBlock
- {
- public:
- GrassBlock(int typeId, Framework::Vec3<int> pos, int dimensionId);
- virtual bool onTick(
- TickQueue* zQueue, int numTicks, bool& blocked) override;
- virtual void onPostTick() override;
- void filterPassingLight(unsigned char rgb[3]) const override;
- friend GrassBlockType;
- };
- class GrassBlockType : public AdditionalItemSpawningBlockType
- {
- public:
- GrassBlockType();
- protected:
- virtual void createSuperBlock(Block* zBlock, Item* zItem) const override;
- virtual void loadSuperBlock(Block* zBlock,
- Framework::StreamReader* zReader,
- int dimensionId) const override;
- virtual void saveSuperBlock(
- Block* zBlock, Framework::StreamWriter* zWriter) const override;
- virtual Item* createItem() const override;
- virtual Block* createBlock(
- Framework::Vec3<int> position, int dimensionId) const override;
- public:
- virtual ItemType* createItemType() const override;
- };
- class GrassBlockTypeFactory : public SubTypeFactory<BlockType, GrassBlockType>
- {
- private:
- AdditionalItemSpawningBlockTypeFactory super;
- public:
- GrassBlockTypeFactory();
- GrassBlockType* createValue(
- Framework::JSON::JSONObject* zJson) const override;
- void fromJson(GrassBlockType* zResult,
- Framework::JSON::JSONObject* zJson) const override;
- void toJson(GrassBlockType* zObject,
- Framework::JSON::JSONObject* zResult) const override;
- JSONObjectValidationBuilder* addToValidator(
- JSONObjectValidationBuilder* builder) const override;
- Framework::Text getTypeToken() const override;
- };
|