1
0
mirror of https://github.com/p2r3/bareiron.git synced 2025-10-02 07:35:08 +02:00

rewrite sand ticking

This commit is contained in:
2025-09-27 20:29:10 +02:00
parent ae6aaf3925
commit ede77674d3
3 changed files with 109 additions and 46 deletions

View File

@@ -199,11 +199,20 @@ typedef struct {
uint8_t block;
} BlockChange;
#define UPDATE_BASIC (1 << 0)
// the sand at this position will be moved down immediately when this is processed
#define UPDATE_FALL_SAND (1 << 1)
// the sand below this block will fall soon
#define UPDATE_CHECK_SAND_FALL (1 << 2)
#define UPDATE_NOW (UPDATE_BASIC | UPDATE_CHECK_SAND_FALL)
typedef struct {
short update_kind;
short x;
short z;
uint8_t y;
uint8_t awaitTicks;
uint8_t await_ticks;
} DeferredBlockUpdate;
#pragma pack(push, 1)

View File

@@ -32,6 +32,7 @@ uint8_t makeBlockChange (short x, uint8_t y, short z, uint8_t block);
uint8_t isInstantlyMined (PlayerData *player, uint8_t block);
uint8_t isColumnBlock (uint8_t block);
uint8_t isFallingBlock (uint8_t block);
uint8_t isPassableBlock (uint8_t block);
uint8_t isPassableSpawnBlock (uint8_t block);
uint8_t isReplaceableBlock (uint8_t block);
@@ -43,9 +44,10 @@ void bumpToolDurability (PlayerData *player);
void handlePlayerAction (PlayerData *player, int action, short x, short y, short z);
void handlePlayerUseItem (PlayerData *player, short x, short y, short z, uint8_t face);
void checkFluidUpdate (short x, uint8_t y, short z, uint8_t block);
void processBlockUpdate (short x, uint8_t y, short z, uint8_t block);
void deferBlockUpdate (short x, uint8_t y, short z, uint8_t awaitTicks);
void processBlockUpdate (short x, uint8_t y, short z, uint8_t block, short update_kind);
void updateXZNeighbors (short x, uint8_t y, short z, short update_kind);
void updateXYZNeighbors (short x, uint8_t y, short z, short update_kind);
void deferBlockUpdate (short x, uint8_t y, short z, uint8_t await_ticks, short update_kind);
void spawnMob (uint8_t type, short x, uint8_t y, short z, uint8_t health);
void interactEntity (int entity_id, int interactor_id);