diff options
| author | daoge <3523206925@qq.com> | 2026-03-03 03:04:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-03 03:04:10 +0800 |
| commit | b3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch) | |
| tree | 267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.World/BaseRailTile.h | |
| parent | 84c31a2331f7a0ec85b9d438992e244f60e5020f (diff) | |
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a43994725008e35fceb984d5549df9c8cea470.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
Diffstat (limited to 'Minecraft.World/BaseRailTile.h')
| -rw-r--r-- | Minecraft.World/BaseRailTile.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/Minecraft.World/BaseRailTile.h b/Minecraft.World/BaseRailTile.h new file mode 100644 index 00000000..105ddfde --- /dev/null +++ b/Minecraft.World/BaseRailTile.h @@ -0,0 +1,89 @@ +#pragma once +#include "Tile.h" +#include "TilePos.h" +#include "Definitions.h" + +class Random; +class HitResult; +class ChunkRebuildData; + +using namespace std; + +class BaseRailTile : public Tile +{ + friend class Tile; + friend class ChunkRebuildData; +public: + static const int DIR_FLAT_Z = 0; + static const int DIR_FLAT_X = 1; + // the data bit is used by boosters and detectors, so they can't turn + static const int RAIL_DATA_BIT = 8; + static const int RAIL_DIRECTION_MASK = 7; + +private: + Icon *iconTurn; + +protected: + bool usesDataBit; + + class Rail + { + friend class BaseRailTile; + friend class RailTile; + private: + Level *level; + int x, y, z; + bool usesDataBit; + vector<TilePos *> connections; + bool m_bValidRail; // 4J added + + public: + Rail(Level *level, int x, int y, int z); + ~Rail(); + private: + void updateConnections(int direction); + void removeSoftConnections(); + bool hasRail(int x, int y, int z); + Rail *getRail(TilePos *p); + bool connectsTo(Rail *rail); + bool hasConnection(int x, int y, int z); + + protected: + int countPotentialConnections(); + + private: + bool canConnectTo(Rail *rail); + void connectTo(Rail *rail); + bool hasNeighborRail(int x, int y, int z); + public: + void place(bool hasSignal, bool first); + }; +public: + static bool isRail(Level *level, int x, int y, int z); + static bool isRail(int id); +protected: + BaseRailTile(int id, bool usesDataBit); +public: + using Tile::getResourceCount; + + bool isUsesDataBit(); + virtual AABB *getAABB(Level *level, int x, int y, int z); + virtual bool blocksLight(); + virtual bool isSolidRender(bool isServerLevel = false); + virtual HitResult *clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b); + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param + virtual bool isCubeShaped(); + virtual int getRenderShape(); + virtual int getResourceCount(Random random); + virtual bool mayPlace(Level *level, int x, int y, int z); + virtual void onPlace(Level *level, int x, int y, int z); + virtual void neighborChanged(Level *level, int x, int y, int z, int type); + +protected: + virtual void updateState(Level *level, int x, int y, int z, int data, int dir, int type); + virtual void updateDir(Level *level, int x, int y, int z, bool first); + +public: + int getPistonPushReaction(); + void onRemove(Level *level, int x, int y, int z, int id, int data); +}; |
