mirror of https://github.com/basinserver/basin/
Made header indentation persistent.
This commit is contained in:
parent
09a01a67b0
commit
f9e586a2f4
|
@ -0,0 +1,3 @@
|
|||
[Dolphin]
|
||||
Timestamp=2019,5,1,13,2,13
|
||||
Version=4
|
|
@ -7,35 +7,35 @@
|
|||
#include <stdint.h>
|
||||
|
||||
struct ai_attackmelee_data {
|
||||
int32_t delayCounter;
|
||||
double targetX;
|
||||
double targetY;
|
||||
double targetZ;
|
||||
int32_t attackInterval;
|
||||
double speed;
|
||||
int32_t attackTick;
|
||||
uint8_t longMemory;
|
||||
int32_t delayCounter;
|
||||
double targetX;
|
||||
double targetY;
|
||||
double targetZ;
|
||||
int32_t attackInterval;
|
||||
double speed;
|
||||
int32_t attackTick;
|
||||
uint8_t longMemory;
|
||||
};
|
||||
|
||||
struct ai_nearestattackabletarget_data {
|
||||
int32_t type;
|
||||
int32_t chance;
|
||||
uint8_t checkSight;
|
||||
int32_t targetSearchDelay;
|
||||
int32_t unseenTicks;
|
||||
double targetDist;
|
||||
int32_t type;
|
||||
int32_t chance;
|
||||
uint8_t checkSight;
|
||||
int32_t targetSearchDelay;
|
||||
int32_t unseenTicks;
|
||||
double targetDist;
|
||||
};
|
||||
|
||||
void initai_zombie(struct world* world, struct entity* entity);
|
||||
|
||||
struct aitask {
|
||||
int32_t (*ai_tick)(struct world* world, struct entity* entity, struct aitask* ai);
|
||||
int (*ai_should)(struct world* world, struct entity* entity, struct aitask* ai);
|
||||
void (*ai_cancel)(struct world* world, struct entity* entity, struct aitask* ai);
|
||||
uint8_t ai_running;
|
||||
int32_t ai_waiting;
|
||||
uint16_t mutex;
|
||||
void* data;
|
||||
int32_t (*ai_tick)(struct world* world, struct entity* entity, struct aitask* ai);
|
||||
int (*ai_should)(struct world* world, struct entity* entity, struct aitask* ai);
|
||||
void (*ai_cancel)(struct world* world, struct entity* entity, struct aitask* ai);
|
||||
uint8_t ai_running;
|
||||
int32_t ai_waiting;
|
||||
uint16_t mutex;
|
||||
void* data;
|
||||
};
|
||||
|
||||
void ai_stdcancel(struct world* world, struct entity* entity, struct aitask* ai);
|
||||
|
@ -61,23 +61,23 @@ struct aitask* ai_initTask(struct entity* entity, uint16_t mutex, int32_t (*ai_t
|
|||
#define AIPATH_DOOR_IRON_CLOSED -1.0
|
||||
|
||||
struct aipath_point {
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t z;
|
||||
int32_t index;
|
||||
float total_dist;
|
||||
float next_dist;
|
||||
float target_dist;
|
||||
struct aipath_point* previous;
|
||||
float cost;
|
||||
uint8_t visited;
|
||||
float priority;
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t z;
|
||||
int32_t index;
|
||||
float total_dist;
|
||||
float next_dist;
|
||||
float target_dist;
|
||||
struct aipath_point* previous;
|
||||
float cost;
|
||||
uint8_t visited;
|
||||
float priority;
|
||||
};
|
||||
|
||||
struct aipath {
|
||||
struct aipath_point** points;
|
||||
size_t points_size;
|
||||
size_t points_count;
|
||||
struct aipath_point** points;
|
||||
size_t points_size;
|
||||
size_t points_count;
|
||||
};
|
||||
|
||||
struct aipath* findPath(int32_t sx, int32_t sy, int32_t sz, int32_t ex, int32_t ey, int32_t ez);
|
||||
|
@ -85,14 +85,14 @@ struct aipath* findPath(int32_t sx, int32_t sy, int32_t sz, int32_t ex, int32_t
|
|||
void freePath(struct aipath* path);
|
||||
|
||||
struct aicontext {
|
||||
struct hashmap* tasks;
|
||||
uint32_t ai_waiting;
|
||||
uint16_t mutex;
|
||||
double lookHelper_x;
|
||||
double lookHelper_y;
|
||||
double lookHelper_z;
|
||||
float lookHelper_speedYaw; // 0. to disable.
|
||||
float lookHelper_speedPitch; // 0. to disable.
|
||||
struct hashmap* tasks;
|
||||
uint32_t ai_waiting;
|
||||
uint16_t mutex;
|
||||
double lookHelper_x;
|
||||
double lookHelper_y;
|
||||
double lookHelper_z;
|
||||
float lookHelper_speedYaw; // 0. to disable.
|
||||
float lookHelper_speedPitch; // 0. to disable.
|
||||
};
|
||||
|
||||
void lookHelper_tick(struct entity* entity);
|
||||
|
|
|
@ -495,17 +495,17 @@ typedef uint16_t block;
|
|||
#define BLK_STRUCTUREBLOCK 4080
|
||||
|
||||
struct block_material {
|
||||
char* name;
|
||||
uint8_t flammable;
|
||||
uint8_t replacable;
|
||||
uint8_t requiresnotool;
|
||||
uint8_t mobility;
|
||||
uint8_t adventure_exempt;
|
||||
uint8_t liquid;
|
||||
uint8_t solid;
|
||||
uint8_t blocksLight;
|
||||
uint8_t blocksMovement;
|
||||
uint8_t opaque;
|
||||
char* name;
|
||||
uint8_t flammable;
|
||||
uint8_t replacable;
|
||||
uint8_t requiresnotool;
|
||||
uint8_t mobility;
|
||||
uint8_t adventure_exempt;
|
||||
uint8_t liquid;
|
||||
uint8_t solid;
|
||||
uint8_t blocksLight;
|
||||
uint8_t blocksMovement;
|
||||
uint8_t opaque;
|
||||
};
|
||||
|
||||
struct block_material* getBlockMaterial(char* name);
|
||||
|
@ -519,31 +519,31 @@ uint8_t getFaceFromPlayer(struct player* player);
|
|||
item getItemFromName(const char* name);
|
||||
|
||||
struct block_info {
|
||||
int (*onBlockDestroyed)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, block replacedBy);
|
||||
int (*onBlockDestroyedPlayer)(struct player* player, struct world* world, block blk, int32_t x, int32_t y, int32_t z);
|
||||
block (*onBlockPlaced)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, block replaced);
|
||||
block (*onBlockPlacedPlayer)(struct player* player, struct world* world, block blk, int32_t x, int32_t y, int32_t z, uint8_t face);
|
||||
void (*onBlockInteract)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, struct player* player, uint8_t face, float curPosX, float curPosY, float curPosZ);
|
||||
void (*onBlockCollide)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, struct entity* entity);
|
||||
void (*onBlockUpdate)(struct world* world, block blk, int32_t x, int32_t y, int32_t z);
|
||||
void (*dropItems)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, int fortune);
|
||||
int (*canBePlaced)(struct world* world, block blk, int32_t x, int32_t y, int32_t z);
|
||||
void (*randomTick)(struct world* world, struct chunk* ch, block blk, int32_t x, int32_t y, int32_t z);
|
||||
int (*scheduledTick)(struct world* world, block blk, int32_t x, int32_t y, int32_t z);
|
||||
struct boundingbox* boundingBoxes;
|
||||
size_t boundingBox_count;
|
||||
float hardness;
|
||||
struct block_material* material;
|
||||
float slipperiness;
|
||||
item drop;
|
||||
int16_t drop_damage;
|
||||
uint8_t drop_min;
|
||||
uint8_t drop_max;
|
||||
uint8_t fullCube;
|
||||
uint8_t canProvidePower;
|
||||
uint8_t lightOpacity;
|
||||
uint8_t lightEmission;
|
||||
float resistance;
|
||||
int (*onBlockDestroyed)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, block replacedBy);
|
||||
int (*onBlockDestroyedPlayer)(struct player* player, struct world* world, block blk, int32_t x, int32_t y, int32_t z);
|
||||
block (*onBlockPlaced)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, block replaced);
|
||||
block (*onBlockPlacedPlayer)(struct player* player, struct world* world, block blk, int32_t x, int32_t y, int32_t z, uint8_t face);
|
||||
void (*onBlockInteract)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, struct player* player, uint8_t face, float curPosX, float curPosY, float curPosZ);
|
||||
void (*onBlockCollide)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, struct entity* entity);
|
||||
void (*onBlockUpdate)(struct world* world, block blk, int32_t x, int32_t y, int32_t z);
|
||||
void (*dropItems)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, int fortune);
|
||||
int (*canBePlaced)(struct world* world, block blk, int32_t x, int32_t y, int32_t z);
|
||||
void (*randomTick)(struct world* world, struct chunk* ch, block blk, int32_t x, int32_t y, int32_t z);
|
||||
int (*scheduledTick)(struct world* world, block blk, int32_t x, int32_t y, int32_t z);
|
||||
struct boundingbox* boundingBoxes;
|
||||
size_t boundingBox_count;
|
||||
float hardness;
|
||||
struct block_material* material;
|
||||
float slipperiness;
|
||||
item drop;
|
||||
int16_t drop_damage;
|
||||
uint8_t drop_min;
|
||||
uint8_t drop_max;
|
||||
uint8_t fullCube;
|
||||
uint8_t canProvidePower;
|
||||
uint8_t lightOpacity;
|
||||
uint8_t lightEmission;
|
||||
float resistance;
|
||||
};
|
||||
|
||||
int falling_canFallThrough(block b);
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
struct list* crafting_recipies;
|
||||
|
||||
struct crafting_recipe {
|
||||
struct slot* slot[9];
|
||||
struct slot output;
|
||||
uint8_t shapeless;
|
||||
uint8_t width;
|
||||
struct slot* slot[9];
|
||||
struct slot output;
|
||||
uint8_t shapeless;
|
||||
uint8_t width;
|
||||
};
|
||||
|
||||
void crafting_init();
|
||||
|
|
|
@ -126,32 +126,32 @@
|
|||
#define POT_UNLUCK 27
|
||||
|
||||
struct entity_loot {
|
||||
item id;
|
||||
uint8_t amountMax;
|
||||
uint8_t amountMin;
|
||||
uint8_t metaMin;
|
||||
uint8_t metaMax;
|
||||
item id;
|
||||
uint8_t amountMax;
|
||||
uint8_t amountMin;
|
||||
uint8_t metaMin;
|
||||
uint8_t metaMax;
|
||||
};
|
||||
|
||||
struct entity_info {
|
||||
char* name;
|
||||
float maxHealth;
|
||||
float width;
|
||||
float height;
|
||||
char** flags;
|
||||
size_t flag_count;
|
||||
uint32_t spawn_packet;
|
||||
int32_t spawn_packet_id;
|
||||
struct entity_loot* loots;
|
||||
size_t loot_count;
|
||||
char* dataname;
|
||||
void (*onDeath)(struct world* world, struct entity* entity, struct entity* causer); // causer may be NULL
|
||||
void (*onAttacked)(struct world* world, struct entity* entity, struct entity* attacker); // attacker may be NULL
|
||||
uint32_t (*onAITick)(struct world* world, struct entity* entity); // returns a tick delay before next AI tick, 0 = never tick again, 1 = 1 tick
|
||||
int (*onTick)(struct world* world, struct entity* entity); // if return != 0, then the tick is cancelled (for when the entity has been despawned)
|
||||
uint32_t (*initAI)(struct world* world, struct entity* entity); // returns a tick delay before next AI tick, 0 = never tick again, 1 = 1 tick
|
||||
void (*onSpawned)(struct world* world, struct entity* entity);
|
||||
void (*onInteract)(struct world* world, struct entity* entity, struct player* interacter, struct slot* item, int16_t slot_index);
|
||||
char* name;
|
||||
float maxHealth;
|
||||
float width;
|
||||
float height;
|
||||
char** flags;
|
||||
size_t flag_count;
|
||||
uint32_t spawn_packet;
|
||||
int32_t spawn_packet_id;
|
||||
struct entity_loot* loots;
|
||||
size_t loot_count;
|
||||
char* dataname;
|
||||
void (*onDeath)(struct world* world, struct entity* entity, struct entity* causer); // causer may be NULL
|
||||
void (*onAttacked)(struct world* world, struct entity* entity, struct entity* attacker); // attacker may be NULL
|
||||
uint32_t (*onAITick)(struct world* world, struct entity* entity); // returns a tick delay before next AI tick, 0 = never tick again, 1 = 1 tick
|
||||
int (*onTick)(struct world* world, struct entity* entity); // if return != 0, then the tick is cancelled (for when the entity has been despawned)
|
||||
uint32_t (*initAI)(struct world* world, struct entity* entity); // returns a tick delay before next AI tick, 0 = never tick again, 1 = 1 tick
|
||||
void (*onSpawned)(struct world* world, struct entity* entity);
|
||||
void (*onInteract)(struct world* world, struct entity* entity, struct player* interacter, struct slot* item, int16_t slot_index);
|
||||
};
|
||||
|
||||
void swingArm(struct entity* entity);
|
||||
|
@ -167,282 +167,282 @@ struct entity_info* getEntityInfo(uint32_t id);
|
|||
void add_entity_info(uint32_t eid, struct entity_info* bm);
|
||||
|
||||
struct potioneffect {
|
||||
char effectID;
|
||||
char amplifier;
|
||||
int32_t duration;
|
||||
char particles;
|
||||
char effectID;
|
||||
char amplifier;
|
||||
int32_t duration;
|
||||
char particles;
|
||||
};
|
||||
|
||||
int hasFlag(struct entity_info* ei, char* flag);
|
||||
|
||||
union entity_data {
|
||||
struct entity_player {
|
||||
struct player* player;
|
||||
} player;
|
||||
struct entity_creeper {
|
||||
struct entity_player {
|
||||
struct player* player;
|
||||
} player;
|
||||
struct entity_creeper {
|
||||
|
||||
} creeper;
|
||||
struct entity_skeleton {
|
||||
|
||||
} skeleton;
|
||||
struct entity_spider {
|
||||
|
||||
} spider;
|
||||
struct entity_giant {
|
||||
|
||||
} giant;
|
||||
struct entity_zombie {
|
||||
|
||||
} zombie;
|
||||
struct entity_slime {
|
||||
uint8_t size;
|
||||
} slime;
|
||||
struct entity_ghast {
|
||||
|
||||
} ghast;
|
||||
struct entity_zpigman {
|
||||
|
||||
} zpigman;
|
||||
struct entity_enderman {
|
||||
|
||||
} enderman;
|
||||
struct entity_cavespider {
|
||||
|
||||
} cavespider;
|
||||
struct entity_silverfish {
|
||||
|
||||
} silverfish;
|
||||
struct entity_blaze {
|
||||
|
||||
} creeper;
|
||||
struct entity_skeleton {
|
||||
} blaze;
|
||||
struct entity_magmacube {
|
||||
uint8_t size;
|
||||
} magmacube;
|
||||
struct entity_enderdragon {
|
||||
|
||||
} skeleton;
|
||||
struct entity_spider {
|
||||
} enderdragon;
|
||||
struct entity_wither {
|
||||
|
||||
} spider;
|
||||
struct entity_giant {
|
||||
} wither;
|
||||
struct entity_bat {
|
||||
|
||||
} giant;
|
||||
struct entity_zombie {
|
||||
} bat;
|
||||
struct entity_witch {
|
||||
|
||||
} zombie;
|
||||
struct entity_slime {
|
||||
uint8_t size;
|
||||
} slime;
|
||||
struct entity_ghast {
|
||||
} witch;
|
||||
struct entity_endermite {
|
||||
|
||||
} ghast;
|
||||
struct entity_zpigman {
|
||||
} endermite;
|
||||
struct entity_guardian {
|
||||
|
||||
} zpigman;
|
||||
struct entity_enderman {
|
||||
} guardian;
|
||||
struct entity_shulker {
|
||||
|
||||
} enderman;
|
||||
struct entity_cavespider {
|
||||
} shulker;
|
||||
struct entity_pig {
|
||||
|
||||
} cavespider;
|
||||
struct entity_silverfish {
|
||||
} pig;
|
||||
struct entity_sheep {
|
||||
|
||||
} silverfish;
|
||||
struct entity_blaze {
|
||||
} sheep;
|
||||
struct entity_cow {
|
||||
|
||||
} blaze;
|
||||
struct entity_magmacube {
|
||||
uint8_t size;
|
||||
} magmacube;
|
||||
struct entity_enderdragon {
|
||||
} cow;
|
||||
struct entity_chicken {
|
||||
|
||||
} enderdragon;
|
||||
struct entity_wither {
|
||||
} chicken;
|
||||
struct entity_squid {
|
||||
|
||||
} wither;
|
||||
struct entity_bat {
|
||||
} squid;
|
||||
struct entity_wolf {
|
||||
|
||||
} bat;
|
||||
struct entity_witch {
|
||||
} wolf;
|
||||
struct entity_mooshroom {
|
||||
|
||||
} witch;
|
||||
struct entity_endermite {
|
||||
} mooshroom;
|
||||
struct entity_snowman {
|
||||
|
||||
} endermite;
|
||||
struct entity_guardian {
|
||||
} snowman;
|
||||
struct entity_ocelot {
|
||||
|
||||
} guardian;
|
||||
struct entity_shulker {
|
||||
} ocelot;
|
||||
struct entity_irongolem {
|
||||
|
||||
} shulker;
|
||||
struct entity_pig {
|
||||
} irongolem;
|
||||
struct entity_horse {
|
||||
|
||||
} pig;
|
||||
struct entity_sheep {
|
||||
} horse;
|
||||
struct entity_rabbit {
|
||||
|
||||
} sheep;
|
||||
struct entity_cow {
|
||||
} rabbit;
|
||||
struct entity_villager {
|
||||
|
||||
} cow;
|
||||
struct entity_chicken {
|
||||
} villager;
|
||||
struct entity_boat {
|
||||
|
||||
} chicken;
|
||||
struct entity_squid {
|
||||
} boat;
|
||||
struct entity_itemstack {
|
||||
struct slot* slot;
|
||||
int16_t delayBeforeCanPickup;
|
||||
} itemstack;
|
||||
struct entity_areaeffect {
|
||||
|
||||
} squid;
|
||||
struct entity_wolf {
|
||||
} areaeffect;
|
||||
struct entity_minecart {
|
||||
|
||||
} wolf;
|
||||
struct entity_mooshroom {
|
||||
} minecart;
|
||||
struct entity_tnt {
|
||||
uint16_t fuse;
|
||||
} tnt;
|
||||
struct entity_endercrystal {
|
||||
|
||||
} mooshroom;
|
||||
struct entity_snowman {
|
||||
} endercrystal;
|
||||
struct entity_arrow {
|
||||
uint32_t ticksInGround;
|
||||
uint8_t isCritical;
|
||||
uint8_t pickupFlags;
|
||||
float damage;
|
||||
float knockback;
|
||||
} arrow;
|
||||
struct entity_snowball {
|
||||
|
||||
} snowman;
|
||||
struct entity_ocelot {
|
||||
} snowball;
|
||||
struct entity_egg {
|
||||
|
||||
} ocelot;
|
||||
struct entity_irongolem {
|
||||
} egg;
|
||||
struct entity_fireball {
|
||||
|
||||
} irongolem;
|
||||
struct entity_horse {
|
||||
} fireball;
|
||||
struct entity_firecharge {
|
||||
|
||||
} horse;
|
||||
struct entity_rabbit {
|
||||
} firecharge;
|
||||
struct entity_enderpearl {
|
||||
|
||||
} rabbit;
|
||||
struct entity_villager {
|
||||
} enderpearl;
|
||||
struct entity_witherskull {
|
||||
|
||||
} villager;
|
||||
struct entity_boat {
|
||||
} witherskull;
|
||||
struct entity_shulkerbullet {
|
||||
|
||||
} boat;
|
||||
struct entity_itemstack {
|
||||
struct slot* slot;
|
||||
int16_t delayBeforeCanPickup;
|
||||
} itemstack;
|
||||
struct entity_areaeffect {
|
||||
} shulkerbullet;
|
||||
struct entity_fallingblock {
|
||||
block b;
|
||||
} fallingblock;
|
||||
struct entity_itemframe {
|
||||
|
||||
} areaeffect;
|
||||
struct entity_minecart {
|
||||
} itemframe;
|
||||
struct entity_eyeender {
|
||||
|
||||
} minecart;
|
||||
struct entity_tnt {
|
||||
uint16_t fuse;
|
||||
} tnt;
|
||||
struct entity_endercrystal {
|
||||
} eyeender;
|
||||
struct entity_thrownpotion {
|
||||
|
||||
} endercrystal;
|
||||
struct entity_arrow {
|
||||
uint32_t ticksInGround;
|
||||
uint8_t isCritical;
|
||||
uint8_t pickupFlags;
|
||||
float damage;
|
||||
float knockback;
|
||||
} arrow;
|
||||
struct entity_snowball {
|
||||
} thrownpotion;
|
||||
struct entity_husk {
|
||||
|
||||
} snowball;
|
||||
struct entity_egg {
|
||||
} husk;
|
||||
struct entity_fallingegg {
|
||||
|
||||
} egg;
|
||||
struct entity_fireball {
|
||||
} fallingegg;
|
||||
struct entity_expbottle {
|
||||
|
||||
} fireball;
|
||||
struct entity_firecharge {
|
||||
} expbottle;
|
||||
struct entity_firework {
|
||||
|
||||
} firecharge;
|
||||
struct entity_enderpearl {
|
||||
} firework;
|
||||
struct entity_leashknot {
|
||||
|
||||
} enderpearl;
|
||||
struct entity_witherskull {
|
||||
} leashknot;
|
||||
struct entity_armorstand {
|
||||
|
||||
} witherskull;
|
||||
struct entity_shulkerbullet {
|
||||
} armorstand;
|
||||
struct entity_fishingfloat {
|
||||
|
||||
} shulkerbullet;
|
||||
struct entity_fallingblock {
|
||||
block b;
|
||||
} fallingblock;
|
||||
struct entity_itemframe {
|
||||
} fishingfloat;
|
||||
struct entity_evocationfangs {
|
||||
|
||||
} itemframe;
|
||||
struct entity_eyeender {
|
||||
} evocationfangs;
|
||||
struct entity_elderguardian {
|
||||
|
||||
} eyeender;
|
||||
struct entity_thrownpotion {
|
||||
} elderguardian;
|
||||
struct entity_dragonfireball {
|
||||
|
||||
} thrownpotion;
|
||||
struct entity_husk {
|
||||
} dragonfireball;
|
||||
struct entity_experienceorb {
|
||||
uint16_t count;
|
||||
} experienceorb;
|
||||
struct entity_polarbear {
|
||||
|
||||
} husk;
|
||||
struct entity_fallingegg {
|
||||
} polarbear;
|
||||
struct entity_llama {
|
||||
|
||||
} fallingegg;
|
||||
struct entity_expbottle {
|
||||
} llama;
|
||||
struct entity_llamaspit {
|
||||
|
||||
} expbottle;
|
||||
struct entity_firework {
|
||||
} llamaspit;
|
||||
struct entity_stray {
|
||||
|
||||
} firework;
|
||||
struct entity_leashknot {
|
||||
} stray;
|
||||
struct entity_painting {
|
||||
char* title;
|
||||
uint8_t direction;
|
||||
} painting;
|
||||
struct entity_evocationillager {
|
||||
|
||||
} leashknot;
|
||||
struct entity_armorstand {
|
||||
} evocationillager;
|
||||
struct entity_vex {
|
||||
|
||||
} armorstand;
|
||||
struct entity_fishingfloat {
|
||||
} vex;
|
||||
struct entity_vindicationillager {
|
||||
|
||||
} fishingfloat;
|
||||
struct entity_evocationfangs {
|
||||
|
||||
} evocationfangs;
|
||||
struct entity_elderguardian {
|
||||
|
||||
} elderguardian;
|
||||
struct entity_dragonfireball {
|
||||
|
||||
} dragonfireball;
|
||||
struct entity_experienceorb {
|
||||
uint16_t count;
|
||||
} experienceorb;
|
||||
struct entity_polarbear {
|
||||
|
||||
} polarbear;
|
||||
struct entity_llama {
|
||||
|
||||
} llama;
|
||||
struct entity_llamaspit {
|
||||
|
||||
} llamaspit;
|
||||
struct entity_stray {
|
||||
|
||||
} stray;
|
||||
struct entity_painting {
|
||||
char* title;
|
||||
uint8_t direction;
|
||||
} painting;
|
||||
struct entity_evocationillager {
|
||||
|
||||
} evocationillager;
|
||||
struct entity_vex {
|
||||
|
||||
} vex;
|
||||
struct entity_vindicationillager {
|
||||
|
||||
} vindicationillager;
|
||||
} vindicationillager;
|
||||
};
|
||||
|
||||
struct entity {
|
||||
struct mempool* pool;
|
||||
int32_t id;
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
double last_x;
|
||||
double last_y;
|
||||
double last_z;
|
||||
uint32_t type;
|
||||
float yaw;
|
||||
float pitch;
|
||||
float last_yaw;
|
||||
float last_pitch;
|
||||
float headpitch;
|
||||
int on_ground;
|
||||
int collidedVertically;
|
||||
int collidedHorizontally;
|
||||
double motX;
|
||||
double motY;
|
||||
double motZ;
|
||||
float health;
|
||||
float maxHealth;
|
||||
int32_t objectData;
|
||||
int markedKill;
|
||||
struct potioneffect* effects;
|
||||
size_t effect_count;
|
||||
int sneaking;
|
||||
int usingItemMain;
|
||||
int usingItemOff;
|
||||
int sprinting;
|
||||
int portalCooldown;
|
||||
size_t ticksExisted;
|
||||
int32_t subtype;
|
||||
float fallDistance;
|
||||
union entity_data data;
|
||||
struct world* world;
|
||||
struct hashmap* loadingPlayers;
|
||||
uint64_t age;
|
||||
uint8_t invincibilityTicks;
|
||||
uint8_t inWater;
|
||||
uint8_t inLava;
|
||||
uint8_t immovable;
|
||||
struct aicontext* ai;
|
||||
struct entity* attacking;
|
||||
struct hashmap* attackers;
|
||||
struct mempool* pool;
|
||||
int32_t id;
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
double last_x;
|
||||
double last_y;
|
||||
double last_z;
|
||||
uint32_t type;
|
||||
float yaw;
|
||||
float pitch;
|
||||
float last_yaw;
|
||||
float last_pitch;
|
||||
float headpitch;
|
||||
int on_ground;
|
||||
int collidedVertically;
|
||||
int collidedHorizontally;
|
||||
double motX;
|
||||
double motY;
|
||||
double motZ;
|
||||
float health;
|
||||
float maxHealth;
|
||||
int32_t objectData;
|
||||
int markedKill;
|
||||
struct potioneffect* effects;
|
||||
size_t effect_count;
|
||||
int sneaking;
|
||||
int usingItemMain;
|
||||
int usingItemOff;
|
||||
int sprinting;
|
||||
int portalCooldown;
|
||||
size_t ticksExisted;
|
||||
int32_t subtype;
|
||||
float fallDistance;
|
||||
union entity_data data;
|
||||
struct world* world;
|
||||
struct hashmap* loadingPlayers;
|
||||
uint64_t age;
|
||||
uint8_t invincibilityTicks;
|
||||
uint8_t inWater;
|
||||
uint8_t inLava;
|
||||
uint8_t immovable;
|
||||
struct aicontext* ai;
|
||||
struct entity* attacking;
|
||||
struct hashmap* attackers;
|
||||
};
|
||||
|
||||
int damageEntityWithItem(struct entity* attacked, struct entity* attacker, uint8_t slot_index, struct slot* item);
|
||||
|
|
|
@ -245,30 +245,30 @@ void offsetCoordByFace(int32_t* x, int32_t* y, int32_t* z, uint8_t face);
|
|||
#define ARMOR_BOOTS 4
|
||||
|
||||
struct itemfood_arg {
|
||||
uint8_t food;
|
||||
uint8_t alwaysEat;
|
||||
float saturation;
|
||||
uint8_t food;
|
||||
uint8_t alwaysEat;
|
||||
float saturation;
|
||||
};
|
||||
|
||||
struct item_info {
|
||||
struct tool_info* toolType;
|
||||
uint8_t maxStackSize;
|
||||
int16_t maxDamage;
|
||||
uint32_t maxUseDuration;
|
||||
uint8_t armor;
|
||||
uint8_t armorType;
|
||||
float damage;
|
||||
float attackSpeed;
|
||||
float toolProficiency;
|
||||
uint8_t harvestLevel;
|
||||
int (*canUseItem)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot);
|
||||
void (*onItemUseTick)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, int32_t ticksElapsed); // not in-world usage, nor called on last tick. ticksElapsed==0 on start., -1 on cancel
|
||||
void (*onItemUse)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, uint32_t ticks); // not in-world usage, when called with long use items, full duration not guaranteed
|
||||
int (*onItemInteract)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, int32_t x, int32_t y, int32_t z, uint8_t face, float cx, float cy, float cz); // in-world usage, called after onItemUse
|
||||
int (*onItemBreakBlock)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, int32_t x, int32_t y, int32_t z); // in-world usage
|
||||
float (*onItemAttacked)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, struct entity* entity); // entity may be NULL
|
||||
float (*onEntityHitWhileWearing)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, float damage); // only called for armor/shields
|
||||
void* callback_arg;
|
||||
struct tool_info* toolType;
|
||||
uint8_t maxStackSize;
|
||||
int16_t maxDamage;
|
||||
uint32_t maxUseDuration;
|
||||
uint8_t armor;
|
||||
uint8_t armorType;
|
||||
float damage;
|
||||
float attackSpeed;
|
||||
float toolProficiency;
|
||||
uint8_t harvestLevel;
|
||||
int (*canUseItem)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot);
|
||||
void (*onItemUseTick)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, int32_t ticksElapsed); // not in-world usage, nor called on last tick. ticksElapsed==0 on start., -1 on cancel
|
||||
void (*onItemUse)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, uint32_t ticks); // not in-world usage, when called with long use items, full duration not guaranteed
|
||||
int (*onItemInteract)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, int32_t x, int32_t y, int32_t z, uint8_t face, float cx, float cy, float cz); // in-world usage, called after onItemUse
|
||||
int (*onItemBreakBlock)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, int32_t x, int32_t y, int32_t z); // in-world usage
|
||||
float (*onItemAttacked)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, struct entity* entity); // entity may be NULL
|
||||
float (*onEntityHitWhileWearing)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, float damage); // only called for armor/shields
|
||||
void* callback_arg;
|
||||
};
|
||||
|
||||
struct item_info* getItemInfo(item id);
|
||||
|
|
|
@ -28,38 +28,38 @@
|
|||
#define NBT_TAG_LONGARRAY 12
|
||||
|
||||
union nbt_data {
|
||||
signed char nbt_byte;
|
||||
int16_t nbt_short;
|
||||
int32_t nbt_int;
|
||||
int64_t nbt_long;
|
||||
float nbt_float;
|
||||
double nbt_double;
|
||||
struct {
|
||||
int32_t len;
|
||||
unsigned char* data;
|
||||
} nbt_bytearray;
|
||||
char* nbt_string;
|
||||
struct {
|
||||
unsigned char type;
|
||||
int32_t count;
|
||||
} nbt_list;
|
||||
struct {
|
||||
int32_t count;
|
||||
int32_t* ints;
|
||||
} nbt_intarray;
|
||||
struct {
|
||||
int32_t count;
|
||||
int64_t* longs;
|
||||
} nbt_longarray;
|
||||
signed char nbt_byte;
|
||||
int16_t nbt_short;
|
||||
int32_t nbt_int;
|
||||
int64_t nbt_long;
|
||||
float nbt_float;
|
||||
double nbt_double;
|
||||
struct {
|
||||
int32_t len;
|
||||
unsigned char* data;
|
||||
} nbt_bytearray;
|
||||
char* nbt_string;
|
||||
struct {
|
||||
unsigned char type;
|
||||
int32_t count;
|
||||
} nbt_list;
|
||||
struct {
|
||||
int32_t count;
|
||||
int32_t* ints;
|
||||
} nbt_intarray;
|
||||
struct {
|
||||
int32_t count;
|
||||
int64_t* longs;
|
||||
} nbt_longarray;
|
||||
};
|
||||
|
||||
struct nbt_tag {
|
||||
unsigned char id;
|
||||
char* name;
|
||||
struct hashmap* children;
|
||||
struct llist* children_list;
|
||||
union nbt_data data;
|
||||
struct mempool* pool;
|
||||
unsigned char id;
|
||||
char* name;
|
||||
struct hashmap* children;
|
||||
struct llist* children_list;
|
||||
union nbt_data data;
|
||||
struct mempool* pool;
|
||||
};
|
||||
|
||||
ssize_t nbt_decompress(struct mempool* pool, void* data, size_t size, void** dest);
|
||||
|
|
|
@ -15,19 +15,19 @@
|
|||
struct packet;
|
||||
|
||||
struct __attribute__((__packed__)) encpos {
|
||||
int32_t z :26;
|
||||
int32_t y :12;
|
||||
int32_t x :26;
|
||||
int32_t z :26;
|
||||
int32_t y :12;
|
||||
int32_t x :26;
|
||||
};
|
||||
|
||||
struct __attribute__((__packed__)) uuid {
|
||||
uint64_t uuid1;
|
||||
uint64_t uuid2;
|
||||
uint64_t uuid1;
|
||||
uint64_t uuid2;
|
||||
};
|
||||
|
||||
struct entity_metadata {
|
||||
uint8_t* metadata;
|
||||
size_t metadata_size;
|
||||
uint8_t* metadata;
|
||||
size_t metadata_size;
|
||||
};
|
||||
|
||||
RSA* public_rsa;
|
||||
|
@ -60,17 +60,17 @@ int writeSlot(struct slot* slot, unsigned char* buffer, size_t buflen);
|
|||
|
||||
int writeVarInt_stream(int32_t input,
|
||||
#ifdef __MINGW32__
|
||||
SOCKET
|
||||
SOCKET
|
||||
#else
|
||||
int
|
||||
int
|
||||
#endif
|
||||
fd);
|
||||
fd);
|
||||
|
||||
int readVarInt_stream(int32_t* output,
|
||||
#ifdef __MINGW32__
|
||||
SOCKET
|
||||
SOCKET
|
||||
#else
|
||||
int
|
||||
int
|
||||
#endif
|
||||
fd);
|
||||
fd);
|
||||
#endif /* NETWORK_H_ */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,8 +4,8 @@
|
|||
#include <stdint.h>
|
||||
|
||||
struct perlin {
|
||||
uint8_t perm[256];
|
||||
uint8_t perm2[512];
|
||||
uint8_t perm[256];
|
||||
uint8_t perm2[512];
|
||||
};
|
||||
|
||||
uint64_t perlin_rand(uint64_t seed);
|
||||
|
|
|
@ -13,57 +13,57 @@
|
|||
#include <avuna/pmem.h>
|
||||
|
||||
struct player {
|
||||
struct mempool* pool;
|
||||
struct server* server;
|
||||
struct conn* conn;
|
||||
struct world* world;
|
||||
struct entity* entity;
|
||||
struct mempool* pool;
|
||||
struct server* server;
|
||||
struct conn* conn;
|
||||
struct world* world;
|
||||
struct entity* entity;
|
||||
|
||||
char* name;
|
||||
struct uuid uuid;
|
||||
char* name;
|
||||
struct uuid uuid;
|
||||
|
||||
struct hashmap* loaded_chunks;
|
||||
struct hashmap* loaded_entities;
|
||||
struct queue* outgoing_packets;
|
||||
struct queue* incoming_packets;
|
||||
uint32_t next_keep_alive;
|
||||
uint8_t spawned_in;
|
||||
struct hashmap* loaded_chunks;
|
||||
struct hashmap* loaded_entities;
|
||||
struct queue* outgoing_packets;
|
||||
struct queue* incoming_packets;
|
||||
uint32_t next_keep_alive;
|
||||
uint8_t spawned_in;
|
||||
|
||||
struct inventory* inventory;
|
||||
struct inventory* open_inventory;
|
||||
struct slot* inventory_holding;
|
||||
struct inventory* inventory;
|
||||
struct inventory* open_inventory;
|
||||
struct slot* inventory_holding;
|
||||
|
||||
uint16_t currentItem;
|
||||
uint8_t gamemode;
|
||||
float reachDistance;
|
||||
uint8_t invulnerable;
|
||||
uint16_t currentItem;
|
||||
uint8_t gamemode;
|
||||
float reachDistance;
|
||||
uint8_t invulnerable;
|
||||
|
||||
uint8_t ping;
|
||||
float walkSpeed;
|
||||
float flySpeed;
|
||||
uint8_t flying;
|
||||
int32_t xpseed;
|
||||
int32_t xptotal;
|
||||
int32_t xplevel;
|
||||
int32_t score;
|
||||
size_t last_teleport_id;
|
||||
int8_t sleeping;
|
||||
int16_t fire;
|
||||
//TODO: enderitems inventory
|
||||
uint8_t ping;
|
||||
float walkSpeed;
|
||||
float flySpeed;
|
||||
uint8_t flying;
|
||||
int32_t xpseed;
|
||||
int32_t xptotal;
|
||||
int32_t xplevel;
|
||||
int32_t score;
|
||||
size_t last_teleport_id;
|
||||
int8_t sleeping;
|
||||
int16_t fire;
|
||||
//TODO: enderitems inventory
|
||||
|
||||
struct encpos digging_position;
|
||||
float digging;
|
||||
float digspeed;
|
||||
struct encpos digging_position;
|
||||
float digging;
|
||||
float digspeed;
|
||||
|
||||
uint32_t itemUseDuration;
|
||||
uint8_t itemUseHand;
|
||||
size_t lastSwing;
|
||||
uint32_t itemUseDuration;
|
||||
uint8_t itemUseHand;
|
||||
size_t lastSwing;
|
||||
|
||||
int32_t food;
|
||||
int32_t foodTick;
|
||||
uint8_t foodTimer;
|
||||
float foodExhaustion;
|
||||
float saturation;
|
||||
int32_t food;
|
||||
int32_t foodTick;
|
||||
uint8_t foodTimer;
|
||||
float foodExhaustion;
|
||||
float saturation;
|
||||
};
|
||||
|
||||
struct player* player_new(struct mempool* parent, struct server* server, struct conn* conn, struct world* world, struct entity* entity, char* name, struct uuid uuid, uint8_t gamemode);
|
||||
|
|
|
@ -21,42 +21,42 @@ struct hashmap* plugins;
|
|||
#define PLUGIN_LUA 2
|
||||
|
||||
struct plugin {
|
||||
void* hnd;
|
||||
char* filename;
|
||||
void (*onWorldLoad)(struct world* world); // called at the end of loaded world
|
||||
void (*tick_global)(); // called in global tick thread
|
||||
void (*tick_world)(struct world* world); // called in the world tick thread first
|
||||
void (*tick_player)(struct world* world, struct player* player); // called at the start of a player's tick after defunct checks.
|
||||
void (*tick_entity)(struct world* world, struct entity* entity); // called at the start of an entities tick in the world thread
|
||||
void (*tick_chunk)(struct world* world, struct chunk* chunk); // called at the start of a chunks tick in the world thread
|
||||
void (*onConnect)(struct conn* conn); // called upon player connect, set conn->disconnect to disconnect.
|
||||
void (*onDisconnect)(struct conn* conn); // called upon player disconnect but before the player is defunct.
|
||||
int (*onBlockDestroyed)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, block replacedBy); // called before a block is destroyed.
|
||||
int (*onBlockDestroyedPlayer)(struct player* player, struct world* world, block blk, int32_t x, int32_t y, int32_t z); // called before a block is destroyed.
|
||||
block (*onBlockPlaced)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, block replaced); // called when a block is placed. no block is placed if return = 0
|
||||
block (*onBlockPlacedPlayer)(struct player* player, struct world* world, block blk, int32_t x, int32_t y, int32_t z, uint8_t face); // called when a block is placed. no block is placed if return = 0
|
||||
void (*onBlockInteract)(struct player* player, struct world* world, block blk, int32_t x, int32_t y, int32_t z, uint8_t face, float curPosX, float curPosY, float curPosZ); // called when a player interacts with a block.
|
||||
void (*onBlockCollide)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, struct entity* entity); // called when an entity collides with a block.
|
||||
void (*onItemUse)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, uint16_t ticks); // called during an items usage, ticks = 0 for start.
|
||||
int (*onItemInteract)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, int32_t x, uint8_t y, int32_t z, uint8_t face); // called when a player right clicks on a block
|
||||
int (*onPlayerBreakBlock)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, int32_t x, uint8_t y, int32_t z); // called when a player breaks a block, set return to cancel tile break.
|
||||
float (*onEntityAttacked)(struct world* world, struct entity* attacker, uint8_t slot_index, struct slot* slot, struct entity* attacked, float damage); // called when a player attacks an entity return = damage, 0 for cancel.
|
||||
float (*onEntityDamaged)(struct world* world, struct entity* entity, float damage); // called when any entity is damaged for any reason.
|
||||
int (*onInventoryUpdate)(struct world* world, struct player* player, struct inventory* inventory, int16_t slot, struct slot* item);
|
||||
int (*onPacketReceive)(int state, struct conn* conn, struct packet* packet); // UNSAFE! breaks protocol intercompatibilty - check conn->protocol_version setting return = drop packet
|
||||
int (*onPacketSend)(int state, struct conn* conn, struct packet* packet); // UNSAFE! breaks protocol intercompatibilty - check conn->protocol_version setting return = drop packet
|
||||
void (*onEntitySpawn)(struct world* world, struct entity* entity); // called after an entity spawns
|
||||
void (*onPlayerSpawn)(struct world* world, struct player* player); // called after a player spawns
|
||||
void (*onPlayerFullySpawned)(struct world* world, struct player* player); // called after a player spawns and has moved
|
||||
int (*pre_chunk_unload)(struct world* world, struct chunk* chunk); // if 1 is returned, a chunk unload will be cancelled
|
||||
void (*post_chunk_unload)(struct world* world, int32_t x, int32_t y);
|
||||
struct chunk* (*pre_chunk_loaded)(struct world* world, int32_t x, int32_t y); // if set and returns a non-null valid chunk, will replace a loaded chunk before it is loaded
|
||||
struct chunk* (*post_chunk_loaded)(struct world* world, struct chunk* chunk); // if set and returns a non-null valid chunk, will replace a loaded chunk
|
||||
struct chunk* (*generateChunk)(struct world* world, struct chunk* chunk); // if set and returns a non-null valid chunk, will use it as a world generator
|
||||
uint8_t type;
|
||||
JavaVM* javaVM;
|
||||
JNIEnv* jniEnv;
|
||||
jclass mainClass;
|
||||
void* hnd;
|
||||
char* filename;
|
||||
void (*onWorldLoad)(struct world* world); // called at the end of loaded world
|
||||
void (*tick_global)(); // called in global tick thread
|
||||
void (*tick_world)(struct world* world); // called in the world tick thread first
|
||||
void (*tick_player)(struct world* world, struct player* player); // called at the start of a player's tick after defunct checks.
|
||||
void (*tick_entity)(struct world* world, struct entity* entity); // called at the start of an entities tick in the world thread
|
||||
void (*tick_chunk)(struct world* world, struct chunk* chunk); // called at the start of a chunks tick in the world thread
|
||||
void (*onConnect)(struct conn* conn); // called upon player connect, set conn->disconnect to disconnect.
|
||||
void (*onDisconnect)(struct conn* conn); // called upon player disconnect but before the player is defunct.
|
||||
int (*onBlockDestroyed)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, block replacedBy); // called before a block is destroyed.
|
||||
int (*onBlockDestroyedPlayer)(struct player* player, struct world* world, block blk, int32_t x, int32_t y, int32_t z); // called before a block is destroyed.
|
||||
block (*onBlockPlaced)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, block replaced); // called when a block is placed. no block is placed if return = 0
|
||||
block (*onBlockPlacedPlayer)(struct player* player, struct world* world, block blk, int32_t x, int32_t y, int32_t z, uint8_t face); // called when a block is placed. no block is placed if return = 0
|
||||
void (*onBlockInteract)(struct player* player, struct world* world, block blk, int32_t x, int32_t y, int32_t z, uint8_t face, float curPosX, float curPosY, float curPosZ); // called when a player interacts with a block.
|
||||
void (*onBlockCollide)(struct world* world, block blk, int32_t x, int32_t y, int32_t z, struct entity* entity); // called when an entity collides with a block.
|
||||
void (*onItemUse)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, uint16_t ticks); // called during an items usage, ticks = 0 for start.
|
||||
int (*onItemInteract)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, int32_t x, uint8_t y, int32_t z, uint8_t face); // called when a player right clicks on a block
|
||||
int (*onPlayerBreakBlock)(struct world* world, struct player* player, uint8_t slot_index, struct slot* slot, int32_t x, uint8_t y, int32_t z); // called when a player breaks a block, set return to cancel tile break.
|
||||
float (*onEntityAttacked)(struct world* world, struct entity* attacker, uint8_t slot_index, struct slot* slot, struct entity* attacked, float damage); // called when a player attacks an entity return = damage, 0 for cancel.
|
||||
float (*onEntityDamaged)(struct world* world, struct entity* entity, float damage); // called when any entity is damaged for any reason.
|
||||
int (*onInventoryUpdate)(struct world* world, struct player* player, struct inventory* inventory, int16_t slot, struct slot* item);
|
||||
int (*onPacketReceive)(int state, struct conn* conn, struct packet* packet); // UNSAFE! breaks protocol intercompatibilty - check conn->protocol_version setting return = drop packet
|
||||
int (*onPacketSend)(int state, struct conn* conn, struct packet* packet); // UNSAFE! breaks protocol intercompatibilty - check conn->protocol_version setting return = drop packet
|
||||
void (*onEntitySpawn)(struct world* world, struct entity* entity); // called after an entity spawns
|
||||
void (*onPlayerSpawn)(struct world* world, struct player* player); // called after a player spawns
|
||||
void (*onPlayerFullySpawned)(struct world* world, struct player* player); // called after a player spawns and has moved
|
||||
int (*pre_chunk_unload)(struct world* world, struct chunk* chunk); // if 1 is returned, a chunk unload will be cancelled
|
||||
void (*post_chunk_unload)(struct world* world, int32_t x, int32_t y);
|
||||
struct chunk* (*pre_chunk_loaded)(struct world* world, int32_t x, int32_t y); // if set and returns a non-null valid chunk, will replace a loaded chunk before it is loaded
|
||||
struct chunk* (*post_chunk_loaded)(struct world* world, struct chunk* chunk); // if set and returns a non-null valid chunk, will replace a loaded chunk
|
||||
struct chunk* (*generateChunk)(struct world* world, struct chunk* chunk); // if set and returns a non-null valid chunk, will use it as a world generator
|
||||
uint8_t type;
|
||||
JavaVM* javaVM;
|
||||
JNIEnv* jniEnv;
|
||||
jclass mainClass;
|
||||
};
|
||||
|
||||
void init_plugins();
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
#include <stdint.h>
|
||||
|
||||
struct smelting_fuel {
|
||||
int16_t id;
|
||||
int16_t damage;
|
||||
int16_t burn_time;
|
||||
int16_t id;
|
||||
int16_t damage;
|
||||
int16_t burn_time;
|
||||
};
|
||||
|
||||
struct smelting_recipe {
|
||||
struct slot input;
|
||||
struct slot output;
|
||||
struct slot input;
|
||||
struct slot output;
|
||||
};
|
||||
|
||||
int16_t smelting_burnTime(struct slot* slot);
|
||||
|
|
|
@ -30,9 +30,9 @@ struct tile_entity_brewingstand {
|
|||
};
|
||||
|
||||
struct tile_entity_chest {
|
||||
char* lock;
|
||||
struct inventory* inv;
|
||||
//TODO: loot table
|
||||
char* lock;
|
||||
struct inventory* inv;
|
||||
//TODO: loot table
|
||||
};
|
||||
|
||||
struct tile_entity_comparator {
|
||||
|
@ -76,12 +76,12 @@ struct tile_entity_flowerpot {
|
|||
};
|
||||
|
||||
struct tile_entity_furnace {
|
||||
char* lock;
|
||||
struct inventory* inv;
|
||||
int16_t burnTime;
|
||||
int16_t cookTime;
|
||||
int16_t cookTimeTotal;
|
||||
int16_t lastBurnMax;
|
||||
char* lock;
|
||||
struct inventory* inv;
|
||||
int16_t burnTime;
|
||||
int16_t cookTime;
|
||||
int16_t cookTimeTotal;
|
||||
int16_t lastBurnMax;
|
||||
};
|
||||
|
||||
struct tile_entity_hopper {
|
||||
|
@ -117,40 +117,40 @@ struct tile_entity_structureblock {
|
|||
};
|
||||
|
||||
union tile_entity_data {
|
||||
struct tile_entity_banner banner;
|
||||
struct tile_entity_beacon beacon;
|
||||
struct tile_entity_cauldron cauldron;
|
||||
struct tile_entity_brewingstand brewingstand;
|
||||
struct tile_entity_chest chest;
|
||||
struct tile_entity_comparator comparator;
|
||||
struct tile_entity_commandblock commandblock;
|
||||
struct tile_entity_daylightdetector daylightdetector;
|
||||
struct tile_entity_dispenser dispenser;
|
||||
struct tile_entity_dropper dropper;
|
||||
struct tile_entity_enchantingtable enchantingtable;
|
||||
struct tile_entity_enderchest enderchest;
|
||||
struct tile_entity_endgateway endgateway;
|
||||
struct tile_entity_endportal endportal;
|
||||
struct tile_entity_flowerpot flowerpot;
|
||||
struct tile_entity_furnace furnace;
|
||||
struct tile_entity_hopper hopper;
|
||||
struct tile_entity_jukebox jukebox;
|
||||
struct tile_entity_mobspawner mobspawner;
|
||||
struct tile_entity_noteblock noteblock;
|
||||
struct tile_entity_piston piston;
|
||||
struct tile_entity_sign sign;
|
||||
struct tile_entity_skull skull;
|
||||
struct tile_entity_structureblock structureblock;
|
||||
struct tile_entity_banner banner;
|
||||
struct tile_entity_beacon beacon;
|
||||
struct tile_entity_cauldron cauldron;
|
||||
struct tile_entity_brewingstand brewingstand;
|
||||
struct tile_entity_chest chest;
|
||||
struct tile_entity_comparator comparator;
|
||||
struct tile_entity_commandblock commandblock;
|
||||
struct tile_entity_daylightdetector daylightdetector;
|
||||
struct tile_entity_dispenser dispenser;
|
||||
struct tile_entity_dropper dropper;
|
||||
struct tile_entity_enchantingtable enchantingtable;
|
||||
struct tile_entity_enderchest enderchest;
|
||||
struct tile_entity_endgateway endgateway;
|
||||
struct tile_entity_endportal endportal;
|
||||
struct tile_entity_flowerpot flowerpot;
|
||||
struct tile_entity_furnace furnace;
|
||||
struct tile_entity_hopper hopper;
|
||||
struct tile_entity_jukebox jukebox;
|
||||
struct tile_entity_mobspawner mobspawner;
|
||||
struct tile_entity_noteblock noteblock;
|
||||
struct tile_entity_piston piston;
|
||||
struct tile_entity_sign sign;
|
||||
struct tile_entity_skull skull;
|
||||
struct tile_entity_structureblock structureblock;
|
||||
};
|
||||
|
||||
struct tile_entity {
|
||||
char* id;
|
||||
struct mempool* pool;
|
||||
int32_t x;
|
||||
uint8_t y;
|
||||
int32_t z;
|
||||
void (*tick)(struct world* world, struct tile_entity* te);
|
||||
union tile_entity_data data;
|
||||
char* id;
|
||||
struct mempool* pool;
|
||||
int32_t x;
|
||||
uint8_t y;
|
||||
int32_t z;
|
||||
void (*tick)(struct world* world, struct tile_entity* te);
|
||||
union tile_entity_data data;
|
||||
};
|
||||
|
||||
void tetick_furnace(struct world* world, struct tile_entity* te);
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
#include <basin/world.h>
|
||||
|
||||
struct tool_proficiency {
|
||||
uint16_t* proficient;
|
||||
size_t proficient_size;
|
||||
uint16_t* proficient;
|
||||
size_t proficient_size;
|
||||
};
|
||||
|
||||
struct tool_info {
|
||||
char* name;
|
||||
struct tool_proficiency* proficiencies;
|
||||
size_t proficient_size;
|
||||
char* name;
|
||||
struct tool_proficiency* proficiencies;
|
||||
size_t proficient_size;
|
||||
};
|
||||
|
||||
void tools_init();
|
||||
|
|
|
@ -41,37 +41,37 @@ struct chunk_request {
|
|||
struct entity;
|
||||
|
||||
struct scheduled_tick {
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t z;
|
||||
int32_t ticksLeft;
|
||||
float priority;
|
||||
block src;
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t z;
|
||||
int32_t ticksLeft;
|
||||
float priority;
|
||||
block src;
|
||||
};
|
||||
|
||||
struct world {
|
||||
struct mempool* pool;
|
||||
struct server* server;
|
||||
struct hashmap* entities;
|
||||
struct hashmap* players;
|
||||
struct hashmap* regions;
|
||||
struct hashmap* chunks;
|
||||
pthread_mutex_t tick_mut;
|
||||
pthread_cond_t tick_cond;
|
||||
char* level_type;
|
||||
struct encpos spawnpos;
|
||||
int32_t dimension;
|
||||
uint64_t time;
|
||||
uint64_t age;
|
||||
struct nbt_tag* level;
|
||||
char* world_folder;
|
||||
uint8_t skylightSubtracted;
|
||||
struct hashmap* scheduledTicks;
|
||||
uint16_t ticksInSecond;
|
||||
float tps;
|
||||
uint64_t seed;
|
||||
struct perlin perlin;
|
||||
struct queue* chunk_requests;
|
||||
struct hashmap* entities;
|
||||
struct hashmap* players;
|
||||
struct hashmap* regions;
|
||||
struct hashmap* chunks;
|
||||
pthread_mutex_t tick_mut;
|
||||
pthread_cond_t tick_cond;
|
||||
char* level_type;
|
||||
struct encpos spawnpos;
|
||||
int32_t dimension;
|
||||
uint64_t time;
|
||||
uint64_t age;
|
||||
struct nbt_tag* level;
|
||||
char* world_folder;
|
||||
uint8_t skylightSubtracted;
|
||||
struct hashmap* scheduledTicks;
|
||||
uint16_t ticksInSecond;
|
||||
float tps;
|
||||
uint64_t seed;
|
||||
struct perlin perlin;
|
||||
struct queue* chunk_requests;
|
||||
};
|
||||
|
||||
// "*_guess" functions accept a chunk guess and call the proper function if the chunk is a miss. used to optimize chunk lookups in intensive local algorithms. probably overused.
|
||||
|
|
Loading…
Reference in New Issue