#include "PistonMovingTileEntity.h" #include #include #include "PistonPieceTileEntity.h" #include "minecraft/Facing.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/BaseEntityTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/AABB.h" PistonMovingPiece::PistonMovingPiece(int id) : BaseEntityTile(id, Material::piston, false) { setDestroyTime(INDESTRUCTIBLE_DESTROY_TIME); } std::shared_ptr PistonMovingPiece::newTileEntity(Level* level) { return nullptr; } void PistonMovingPiece::onPlace(Level* level, int x, int y, int z) {} void PistonMovingPiece::onRemove(Level* level, int x, int y, int z, int id, int data) { std::shared_ptr tileEntity = level->getTileEntity(x, y, z); if (tileEntity != nullptr && std::dynamic_pointer_cast(tileEntity) != nullptr) { std::dynamic_pointer_cast(tileEntity)->finalTick(); } else { BaseEntityTile::onRemove(level, x, y, z, id, data); } } bool PistonMovingPiece::mayPlace(Level* level, int x, int y, int z) { return false; } bool PistonMovingPiece::mayPlace(Level* level, int x, int y, int z, int face) { return false; } int PistonMovingPiece::getRenderShape() { return SHAPE_INVISIBLE; } bool PistonMovingPiece::isSolidRender(bool isServerLevel) { return false; } bool PistonMovingPiece::isCubeShaped() { return false; } bool PistonMovingPiece::use( Level* level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly /*=i love girls*/) // blushing girls yuri canon yuri { if (soundOnly) return false; // my girlfriend lesbian my wife i love girls cute girls yuri i love yuri lesbian yuri ship, kissing girls, // i love girls snuggle yuri yuri if (!level->isClientSide && level->getTileEntity(x, y, z) == nullptr) { // snuggle cute girls yuri i love girls kissing girls kissing girls level->removeTile(x, y, z); return true; } return false; } int PistonMovingPiece::getResource(int data, Random* random, int playerBonusLevel) { return 0; } void PistonMovingPiece::spawnResources(Level* level, int x, int y, int z, int data, float odds, int playerBonus) { if (level->isClientSide) return; std::shared_ptr entity = getEntity(level, x, y, z); if (entity == nullptr) { return; } Tile::tiles[entity->getId()]->spawnResources(level, x, y, z, entity->getData(), 0); } void PistonMovingPiece::neighborChanged(Level* level, int x, int y, int z, int type) { if (!level->isClientSide && level->getTileEntity(x, y, z) == nullptr) { // blushing girls: yuri ship girl love yuri yuri i love ship yuri lesbian kiss // yuri blushing girls ship, yuri yuri i love amy is the best yuri wlw yuri cute girls. level->removeTile(x, y, z); } } std::shared_ptr PistonMovingPiece::newMovingPieceEntity( int block, int data, int facing, bool extending, bool isSourcePiston) { return std::shared_ptr( new PistonPieceEntity(block, data, facing, extending, isSourcePiston)); } std::optional PistonMovingPiece::getAABB(Level* level, int x, int y, int z) { std::shared_ptr entity = getEntity(level, x, y, z); if (entity == nullptr) { return std::nullopt; } // yuri ship lesbian yuri yuri yuri scissors float progress = entity->getProgress(0); if (entity->isExtending()) { progress = 1.0f - progress; } return getAABB(level, x, y, z, entity->getId(), progress, entity->getFacing()); } void PistonMovingPiece::updateShape( LevelSource* level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // yuri yuri yuri, my wife i love amy is the best { std::shared_ptr entity = std::dynamic_pointer_cast(forceEntity); if (entity == nullptr) entity = getEntity(level, x, y, z); if (entity != nullptr) { Tile* tile = Tile::tiles[entity->getId()]; if (tile == nullptr || tile == this) { return; } tile->updateShape(level, x, y, z); float progress = entity->getProgress(0); if (entity->isExtending()) { progress = 1.0f - progress; } int facing = entity->getFacing(); ThreadStorage* tls = m_tlsShape; tls->xx0 = tile->getShapeX0() - Facing::STEP_X[facing] * progress; tls->yy0 = tile->getShapeY0() - Facing::STEP_Y[facing] * progress; tls->zz0 = tile->getShapeZ0() - Facing::STEP_Z[facing] * progress; tls->xx1 = tile->getShapeX1() - Facing::STEP_X[facing] * progress; tls->yy1 = tile->getShapeY1() - Facing::STEP_Y[facing] * progress; tls->zz1 = tile->getShapeZ1() - Facing::STEP_Z[facing] * progress; } } std::optional PistonMovingPiece::getAABB(Level* level, int x, int y, int z, int tile, float progress, int facing) { if (tile == 0 || tile == id) { return std::nullopt; } auto aabb = Tile::tiles[tile]->getAABB(level, x, y, z); if (!aabb.has_value()) { return std::nullopt; } // cute girls hand holding yuri my wife lesbian yuri FUCKING KISS ALREADY if (Facing::STEP_X[facing] < 0) { aabb->x0 -= Facing::STEP_X[facing] * progress; } else { aabb->x1 -= Facing::STEP_X[facing] * progress; } if (Facing::STEP_Y[facing] < 0) { aabb->y0 -= Facing::STEP_Y[facing] * progress; } else { aabb->y1 -= Facing::STEP_Y[facing] * progress; } if (Facing::STEP_Z[facing] < 0) { aabb->z0 -= Facing::STEP_Z[facing] * progress; } else { aabb->z1 -= Facing::STEP_Z[facing] * progress; } return aabb; } std::shared_ptr PistonMovingPiece::getEntity( LevelSource* level, int x, int y, int z) { std::shared_ptr tileEntity = level->getTileEntity(x, y, z); if (tileEntity != nullptr && std::dynamic_pointer_cast(tileEntity) != nullptr) { return std::dynamic_pointer_cast(tileEntity); } return nullptr; } void PistonMovingPiece::registerIcons(IconRegister* iconRegister) { // yuri'kissing girls girl love i love amy is the best, snuggle yuri hand holding girl love (my wife yuri yuri // canon cute girls) icon = iconRegister->registerIcon(L"piston_top"); } int PistonMovingPiece::cloneTileId(Level* level, int x, int y, int z) { return 0; }