Add Cake #81

Merged
TheBrokenRail merged 22 commits from bigjango13/minecraft-pi-reborn:master into master 2024-02-07 06:47:47 +00:00
9 changed files with 35 additions and 3 deletions
Showing only changes of commit bf1dea322a - Show all commits

View File

@ -31,6 +31,7 @@ set(SRC
src/entity/PrimedTnt.def
src/entity/CameraEntity.def
src/entity/EntityRenderer.def
src/entity/ItemSpriteRenderer.def
src/entity/Sheep.def
src/entity/PathfinderMob.def
src/entity/HumanoidModel.def
@ -50,6 +51,7 @@ set(SRC
src/entity/Entity.def
src/entity/ItemEntity.def
src/entity/Arrow.def
src/entity/Throwable.def
src/level/container/FillingContainer.def
src/level/container/Container.def
src/level/container/ContainerMenu.def
@ -133,6 +135,7 @@ set(SRC
src/misc/SoundEngine.def
src/misc/Common.def
src/misc/Config.def
src/misc/Random.def
src/input/IMoveInput.def
src/input/IBuildInput.def
src/input/MouseBuildInput.def

View File

@ -1,12 +1,15 @@
virtual-method void remove() = 0x10;
virtual-method void tick() = 0x34;
virtual-method bool hurt(Entity *attacker, int damage) = 0xa4;
virtual-method int getEntityTypeId() = 0xdc;
method void moveTo(float x, float y, float z, float pitch, float yaw) = 0x7a834;
method void moveTo(float x, float y, float z, float yaw, float pitch) = 0x7a834;
property float x = 0x4;
property float y = 0x8;
property float z = 0xc;
property int id = 0x1c;
property Level *level = 0x24;
property float old_x = 0x28;
property float old_y = 0x2c;
property float old_z = 0x30;
@ -20,5 +23,6 @@ property float old_pitch = 0x4c;
property float head_height = 0x68;
property float hitbox_width = 0x6c;
property float hitbox_height = 0x70;
property int renderer_id = 0xa8;
property bool on_ground = 0xb2;
property bool freeze_physics = 0xb9;

View File

@ -1,2 +1,3 @@
constructor () = 0x6096c;
method void assign(uchar entity_id, EntityRenderer *renderer) = 0x6094c;

View File

@ -0,0 +1,5 @@
extends EntityRenderer;
size 0x10;
constructor (int texture) = 0x64078;

View File

@ -0,0 +1,11 @@
extends Entity;
size 0xf4;
vtable 0x10dcb8;
vtable-size 0x13c;
constructor (Level *level, Entity *thrower) = 0x8ccf0;
virtual-method void onHit(HitResult *res) = 0x138;
property int thrower_id = 0xd8;

View File

@ -10,3 +10,4 @@ method ItemInstance *getArmor(int slot) = 0x8fda4;
property std::string username = 0xbf4;
property Inventory *inventory = 0xbe0;
property bool infinite_items = 0xbff;

View File

@ -14,10 +14,13 @@ virtual-method void setDescriptionId(std::string *name) = 0x6c;
virtual-method std::string getDescriptionId(ItemInstance *item_instance) = 0x7c;
bigjango13 marked this conversation as resolved
Review

This seems wrong. According to Ghidra, this function's signature is Item::useTimeDepleted(ItemInstance*, Level*, Player*) (and of course an extra Item *self).

It could be returning a structure, IIRC if a function returns a structure, the caller allocates the structure and passes a pointer to it as the first argument top the function (like how this is passed) and then the function writes to that pointer. Check out CommandServer::parse in Ghidra.

This seems wrong. According to Ghidra, this function's signature is `Item::useTimeDepleted(ItemInstance*, Level*, Player*)` (and of course an extra `Item *self`). It could be returning a structure, IIRC if a function returns a structure, the caller allocates the structure and passes a pointer to it as the first argument top the function (like how `this` is passed) and then the function writes to that pointer. Check out `CommandServer::parse` in Ghidra.
Review

Hmm, seems like it. it tripped me up because both Item and ItemInstance have the id at 0x4.

Hmm, seems like it. it tripped me up because both Item and ItemInstance have the id at 0x4.
property int id = 0x4;
property bool is_stacked_by_data = 0x19;
property int category = 0x10;
property int max_damage = 0x8;
property int texture = 0xc;
property int category = 0x10;
property int max_stack_size = 0x14;
property bool equipped = 0x18;
property bool is_stacked_by_data = 0x19;
property std::string description_id = 0x20;
// Globals
static-property-array Item *items = 0x17b250;

View File

@ -10,6 +10,7 @@ method void addParticle(std::string *particle, float x, float y, float z, float
method Entity *getEntity(int id) = 0xa45a4;
method bool addEntity(Entity *entity) = 0xa7cbc;
method int getBrightness2(LightLayer *layer, int x, int y, int z) = 0xa3c70;
method void playSound(Entity *entity, std::string *name, float volume, float pitch) = 0xa42a8;
virtual-method void tick() = 0x28;
virtual-method void updateSleepingPlayerList() = 0x2c;

View File

@ -0,0 +1,3 @@
method int genrand_int32() = 0x42cf8;
static-property Random random = 0x17a87c;