Fix Eggs Spawning Abnormally Healthy Chickens
This commit is contained in:
parent
e04b12e94e
commit
cd2cb37980
@ -64,7 +64,8 @@
|
||||
* `Implement RaspberryJuice API` (Enabled By Default)
|
||||
* `Fix HUD When Spectating Other Players` (Enabled By Default)
|
||||
* `Fix Crash When Spectated Entity Is Removed` (Enabled By Default)
|
||||
* `Fix Torch Placement` (Enabled)
|
||||
* `Fix Torch Placement` (Enabled By Default)
|
||||
* `Fix Eggs Spawning Abnormally Healthy Chickens` (Enabled By Default)
|
||||
* Existing Functionality (All Enabled By Default)
|
||||
* `Fix Screen Rendering When Hiding HUD`
|
||||
* `Sanitize Usernames`
|
||||
|
@ -132,6 +132,7 @@ CATEGORY Bug Fixes
|
||||
TRUE Fix Sunlight Not Properly Setting Mobs On Fire
|
||||
TRUE Fix Transferring Durability When Using Items
|
||||
TRUE Fix Torch Placement
|
||||
TRUE Fix Eggs Spawning Abnormally Healthy Chickens
|
||||
CATEGORY Crashes
|
||||
TRUE Fix Crash When Generating Certain Seeds
|
||||
TRUE Close Editor When Sign Is Destroyed
|
||||
|
@ -15,6 +15,8 @@ typedef RakNet_RakString *(*RakNet_RakString_constructor_2_t)(RakNet_RakString *
|
||||
extern RakNet_RakString_constructor_2_t RakNet_RakString_constructor_2;
|
||||
}
|
||||
|
||||
void misc_set_on_fire(Mob *mob, int seconds);
|
||||
|
||||
void misc_run_on_init(const std::function<void(Minecraft *)> &func);
|
||||
void misc_run_on_update(const std::function<void(Minecraft *)> &func);
|
||||
void misc_run_on_tick(const std::function<void(Minecraft *)> &func);
|
||||
|
@ -398,7 +398,7 @@ static void ServerSideNetworkHandler_handle_PlayerActionPacket_injection(ServerS
|
||||
}
|
||||
|
||||
// Make Mobs Actually Catch On Fire
|
||||
static void set_on_fire(Mob *mob, const int seconds) {
|
||||
void misc_set_on_fire(Mob *mob, const int seconds) {
|
||||
const int value = seconds * 20;
|
||||
if (value > mob->fire_timer) {
|
||||
mob->fire_timer = value;
|
||||
@ -413,7 +413,7 @@ static void Monster_aiStep_injection(__attribute__((unused)) const std::function
|
||||
if (brightness > 0.5f) {
|
||||
Random *random = &self->random;
|
||||
if (level->canSeeSky(Mth::floor(self->x), Mth::floor(self->y), Mth::floor(self->z)) && random->nextFloat() * 3.5f < (brightness - 0.4f)) {
|
||||
set_on_fire((Mob *) self, 8);
|
||||
misc_set_on_fire((Mob *) self, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -499,13 +499,26 @@ static int Level_getTopTile_injection(Level_getTopTile_t original, Level *self,
|
||||
|
||||
// Fix Torch Placement
|
||||
static bool TileItem_useOn_Level_setTileAndData_injection(Level *self, const int x, const int y, const int z, const int tile, const int data) {
|
||||
// Call Original Method
|
||||
const bool ret = self->setTileAndData(x, y, z, tile, data);
|
||||
if (tile == Tile::torch->id) {
|
||||
// Force Correct Data
|
||||
if (ret && tile == Tile::torch->id) {
|
||||
self->setData(x, y, z, data);
|
||||
}
|
||||
// Return
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Fix Egg Behavior
|
||||
static void ThrownEgg_onHit_Chicken_moveTo_injection(Chicken *self, const float x, const float y, const float z, const float yaw, const float pitch) {
|
||||
// Call Original Method
|
||||
self->moveTo(x, y, z, yaw, pitch);
|
||||
// Fix Health
|
||||
self->health = self->getMaxHealth();
|
||||
// Fix Age
|
||||
self->setAge(-24000);
|
||||
}
|
||||
|
||||
// Init
|
||||
void init_misc() {
|
||||
// Sanitize Username
|
||||
@ -687,6 +700,11 @@ void init_misc() {
|
||||
overwrite_call((void *) 0xcb784, Level_setTileAndData, TileItem_useOn_Level_setTileAndData_injection);
|
||||
}
|
||||
|
||||
// Fix Egg Behavior
|
||||
if (feature_has("Fix Eggs Spawning Abnormally Healthy Chickens", server_enabled)) {
|
||||
overwrite_call((void *) 0x7de0c, Chicken_moveTo, ThrownEgg_onHit_Chicken_moveTo_injection);
|
||||
}
|
||||
|
||||
// Disable overwrite_calls() After Minecraft::init
|
||||
misc_run_on_init([](__attribute__((unused)) Minecraft *minecraft) {
|
||||
thunk_enabler = [](__attribute__((unused)) void *a, __attribute__((unused)) void *b) -> void * {
|
||||
|
Loading…
x
Reference in New Issue
Block a user