Java Light Ramp (Also From ReMCPE)

This commit is contained in:
TheBrokenRail 2024-01-31 23:44:04 -05:00
parent 1771919cc1
commit 6d4ff44092
7 changed files with 30 additions and 2 deletions

View File

@ -51,3 +51,4 @@ TRUE Disable Hostile AI In Creative Mode
TRUE Load Custom Skins TRUE Load Custom Skins
TRUE 3D Chest Model TRUE 3D Chest Model
TRUE Replace Block Highlight With Outline TRUE Replace Block Highlight With Outline
TRUE Use Java Beta 1.3 Light Ramp

View File

@ -545,6 +545,18 @@ static int FurnaceTileEntity_getLitProgress_injection(FurnaceTileEntity *furnace
return ret; return ret;
} }
// Java Light Ramp
static void Dimension_updateLightRamp_injection(Dimension *self) {
// https://github.com/ReMinecraftPE/mcpe/blob/d7a8b6baecf8b3b050538abdbc976f690312aa2d/source/world/level/Dimension.cpp#L92-L105
for (int i = 0; i <= 15; i++) {
float f1 = 1.0f - (((float) i) / 15.0f);
self->light_ramp[i] = ((1.0f - f1) / (f1 * 3.0f + 1.0f)) * (1.0f - 0.1f) + 0.1f;
// Default Light Ramp:
// float fVar4 = 1.0 - ((float) i * 0.0625);
// self->light_ramp[i] = ((1.0 - fVar4) / (fVar4 * 3.0 + 1.0)) * 0.95 + 0.15;
}
}
// Init // Init
static void nop() { static void nop() {
} }
@ -731,6 +743,11 @@ void init_misc() {
unsigned char mov_r3_ff[4] = {0xff, 0x30, 0xa0, 0xe3}; // "mov r3, #0xff" unsigned char mov_r3_ff[4] = {0xff, 0x30, 0xa0, 0xe3}; // "mov r3, #0xff"
patch((void *) 0x7178c, mov_r3_ff); patch((void *) 0x7178c, mov_r3_ff);
// Java Light Ramp
if (feature_has("Use Java Beta 1.3 Light Ramp", server_disabled)) {
overwrite((void *) Dimension_updateLightRamp_non_virtual, (void *) Dimension_updateLightRamp_injection);
}
// Init C++ And Logging // Init C++ And Logging
_init_misc_cpp(); _init_misc_cpp();
_init_misc_logging(); _init_misc_logging();

View File

@ -74,6 +74,8 @@ set(SRC
src/level/LevelData.def src/level/LevelData.def
src/level/LevelSettings.def src/level/LevelSettings.def
src/level/ServerLevel.def src/level/ServerLevel.def
src/level/Dimension.def
src/level/MultiPlayerLevel.def
src/item/ItemRenderer.def src/item/ItemRenderer.def
src/item/ItemInHandRenderer.def src/item/ItemInHandRenderer.def
src/item/AuxDataTileItem.def src/item/AuxDataTileItem.def

View File

@ -0,0 +1,5 @@
vtable 0x110370;
virtual-method void updateLightRamp() = 0x28;
property float light_ramp[16] = 0x10;

View File

@ -1,6 +1,6 @@
extends LevelSource; extends LevelSource;
vtable 0x108de0; vtable 0x10fcf0;
method void saveLevelData() = 0xa2e94; method void saveLevelData() = 0xa2e94;
method void setTileAndData(int x, int y, int z, int id, int data) = 0xa38b4; method void setTileAndData(int x, int y, int z, int id, int data) = 0xa38b4;

View File

@ -0,0 +1,3 @@
extends Level;
vtable 0x108de0;

View File

@ -2,4 +2,4 @@ extends Level;
size 0xb80; size 0xb80;
constructor (uchar *storage, uchar *name, LevelSettings *settings, int param_4, uchar *dimension) = 0x7692c; constructor (uchar *storage, uchar *name, LevelSettings *settings, int param_4, Dimension *dimension) = 0x7692c;