diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/DispenserTile.h | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.World/DispenserTile.h')
| -rw-r--r-- | Minecraft.World/DispenserTile.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Minecraft.World/DispenserTile.h b/Minecraft.World/DispenserTile.h new file mode 100644 index 00000000..5bc892aa --- /dev/null +++ b/Minecraft.World/DispenserTile.h @@ -0,0 +1,58 @@ +#pragma once +#include "EntityTile.h" + +class Player; +class Mob; +class ChunkRebuildData; +class DispenserTile : public EntityTile +{ + friend class Tile; + friend class ChunkRebuildData; + +private: + static const int DISPENSE_ITEM = 0; + static const int REMOVE_ITEM = 1; + static const int LEAVE_ITEM = 2; + +public: + static const int FACING_MASK = 0x7; + +protected: + Random *random; + + Icon *iconTop; + Icon *iconFront; + Icon *iconFrontVertical; + +protected: + DispenserTile(int id); + +public: + virtual int getTickDelay(); + virtual int getResource(int data, Random *random, int playerBonusLevel); + virtual void onPlace(Level *level, int x, int y, int z); + +private: + void recalcLockDir(Level *level, int x, int y, int z); + +public: + virtual Icon *getTexture(int face, int data); + //@Override + void registerIcons(IconRegister *iconRegister); + virtual bool TestUse(); + virtual bool use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + +private: + void fireArrow(Level *level, int x, int y, int z, Random *random); + +public: + virtual void neighborChanged(Level *level, int x, int y, int z, int type); + virtual void tick(Level *level, int x, int y, int z, Random *random); + virtual shared_ptr<TileEntity> newTileEntity(Level *level); + virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr<Mob> by); + virtual void onRemove(Level *level, int x, int y, int z, int id, int data); + +private: + static void throwItem(Level *level, shared_ptr<ItemInstance> item, Random *random, int accuracy, int xd, int zd, double xp, double yp, double zp); + static int dispenseItem(shared_ptr<DispenserTileEntity> trap, Level *level, shared_ptr<ItemInstance> item, Random *random, int x, int y, int z, int xd, int zd, double xp, double yp, double zp); +};
\ No newline at end of file |
