Skip to content

Commit

Permalink
refactor: simplify hook original calls
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Jul 12, 2024
1 parent b7111f5 commit 1484ba1
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,5 @@ void StartGamePacket::write(BinaryStream &stream) const
settings_.setRandomSeed({0});
}

#if _WIN32
ENDSTONE_HOOK_CALL_ORIGINAL_NAME(&StartGamePacket::write, __FUNCDNAME__, this, stream);
#else
ENDSTONE_HOOK_CALL_ORIGINAL_NAME(&StartGamePacket::write, "_ZNK15StartGamePacket5writeER12BinaryStream", this,
stream);
#endif
}
4 changes: 0 additions & 4 deletions src/endstone_runtime/bedrock/server/server_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ void ServerPlayer::die(const ActorDamageSource &source)
}
}

#if _WIN32
ENDSTONE_HOOK_CALL_ORIGINAL_NAME(&ServerPlayer::die, __FUNCDNAME__, this, source);
#else
ENDSTONE_HOOK_CALL_ORIGINAL_NAME(&ServerPlayer::die, "_ZN12ServerPlayer3dieERK17ActorDamageSource", this, source);
#endif
}

void ServerPlayer::doInitialSpawn()
Expand Down
9 changes: 0 additions & 9 deletions src/endstone_runtime/bedrock/world/actor/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ void Actor::remove()
server.getPluginManager().callEvent(e);
}

#if _WIN32
ENDSTONE_HOOK_CALL_ORIGINAL_NAME(&Actor::remove, __FUNCDNAME__, this);
#else
ENDSTONE_HOOK_CALL_ORIGINAL_NAME(&Actor::remove, "_ZN5Actor6removeEv", this);
#endif
}

void Actor::teleportTo(const Vec3 &pos, bool should_stop_riding, int cause, int entity_type, bool keep_velocity)
Expand All @@ -64,13 +60,8 @@ void Actor::teleportTo(const Vec3 &pos, bool should_stop_riding, int cause, int

// TODO(event): pass to to the origin function
}
#if _WIN32
ENDSTONE_HOOK_CALL_ORIGINAL_NAME(&Actor::teleportTo, __FUNCDNAME__, this, pos, should_stop_riding, cause,
entity_type, keep_velocity);
#else
ENDSTONE_HOOK_CALL_ORIGINAL_NAME(&Actor::teleportTo, "_ZN5Actor10teleportToERK4Vec3biib", this, pos,
should_stop_riding, cause, entity_type, keep_velocity);
#endif
}

bool Actor::isPlayer() const
Expand Down
4 changes: 0 additions & 4 deletions src/endstone_runtime/bedrock/world/actor/mob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ void Mob::die(const ActorDamageSource &source)
server.getPluginManager().callEvent(e);
}

#if _WIN32
ENDSTONE_HOOK_CALL_ORIGINAL_NAME(&Mob::die, __FUNCDNAME__, this, source);
#else
ENDSTONE_HOOK_CALL_ORIGINAL_NAME(&Mob::die, "_ZN3Mob3dieERK17ActorDamageSource", this, source);
#endif
}

bool Mob::isGliding() const
Expand Down

0 comments on commit 1484ba1

Please sign in to comment.