More symbols and clean up "Disable Hostile AI In Creative Mode"
This commit is contained in:
parent
b033912633
commit
f57c0a6190
@ -464,15 +464,17 @@ static int32_t Tile_getColor_injection() {
|
||||
}
|
||||
|
||||
// Disable Hostile AI In Creative Mode
|
||||
#define has_vtable(obj, type) (((void *) obj->vtable) == type##_vtable_base)
|
||||
static Entity *PathfinderMob_findAttackTarget_injection(PathfinderMob *mob) {
|
||||
// Call Original Method
|
||||
Entity *target = mob->vtable->findAttackTarget(mob);
|
||||
|
||||
// Check if hostile
|
||||
if (mob->vtable->getCreatureBaseType(mob) != 1) {
|
||||
return target;
|
||||
}
|
||||
|
||||
// Check If Creative Mode
|
||||
if (target != NULL) {
|
||||
bool is_player = has_vtable(target, Player) || has_vtable(target, LocalPlayer) || has_vtable(target, ServerPlayer) || has_vtable(target, RemotePlayer);
|
||||
if (is_player) {
|
||||
if (target != NULL && target->vtable->isPlayer(target)) {
|
||||
Player *player = (Player *) target;
|
||||
Inventory *inventory = player->inventory;
|
||||
bool is_creative = inventory->is_creative;
|
||||
@ -480,7 +482,6 @@ static Entity *PathfinderMob_findAttackTarget_injection(PathfinderMob *mob) {
|
||||
target = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return
|
||||
return target;
|
||||
|
@ -33,7 +33,6 @@ set(SRC
|
||||
src/entity/CameraEntity.def
|
||||
src/entity/EntityRenderer.def
|
||||
src/entity/ItemSpriteRenderer.def
|
||||
src/entity/Sheep.def
|
||||
src/entity/PathfinderMob.def
|
||||
src/entity/HumanoidModel.def
|
||||
src/entity/TripodCameraRenderer.def
|
||||
@ -43,6 +42,15 @@ set(SRC
|
||||
src/entity/animal/AgableMob.def
|
||||
src/entity/animal/Animal.def
|
||||
src/entity/animal/Cow.def
|
||||
src/entity/animal/Chicken.def
|
||||
src/entity/animal/Pig.def
|
||||
src/entity/animal/Sheep.def
|
||||
src/entity/monster/Creeper.def
|
||||
src/entity/monster/Monster.def
|
||||
src/entity/monster/PigZombie.def
|
||||
src/entity/monster/Skeleton.def
|
||||
src/entity/monster/Spider.def
|
||||
src/entity/monster/Zombie.def
|
||||
src/entity/Mob.def
|
||||
src/entity/player/ServerPlayer.def
|
||||
src/entity/player/Player.def
|
||||
|
@ -1,6 +1,7 @@
|
||||
virtual-method void remove() = 0x10;
|
||||
virtual-method void tick() = 0x34;
|
||||
virtual-method bool interact(Player *with) = 0x6c;
|
||||
virtual-method void playerTouch(Player *player) = 0x70;
|
||||
virtual-method bool isPlayer() = 0x94;
|
||||
virtual-method bool hurt(Entity *attacker, int damage) = 0xa4;
|
||||
// See https://mcpirevival.miraheze.org/wiki/Minecraft:_Pi_Edition_Complete_Entity_List for these two
|
||||
@ -30,9 +31,7 @@ property float yaw = 0x40;
|
||||
property float pitch = 0x44;
|
||||
property float old_yaw = 0x48;
|
||||
property float old_pitch = 0x4c;
|
||||
property float head_height = 0x68;
|
||||
property float hitbox_width = 0x6c;
|
||||
property float hitbox_height = 0x70;
|
||||
property AABB aabb = 0x50;
|
||||
property int renderer_id = 0xa8;
|
||||
property bool on_ground = 0xb2;
|
||||
property bool freeze_physics = 0xb9;
|
||||
|
@ -1,3 +1,7 @@
|
||||
extends Item;
|
||||
extends Entity;
|
||||
|
||||
vtable 0x10c5b0;
|
||||
constructor (Level *level, float x, float y, float z, ItemInstance *item) = 0x86d70;
|
||||
|
||||
property ItemInstance item = 0xd0;
|
||||
property int age = 0xdc;
|
||||
|
@ -7,6 +7,7 @@ constructor (Level *level) = 0x81b80;
|
||||
virtual-method void actuallyHurt(int damage) = 0x16c;
|
||||
virtual-method void die(Entity *cause) = 0x130;
|
||||
virtual-method ItemInstance *getCarriedItem() = 0x1ac;
|
||||
virtual-method void updateAi() = 0x1cc;
|
||||
virtual-method float getWalkingSpeedModifier() = 0x1e8;
|
||||
|
||||
property int health = 0xec;
|
||||
|
@ -1,3 +1,8 @@
|
||||
extends Mob;
|
||||
|
||||
vtable 0x10b218;
|
||||
|
||||
virtual-method Entity *findAttackTarget() = 0x204;
|
||||
|
||||
property int target_id = 0xbe0;
|
||||
property int running_away_timer = 0xbe8;
|
||||
|
@ -1 +1,3 @@
|
||||
extends AgableMob;
|
||||
|
||||
vtable 0x10b588;
|
||||
|
4
symbols/src/entity/animal/Chicken.def
Normal file
4
symbols/src/entity/animal/Chicken.def
Normal file
@ -0,0 +1,4 @@
|
||||
extends Animal;
|
||||
|
||||
vtable 0x10b7d0;
|
||||
constructor (Level *level) = 0x855a0;
|
@ -1,3 +1,4 @@
|
||||
extends Animal;
|
||||
|
||||
vtable 0x10ba38;
|
||||
constructor (Level *level) = 0x857f4;
|
4
symbols/src/entity/animal/Pig.def
Normal file
4
symbols/src/entity/animal/Pig.def
Normal file
@ -0,0 +1,4 @@
|
||||
extends Animal;
|
||||
|
||||
vtable 0x10bc90;
|
||||
constructor (Level *level) = 0x85948;
|
@ -1,3 +1,6 @@
|
||||
extends Animal;
|
||||
|
||||
vtable 0x10bef0;
|
||||
constructor (Level *level) = 0x85da0;
|
||||
|
||||
method void setColor(int color) = 0x86274;
|
4
symbols/src/entity/monster/Creeper.def
Normal file
4
symbols/src/entity/monster/Creeper.def
Normal file
@ -0,0 +1,4 @@
|
||||
extends Monster;
|
||||
|
||||
vtable 0x10ca90;
|
||||
constructor (Level *level) = 0x87fe8;
|
4
symbols/src/entity/monster/Monster.def
Normal file
4
symbols/src/entity/monster/Monster.def
Normal file
@ -0,0 +1,4 @@
|
||||
extends PathfinderMob;
|
||||
|
||||
vtable 0x10cd10;
|
||||
constructor (Level *level) = 0x885c0;
|
4
symbols/src/entity/monster/PigZombie.def
Normal file
4
symbols/src/entity/monster/PigZombie.def
Normal file
@ -0,0 +1,4 @@
|
||||
extends Monster;
|
||||
|
||||
vtable 0x10cf50;
|
||||
constructor (Level *level) = 0x88b4c;
|
4
symbols/src/entity/monster/Skeleton.def
Normal file
4
symbols/src/entity/monster/Skeleton.def
Normal file
@ -0,0 +1,4 @@
|
||||
extends Monster;
|
||||
|
||||
vtable 0x10d208;
|
||||
constructor (Level *level) = 0x89350;
|
4
symbols/src/entity/monster/Spider.def
Normal file
4
symbols/src/entity/monster/Spider.def
Normal file
@ -0,0 +1,4 @@
|
||||
extends Monster;
|
||||
|
||||
vtable 0x10d490;
|
||||
constructor (Level *level) = 0x89618;
|
4
symbols/src/entity/monster/Zombie.def
Normal file
4
symbols/src/entity/monster/Zombie.def
Normal file
@ -0,0 +1,4 @@
|
||||
extends Monster;
|
||||
|
||||
vtable 0x10d8a0;
|
||||
constructor (Level *level) = 0x89cc8;
|
@ -15,6 +15,8 @@ virtual-method ItemInstance useTimeDepleted(ItemInstance *item_instance, Level *
|
||||
virtual-method int getDestorySpeed(ItemInstance *item_instance, Tile *tile) = 0x2c;
|
||||
virtual-method ItemInstance *use(ItemInstance *item_instance, Level *level, Player *player) = 0x30;
|
||||
virtual-method bool mineBlock(ItemInstance *instance, int tile_id, int x, int y, int z) = 0x48;
|
||||
// Not just enemy, but any entity
|
||||
virtual-method void interactEnemy(ItemInstance *item_instance, Mob *mob) = 0x54;
|
||||
virtual-method bool isFood() = 0x64;
|
||||
virtual-method bool isArmor() = 0x68;
|
||||
virtual-method void setDescriptionId(std::string *name) = 0x6c;
|
||||
|
@ -11,6 +11,10 @@ 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;
|
||||
// Searches aabb for entities of type type_id, adds then to buff, returns the number of entities added
|
||||
method int getEntitiesOfType(int type_id, AABB *aabb, std::vector<Entity*> *buff) = 0xa612c;
|
||||
// Searches aabb for entities of base type base_type, adds then to buff, returns the number of entities added
|
||||
method int getEntitiesOfClass(int base_type, AABB *aabb, std::vector<Entity*> *buff) = 0xa6240;
|
||||
|
||||
virtual-method void tick() = 0x28;
|
||||
virtual-method void updateSleepingPlayerList() = 0x2c;
|
||||
|
Loading…
Reference in New Issue
Block a user