Skip to content

Commit

Permalink
fix: fix IConstBlockSource #1499
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Mar 27, 2024
1 parent 175d148 commit fa1f97d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/ll/test/EventTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@
#include "ll/api/event/player/PlayerSwingEvent.h"
#include "ll/api/event/player/PlayerUseItemEvent.h"
#include "ll/api/event/player/PlayerUseItemOnEvent.h"
#include "ll/api/event/world/BlockChangedEvent.h"
#include "ll/api/event/world/SpawnMobEvent.h"
#include "ll/api/io/FileUtils.h"
#include "mc/codebuilder/MCRESULT.h"
#include "mc/nbt/CompoundTag.h"
#include "mc/world/actor/ActorDamageSource.h"
#include "mc/world/item/registry/ItemStack.h"
#include "mc/world/level/dimension/Dimension.h"


#include "ll/api/base/FixedString.h"

Expand Down Expand Up @@ -229,4 +232,9 @@ LL_AUTO_TYPE_INSTANCE_HOOK(
bus.addListener(dl, getEventId<PlayerDestroyBlockEvent>);
bus.addListener(dl, getEventId<PlayerPlacingBlockEvent>);
// bus.addListener(dl, getEventId<SpawnedMobEvent>);

bus.emplaceListener<BlockChangedEvent>([](BlockChangedEvent& ev) {
ll::logger
.debug("Block Changed Pos: {} Dimension: {}", ev.pos().toString(), ev.blockSource().getDimensionId().id);
});
}
22 changes: 14 additions & 8 deletions src/mc/world/level/IConstBlockSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,41 @@ class IConstBlockSource {
// vIndex: 12, symbol: ?getMaterial@BlockSource@@UEBAAEBVMaterial@@HHH@Z
virtual class Material const& getMaterial(int, int, int) const = 0;

// vIndex: 13, symbol: ?hasChunksAt@BlockSource@@UEBA_NAEBUBounds@@_N@Z
// vIndex: 13, symbol: ?hasBorderBlock@BlockSource@@UEBA_NVBlockPos@@@Z
virtual bool hasBorderBlock(class BlockPos pos) const;

// vIndex: 14, symbol: ?getChunkAt@BlockSource@@UEBAPEAVLevelChunk@@AEBVBlockPos@@@Z
virtual class LevelChunk* getChunkAt(class BlockPos const& pos) const;

// vIndex: 15, symbol: ?hasChunksAt@BlockSource@@UEBA_NAEBUBounds@@_N@Z
virtual bool hasChunksAt(struct Bounds const&, bool) const = 0;

// vIndex: 14, symbol: ?hasChunksAt@BlockSource@@UEBA_NAEBVBlockPos@@H_N@Z
// vIndex: 16, symbol: ?hasChunksAt@BlockSource@@UEBA_NAEBVBlockPos@@H_N@Z
virtual bool hasChunksAt(class BlockPos const&, int, bool) const = 0;

// vIndex: 15, symbol: ?hasChunksAt@BlockSource@@UEBA_NAEBVAABB@@_N@Z
// vIndex: 17, symbol: ?hasChunksAt@BlockSource@@UEBA_NAEBVAABB@@_N@Z
virtual bool hasChunksAt(class AABB const&, bool) const = 0;

// vIndex: 16, symbol: ?getDimensionId@BlockSource@@UEBA?AV?$AutomaticID@VDimension@@H@@XZ
// vIndex: 18, symbol: ?getDimensionId@BlockSource@@UEBA?AV?$AutomaticID@VDimension@@H@@XZ
virtual DimensionType getDimensionId() const = 0;

// vIndex: 17, symbol:
// vIndex: 19, symbol:
// ?fetchAABBs@BlockSource@@UEBAXAEAV?$vector@VAABB@@V?$allocator@VAABB@@@std@@@std@@AEBVAABB@@_N@Z
virtual void fetchAABBs(std::vector<class AABB>&, class AABB const&, bool) const = 0;

// vIndex: 18, symbol:
// vIndex: 20, symbol:
// ?fetchCollisionShapes@BlockSource@@UEBAXAEAV?$vector@VAABB@@V?$allocator@VAABB@@@std@@@std@@AEBVAABB@@_NV?$optional_ref@$$CBVGetCollisionShapeInterface@@@@@Z
virtual void
fetchCollisionShapes(std::vector<class AABB>&, class AABB const&, bool, class optional_ref<class GetCollisionShapeInterface const>)
const = 0;

// vIndex: 19, symbol:
// vIndex: 21, symbol:
// ?getTallestCollisionShape@BlockSource@@UEBA?AVAABB@@AEBV2@PEAM_NV?$optional_ref@$$CBVGetCollisionShapeInterface@@@@@Z
virtual class AABB
getTallestCollisionShape(class AABB const&, float*, bool, class optional_ref<class GetCollisionShapeInterface const>)
const = 0;

// vIndex: 20, symbol: ?getBrightness@BlockSource@@UEBAMAEBVBlockPos@@@Z
// vIndex: 22, symbol: ?getBrightness@BlockSource@@UEBAMAEBVBlockPos@@@Z
virtual float getBrightness(class BlockPos const&) const = 0;

// symbol: ?checkMaterial@IConstBlockSource@@QEBA_NAEBVAABB@@W4MaterialType@@@Z
Expand Down

0 comments on commit fa1f97d

Please sign in to comment.