diff --git a/package-lock.json b/package-lock.json index 8a84c2a..bf8fad0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@bdsx/bdsx-lxl", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 5803e1d..70bb6ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bdsx/bdsx-lxl", - "version": "1.1.0", + "version": "1.1.1", "description": "LiteXLoader ported into BDSX", "main": "index.js", "keywords": [], diff --git a/src/api/event.ts b/src/api/event.ts index 557c942..aef81a1 100644 --- a/src/api/event.ts +++ b/src/api/event.ts @@ -526,39 +526,26 @@ events.playerDropItem.on(event => { }); } { + let doors: Block[]; + bedrockServer.afterOpen().then(()=> { + doors = [ + daccess(MCAPI.VanillaBlocks.mWoodenDoor, Block.ref()), + daccess(MCAPI.VanillaBlocks.mWoodenDoorSpruce, Block.ref()), + daccess(MCAPI.VanillaBlocks.mWoodenDoorBirch, Block.ref()), + daccess(MCAPI.VanillaBlocks.mWoodenDoorJungle, Block.ref()), + daccess(MCAPI.VanillaBlocks.mWoodenDoorAcacia, Block.ref()), + daccess(MCAPI.VanillaBlocks.mWoodenDoorDarkOak, Block.ref()), + daccess(MCAPI.VanillaBlocks.mIronDoor, Block.ref()), + daccess(MCAPI.VanillaBlocks.mCrimsonDoor, Block.ref()), + daccess(MCAPI.VanillaBlocks.mWarpedDoor, Block.ref()), + ]; + }); + const original = symhook("?_useOn@DoorItem@@EEBA_NAEAVItemStack@@AEAVActor@@VBlockPos@@EAEBVVec3@@@Z", bool_t, null, StaticPointer, ItemStack, Actor, BlockPos, uint8_t, Vec3) ((thiz, instance, entity, pos, face, clickPos) => { if (entity.isPlayer()) { - let block!: Block; - switch (daccess(thiz, int32_t, 552)) { - case 0: - block = Block.constructWith("minecraft:wooden_door")!; - break; - case 1: - block = Block.constructWith("minecraft:spruce_door")!; - break; - case 2: - block = Block.constructWith("minecraft:birch_door")!; - break; - case 3: - block = Block.constructWith("minecraft:jungle_door")!; - break; - case 4: - block = Block.constructWith("minecraft:acacia_door")!; - break; - case 5: - block = Block.constructWith("minecraft:dark_oak_door")!; - break; - case 6: - block = Block.constructWith("minecraft:iron_door")!; - break; - case 7: - block = Block.constructWith("minecraft:crimson_door")!; - break; - case 8: - block = Block.constructWith("minecraft:warped_door")!; - } + const block = doors[daccess(thiz, int32_t, 552)]; if (!block) { return false; } diff --git a/src/dep/native.ts b/src/dep/native.ts index 6ea6f47..53608a1 100644 --- a/src/dep/native.ts +++ b/src/dep/native.ts @@ -215,6 +215,16 @@ const RVAs = pdb.getList(path.join(__dirname, "pdb.ini"), {}, [ // TridentItem "?releaseUsing@TridentItem@@UEBAXAEAVItemStack@@PEAVPlayer@@H@Z", // VanillaBlocks + "?mWoodenDoor@VanillaBlocks@@3PEBVBlock@@EB", + "?mWoodenDoorSpruce@VanillaBlocks@@3PEBVBlock@@EB", + "?mWoodenDoorBirch@VanillaBlocks@@3PEBVBlock@@EB", + "?mWoodenDoorJungle@VanillaBlocks@@3PEBVBlock@@EB", + "?mWoodenDoorAcacia@VanillaBlocks@@3PEBVBlock@@EB", + "?mWoodenDoorDarkOak@VanillaBlocks@@3PEBVBlock@@EB", + "?mIronDoor@VanillaBlocks@@3PEBVBlock@@EB", + "?mCrimsonDoor@VanillaBlocks@@3PEBVBlock@@EB", + "?mWarpedDoor@VanillaBlocks@@3PEBVBlock@@EB", + "?mWallSign@VanillaBlocks@@3PEBVBlock@@EB", "?mSign@VanillaBlocks@@3PEBVBlock@@EB", "?mSpruceWallSign@VanillaBlocks@@3PEBVBlock@@EB", @@ -513,6 +523,16 @@ export namespace MCAPI { } } export namespace VanillaBlocks { + export const mWoodenDoor = dlsym("?mWoodenDoor@VanillaBlocks@@3PEBVBlock@@EB"); + export const mWoodenDoorSpruce = dlsym("?mWoodenDoorSpruce@VanillaBlocks@@3PEBVBlock@@EB"); + export const mWoodenDoorBirch = dlsym("?mWoodenDoorBirch@VanillaBlocks@@3PEBVBlock@@EB"); + export const mWoodenDoorJungle = dlsym("?mWoodenDoorJungle@VanillaBlocks@@3PEBVBlock@@EB"); + export const mWoodenDoorAcacia = dlsym("?mWoodenDoorAcacia@VanillaBlocks@@3PEBVBlock@@EB"); + export const mWoodenDoorDarkOak = dlsym("?mWoodenDoorDarkOak@VanillaBlocks@@3PEBVBlock@@EB"); + export const mIronDoor = dlsym("?mIronDoor@VanillaBlocks@@3PEBVBlock@@EB"); + export const mCrimsonDoor = dlsym("?mCrimsonDoor@VanillaBlocks@@3PEBVBlock@@EB"); + export const mWarpedDoor = dlsym("?mWarpedDoor@VanillaBlocks@@3PEBVBlock@@EB"); + export const mWallSign = dlsym("?mWallSign@VanillaBlocks@@3PEBVBlock@@EB"); export const mSign = dlsym("?mSign@VanillaBlocks@@3PEBVBlock@@EB"); export const mSpruceWallSign = dlsym("?mSpruceWallSign@VanillaBlocks@@3PEBVBlock@@EB"); diff --git a/src/dep/pdb.ini b/src/dep/pdb.ini index be7aaa9..3a6217d 100644 --- a/src/dep/pdb.ini +++ b/src/dep/pdb.ini @@ -143,3 +143,12 @@ ?releaseUsing@TridentItem@@UEBAXAEAVItemStack@@PEAVPlayer@@H@Z = 0x1363E10 ?resetPlayerLevel@Player@@QEAAXXZ = 0xCA8A20 ?maintainOldData@TransformationComponent@@QEAAXAEAVActor@@0AEBUTransformationDescription@@AEBUActorUniqueID@@AEBVLevel@@@Z = 0x8BB8F0 +?mWoodenDoorDarkOak@VanillaBlocks@@3PEBVBlock@@EB = 0x229EC18 +?mWoodenDoorJungle@VanillaBlocks@@3PEBVBlock@@EB = 0x229EC08 +?mWoodenDoorAcacia@VanillaBlocks@@3PEBVBlock@@EB = 0x229EC10 +?mWoodenDoorSpruce@VanillaBlocks@@3PEBVBlock@@EB = 0x229EBF8 +?mWoodenDoorBirch@VanillaBlocks@@3PEBVBlock@@EB = 0x229EC00 +?mCrimsonDoor@VanillaBlocks@@3PEBVBlock@@EB = 0x229F538 +?mWoodenDoor@VanillaBlocks@@3PEBVBlock@@EB = 0x229E7D8 +?mWarpedDoor@VanillaBlocks@@3PEBVBlock@@EB = 0x229F540 +?mIronDoor@VanillaBlocks@@3PEBVBlock@@EB = 0x229E810