mirror of https://github.com/basinserver/basin/
add readme for discord
This commit is contained in:
parent
4aecba3204
commit
2b4222d72e
|
@ -1,6 +1,10 @@
|
||||||
# Basin
|
# Basin
|
||||||
A high performance Minecraft server implementation written in C.
|
A high performance Minecraft server implementation written in C.
|
||||||
|
|
||||||
|
## Discord Server
|
||||||
|
|
||||||
|
Join the Discord server [here](https://discord.gg/3uW2QQV).
|
||||||
|
|
||||||
# Goals
|
# Goals
|
||||||
* Pure performance: minimum resource usage for a full Minecraft server implementation
|
* Pure performance: minimum resource usage for a full Minecraft server implementation
|
||||||
* Drop-in replacement: compatible with Spigot API plugins via JNI, standard Minecraft world format (Anvil)
|
* Drop-in replacement: compatible with Spigot API plugins via JNI, standard Minecraft world format (Anvil)
|
||||||
|
|
|
@ -1033,7 +1033,8 @@ void tick_entity(struct world* world, struct entity* entity) {
|
||||||
damageEntity(entity, 1., 0);
|
damageEntity(entity, 1., 0);
|
||||||
}
|
}
|
||||||
if (ei != NULL && ei->onTick != NULL) {
|
if (ei != NULL && ei->onTick != NULL) {
|
||||||
if ((*ei->onTick)(world, entity)) {
|
(*ei->onTick)(world, entity);
|
||||||
|
if (entity->despawn) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,14 +188,11 @@ void tick_arrow(struct world* world, struct entity* entity) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("hf2c = %f, %f, %f\n", entity->x, entity->y, entity->z);
|
|
||||||
|
|
||||||
if (entity->data.arrow.ticksInGround == 0) {
|
if (entity->data.arrow.ticksInGround == 0) {
|
||||||
float dhz = sqrtf(entity->motX * entity->motX + entity->motZ * entity->motZ);
|
float dhz = sqrtf(entity->motX * entity->motX + entity->motZ * entity->motZ);
|
||||||
entity->yaw = atan2f(entity->motX, entity->motZ) * 180. / M_PI;
|
entity->yaw = atan2f(entity->motX, entity->motZ) * 180. / M_PI;
|
||||||
entity->pitch = atan2f(entity->motY, dhz) * 180. / M_PI;
|
entity->pitch = atan2f(entity->motY, dhz) * 180. / M_PI;
|
||||||
//printf("desired %f, %f, %f\n", entity->pitch, entity->motY, dhz);
|
|
||||||
//printf("yaw = %f, last_yaw = %f\npitch = %f, last_pitch = %f\n", entity->yaw, entity->last_yaw, entity->pitch, entity->last_pitch);
|
|
||||||
if ((entity->last_yaw == 0. && entity->last_pitch == 0.)) {
|
if ((entity->last_yaw == 0. && entity->last_pitch == 0.)) {
|
||||||
entity->last_yaw = entity->yaw;
|
entity->last_yaw = entity->yaw;
|
||||||
entity->last_pitch = entity->pitch;
|
entity->last_pitch = entity->pitch;
|
||||||
|
@ -215,7 +212,7 @@ void tick_arrow(struct world* world, struct entity* entity) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tick_itemstack(struct world* world, struct entity* entity) {
|
void tick_itemstack(struct world* world, struct entity* entity) {
|
||||||
if (entity->data.itemstack.delayBeforeCanPickup > 0) {
|
if (entity->data.itemstack.delayBeforeCanPickup > 0) {
|
||||||
entity->data.itemstack.delayBeforeCanPickup--;
|
entity->data.itemstack.delayBeforeCanPickup--;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -888,7 +888,7 @@ void world_tick(struct world* world) {
|
||||||
pthread_rwlock_rdlock(&world->players->rwlock);
|
pthread_rwlock_rdlock(&world->players->rwlock);
|
||||||
ITER_MAP(world->players) {
|
ITER_MAP(world->players) {
|
||||||
struct player* player = (struct player*) value;
|
struct player* player = (struct player*) value;
|
||||||
player_tick(world, player);
|
player_tick(player);
|
||||||
tick_entity(world, player->entity); // might need to be moved into separate loop later
|
tick_entity(world, player->entity); // might need to be moved into separate loop later
|
||||||
ITER_MAP_END();
|
ITER_MAP_END();
|
||||||
}
|
}
|
||||||
|
@ -899,6 +899,9 @@ void world_tick(struct world* world) {
|
||||||
ITER_MAP(world->entities) {
|
ITER_MAP(world->entities) {
|
||||||
struct entity* entity = (struct entity*) value;
|
struct entity* entity = (struct entity*) value;
|
||||||
if (entity->type != ENT_PLAYER) tick_entity(world, entity);
|
if (entity->type != ENT_PLAYER) tick_entity(world, entity);
|
||||||
|
if (entity->despawn) {
|
||||||
|
pfree(entity->pool);
|
||||||
|
}
|
||||||
ITER_MAP_END();
|
ITER_MAP_END();
|
||||||
}
|
}
|
||||||
pthread_rwlock_unlock(&world->entities->rwlock);
|
pthread_rwlock_unlock(&world->entities->rwlock);
|
||||||
|
|
Loading…
Reference in New Issue