Way Too Many Changes
This commit is contained in:
parent
07f5e188f7
commit
c5937e6794
@ -7,16 +7,38 @@
|
|||||||
* Add Peaceful Mode To Options Screen
|
* Add Peaceful Mode To Options Screen
|
||||||
* Proper Create New World Screen
|
* Proper Create New World Screen
|
||||||
* Proper Chat Screen
|
* Proper Chat Screen
|
||||||
* Add `Animated Lava` Feature Flag (Enabled By Default)
|
* New Feature Flags
|
||||||
* Add `Animated Fire` Feature Flag (Enabled By Default)
|
* `Animated Lava` (Enabled By Default)
|
||||||
* Add `Use Java Beta 1.3 Light Ramp` Feature Flag (Enabled By Default)
|
* `Animated Fire` (Enabled By Default)
|
||||||
* Add `Send Full Level When Hosting Game` Feature Flag (Enabled By Default)
|
* `Add Cake` (Enabled By Default)
|
||||||
* Add `Food Overlay` Feature Flag (Disabled By Default)
|
* `Use Java Beta 1.3 Light Ramp` (Enabled By Default)
|
||||||
* Add `Display Date In Select World Screen` Feature Flag (Enabled By Default)
|
* `Send Full Level When Hosting Game` (Enabled By Default)
|
||||||
* Add `Optimized Chunk Sorting` Feature Flag (Enabled By Default)
|
* `Food Overlay` (Disabled By Default)
|
||||||
* Add `Add Cake` Feature Flag (Enabled By Default)
|
* `Add Splashes` (Enabled By Default)
|
||||||
* Add `Add Reborn Info To Options` Feature Flag (Enabled By Default)
|
* `Display Date In Select World Screen` (Enabled By Default)
|
||||||
* Add `Log FPS` Feature Flag (Disabled By Default)
|
* `Optimized Chunk Sorting` (Enabled By Default)
|
||||||
|
* `Fix Held Item Caching` (Enabled By Default)
|
||||||
|
* `Add Reborn Info To Options` (Enabled By Default)
|
||||||
|
* `Log FPS` (Disabled By Default)
|
||||||
|
* `Add Welcome Screen` (Enabled By Default)
|
||||||
|
* `F3 Debug Information` (Enabled By Default)
|
||||||
|
* `Multidraw Rendering` (Enabled By Default)
|
||||||
|
* `Add Missing Language Strings` (Enabled By Default)
|
||||||
|
* `Fix Pigmen Burning In The Sun` (Enabled By Default)
|
||||||
|
* `Fix Carried Grass's Bottom Texture` (Enabled By Default)
|
||||||
|
* `Hide Crosshair In Third-Person` (Enabled By Default)
|
||||||
|
* `Fix Camera Legs` (Enabled By Default)
|
||||||
|
* `Implement Crafting Remainders` (Enabled By Default)
|
||||||
|
* `Fix Door Duplication` (Enabled By Default)
|
||||||
|
* `Fix Cobweb Lighting` (Enabled By Default)
|
||||||
|
* `Fix Sneaking Syncing` (Enabled By Default)
|
||||||
|
* `Fix Fire Immunity` (Enabled By Default)
|
||||||
|
* `Fix Fire Syncing` (Enabled By Default)
|
||||||
|
* `Fix Sunlight Not Properly Setting Mobs On Fire` (Enabled By Default)
|
||||||
|
* `Stop Creative Players From Burning` (Enabled By Default)
|
||||||
|
* `Render Fire In Third-Person` (Enabled By Default)
|
||||||
|
* `Improved Water Rendering` (Enabled By Default)
|
||||||
|
* `Classic Item Count UI` (Enabled By Default)
|
||||||
* Split Up `Remove Creative Mode Restrictions` Feature Flag
|
* Split Up `Remove Creative Mode Restrictions` Feature Flag
|
||||||
* `Remove Creative Mode Restrictions` (Disabled By Default)
|
* `Remove Creative Mode Restrictions` (Disabled By Default)
|
||||||
* `Display Slot Count In Creative Mode` (Disabled By Default)
|
* `Display Slot Count In Creative Mode` (Disabled By Default)
|
||||||
@ -25,12 +47,11 @@
|
|||||||
* `Maximize Creative Mode Inventory Stack Size` (Disabled By Default)
|
* `Maximize Creative Mode Inventory Stack Size` (Disabled By Default)
|
||||||
* Rename `Disable Buggy Held Item Caching` Feature Flag To `Fix Held Item Caching`
|
* Rename `Disable Buggy Held Item Caching` Feature Flag To `Fix Held Item Caching`
|
||||||
* Add Milk Buckets
|
* Add Milk Buckets
|
||||||
* Implement Crafting Remainders
|
* Included In The `Add Buckets` Feature Flag
|
||||||
* Improve Death Messages
|
* Improve Death Messages
|
||||||
* Massive Build System Improvements
|
* Massive Build System Improvements
|
||||||
* Fix Item Dropping When Killing Players From The Server Console
|
* Fix Item Dropping When Killing Players From The Server Console
|
||||||
* Fix Furnace Visual Bug When Using Lava Bucket As Fuel
|
* Fix Furnace Visual Bug When Using Lava Bucket As Fuel
|
||||||
* Add Splash Text To Start Screen
|
|
||||||
* `overwrite_calls` Now Scans VTables
|
* `overwrite_calls` Now Scans VTables
|
||||||
* Unify Server/Client Builds
|
* Unify Server/Client Builds
|
||||||
|
|
||||||
|
@ -78,3 +78,11 @@ TRUE Fix Camera Legs
|
|||||||
TRUE Implement Crafting Remainders
|
TRUE Implement Crafting Remainders
|
||||||
TRUE Fix Door Duplication
|
TRUE Fix Door Duplication
|
||||||
TRUE Fix Cobweb Lighting
|
TRUE Fix Cobweb Lighting
|
||||||
|
TRUE Fix Sneaking Syncing
|
||||||
|
TRUE Fix Fire Immunity
|
||||||
|
TRUE Fix Fire Syncing
|
||||||
|
TRUE Fix Sunlight Not Properly Setting Mobs On Fire
|
||||||
|
TRUE Stop Creative Players From Burning
|
||||||
|
TRUE Render Fire In Third-Person
|
||||||
|
TRUE Improved Water Rendering
|
||||||
|
TRUE Classic Item Count UI
|
@ -12,4 +12,4 @@ std::string chat_send_api_command(const Minecraft *minecraft, const std::string
|
|||||||
// Override using the HOOK() macro to provide customized chat behavior.
|
// Override using the HOOK() macro to provide customized chat behavior.
|
||||||
void chat_send_message(ServerSideNetworkHandler *server_side_network_handler, char *username, char *message);
|
void chat_send_message(ServerSideNetworkHandler *server_side_network_handler, char *username, char *message);
|
||||||
void chat_handle_packet_send(Minecraft *minecraft, ChatPacket *packet);
|
void chat_handle_packet_send(Minecraft *minecraft, ChatPacket *packet);
|
||||||
};
|
}
|
||||||
|
7
mods/include/mods/multidraw/multidraw.h
Normal file
7
mods/include/mods/multidraw/multidraw.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <symbols/minecraft.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
void LevelRenderer_renderSameAsLast(LevelRenderer *self, float delta);
|
||||||
|
}
|
@ -21,6 +21,7 @@
|
|||||||
#include <mods/feature/feature.h>
|
#include <mods/feature/feature.h>
|
||||||
#include <mods/input/input.h>
|
#include <mods/input/input.h>
|
||||||
#include <mods/misc/misc.h>
|
#include <mods/misc/misc.h>
|
||||||
|
#include <mods/multidraw/multidraw.h>
|
||||||
|
|
||||||
#include "misc-internal.h"
|
#include "misc-internal.h"
|
||||||
|
|
||||||
@ -765,9 +766,13 @@ static std::string *Tile_initTiles_std_string_constructor(std::string *self, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fix Pigmen Burning In The Sun
|
// Fix Pigmen Burning In The Sun
|
||||||
|
static bool fix_pigmen_burning = false;
|
||||||
static float Zombie_aiStep_getBrightness_injection(Entity *self, float param_1) {
|
static float Zombie_aiStep_getBrightness_injection(Entity *self, float param_1) {
|
||||||
if (self->getEntityTypeId() == 36) return 0;
|
if (fix_pigmen_burning && self->getEntityTypeId() == 36) {
|
||||||
return self->getBrightness(param_1);
|
return 0;
|
||||||
|
} else {
|
||||||
|
return self->getBrightness(param_1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix grass_carried's Bottom Texture
|
// Fix grass_carried's Bottom Texture
|
||||||
@ -786,6 +791,263 @@ static Tile *Tile_initTiles_WebTile_setLightBlock_injection(Tile *self, __attrib
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fix Fire Immunity
|
||||||
|
static void Mob_baseTick_injection_fire_immunity(Mob_baseTick_t original, Mob *self) {
|
||||||
|
// Fix Fire Timer
|
||||||
|
if (self->fire_immune) {
|
||||||
|
self->fire_timer = 0;
|
||||||
|
}
|
||||||
|
// Call Original Method
|
||||||
|
original(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix Fire Syncing
|
||||||
|
#define FLAG_ONFIRE 0
|
||||||
|
static void Mob_baseTick_injection_fire_syncing(Mob_baseTick_t original, Mob *self) {
|
||||||
|
// Fix Fire Timer
|
||||||
|
if (self->level->is_client_side) {
|
||||||
|
self->fire_timer = 0;
|
||||||
|
}
|
||||||
|
// Call Original Method
|
||||||
|
original(self);
|
||||||
|
// Sync Data
|
||||||
|
if (!self->level->is_client_side) {
|
||||||
|
self->setSharedFlag(FLAG_ONFIRE, self->fire_timer > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static bool Entity_isOnFire_injection(Entity_isOnFire_t original, Entity *self) {
|
||||||
|
// Call Original Method
|
||||||
|
bool ret = original(self);
|
||||||
|
|
||||||
|
// Check Shared Data
|
||||||
|
bool shared_data = false;
|
||||||
|
if (self->isMob()) {
|
||||||
|
shared_data = ((Mob *) self)->getSharedFlag(FLAG_ONFIRE);
|
||||||
|
}
|
||||||
|
if (shared_data) {
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix Sneaking Syncing
|
||||||
|
#define FLAG_SNEAKING 1
|
||||||
|
#define PLAYER_ACTION_STOP_SNEAKING 100
|
||||||
|
#define PLAYER_ACTION_START_SNEAKING 101
|
||||||
|
static void LocalPlayer_tick_injection(LocalPlayer_tick_t original, LocalPlayer *self) {
|
||||||
|
// Call Original Method
|
||||||
|
original(self);
|
||||||
|
// Sync Data
|
||||||
|
if (!self->level->is_client_side) {
|
||||||
|
self->setSharedFlag(FLAG_SNEAKING, self->isSneaking());
|
||||||
|
} else {
|
||||||
|
const bool real = self->isSneaking();
|
||||||
|
const bool synced = self->getSharedFlag(FLAG_SNEAKING);
|
||||||
|
if (real != synced) {
|
||||||
|
// Send To Server
|
||||||
|
PlayerActionPacket *packet = new PlayerActionPacket;
|
||||||
|
Packet_constructor->get(false)((Packet *) packet);
|
||||||
|
packet->vtable = PlayerActionPacket_vtable_base;
|
||||||
|
packet->entity_id = self->id;
|
||||||
|
packet->action = real ? PLAYER_ACTION_START_SNEAKING : PLAYER_ACTION_STOP_SNEAKING;
|
||||||
|
self->minecraft->rak_net_instance->send(*(Packet *) packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void ServerSideNetworkHandler_handle_PlayerActionPacket_injection(ServerSideNetworkHandler_handle_PlayerActionPacket_t original, ServerSideNetworkHandler *self, const RakNet_RakNetGUID &rak_net_guid, PlayerActionPacket *packet) {
|
||||||
|
// Call Original Method
|
||||||
|
original(self, rak_net_guid, packet);
|
||||||
|
|
||||||
|
// Handle Sneaking
|
||||||
|
const bool is_sneaking = packet->action == PLAYER_ACTION_START_SNEAKING;
|
||||||
|
if (self->level != nullptr && (is_sneaking || packet->action == PLAYER_ACTION_STOP_SNEAKING)) {
|
||||||
|
Entity *entity = self->level->getEntity(packet->entity_id);
|
||||||
|
if (entity != nullptr && entity->isPlayer()) {
|
||||||
|
((Player *) entity)->setSharedFlag(FLAG_SNEAKING, is_sneaking);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make Mobs Actually Catch On Fire
|
||||||
|
static void set_on_fire(Mob *mob, const int seconds) {
|
||||||
|
const int value = seconds * 20;
|
||||||
|
if (value > mob->fire_timer) {
|
||||||
|
mob->fire_timer = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template <typename Self>
|
||||||
|
static void Monster_aiStep_injection(__attribute__((unused)) std::function<void(Self *)> original, Self *self) {
|
||||||
|
// Fire!
|
||||||
|
Level *level = self->level;
|
||||||
|
if (level->isDay() && !level->is_client_side) {
|
||||||
|
const float brightness = Zombie_aiStep_getBrightness_injection((Entity *) self, 1);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call Parent Method
|
||||||
|
Monster_aiStep->get(false)((Monster *) self);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fire Rendering
|
||||||
|
static void EntityRenderDispatcher_render_EntityRenderer_render_injection(EntityRenderer *self, Entity *entity, float x, float y, float z, float rot, float unknown) {
|
||||||
|
// Call Original Method
|
||||||
|
self->render(entity, x, y, z, rot, unknown);
|
||||||
|
|
||||||
|
// Render Fire
|
||||||
|
if (entity->isOnFire()) {
|
||||||
|
// Here Be Decompiled Code
|
||||||
|
y -= entity->height_offset;
|
||||||
|
const int texture = Tile::fire->texture;
|
||||||
|
const int xt = (texture & 0xf) << 4;
|
||||||
|
const int yt = texture & 0xf0;
|
||||||
|
glPushMatrix();
|
||||||
|
glTranslatef(x, y, z);
|
||||||
|
const float s = entity->hitbox_width * 1.4f;
|
||||||
|
glScalef(s, s, s);
|
||||||
|
self->bindTexture("terrain.png");
|
||||||
|
Tesselator &t = Tesselator::instance;
|
||||||
|
float r = 0.5f;
|
||||||
|
float h = entity->hitbox_height / s;
|
||||||
|
float yo = entity->y - entity->height_offset - entity->hitbox.y1;
|
||||||
|
float player_rot_y = EntityRenderer::entityRenderDispatcher->player_rot_y;
|
||||||
|
if (EntityRenderer::entityRenderDispatcher->minecraft->options.third_person == 2) {
|
||||||
|
// Handle Front-Facing
|
||||||
|
player_rot_y -= 180.f;
|
||||||
|
}
|
||||||
|
glRotatef(-player_rot_y, 0, 1, 0);
|
||||||
|
glTranslatef(0, 0, -0.3f + float(int(h)) * 0.02f);
|
||||||
|
glColor4f(1, 1, 1, 1);
|
||||||
|
float zo = 0;
|
||||||
|
int ss = 0;
|
||||||
|
t.begin(7);
|
||||||
|
while (h > 0) {
|
||||||
|
constexpr float xo = 0.0f;
|
||||||
|
float u0;
|
||||||
|
float u1;
|
||||||
|
float v0;
|
||||||
|
float v1;
|
||||||
|
if (ss % 2 == 0) {
|
||||||
|
u0 = float(xt) / 256.0f;
|
||||||
|
u1 = (float(xt) + 15.99f) / 256.0f;
|
||||||
|
v0 = float(yt) / 256.0f;
|
||||||
|
v1 = (float(yt) + 15.99f) / 256.0f;
|
||||||
|
} else {
|
||||||
|
u0 = float(xt) / 256.0f;
|
||||||
|
u1 = (float(xt) + 15.99f) / 256.0f;
|
||||||
|
v0 = (float(yt) + 16) / 256.0f;
|
||||||
|
v1 = (float(yt) + 16 + 15.99f) / 256.0f;
|
||||||
|
}
|
||||||
|
if (ss / 2 % 2 == 0) {
|
||||||
|
std::swap(u1, u0);
|
||||||
|
}
|
||||||
|
t.vertexUV(r - xo, 0 - yo, zo, u1, v1);
|
||||||
|
t.vertexUV(-r - xo, 0 - yo, zo, u0, v1);
|
||||||
|
t.vertexUV(-r - xo, 1.4f - yo, zo, u0, v0);
|
||||||
|
t.vertexUV(r - xo, 1.4f - yo, zo, u1, v0);
|
||||||
|
h -= 0.45f;
|
||||||
|
yo -= 0.45f;
|
||||||
|
r *= 0.9f;
|
||||||
|
zo += 0.03f;
|
||||||
|
ss++;
|
||||||
|
}
|
||||||
|
t.draw();
|
||||||
|
glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear Fire For Creative Players
|
||||||
|
static void Player_tick_injection(Player_tick_t original, Player *self) {
|
||||||
|
// Fix Value
|
||||||
|
if (self->inventory->is_creative && !self->level->is_client_side && self->isOnFire()) {
|
||||||
|
self->fire_timer = 0;
|
||||||
|
}
|
||||||
|
// Call Original Method
|
||||||
|
original(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nicer Water Rendering
|
||||||
|
static bool game_render_anaglyph_color_mask[4];
|
||||||
|
static void GameRenderer_render_glColorMask_injection(const bool red, const bool green, const bool blue, const bool alpha) {
|
||||||
|
game_render_anaglyph_color_mask[0] = red;
|
||||||
|
game_render_anaglyph_color_mask[1] = green;
|
||||||
|
game_render_anaglyph_color_mask[2] = blue;
|
||||||
|
game_render_anaglyph_color_mask[3] = alpha;
|
||||||
|
glColorMask(red, green, blue, alpha);
|
||||||
|
}
|
||||||
|
static int GameRenderer_render_LevelRenderer_render_injection(LevelRenderer *self, Mob *mob, int param_1, float delta) {
|
||||||
|
glColorMask(false, false, false, false);
|
||||||
|
const int water_chunks = self->render(mob, param_1, delta);
|
||||||
|
glColorMask(true, true, true, true);
|
||||||
|
if (self->minecraft->options.anaglyph_3d) {
|
||||||
|
glColorMask(game_render_anaglyph_color_mask[0], game_render_anaglyph_color_mask[1], game_render_anaglyph_color_mask[2], game_render_anaglyph_color_mask[3]);
|
||||||
|
}
|
||||||
|
if (water_chunks > 0) {
|
||||||
|
LevelRenderer_renderSameAsLast(self, delta);
|
||||||
|
}
|
||||||
|
return water_chunks;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Classic Slot Count Location
|
||||||
|
static void Gui_renderSlotText_injection_common(Gui *self, const ItemInstance *item, float x, float y, const bool param_1, const bool param_2) {
|
||||||
|
// Position
|
||||||
|
x += 17;
|
||||||
|
y += 9;
|
||||||
|
// Call Original Method
|
||||||
|
self->renderSlotText(item, x, y, param_1, param_2);
|
||||||
|
}
|
||||||
|
static void Gui_renderSlotText_injection_furnace(Gui *self, const ItemInstance *item, float x, float y, const bool param_1, const bool param_2) {
|
||||||
|
// Position
|
||||||
|
x += 4;
|
||||||
|
y += 5;
|
||||||
|
// Call Original Method
|
||||||
|
Gui_renderSlotText_injection_common(self, item, x, y, param_1, param_2);
|
||||||
|
}
|
||||||
|
static void unscale_slot_text(float &x, float &y) {
|
||||||
|
const float factor = 0.5f * Gui::GuiScale;
|
||||||
|
x /= factor;
|
||||||
|
y /= factor;
|
||||||
|
}
|
||||||
|
static void Gui_renderSlotText_injection_classic_inventory(Gui *self, const ItemInstance *item, float x, float y, const bool param_1, const bool param_2) {
|
||||||
|
// Position
|
||||||
|
unscale_slot_text(x, y);
|
||||||
|
// Call Original Method
|
||||||
|
Gui_renderSlotText_injection_common(self, item, x, y, param_1, param_2);
|
||||||
|
}
|
||||||
|
static void Gui_renderSlotText_injection_toolbar(Gui *self, const ItemInstance *item, float x, float y, const bool param_1, const bool param_2) {
|
||||||
|
// Position
|
||||||
|
y--;
|
||||||
|
unscale_slot_text(x, y);
|
||||||
|
// Call Original Method
|
||||||
|
Gui_renderSlotText_injection_common(self, item, x, y, param_1, param_2);
|
||||||
|
}
|
||||||
|
static void Gui_renderSlotText_injection_inventory(Gui *self, const ItemInstance *item, float x, float y, const bool param_1, const bool param_2) {
|
||||||
|
// Position
|
||||||
|
unscale_slot_text(x, y);
|
||||||
|
x++;
|
||||||
|
y++;
|
||||||
|
// Call Original Method
|
||||||
|
Gui_renderSlotText_injection_common(self, item, x, y, param_1, param_2);
|
||||||
|
}
|
||||||
|
template <auto *const func>
|
||||||
|
static void Gui_renderSlotText_Font_draw_injection(Font *self, const char *raw_string, float x, float y, uint color) {
|
||||||
|
// Fix X
|
||||||
|
std::string string = raw_string;
|
||||||
|
x -= self->width(string);
|
||||||
|
// Fix Color
|
||||||
|
if (color == 0xffcccccc) {
|
||||||
|
color = 0xffffffff;
|
||||||
|
}
|
||||||
|
// Call
|
||||||
|
(*func)->get(false)(self, string, x, y, color);
|
||||||
|
}
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
static void nop(__attribute__((unused)) Args... args) {
|
static void nop(__attribute__((unused)) Args... args) {
|
||||||
@ -1045,6 +1307,7 @@ void init_misc() {
|
|||||||
|
|
||||||
// Fix pigmen from burning in the sun
|
// Fix pigmen from burning in the sun
|
||||||
if (feature_has("Fix Pigmen Burning In The Sun", server_enabled)) {
|
if (feature_has("Fix Pigmen Burning In The Sun", server_enabled)) {
|
||||||
|
fix_pigmen_burning = true;
|
||||||
overwrite_call((void *) 0x89a1c, (void *) Zombie_aiStep_getBrightness_injection);
|
overwrite_call((void *) 0x89a1c, (void *) Zombie_aiStep_getBrightness_injection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1065,6 +1328,62 @@ void init_misc() {
|
|||||||
overwrite_call((void *) 0xc444c, (void *) Tile_initTiles_WebTile_setLightBlock_injection);
|
overwrite_call((void *) 0xc444c, (void *) Tile_initTiles_WebTile_setLightBlock_injection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fix Fire Immunity
|
||||||
|
if (feature_has("Fix Fire Immunity", server_enabled)) {
|
||||||
|
overwrite_calls(Mob_baseTick, Mob_baseTick_injection_fire_immunity);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix Fire Syncing
|
||||||
|
if (feature_has("Fix Fire Syncing", server_enabled)) {
|
||||||
|
overwrite_calls(Mob_baseTick, Mob_baseTick_injection_fire_syncing);
|
||||||
|
overwrite_calls(Entity_isOnFire, Entity_isOnFire_injection);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix Sneaking Syncing
|
||||||
|
if (feature_has("Fix Sneaking Syncing", server_enabled)) {
|
||||||
|
overwrite_calls(LocalPlayer_tick, LocalPlayer_tick_injection);
|
||||||
|
overwrite_calls(ServerSideNetworkHandler_handle_PlayerActionPacket, ServerSideNetworkHandler_handle_PlayerActionPacket_injection);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make Skeletons/Zombies Actually Catch On Fire
|
||||||
|
if (feature_has("Fix Sunlight Not Properly Setting Mobs On Fire", server_enabled)) {
|
||||||
|
overwrite_calls(Zombie_aiStep, Monster_aiStep_injection<Zombie>);
|
||||||
|
overwrite_calls(Skeleton_aiStep, Monster_aiStep_injection<Skeleton>);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render Fire In Third-Person
|
||||||
|
if (feature_has("Render Fire In Third-Person", server_disabled)) {
|
||||||
|
overwrite_call((void *) 0x606c0, (void *) EntityRenderDispatcher_render_EntityRenderer_render_injection);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear Fire For Creative Players
|
||||||
|
if (feature_has("Stop Creative Players From Burning", server_enabled)) {
|
||||||
|
overwrite_calls(Player_tick, Player_tick_injection);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Slightly Nicer Water Rendering
|
||||||
|
if (feature_has("Improved Water Rendering", server_disabled)) {
|
||||||
|
overwrite_call((void *) 0x49ed4, (void *) GameRenderer_render_glColorMask_injection);
|
||||||
|
overwrite_call((void *) 0x4a18c, (void *) GameRenderer_render_LevelRenderer_render_injection);
|
||||||
|
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||||
|
patch((void *) 0x4a12c, nop_patch);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Classic Slot Count Location
|
||||||
|
if (feature_has("Classic Item Count UI", server_disabled)) {
|
||||||
|
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||||
|
patch((void *) 0x27074, nop_patch);
|
||||||
|
patch((void *) 0x33984, nop_patch);
|
||||||
|
patch((void *) 0x1e424, nop_patch);
|
||||||
|
overwrite_call((void *) 0x1e4b8, (void *) Gui_renderSlotText_injection_inventory);
|
||||||
|
overwrite_call((void *) 0x27100, (void *) Gui_renderSlotText_injection_toolbar);
|
||||||
|
overwrite_call((void *) 0x339b4, (void *) Gui_renderSlotText_injection_classic_inventory);
|
||||||
|
overwrite_call((void *) 0x2b268, (void *) Gui_renderSlotText_injection_furnace);
|
||||||
|
overwrite_call((void *) 0x320c4, (void *) Gui_renderSlotText_injection_furnace);
|
||||||
|
overwrite_call((void *) 0x25e84, (void *) Gui_renderSlotText_Font_draw_injection<&Font_draw>);
|
||||||
|
overwrite_call((void *) 0x25e74, (void *) Gui_renderSlotText_Font_draw_injection<&Font_drawShadow>);
|
||||||
|
}
|
||||||
|
|
||||||
// Init Logging
|
// Init Logging
|
||||||
_init_misc_logging();
|
_init_misc_logging();
|
||||||
_init_misc_api();
|
_init_misc_api();
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <mods/init/init.h>
|
#include <mods/init/init.h>
|
||||||
#include <mods/feature/feature.h>
|
#include <mods/feature/feature.h>
|
||||||
|
#include <mods/multidraw/multidraw.h>
|
||||||
|
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ HOOK(glDeleteBuffers, void, (GLsizei n, const GLuint *buffers)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Usage
|
// Setup Fake OpenGL Buffers
|
||||||
static int current_chunk = -1;
|
static int current_chunk = -1;
|
||||||
HOOK(glBindBuffer, void, (const GLenum target, GLuint buffer)) {
|
HOOK(glBindBuffer, void, (const GLenum target, GLuint buffer)) {
|
||||||
if (target == GL_ARRAY_BUFFER && buffer >= MULTIDRAW_BASE && storage != nullptr) {
|
if (target == GL_ARRAY_BUFFER && buffer >= MULTIDRAW_BASE && storage != nullptr) {
|
||||||
@ -50,6 +51,8 @@ HOOK(glBufferData, void, (GLenum target, GLsizeiptr size, const void *data, GLen
|
|||||||
real_glBufferData(target, size, data, usage);
|
real_glBufferData(target, size, data, usage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Render
|
||||||
#define VERTEX_SIZE 24
|
#define VERTEX_SIZE 24
|
||||||
#define MAX_RENDER_CHUNKS 4096
|
#define MAX_RENDER_CHUNKS 4096
|
||||||
static bool supports_multidraw() {
|
static bool supports_multidraw() {
|
||||||
@ -59,9 +62,11 @@ static bool supports_multidraw() {
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
static int LevelRenderer_renderChunks_injection(__attribute__((unused)) LevelRenderer_renderChunks_t original, LevelRenderer *self, const int start, const int end, const int a, const float b) {
|
static GLint multidraw_firsts[MAX_RENDER_CHUNKS];
|
||||||
|
static GLsizei multidraw_counts[MAX_RENDER_CHUNKS];
|
||||||
|
static GLsizei multidraw_total = 0;
|
||||||
|
static void multidraw_renderSameAsLast(const LevelRenderer *self, const float b) {
|
||||||
// Prepare Offset
|
// Prepare Offset
|
||||||
self->render_list.clear();
|
|
||||||
const Mob *camera = self->minecraft->camera;
|
const Mob *camera = self->minecraft->camera;
|
||||||
const float x = camera->old_x + ((camera->x - camera->old_x) * b);
|
const float x = camera->old_x + ((camera->x - camera->old_x) * b);
|
||||||
const float y = camera->old_y + ((camera->y - camera->old_y) * b);
|
const float y = camera->old_y + ((camera->y - camera->old_y) * b);
|
||||||
@ -78,10 +83,27 @@ static int LevelRenderer_renderChunks_injection(__attribute__((unused)) LevelRen
|
|||||||
glTexCoordPointer(2, GL_FLOAT, VERTEX_SIZE, (void *) 0xc);
|
glTexCoordPointer(2, GL_FLOAT, VERTEX_SIZE, (void *) 0xc);
|
||||||
glColorPointer(4, GL_UNSIGNED_BYTE, VERTEX_SIZE, (void *) 0x14);
|
glColorPointer(4, GL_UNSIGNED_BYTE, VERTEX_SIZE, (void *) 0x14);
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
#ifdef MCPI_USE_GLES1_COMPATIBILITY_LAYER
|
||||||
|
if (supports_multidraw()) {
|
||||||
|
glMultiDrawArrays(GL_TRIANGLES, multidraw_firsts, multidraw_counts, multidraw_total);
|
||||||
|
} else {
|
||||||
|
#endif
|
||||||
|
for (int i = 0; i < multidraw_total; i++) {
|
||||||
|
glDrawArrays(GL_TRIANGLES, multidraw_firsts[i], multidraw_counts[i]);
|
||||||
|
}
|
||||||
|
#ifdef MCPI_USE_GLES1_COMPATIBILITY_LAYER
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glPopMatrix();
|
||||||
|
}
|
||||||
|
static int LevelRenderer_renderChunks_injection(__attribute__((unused)) LevelRenderer_renderChunks_t original, LevelRenderer *self, const int start, const int end, const int a, const float b) {
|
||||||
// Batch
|
// Batch
|
||||||
static GLint firsts[MAX_RENDER_CHUNKS];
|
multidraw_total = 0;
|
||||||
static GLsizei counts[MAX_RENDER_CHUNKS];
|
|
||||||
GLsizei total = 0;
|
|
||||||
for (int i = start; i < end; i++) {
|
for (int i = start; i < end; i++) {
|
||||||
Chunk *chunk = self->chunks[i];
|
Chunk *chunk = self->chunks[i];
|
||||||
// Check If Chunk Is Visible
|
// Check If Chunk Is Visible
|
||||||
@ -94,32 +116,27 @@ static int LevelRenderer_renderChunks_injection(__attribute__((unused)) LevelRen
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Queue
|
// Queue
|
||||||
const int j = total++;
|
const int j = multidraw_total++;
|
||||||
firsts[j] = block->offset / VERTEX_SIZE;
|
multidraw_firsts[j] = block->offset / VERTEX_SIZE;
|
||||||
counts[j] = render_chunk->vertices;
|
multidraw_counts[j] = render_chunk->vertices;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
#ifdef MCPI_USE_GLES1_COMPATIBILITY_LAYER
|
multidraw_renderSameAsLast(self, b);
|
||||||
if (supports_multidraw()) {
|
|
||||||
glMultiDrawArrays(GL_TRIANGLES, firsts, counts, total);
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
for (int i = 0; i < total; i++) {
|
|
||||||
glDrawArrays(GL_TRIANGLES, firsts[i], counts[i]);
|
|
||||||
}
|
|
||||||
#ifdef MCPI_USE_GLES1_COMPATIBILITY_LAYER
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Cleanup
|
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
|
||||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
||||||
glPopMatrix();
|
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return total;
|
return multidraw_total;
|
||||||
|
}
|
||||||
|
|
||||||
|
// API
|
||||||
|
static bool use_multidraw = false;
|
||||||
|
void LevelRenderer_renderSameAsLast(LevelRenderer *self, const float delta) {
|
||||||
|
if (use_multidraw) {
|
||||||
|
multidraw_renderSameAsLast(self, delta);
|
||||||
|
} else {
|
||||||
|
self->render_list.render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
@ -131,5 +148,6 @@ void init_multidraw() {
|
|||||||
overwrite_calls(LevelRenderer_renderChunks, LevelRenderer_renderChunks_injection);
|
overwrite_calls(LevelRenderer_renderChunks, LevelRenderer_renderChunks_injection);
|
||||||
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||||
patch((void *) 0x479fc, nop_patch);
|
patch((void *) 0x479fc, nop_patch);
|
||||||
|
use_multidraw = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,7 +17,7 @@ HOOK(access, int, (const char *pathname, int mode)) {
|
|||||||
char *new_path = override_get_path(pathname);
|
char *new_path = override_get_path(pathname);
|
||||||
// Open File
|
// Open File
|
||||||
ensure_access();
|
ensure_access();
|
||||||
int ret = real_access(new_path != nullptr ? new_path : pathname, mode);
|
const int ret = real_access(new_path != nullptr ? new_path : pathname, mode);
|
||||||
// Free Data
|
// Free Data
|
||||||
if (new_path != nullptr) {
|
if (new_path != nullptr) {
|
||||||
free(new_path);
|
free(new_path);
|
||||||
|
@ -28,6 +28,7 @@ set(SRC
|
|||||||
src/network/packet/Packet.def
|
src/network/packet/Packet.def
|
||||||
src/network/packet/StartGamePacket.def
|
src/network/packet/StartGamePacket.def
|
||||||
src/network/packet/ChatPacket.def
|
src/network/packet/ChatPacket.def
|
||||||
|
src/network/packet/PlayerActionPacket.def
|
||||||
src/entity/EntityFactory.def
|
src/entity/EntityFactory.def
|
||||||
src/entity/PrimedTnt.def
|
src/entity/PrimedTnt.def
|
||||||
src/entity/CameraEntity.def
|
src/entity/CameraEntity.def
|
||||||
|
@ -19,6 +19,9 @@ virtual-method bool isItemEntity() = 0xec;
|
|||||||
virtual-method bool isHangingEntity() = 0xf0;
|
virtual-method bool isHangingEntity() = 0xf0;
|
||||||
// The owner entity id for arrows/throwables, else 0
|
// The owner entity id for arrows/throwables, else 0
|
||||||
virtual-method int getAuxData() = 0xf4;
|
virtual-method int getAuxData() = 0xf4;
|
||||||
|
virtual-method bool isOnFire() = 0x90;
|
||||||
|
virtual-method void baseTick() = 0x38;
|
||||||
|
virtual-method bool isSneaking() = 0x88;
|
||||||
|
|
||||||
property float x = 0x4;
|
property float x = 0x4;
|
||||||
property float y = 0x8;
|
property float y = 0x8;
|
||||||
@ -37,9 +40,12 @@ property float old_yaw = 0x48;
|
|||||||
property float old_pitch = 0x4c;
|
property float old_pitch = 0x4c;
|
||||||
property AABB hitbox = 0x50;
|
property AABB hitbox = 0x50;
|
||||||
property float height_offset = 0x68;
|
property float height_offset = 0x68;
|
||||||
|
property float hitbox_width = 0x6c;
|
||||||
|
property float hitbox_height = 0x70;
|
||||||
property int fire_timer = 0xa0;
|
property int fire_timer = 0xa0;
|
||||||
property int renderer_id = 0xa8;
|
property int renderer_id = 0xa8;
|
||||||
property bool on_ground = 0xb2;
|
property bool on_ground = 0xb2;
|
||||||
property bool pending_removal = 0xb8;
|
property bool pending_removal = 0xb8;
|
||||||
property bool freeze_physics = 0xb9;
|
property bool freeze_physics = 0xb9;
|
||||||
property float fall_distance = 0xac;
|
property float fall_distance = 0xac;
|
||||||
|
property bool fire_immune = 0xc6;
|
@ -5,3 +5,5 @@ method void render(Entity *entity, float x, float y, float z, float rot, float u
|
|||||||
static-method EntityRenderDispatcher *getInstance() = 0x60e90;
|
static-method EntityRenderDispatcher *getInstance() = 0x60e90;
|
||||||
|
|
||||||
property ItemInHandRenderer *item_renderer = 0x0;
|
property ItemInHandRenderer *item_renderer = 0x0;
|
||||||
|
property float player_rot_y = 0x14;
|
||||||
|
property Minecraft *minecraft = 0xc;
|
@ -9,6 +9,11 @@ virtual-method void die(Entity *cause) = 0x130;
|
|||||||
virtual-method ItemInstance *getCarriedItem() = 0x1ac;
|
virtual-method ItemInstance *getCarriedItem() = 0x1ac;
|
||||||
virtual-method void updateAi() = 0x1cc;
|
virtual-method void updateAi() = 0x1cc;
|
||||||
virtual-method float getWalkingSpeedModifier() = 0x1e8;
|
virtual-method float getWalkingSpeedModifier() = 0x1e8;
|
||||||
|
virtual-method void aiStep() = 0x180;
|
||||||
|
|
||||||
|
method bool getSharedFlag(int flag) = 0x81fd8;
|
||||||
|
method void setSharedFlag(int flag, bool value) = 0x81ef8;
|
||||||
|
|
||||||
property int health = 0xec;
|
property int health = 0xec;
|
||||||
property std::string texture = 0xb54;
|
property std::string texture = 0xb54;
|
||||||
|
property Random random = 0x138;
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
method int width(const std::string &string) = 0x24d4c;
|
method int width(const std::string &string) = 0x24d4c;
|
||||||
method void draw(const std::string &string, float x, float y, uint color) = 0x250e0;
|
method void draw(const std::string &string, float x, float y, uint color) = 0x250e0;
|
||||||
|
method void drawShadow(const std::string &string, float x, float y, uint color) = 0x250ec;
|
@ -47,6 +47,8 @@ method bool getSignal(int x, int y, int z, int direction) = 0xa5e6c;
|
|||||||
method bool hasDirectSignal(int x, int y, int z) = 0xa5d88;
|
method bool hasDirectSignal(int x, int y, int z) = 0xa5d88;
|
||||||
// Called by hasDirectSignal
|
// Called by hasDirectSignal
|
||||||
method bool getDirectSignal(int x, int y, int z, int direction) = 0xa5d2c;
|
method bool getDirectSignal(int x, int y, int z, int direction) = 0xa5d2c;
|
||||||
|
method bool canSeeSky(int x, int y, int z) = 0xa39b8;
|
||||||
|
method bool isDay() = 0xa3d9c;
|
||||||
|
|
||||||
virtual-method void tick() = 0x28;
|
virtual-method void tick() = 0x28;
|
||||||
virtual-method void updateSleepingPlayerList() = 0x2c;
|
virtual-method void updateSleepingPlayerList() = 0x2c;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
method void tick() = 0x4da1c;
|
method void tick() = 0x4da1c;
|
||||||
method void render(Mob *mob, int param_1, float delta) = 0x4f710;
|
method int render(Mob *mob, int param_1, float delta) = 0x4f710;
|
||||||
method void renderDebug(const AABB &aabb, float delta) = 0x4d310;
|
method void renderDebug(const AABB &aabb, float delta) = 0x4d310;
|
||||||
method void generateSky() = 0x4d0d4;
|
method void generateSky() = 0x4d0d4;
|
||||||
method void renderHitSelect(Player *player, const HitResult &hit_result, int i, void *vp, float f) = 0x4e318;
|
method void renderHitSelect(Player *player, const HitResult &hit_result, int i, void *vp, float f) = 0x4e318;
|
||||||
|
@ -6,3 +6,4 @@ static-method float cos(float x) = 0x77728;
|
|||||||
static-method float abs(float x) = 0x7781c;
|
static-method float abs(float x) = 0x7781c;
|
||||||
static-method float min(float a, float b) = 0x7782c;
|
static-method float min(float a, float b) = 0x7782c;
|
||||||
static-method float invSqrt(float a) = 0x776d4;
|
static-method float invSqrt(float a) = 0x776d4;
|
||||||
|
static-method int floor(float x) = 0x7770c;
|
@ -5,3 +5,4 @@ virtual-method void levelGenerated(Level *level) = 0x0;
|
|||||||
virtual-method void onDisconnect(const RakNet_RakNetGUID &guid) = 0x18;
|
virtual-method void onDisconnect(const RakNet_RakNetGUID &guid) = 0x18;
|
||||||
virtual-method void handle_SignUpdatePacket(const RakNet_RakNetGUID &guid, SignUpdatePacket *packet) = 0xcc;
|
virtual-method void handle_SignUpdatePacket(const RakNet_RakNetGUID &guid, SignUpdatePacket *packet) = 0xcc;
|
||||||
virtual-method void handle_ChatPacket(const RakNet_RakNetGUID &rak_net_guid, ChatPacket *packet) = 0xc8;
|
virtual-method void handle_ChatPacket(const RakNet_RakNetGUID &rak_net_guid, ChatPacket *packet) = 0xc8;
|
||||||
|
virtual-method void handle_PlayerActionPacket(const RakNet_RakNetGUID &rak_net_guid, PlayerActionPacket *packet) = 0xa0;
|
||||||
|
@ -6,4 +6,5 @@ method Player *getPlayer(const RakNet_RakNetGUID &guid) = 0x75464;
|
|||||||
method Player *popPendingPlayer(const RakNet_RakNetGUID &guid) = 0x75db4;
|
method Player *popPendingPlayer(const RakNet_RakNetGUID &guid) = 0x75db4;
|
||||||
method void displayGameMessage(const std::string &message) = 0x750c4;
|
method void displayGameMessage(const std::string &message) = 0x750c4;
|
||||||
|
|
||||||
|
property Level *level = 0xc;
|
||||||
property Minecraft *minecraft = 0x8;
|
property Minecraft *minecraft = 0x8;
|
||||||
|
7
symbols/src/network/packet/PlayerActionPacket.def
Normal file
7
symbols/src/network/packet/PlayerActionPacket.def
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
extends Packet;
|
||||||
|
|
||||||
|
size 0x24;
|
||||||
|
vtable 0x102dd8;
|
||||||
|
|
||||||
|
property int action = 0x1c;
|
||||||
|
property int entity_id = 0x20;
|
Loading…
Reference in New Issue
Block a user