1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- #include "Grass.h"
- #include "AddEntityUpdate.h"
- #include "Game.h"
- #include "ItemEntity.h"
- GrassBlock::GrassBlock(int typeId, Framework::Vec3<int> pos, int dimensionId)
- : AdditionalItemSpawningBlock(typeId, pos, dimensionId)
- {
- tickSource = 1;
- transparent = 1;
- }
- bool GrassBlock::onTick(TickQueue* zQueue, int numTicks, bool& blocked)
- {
- // TODO: spread to neighbor blocks if light level is hight enought
- return 0;
- }
- void GrassBlock::onPostTick() {}
- void GrassBlock::filterPassingLight(unsigned char rgb[3]) const
- {
- rgb[0] = (unsigned char)(rgb[0] * 0.7);
- rgb[1] = (unsigned char)(rgb[1] * 0.9);
- rgb[2] = (unsigned char)(rgb[2] * 0.7);
- }
- GrassBlockType::GrassBlockType()
- : AdditionalItemSpawningBlockType()
- {}
- ItemType* GrassBlockType::createItemType() const
- {
- return 0;
- }
- void GrassBlockType::createSuperBlock(Block* zBlock, Item* zItem) const
- {
- AdditionalItemSpawningBlockType::createSuperBlock(zBlock, zItem);
- }
- void GrassBlockType::loadSuperBlock(
- Block* zBlock, Framework::StreamReader* zReader, int dimensionId) const
- {
- AdditionalItemSpawningBlockType::loadSuperBlock(
- zBlock, zReader, dimensionId);
- }
- void GrassBlockType::saveSuperBlock(
- Block* zBlock, Framework::StreamWriter* zWriter) const
- {
- AdditionalItemSpawningBlockType::saveSuperBlock(zBlock, zWriter);
- }
- Item* GrassBlockType::createItem() const
- {
- return 0;
- }
- Block* GrassBlockType::createBlock(
- Framework::Vec3<int> position, int dimensionId) const
- {
- return new GrassBlock(getId(), position, dimensionId);
- }
- GrassBlockTypeFactory::GrassBlockTypeFactory()
- : SubTypeFactory()
- {}
- GrassBlockType* GrassBlockTypeFactory::createValue(
- Framework::JSON::JSONObject* zJson) const
- {
- return new GrassBlockType();
- }
- void GrassBlockTypeFactory::fromJson(
- GrassBlockType* zResult, Framework::JSON::JSONObject* zJson) const
- {
- super.fromJson(zResult, zJson);
- }
- void GrassBlockTypeFactory::toJson(
- GrassBlockType* zObject, Framework::JSON::JSONObject* zResult) const
- {
- super.toJson(zObject, zResult);
- }
- JSONObjectValidationBuilder* GrassBlockTypeFactory::addToValidator(
- JSONObjectValidationBuilder* builder) const
- {
- return super.addToValidator(builder);
- }
- Framework::Text GrassBlockTypeFactory::getTypeToken() const
- {
- return "grass";
- }
|