From 8f23ac1ee1835872153fad1e02dcd6e044b14b89 Mon Sep 17 00:00:00 2001 From: Cube1ber <202843220+cube-one-ber@users.noreply.github.com> Date: Sat, 17 Oct 2026 12:16:33 +0100 Subject: [PATCH 1/3] Reconstruct NBT, streams and core helpers --- data/data_symbols.csv | 50 +- data/mcswitch_functions.csv | 572 +++++++++--------- src/4JLibraries_Source/fui/fui.cpp | 4 +- src/4JLibraries_Source/fui/fuiFile.h | 128 +++- src/4JLibraries_Source/fui/fuiSymbol.h | 10 +- src/DecompUtils.h | 14 + .../com/mojang/nbt/ByteArrayTag.cpp | 5 +- .../com/mojang/nbt/ByteTag.cpp | 2 +- src/Minecraft.Client/com/mojang/nbt/ByteTag.h | 2 +- .../com/mojang/nbt/CompoundTag.cpp | 203 ++++++- .../com/mojang/nbt/CompoundTag.h | 23 +- .../com/mojang/nbt/CompoundTagKeys.cpp | 12 + .../com/mojang/nbt/DoubleTag.cpp | 2 +- .../com/mojang/nbt/DoubleTag.h | 2 +- .../com/mojang/nbt/EndTag.cpp | 2 + .../com/mojang/nbt/FloatTag.cpp | 2 +- .../com/mojang/nbt/FloatTag.h | 2 +- .../com/mojang/nbt/IntArrayTag.cpp | 4 +- .../com/mojang/nbt/IntTag.cpp | 2 +- src/Minecraft.Client/com/mojang/nbt/IntTag.h | 2 +- .../com/mojang/nbt/ListTag.cpp | 47 +- src/Minecraft.Client/com/mojang/nbt/ListTag.h | 10 + .../com/mojang/nbt/ListTagNumeric.cpp | 20 + .../com/mojang/nbt/ListTagSet.cpp | 21 + .../com/mojang/nbt/LongTag.cpp | 4 +- src/Minecraft.Client/com/mojang/nbt/LongTag.h | 6 +- src/Minecraft.Client/com/mojang/nbt/NbtIo.cpp | 63 +- .../com/mojang/nbt/NbtIoStreams.cpp | 55 ++ .../com/mojang/nbt/NbtUtils.cpp | 35 ++ .../com/mojang/nbt/NbtUtils.h | 10 + .../com/mojang/nbt/NumericTag.cpp | 3 + .../com/mojang/nbt/NumericTag.h | 3 +- .../com/mojang/nbt/ShortTag.cpp | 2 +- .../com/mojang/nbt/ShortTag.h | 2 +- .../com/mojang/nbt/StringTag.cpp | 32 + .../com/mojang/nbt/StringTag.h | 1 + src/Minecraft.Client/com/mojang/nbt/Tag.cpp | 3 + src/Minecraft.Client/com/mojang/nbt/Tag.h | 9 +- .../net/minecraft/client/CMinecraftApp.h | 2 + .../net/minecraft/client/color/ColourTable.h | 15 + .../client/multiplayer/ClientChunkCache.h | 2 +- .../renderer/texture/TextureAtlasSprite.h | 13 +- .../net/minecraft/core/BlockPos.cpp | 17 +- .../net/minecraft/core/BlockPos.h | 5 +- .../net/minecraft/core/BlockPosBasics.cpp | 28 + .../net/minecraft/core/BlockPosPacking.cpp | 17 + .../net/minecraft/core/Direction.cpp | 23 +- .../net/minecraft/core/Direction.h | 13 + .../net/minecraft/core/MutableBlockPos.cpp | 2 + .../net/minecraft/core/MutableBlockPos.h | 3 + .../net/minecraft/core/NonNullList.h | 32 +- .../net/minecraft/core/StringHash.cpp | 20 + .../net/minecraft/core/System.cpp | 24 +- .../net/minecraft/core/System.h | 21 +- .../net/minecraft/core/SystemClock.cpp | 44 ++ .../minecraft/core/TreePositionHelpers.cpp | 25 + .../net/minecraft/core/Vec3i.cpp | 12 + .../net/minecraft/core/Vec3i.h | 2 + .../minecraft/resources/ResourceLocation.h | 15 +- .../server/level/ServerChunkCache.cpp | 11 +- .../minecraft/server/level/ServerChunkCache.h | 2 +- .../java/io/ByteArrayInputStream.cpp | 11 + .../java/io/ByteArrayInputStream.h | 1 + .../java/io/ByteArrayOutputStream.cpp | 10 +- src/Minecraft.World/java/io/DataInput.cpp | 3 + src/Minecraft.World/java/io/DataInput.h | 10 +- .../java/io/DataInputStream.cpp | 211 +++++++ src/Minecraft.World/java/io/DataInputStream.h | 12 +- .../java/io/DataInputStreamCompressedNbt.cpp | 22 + .../java/io/DataInputStreamNbt.cpp | 13 + .../java/io/DataInputStreamProtocol.cpp | 25 + src/Minecraft.World/java/io/DataOutput.cpp | 4 + .../java/io/DataOutputStream.cpp | 86 +++ .../java/io/DataOutputStream.h | 5 +- .../java/io/DataOutputStreamNbt.cpp | 13 + .../java/io/DataOutputStreamProtocol.cpp | 19 + src/Minecraft.World/java/io/File.cpp | 69 +++ src/Minecraft.World/java/io/File.h | 20 +- .../java/io/FileInputStream.cpp | 81 +++ src/Minecraft.World/java/io/FileInputStream.h | 18 +- .../java/io/FileOutputStream.cpp | 42 ++ .../java/io/FileOutputStream.h | 6 +- src/Minecraft.World/java/io/FilePaths.cpp | 29 + src/Minecraft.World/java/io/IntCache.h | 10 +- src/Minecraft.World/java/io/JavaLong.h | 5 + .../java/io/SwitchFileStubs.cpp | 11 + .../net/minecraft/util/Mth.cpp | 156 ++++- src/Minecraft.World/net/minecraft/util/Mth.h | 13 +- .../net/minecraft/util/MthCeil.cpp | 6 + .../net/minecraft/util/MthFloor.cpp | 9 + .../net/minecraft/util/MthRound.cpp | 6 + .../net/minecraft/util/StringUtils.cpp | 25 + .../net/minecraft/util/StringUtils.h | 25 + .../net/minecraft/util/datafix/DataFix.h | 11 + .../util/datafix/DataFixLifecycle.cpp | 4 + .../net/minecraft/util/datafix/DataFixTypes.h | 6 + .../net/minecraft/util/datafix/DataFixer.h | 11 + .../minecraft/util/datafix/DataFixerUpper.h | 33 + .../datafix/DataFixerUpperRegistration.cpp | 56 ++ .../util/datafix/DataFixerUpperUpdate.cpp | 44 ++ .../net/minecraft/util/datafix/DataFixers.h | 6 + .../util/datafix/fixes/ItemIdFix.cpp | 321 ++++++++++ .../minecraft/util/datafix/fixes/ItemIdFix.h | 5 +- .../util/datafix/fixes/ItemTagFixes.cpp | 32 + .../util/datafix/fixes/ItemTotemRenameFix.h | 10 + .../util/datafix/fixes/ItemWaterPotionFix.h | 10 + .../datafix/walker/DataFixerItemTraversal.cpp | 23 + .../util/datafix/walker/DataWalker.h | 11 +- .../datafix/walker/DataWalkerLifecycle.cpp | 4 + .../util/datafix/walker/ItemDataWalker.h | 16 + .../util/datafix/walker/ItemDataWalkers.cpp | 18 + .../util/datafix/walker/ItemListDataWalker.h | 17 + .../util/datafix/walker/KeyedDataWalker.cpp | 11 + .../util/datafix/walker/KeyedDataWalker.h | 17 + .../net/minecraft/world/ArrayWithLength.h | 6 + .../net/minecraft/world/Difficulty.h | 6 + .../net/minecraft/world/PlayerUID.h | 8 +- .../net/minecraft/world/Random.h | 6 +- .../net/minecraft/world/entity/Entity.h | 4 + .../net/minecraft/world/entity/LivingEntity.h | 4 +- .../entity/ai/attributes/AttributeModifier.h | 9 + .../minecraft/world/entity/player/Player.h | 7 + .../net/minecraft/world/item/BlockItem.h | 9 +- .../net/minecraft/world/item/Item.cpp | 11 +- .../net/minecraft/world/item/Item.h | 13 +- .../net/minecraft/world/item/ItemInstance.h | 14 +- .../net/minecraft/world/item/Items.h | 2 + .../net/minecraft/world/item/LeadItem.h | 2 + .../net/minecraft/world/level/Level.h | 6 + .../minecraft/world/level/biome/BeachBiome.h | 1 + .../net/minecraft/world/level/biome/Biome.cpp | 6 +- .../net/minecraft/world/level/biome/Biome.h | 24 +- .../world/level/biome/BiomeDecorator.h | 85 +-- .../world/level/biome/BiomeSource.cpp | 12 +- .../minecraft/world/level/biome/DesertBiome.h | 1 + .../world/level/biome/ExtremeHillsBiome.h | 10 +- .../minecraft/world/level/biome/ForestBiome.h | 12 + .../minecraft/world/level/biome/HellBiome.h | 5 + .../minecraft/world/level/biome/IceBiome.h | 10 +- .../minecraft/world/level/biome/JungleBiome.h | 14 +- .../minecraft/world/level/biome/MesaBiome.h | 32 +- .../world/level/biome/MushroomIslandBiome.h | 1 + .../world/level/biome/MutatedForestBiome.h | 6 +- .../world/level/biome/MutatedSavannaBiome.h | 7 +- .../minecraft/world/level/biome/OceanBiome.h | 2 + .../minecraft/world/level/biome/PlainsBiome.h | 9 + .../minecraft/world/level/biome/RiverBiome.h | 1 + .../world/level/biome/SavannaBiome.h | 2 + .../world/level/biome/StoneBeachBiome.h | 1 + .../minecraft/world/level/biome/SwampBiome.h | 9 + .../minecraft/world/level/biome/TaigaBiome.h | 10 + .../minecraft/world/level/biome/TheEndBiome.h | 4 + .../minecraft/world/level/biome/VoidBiome.h | 1 + .../net/minecraft/world/level/block/Block.cpp | 568 ++++++++--------- .../net/minecraft/world/level/block/Block.h | 1 + .../level/block/BlockBootstrapAllocation.h | 22 + .../net/minecraft/world/level/block/Blocks.h | 1 + .../minecraft/world/level/block/CactusBlock.h | 17 +- .../minecraft/world/level/block/ChestBlock.h | 1 + .../world/level/block/ChorusFlowerBlock.h | 17 +- .../minecraft/world/level/block/CocoaBlock.h | 27 +- .../world/level/block/ColoredBlock.h | 1 + .../world/level/block/DoublePlantBlock.h | 21 + .../world/level/block/EndGatewayBlock.h | 18 +- .../minecraft/world/level/block/FlowerBlock.h | 24 +- .../world/level/block/HalfSlabBlock.h | 2 +- .../level/block/HorizontalDirectionalBlock.h | 1 + .../world/level/block/HugeMushroomBlock.h | 14 + .../world/level/block/NewLeafBlock.h | 3 + .../world/level/block/OldLeafBlock.h | 2 + .../minecraft/world/level/block/OreBlock.cpp | 2 +- .../minecraft/world/level/block/PlanksBlock.h | 1 + .../world/level/block/RedSandStoneBlock.h | 1 + .../minecraft/world/level/block/SandBlock.h | 2 + .../world/level/block/SandStoneBlock.h | 1 + .../minecraft/world/level/block/SoundType.h | 15 +- .../minecraft/world/level/block/SpongeBlock.h | 19 +- .../world/level/block/StoneSlabBlock.h | 9 + .../world/level/block/TallGrassBlock.h | 12 +- .../minecraft/world/level/block/TorchBlock.h | 1 + .../minecraft/world/level/block/VineBlock.h | 22 +- .../minecraft/world/level/block/WallBlock.h | 12 + .../level/block/state/BlockStateDefinition.h | 14 +- .../block/state/properties/AbstractProperty.h | 14 +- .../world/level/chunk/ChunkGenerator.h | 3 +- .../minecraft/world/level/chunk/ChunkSource.h | 2 +- .../minecraft/world/level/chunk/LevelChunk.h | 1 + .../levelgen/GenericOverworldLevelSource.h | 2 +- .../level/levelgen/LevelGenerationOptions.h | 6 + .../level/levelgen/NetherFlatLevelSource.cpp | 4 +- .../level/levelgen/NetherFlatLevelSource.h | 2 +- .../level/levelgen/OverworldLevelSource.cpp | 86 +-- .../level/levelgen/OverworldLevelSource.h | 2 +- .../world/level/levelgen/feature/Feature.h | 2 +- .../level/levelgen/feature/FlowerFeature.h | 6 +- .../level/levelgen/feature/LargeFeature.h | 3 +- .../level/levelgen/feature/MineShaftFeature.h | 5 + .../levelgen/feature/MonsterRoomFeature.h | 4 + .../levelgen/feature/OceanMonumentFeature.h | 9 +- .../feature/RandomScatteredLargeFeature.h | 7 +- .../levelgen/feature/StrongholdFeature.h | 6 + .../level/levelgen/feature/StructureFeature.h | 27 +- .../level/levelgen/feature/VillageFeature.h | 9 + .../levelgen/feature/WoodlandMansionFeature.h | 7 + .../level/levelgen/synth/PerlinSimplexNoise.h | 6 +- .../level/newbiome/layer/BiomeInitLayer.cpp | 60 +- .../world/level/newbiome/layer/IntCache.h | 17 +- .../world/level/saveddata/MapItemSavedData.h | 2 +- .../world/level/saveddata/SavedData.h | 2 +- .../world/level/storage/LevelData.cpp | 3 +- .../level/storage/light/SparseLightStorage.h | 39 ++ .../net/minecraft/world/phys/AABB.cpp | 171 +++++- .../net/minecraft/world/phys/AABB.h | 17 + .../net/minecraft/world/phys/AABBClip.cpp | 1 + .../net/minecraft/world/phys/AABBClip.inl | 37 ++ .../net/minecraft/world/phys/HitResult.cpp | 26 + .../net/minecraft/world/phys/HitResult.h | 5 + .../net/minecraft/world/phys/Vec2.cpp | 9 + .../net/minecraft/world/phys/Vec2.h | 32 +- .../net/minecraft/world/phys/Vec3.cpp | 156 ++++- .../net/minecraft/world/phys/Vec3.h | 29 +- .../minecraft/world/stats/GenericStats.cpp | 25 +- .../net/minecraft/world/stats/GenericStats.h | 16 +- src/types.h | 2 +- 224 files changed, 4302 insertions(+), 1142 deletions(-) create mode 100644 src/Minecraft.Client/com/mojang/nbt/CompoundTagKeys.cpp create mode 100644 src/Minecraft.Client/com/mojang/nbt/ListTagNumeric.cpp create mode 100644 src/Minecraft.Client/com/mojang/nbt/ListTagSet.cpp create mode 100644 src/Minecraft.Client/com/mojang/nbt/NbtIoStreams.cpp create mode 100644 src/Minecraft.Client/com/mojang/nbt/NbtUtils.cpp create mode 100644 src/Minecraft.Client/com/mojang/nbt/NbtUtils.h create mode 100644 src/Minecraft.Client/com/mojang/nbt/NumericTag.cpp create mode 100644 src/Minecraft.Client/com/mojang/nbt/StringTag.cpp create mode 100644 src/Minecraft.Client/net/minecraft/core/BlockPosBasics.cpp create mode 100644 src/Minecraft.Client/net/minecraft/core/BlockPosPacking.cpp create mode 100644 src/Minecraft.Client/net/minecraft/core/StringHash.cpp create mode 100644 src/Minecraft.Client/net/minecraft/core/SystemClock.cpp create mode 100644 src/Minecraft.Client/net/minecraft/core/TreePositionHelpers.cpp create mode 100644 src/Minecraft.World/java/io/DataInput.cpp create mode 100644 src/Minecraft.World/java/io/DataInputStream.cpp create mode 100644 src/Minecraft.World/java/io/DataInputStreamCompressedNbt.cpp create mode 100644 src/Minecraft.World/java/io/DataInputStreamNbt.cpp create mode 100644 src/Minecraft.World/java/io/DataInputStreamProtocol.cpp create mode 100644 src/Minecraft.World/java/io/DataOutput.cpp create mode 100644 src/Minecraft.World/java/io/DataOutputStreamNbt.cpp create mode 100644 src/Minecraft.World/java/io/DataOutputStreamProtocol.cpp create mode 100644 src/Minecraft.World/java/io/FileInputStream.cpp create mode 100644 src/Minecraft.World/java/io/FileOutputStream.cpp create mode 100644 src/Minecraft.World/java/io/FilePaths.cpp create mode 100644 src/Minecraft.World/java/io/JavaLong.h create mode 100644 src/Minecraft.World/java/io/SwitchFileStubs.cpp create mode 100644 src/Minecraft.World/net/minecraft/util/MthCeil.cpp create mode 100644 src/Minecraft.World/net/minecraft/util/MthFloor.cpp create mode 100644 src/Minecraft.World/net/minecraft/util/MthRound.cpp create mode 100644 src/Minecraft.World/net/minecraft/util/StringUtils.cpp create mode 100644 src/Minecraft.World/net/minecraft/util/StringUtils.h create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/DataFix.h create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/DataFixLifecycle.cpp create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/DataFixTypes.h create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/DataFixer.h create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpper.h create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperRegistration.cpp create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperUpdate.cpp create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemIdFix.cpp create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTagFixes.cpp create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTotemRenameFix.h create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemWaterPotionFix.h create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/walker/DataFixerItemTraversal.cpp create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/walker/DataWalkerLifecycle.cpp create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalker.h create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalkers.cpp create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/walker/ItemListDataWalker.h create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.cpp create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.h create mode 100644 src/Minecraft.World/net/minecraft/world/level/block/BlockBootstrapAllocation.h create mode 100644 src/Minecraft.World/net/minecraft/world/phys/AABBClip.cpp create mode 100644 src/Minecraft.World/net/minecraft/world/phys/AABBClip.inl diff --git a/data/data_symbols.csv b/data/data_symbols.csv index 0fe1d7e5..1f0f3a3c 100644 --- a/data/data_symbols.csv +++ b/data/data_symbols.csv @@ -1,19 +1,25 @@ +0x000000710036ed18,_ZNK5Vec3i7distSqrERKS_ +0x0000007101070d48,_ZTV18ItemTotemRenameFix +0x0000007101070d98,_ZTV18ItemWaterPotionFix +0x00000071010712d8,_ZTV10DataWalker +0x00000071011172c0,_ZTV14DataFixerUpper +0x000000710111a1e8,_ZTV7DataFix +0x000000710111a218,_ZTV9DataFixer +0x000000710111e7c8,_ZTV14ItemDataWalker +0x000000710111ea30,_ZTV18ItemListDataWalker +0x000000710111ed00,_ZTV15KeyedDataWalker 0x0000007101781BBC,AABB__sThreadStorageCount 0x0000007101781BC0,AABB__sDefaultThreadStorage 0x0000007101781BE0,_ZN6Blocks8RegistryE -0x0000007101781BF8,_ZN6Blocks5CHESTE 0x0000007101781C18,_ZN6Blocks10SNOW_LAYERE 0x0000007101781C20,_ZN6Blocks9HAY_BLOCKE 0x0000007101781C28,_ZN6Blocks5GRASSE 0x0000007101781C40,_ZN6Blocks11LIT_PUMPKINE 0x0000007101781C48,_ZN6Blocks7PUMPKINE -0x0000007101781C50,_ZN6Blocks4DIRTE 0x0000007101781C58,_ZN6Blocks3LOGE 0x0000007101781C60,_ZN6Blocks4LOG2E 0x0000007101781C68,_ZN6Blocks7SAPLINGE 0x0000007101781C70,_ZN6Blocks4VINEE -0x0000007101781C78,_ZN6Blocks14BROWN_MUSHROOME -0x0000007101781C80,_ZN6Blocks12RED_MUSHROOME 0x0000007101781FA8,_ZN6Blocks14CRAFTING_TABLEE 0x0000007101781FB0,_ZN6Blocks7FURNACEE 0x0000007101781FB8,_ZN6Blocks4RAILE @@ -23,8 +29,8 @@ 0x0000007101781FD8,_ZN5Biome10DEEP_OCEANE 0x0000007101781FE0,_ZN5Biome15MUSHROOM_ISLANDE 0x0000007101782068,_ZN6Blocks5ANVILE +0x0000007101782070,_ZN8BlockPos4zeroE 0x00000071017825B8,_ZN6Blocks6PLANKSE -0x00000071017825D0,_ZN6Blocks3AIRE 0x00000071017825D8,_ZN6Blocks3WEBE 0x00000071017825F8,_ZN6Blocks11MELON_BLOCKE 0x0000007101782600,_ZN6Blocks6LADDERE @@ -46,7 +52,6 @@ 0x0000007101782A78,_ZN6Blocks10IRON_BLOCKE 0x0000007101782A80,_ZN6Blocks13STAINED_GLASSE 0x0000007101782A88,_ZN6Blocks18STAINED_GLASS_PANEE -0x0000007101782A90,_ZN6Blocks7BEDROCKE 0x0000007101782AD8,_ZN5Biome6NETHERE 0x0000007101782AE0,_ZN6Blocks11ACACIA_DOORE 0x0000007101782AE8,_ZN6Blocks10BIRCH_DOORE @@ -120,13 +125,6 @@ 0x0000007101783540,_ZN5Biome14MESA_PLATEAU_ME 0x0000007101783548,_ZN5Biome7DEFAULTE 0x0000007101783590,_ZN5Biome17TEMPERATURE_NOISEE -0x00000071017835C8,_ZN6Blocks6GRAVELE -0x00000071017835D0,_ZN6Blocks13YELLOW_FLOWERE -0x00000071017835D8,_ZN6Blocks5STONEE -0x00000071017835E0,_ZN6Blocks8COAL_OREE -0x00000071017835E8,_ZN6Blocks8IRON_OREE -0x00000071017835F0,_ZN6Blocks8GOLD_OREE -0x00000071017835F8,_ZN6Blocks12REDSTONE_OREE 0x0000007101783600,_ZN6Blocks11DIAMOND_OREE 0x0000007101783608,_ZN6Blocks9LAPIS_OREE 0x0000007101783610,_ZN6Blocks8DEADBUSHE @@ -147,7 +145,6 @@ 0x0000007101783750,_ZN6Blocks7LEAVES2E 0x0000007101783770,_ZN11BlockEntity21blockEntityFactoryMapE 0x0000007101783780,_ZN16ResourceLocation8RegistryE -0x00000071017839C8,_ZN6Blocks11COBBLESTONEE 0x00000071017839D0,_ZN6Blocks5WATERE 0x00000071017839D8,_ZN6Blocks4LAVAE 0x00000071017839E0,_ZN6Blocks6SPONGEE @@ -160,11 +157,7 @@ 0x0000007101783A18,_ZN6Blocks17DOUBLE_STONE_SLABE 0x0000007101783A20,_ZN6Blocks10STONE_SLABE 0x0000007101783A28,_ZN6Blocks3TNTE -0x0000007101783A30,_ZN6Blocks17MOSSY_COBBLESTONEE -0x0000007101783A38,_ZN6Blocks8OBSIDIANE -0x0000007101783A40,_ZN6Blocks5TORCHE 0x0000007101783A48,_ZN6Blocks4FIREE -0x0000007101783A50,_ZN6Blocks11MOB_SPAWNERE 0x0000007101783A58,_ZN6Blocks10OAK_STAIRSE 0x0000007101783A60,_ZN6Blocks13REDSTONE_WIREE 0x0000007101783A68,_ZN6Blocks11LIT_FURNACEE @@ -199,7 +192,6 @@ 0x0000007101783B50,_ZN6Blocks10STONEBRICKE 0x0000007101783B58,_ZN6Blocks20BROWN_MUSHROOM_BLOCKE 0x0000007101783B60,_ZN6Blocks18RED_MUSHROOM_BLOCKE -0x0000007101783B68,_ZN6Blocks9IRON_BARSE 0x0000007101783B70,_ZN6Blocks10GLASS_PANEE 0x0000007101783B78,_ZN6Blocks12PUMPKIN_STEME 0x0000007101783B80,_ZN6Blocks10MELON_STEME @@ -261,7 +253,6 @@ 0x0000007101783D40,_ZN6Blocks13ACACIA_STAIRSE 0x0000007101783D48,_ZN6Blocks15DARK_OAK_STAIRSE 0x0000007101783D50,_ZN6Blocks5SLIMEE -0x0000007101783D58,_ZN6Blocks12DOUBLE_PLANTE 0x0000007101783D60,_ZN6Blocks10PRISMARINEE 0x0000007101783D68,_ZN6Blocks13RED_SANDSTONEE 0x0000007101783D70,_ZN6Blocks20RED_SANDSTONE_STAIRSE @@ -323,7 +314,6 @@ 0x0000007101783F30,_ZN6Blocks8CONCRETEE 0x0000007101783F38,_ZN6Blocks15CONCRETE_POWDERE 0x0000007101783F40,_ZN6Blocks15STRUCTURE_BLOCKE -0x0000007101783F98,_ZN17BuiltInLootTables17SPAWN_BONUS_CHESTE 0x00000071017840A8,_ZN17BuiltInLootTables19ABANDONED_MINESHAFTE 0x00000071017840F8,_ZN17BuiltInLootTables14DESERT_PYRAMIDE 0x0000007101784148,_ZN17BuiltInLootTables14DISPENSER_TRAPE @@ -340,8 +330,6 @@ 0x00000071017844B8,_ZN17BuiltInLootTables18VILLAGE_BLACKSMITHE 0x0000007101784508,_ZN17BuiltInLootTables22VILLAGE_TWO_ROOM_HOUSEE 0x0000007101784558,_ZN17BuiltInLootTables16WOODLAND_MANSIONE -0x00000071017860F0,_ZN8DyeColor5WHITEE -0x00000071017860F8,_ZN8DyeColor6YELLOWE 0x0000007101786100,_ZN8DyeColor3REDE 0x0000007101786108,_ZN8DyeColor4PINKE 0x0000007101786110,_ZN8DyeColor6ORANGEE @@ -455,7 +443,6 @@ 0x000000710178A950,_ZN5Items9FIREWORKSE 0x000000710178A9B0,_ZN5Items11FISHING_RODE 0x000000710178AA48,_ZN11FlowerBlock6Flower10RED_FLOWERE -0x000000710178AA50,_ZN11FlowerBlock6Flower13YELLOW_FLOWERE 0x000000710178AAA8,FlowerBlock::FlowerCategory::YELLOW_FLOWER 0x000000710178AC28,_ZN5Items10FLOWER_POTE 0x000000710178ACE8,_ZN5Items12ROTTEN_FLESHE @@ -674,9 +661,7 @@ 0x000000710178BFD8,_ZN9LevelType10CUSTOMIZEDE 0x000000710178BFE0,_ZN9LevelType12LARGE_BIOMESE 0x000000710178C110,_ZN9LeafBlock11CHECK_DECAYE -0x000000710178C118,_ZN8Material6LEAVESE 0x000000710178C130,_ZN9LevelType4FLATE -0x000000710178C138,_ZN8Material3AIRE 0x000000710178C140,_ZN8Material6PORTALE 0x000000710178C1B0,_ZN10LevelChunk10touchedSkyE 0x000000710178C1B8,_ZN9LevelType6NORMALE @@ -687,9 +672,6 @@ 0x000000710178C5A8,_ZN10MobEffects10LEVITATIONE 0x000000710178C600,_ZN8LogBlock12LOG_VARIANTSE 0x000000710178C690,_ZN8LogBlock8LOG_AXISE -0x000000710178C698,_ZN8LogBlock7LogAxis1XE -0x000000710178C6A0,_ZN8LogBlock7LogAxis1YE -0x000000710178C6A8,_ZN8LogBlock7LogAxis1ZE 0x000000710178C6B8,_ZN8LogBlock9PREDICATEE 0x000000710178C6C0,_ZN8Material4WOODE 0x000000710178C6E0,_ZN8LogBlock7LogAxis4NONEE @@ -824,7 +806,8 @@ 0x000000710178CEC0,_ZN15MonsterEggBlock7Variant11MOSSY_BRICKE 0x000000710178CEC8,_ZN15MonsterEggBlock7Variant13CRACKED_BRICKE 0x000000710178CED0,_ZN15MonsterEggBlock7Variant14CHISELED_BRICKE -0x000000710178CFC8,_ZN11NewLogBlock7VARIANTE +0x000000710178cee0,_ZN3Mth3SINE +0x000000710178cee8,_ZN3Mth4ATANE 0x00000071017A1140,_ZN6Packet11sPacketsMapE 0x00000071017A16D8,_ZN15RangedAttribute13ATTACK_DAMAGEE 0x00000071017A16F0,_ZN11PlanksBlock7Variant6SPRUCEE @@ -838,6 +821,7 @@ 0x00000071017A1958,_ZN11PlanksBlock7Variant8VARIANTSE 0x00000071017A1988,_ZN11PlanksBlock9PREDICATEE 0x00000071017A1A30,_ZN15RangedAttribute12ATTACK_SPEEDE +0x00000071017a1a40,_ZN14DataFixerUpper16DATA_VERSION_KEYE 0x00000071017A1BB0,_ZN9Direction4Axis9PREDICATEE 0x00000071017A1E70,_ZN15PrismarineBlock7VARIANTE 0x00000071017A1E78,_ZN15PrismarineBlock7Variant8VARIANTSE @@ -901,13 +885,9 @@ 0x00000071017A42E8,SoundType::GRASS 0x00000071017A42F0,SoundType::STONE 0x00000071017A4318,SoundType::SNOW -0x00000071017A4AC0,_ZN10StoneBlock7VARIANTE 0x00000071017A4AC8,_ZN10StoneBlock7Variant5STONEE -0x00000071017A4AD0,_ZN10StoneBlock7Variant7GRANITEE 0x00000071017A4AD8,_ZN10StoneBlock7Variant14SMOOTH_GRANITEE -0x00000071017A4AE0,_ZN10StoneBlock7Variant7DIORITEE 0x00000071017A4AE8,_ZN10StoneBlock7Variant14SMOOTH_DIORITEE -0x00000071017A4AF0,_ZN10StoneBlock7Variant8ANDESITEE 0x00000071017A4AF8,_ZN10StoneBlock7Variant15SMOOTH_ANDESITEE 0x00000071017A4B00,_ZN10StoneBlock7Variant8VARIANTSE 0x00000071017A4B38,_ZN10StoneBlock9PREDICATEE @@ -920,6 +900,7 @@ 0x00000071017A4BE0,_ZN15StoneBrickBlock7Variant7CRACKEDE 0x00000071017A4BE8,_ZN15StoneBrickBlock7Variant8CHISELEDE 0x00000071017A53F8,SynchedEntityData__sIdMap +0x00000071017A58E8,_ZN4Vec34ZEROE 0x00000071017A5ED8,_ZZN10StoneBlock26createBlockStateDefinitionEvE10properties 0x00000071017A8380,_ZN3fui9sInstanceE 0x00000071017AA788,CGameNetworkManager__sInstance @@ -950,6 +931,7 @@ 0x00000071017C38A0,_ZN14GlStateManager14RESCALE_NORMALE 0x00000071017C38A8,_ZN14GlStateManager9ColorMask9sInstanceE 0x00000071017C38B0,_ZN14GlStateManager5Color9sInstanceE +0x00000071017C3BA8,_ZN9ItemIdFix10ID_TO_NAMEE 0x00000071017C4BB4,worldCutoff 0x00000071017C4BC0,sGlobalChunkCount 0x00000071017C5328,_ZN11MapRenderer21sMaterialColorPaletteE diff --git a/data/mcswitch_functions.csv b/data/mcswitch_functions.csv index 186c2e38..e35f1498 100644 --- a/data/mcswitch_functions.csv +++ b/data/mcswitch_functions.csv @@ -13,27 +13,27 @@ Address,Quality,Size,Name 0x0000007100000278,O,000028,_ZN4AABB23UseDefaultThreadStorageEv 0x0000007100000294,O,000092,_ZN4AABB20ReleaseThreadStorageEv 0x00000071000002f0,O,000116,_ZN4AABB12newPermanentEdddddd -0x0000007100000364,U,000152,_ZN4AABB12newPermanentERK8BlockPos +0x0000007100000364,O,000152,_ZN4AABB12newPermanentERK8BlockPos 0x00000071000003fc,O,000008,_ZNK5Vec3i4getXEv 0x0000007100000404,O,000008,_ZNK5Vec3i4getYEv 0x000000710000040c,O,000008,_ZNK5Vec3i4getZEv -0x0000007100000414,U,000144,_ZN4AABB12newPermanentERK8BlockPosRK8BlockPos +0x0000007100000414,O,000144,_ZN4AABB12newPermanentERK8BlockPosS2_ 0x00000071000004a4,O,000016,_ZN4AABB12newPermanentEPKS_ 0x00000071000004b4,O,000004,_ZN4AABB9resetPoolEv 0x00000071000004b8,O,000152,_ZN4AABB7newTempEdddddd 0x0000007100000550,O,000144,_ZN4AABB3setEdddddd -0x00000071000005e0,U,000152,_ZN4AABB7newTempERK8BlockPos -0x0000007100000678,U,000144,_ZN4AABB7newTempERK8BlockPosRK8BlockPos -0x0000007100000708,U,000016,_ZN4AABB7newTempEPK4AABB +0x00000071000005e0,O,000152,_ZN4AABB7newTempERK8BlockPos +0x0000007100000678,O,000144,_ZN4AABB7newTempERK8BlockPosS2_ +0x0000007100000708,O,000016,_ZN4AABB7newTempEPKS_ 0x0000007100000718,O,000144,_ZN4AABBC1Edddddd 0x00000071000007a8,U,000076, -0x00000071000007f4,U,000152,_ZNK4AABB6equalsEPK4AABB +0x00000071000007f4,O,000152,_ZNK4AABB6equalsEPKS_ 0x000000710000088c,O,000052,_ZN4AABB3setEPKS_ -0x00000071000008c0,U,000092,_ZN4AABB8contractEddd +0x00000071000008c0,O,000092,_ZN4AABB8contractEddd 0x000000710000091c,O,000088,_ZNK4AABB6expandEddd 0x0000007100000974,U,000208, 0x0000007100000a44,U,000212, -0x0000007100000b18,U,000060,_ZN4AABB17divideInternalsByEd +0x0000007100000b18,M,000060,_ZN4AABB17divideInternalsByEd 0x0000007100000b54,O,000052,_ZNK4AABB4growEddd 0x0000007100000b88,O,000012,_ZNK4AABB4growEd 0x0000007100000b94,U,000076, @@ -46,27 +46,27 @@ Address,Quality,Size,Name 0x0000007100000e00,O,000144,_ZN4AABB12clipYCollideEPKS_d 0x0000007100000e90,O,000144,_ZN4AABB12clipZCollideEPKS_d 0x0000007100000f20,O,000016,_ZNK4AABB10intersectsEPKS_ -0x0000007100000f30,M,000116,_ZNK4AABB10intersectsEdddddd +0x0000007100000f30,O,000116,_ZNK4AABB10intersectsEdddddd 0x0000007100000fa4,U,000152, 0x000000710000103c,U,000068, -0x0000007100001080,U,000096,_ZNK4AABB8containsERK8BlockPos +0x0000007100001080,O,000096,_ZNK4AABB8containsERK8BlockPos 0x00000071000010e0,O,000140,_ZN4AABB8containsEP4Vec3 -0x000000710000116c,U,000140,_ZNK4AABB27containsIncludingLowerBoundEP4Vec3 +0x000000710000116c,O,000140,_ZNK4AABB27containsIncludingLowerBoundEP4Vec3 0x00000071000011f8,O,000044,_ZNK4AABB7getSizeEv -0x0000007100001224,U,000016,_ZNK4AABB6shrinkEddd -0x0000007100001234,U,000008,_ZNK4AABB6shrinkEd -0x000000710000123c,U,000456,_ZNK4AABB4clipEP4Vec3S1_ -0x0000007100001404,U,000076,collideWithXPlane__4AABBCFdP4Vec3T2 -0x0000007100001450,U,000088,isClosest__4AABBCFP4Vec3N21 -0x00000071000014a8,U,000076,collideWithYPlane__4AABBCFdP4Vec3T2 -0x00000071000014f4,U,000076,collideWithZPlane__4AABBCFdP4Vec3T2 -0x0000007100001540,U,000096, -0x00000071000015a0,U,000096, -0x0000007100001600,U,000096, +0x0000007100001224,O,000016,_ZNK4AABB6shrinkEddd +0x0000007100001234,O,000008,_ZNK4AABB6shrinkEd +0x000000710000123c,O,000456,_ZNK4AABB4clipEP4Vec3S1_ +0x0000007100001404,O,000076,_ZNK4AABB17collideWithXPlaneEdP4Vec3S1_ +0x0000007100001450,O,000088,_ZNK4AABB9isClosestEP4Vec3S1_S1_ +0x00000071000014a8,O,000076,_ZNK4AABB17collideWithYPlaneEdP4Vec3S1_ +0x00000071000014f4,O,000076,_ZNK4AABB17collideWithZPlaneEdP4Vec3S1_ +0x0000007100001540,O,000096,_ZNK4AABB10containsYZEP4Vec3 +0x00000071000015a0,O,000096,_ZNK4AABB10containsXZEP4Vec3 +0x0000007100001600,O,000096,_ZNK4AABB10containsXYEP4Vec3 0x0000007100001660,U,000108, 0x00000071000016cc,O,000012,_ZN6Double8checkNanEd 0x00000071000016d8,O,000056,_ZNK4AABB9getCenterEv -0x0000007100001710,U,000132,correctMinMax__4AABBFv +0x0000007100001710,O,000132,_ZN4AABB13correctMinMaxEv 0x0000007100001794,O,000040,_ZN9AbilitiesC1Ev 0x00000071000017bc,O,000164,_ZNK9AbilitieseqERKS_ 0x0000007100001860,O,000576,_ZN9Abilities11addSaveDataEP11CompoundTag @@ -677,7 +677,7 @@ Address,Quality,Size,Name 0x0000007100015e28,U,000820, 0x000000710001615c,O,000044,_ZNK8BlockPos5aboveEi 0x0000007100016188,O,000112,_ZNK8BlockPos6offsetEiii -0x00000071000161f8,U,000124, +0x00000071000161f8,O,000124,_ZN15MutableBlockPos4moveEPK9Directioni 0x0000007100016274,O,000012,_ZN15MutableBlockPos3setEiii 0x0000007100016280,O,000028,_ZNK8BlockPos5belowEv 0x000000710001629c,O,000096,_ZNK10BlockState8setValueIPN8LogBlock7LogAxisEEEPKS_P8PropertyT_ @@ -689,10 +689,10 @@ Address,Quality,Size,Name 0x000000710001661c,U,000008, 0x0000007100016624,U,000036, 0x0000007100016648,U,000012, -0x0000007100016654,U,000068,_ZN20ByteArrayInputStreamC1Ev -0x0000007100016698,U,000040,_ZN15DataInputStreamD1Ev +0x0000007100016654,O,000068,_ZN20ByteArrayInputStream5resetEv +0x0000007100016698,O,000040,_ZN15DataInputStreamD1Ev 0x00000071000166c0,U,000216,_ZNSt3__120__shared_ptr_pointerIP17GameCommandPacketNS_14default_deleteIS1_EENS_9allocatorIS1_EEEC_gen -0x0000007100016798,U,000040,_ZN16DataOutputStreamD1Ev +0x0000007100016798,O,000040,_ZN16DataOutputStreamD1Ev 0x00000071000167c0,U,012748, 0x000000710001998c,U,000004, 0x0000007100019990,O,000128,_ZN17AddDeepOceanLayerC1ExNSt3__110shared_ptrI5LayerEE @@ -1057,7 +1057,7 @@ Address,Quality,Size,Name 0x0000007100027a54,U,003580,_ZN5Arrow4tickEv 0x0000007100028850,U,000004, 0x0000007100028854,U,000564, -0x0000007100028a88,U,000008,_ZN9HitResultD1Ev +0x0000007100028a88,O,000008,_ZN9HitResultD1Ev 0x0000007100028a90,U,000040, 0x0000007100028ab8,U,002104, 0x00000071000292f0,O,000216,_ZNSt3__110shared_ptrI6PacketEC2I26ClientboundGameEventPacketEEPT_NS_9enable_ifIXsr14is_convertibleIS6_PS1_EE5valueENS2_5__natEE4typeE @@ -1667,7 +1667,7 @@ Address,Quality,Size,Name 0x000000710003dbec,U,000036,_ZN14BigTreeFeatureD0Ev 0x000000710003dc10,U,000876, 0x000000710003df7c,U,000180, -0x000000710003e030,U,000132, +0x000000710003e030,O,000132,_ZNK8BlockPos6offsetEddd 0x000000710003e0b4,U,000356, 0x000000710003e218,U,000360, 0x000000710003e380,U,000052, @@ -1679,7 +1679,7 @@ Address,Quality,Size,Name 0x000000710003e73c,U,000040, 0x000000710003e764,U,000300, 0x000000710003e890,U,000204, -0x000000710003e95c,U,000028, +0x000000710003e95c,O,000028,_ZNK8BlockPosneERKS_ 0x000000710003e978,U,000012, 0x000000710003e984,U,000228, 0x000000710003ea68,U,000224, @@ -1789,7 +1789,7 @@ Address,Quality,Size,Name 0x0000007100043f00,U,000016, 0x0000007100043f10,U,000060, 0x0000007100043f4c,U,000504,_ZN11BiomeColors15getAverageColorEP11LevelSourceRK8BlockPosPN11BiomeColors13ColorResolverE -0x0000007100044144,U,000016,MutableBlockPos__MutableBlockPos +0x0000007100044144,O,000016,_ZN15MutableBlockPosC1Ev 0x0000007100044154,U,000008,setX__15MutableBlockPosFi 0x000000710004415c,U,000008,setZ__15MutableBlockPosFi 0x0000007100044164,U,000016,_ZN11BiomeColors20getAverageGrassColorEP11LevelSourceRK8BlockPos @@ -1799,13 +1799,13 @@ Address,Quality,Size,Name 0x00000071000441a4,U,000424,_ZN14BiomeDecoratorC2Ev 0x000000710004434c,U,000052,_ZN12ReedsFeatureC1Ev 0x0000007100044380,U,000052,_ZN13CactusFeatureC1Ev -0x00000071000443b4,O,000052,_ZN16WaterlilyFeatureC1Ev +0x00000071000443b4,O,000052,_ZN16WaterlilyFeatureC2Ev 0x00000071000443e8,U,000484,_ZN14BiomeDecoratorD2Ev 0x00000071000445cc,U,000036,_ZN14BiomeDecoratorD0Ev 0x00000071000445f0,U,001040,_ZN14BiomeDecorator8decorateEP5LevelR6RandomP5BiomeRK8BlockPos 0x0000007100044a00,O,000096,_ZNK10BlockState8setValueIPN10StoneBlock7VariantEEEPKS_P8PropertyT_ 0x0000007100044a60,U,004100,_ZN14BiomeDecorator8decorateEP5BiomeP5LevelR6Random -0x0000007100045a64,O,000052,_ZN14PumpkinFeatureC1Ev +0x0000007100045a64,O,000052,_ZN14PumpkinFeatureC2Ev 0x0000007100045a98,U,000416,_ZN14BiomeDecorator12decorateOresEP5LevelR6Random 0x0000007100045c38,U,000300, 0x0000007100045d64,U,000268, @@ -2273,14 +2273,14 @@ Address,Quality,Size,Name 0x000000710006160c,U,000056,_ZN16BlockPlanterItemC_gen 0x0000007100061644,U,001044,_ZN16BlockPlanterItem5useOnENSt3__110shared_ptrI6PlayerEEP5LevelRK8BlockPosN15InteractionHand16EInteractionHandEPK9Directionfffb 0x0000007100061a58,O,000016,_ZN8BlockPosC1Ev -0x0000007100061a68,U,000004, +0x0000007100061a68,O,000004,_ZN8BlockPosC1Eddd 0x0000007100061a6c,U,000016,_ZN8BlockPosC1ERKSt10shared_ptrI6EntityE 0x0000007100061a7c,U,000012,_ZN8BlockPosC1EP6Entity 0x0000007100061a88,O,000012,_ZN8BlockPosC1EP4Vec3 0x0000007100061a94,O,000088,_ZN8BlockPosC1ERK5Vec3i 0x0000007100061aec,U,000152, 0x0000007100061b84,U,000076, -0x0000007100061bd0,U,000096, +0x0000007100061bd0,O,000096,_ZNK8BlockPos6offsetERK5Vec3i 0x0000007100061c30,U,000096, 0x0000007100061c90,U,000168, 0x0000007100061d38,O,000152,_ZNK8BlockPos8relativeEPK9Directioni @@ -2291,14 +2291,14 @@ Address,Quality,Size,Name 0x0000007100061e80,O,000044,_ZNK8BlockPos4eastEi 0x0000007100061eac,U,000232, 0x0000007100061f94,U,000008,_ZNK8Rotation7getTypeEv -0x0000007100061f9c,U,000148,_ZNK8BlockPos16compressBlockPosEv -0x0000007100062030,U,000156,_ZN8BlockPos18decompressBlockPosEx +0x0000007100061f9c,M,000148,_ZNK8BlockPos16compressBlockPosEv +0x0000007100062030,M,000156,_ZN8BlockPos18decompressBlockPosEx 0x00000071000620cc,U,000180, 0x0000007100062180,U,000356, 0x00000071000622e4,O,000004,_ZN15MutableBlockPosC1Eiii 0x00000071000622e8,U,000020, 0x00000071000622fc,U,000008, -0x0000007100062304,U,000072, +0x0000007100062304,O,000072,_ZN15MutableBlockPos3setERK5Vec3i 0x000000710006234c,U,000024, 0x0000007100062364,U,000016, 0x0000007100062374,U,000016, @@ -2983,7 +2983,7 @@ Address,Quality,Size,Name 0x000000710009be70,U,000068,_ZN10ByteBuffer11asIntBufferEv 0x000000710009beb4,U,000068, 0x000000710009bef8,O,000048,_ZN7ByteTagC2Ev -0x000000710009bf28,U,000048,_ZN10NumericTagC1Ev +0x000000710009bf28,O,000048,_ZN10NumericTagC2Ev 0x000000710009bf58,O,000056,_ZN7ByteTagC2Eh 0x000000710009bf90,O,000024,_ZN7ByteTag5writeEP10DataOutput 0x000000710009bfa8,O,000048,_ZN7ByteTag4loadEP9DataInputi @@ -3926,7 +3926,7 @@ Address,Quality,Size,Name 0x00000071000b2354,U,000008,__CPR261__keySet__135SimpleRegistry__tm__112_16ResourceLocationP5BlockQ2_5boost31hash__tm__19_J35JQ2_3std35equal_to__tm__J81JFv_RCQ3_J63J9unordered89unordered_map__tm__68_Z1ZZ2ZZ3ZZ4ZQ2_3std46allocator__tm__29_Q2_3std19pair__tm__8_CZ1ZZ2Z 0x00000071000b235c,U,000164,__CPR162__getRandom__135SimpleRegistry__tm__112_16ResourceLocationP5BlockQ2_5boost31hash__tm__19_J38JQ2_3std35equal_to__tm__J84JFP6Random_Z2Z 0x00000071000b2400,U,000072,__CPR217__getKey__197MappedRegistry__tm__174_16ResourceLocationP5BlockQ2_5boost31hash__tm__19_J35JQ2_3std35equal_to__tm__J81JQ2_J63J19hash__tm__8_PJ54JQ2_3std23equal_to__tm__J167JCFZ2Z_Z1Z -0x00000071000b2448,U,000004, +0x00000071000b2448,O,000004,_ZN7DataFixD2Ev 0x00000071000b244c,U,000036,_ZN16BlockEntityIdFixD0Ev 0x00000071000b2470,U,000036,_ZN29BlockEntityShulkerBoxColorFixD0Ev 0x00000071000b2494,U,000008, @@ -3979,7 +3979,7 @@ Address,Quality,Size,Name 0x00000071000b2a6c,U,000036,_ZN16BrewingStandMenu8FuelSlotD0Ev 0x00000071000b2a90,U,000036,_ZN10BucketItemD0Ev 0x00000071000b2ab4,U,000036,_ZN11ButtonBlockD0Ev -0x00000071000b2ad8,U,000004,_ZN21ByteArrayOutputStream5flushEv +0x00000071000b2ad8,O,000004,_ZN21ByteArrayOutputStream5flushEv 0x00000071000b2adc,O,000036,_ZN7ByteTagD0Ev 0x00000071000b2b00,U,000036,_ZN11CactusBlockD0Ev 0x00000071000b2b24,U,000036,_ZN9CakeBlockD0Ev @@ -4199,9 +4199,9 @@ Address,Quality,Size,Name 0x00000071000b49b0,U,000060, 0x00000071000b49ec,U,000004, 0x00000071000b49f0,O,000024,_ZNSt3__113unordered_mapI16ResourceLocation11eINSTANCEOFNS_4hashIS1_EENS_8equal_toIS1_EENS_9allocatorINS_4pairIKS1_S2_EEEEE2atERS9_ -0x00000071000b4a08,M,000300,_ZNSt3__112__hash_tableINS_17__hash_value_typeI16ResourceLocation11eINSTANCEOFEENS_22__unordered_map_hasherIS2_S4_NS_4hashIS2_EELb1EEENS_21__unordered_map_equalIS2_S4_NS_8equal_toIS2_EELb1EEENS_9allocatorIS4_EEE4findIS2_EENS_15__hash_iteratorIPNS_11__hash_nodeIS4_PvEEEERKT_ +0x00000071000b4a08,O,000300,_ZNSt3__112__hash_tableINS_17__hash_value_typeI16ResourceLocation11eINSTANCEOFEENS_22__unordered_map_hasherIS2_S4_NS_4hashIS2_EELb1EEENS_21__unordered_map_equalIS2_S4_NS_8equal_toIS2_EELb1EEENS_9allocatorIS4_EEE4findIS2_EENS_15__hash_iteratorIPNS_11__hash_nodeIS4_PvEEEERKT_ 0x00000071000b4b34,M,000008,_ZNKSt3__14hashI16ResourceLocationEclERKS1_ -0x00000071000b4b3c,M,000012,_ZNK16ResourceLocationeqERKS_ +0x00000071000b4b3c,M,000012,_ZNKSt3__18equal_toI16ResourceLocationEclERKS1_S4_ 0x00000071000b4b48,U,000604, 0x00000071000b4da4,O,000108,_ZNSt3__112__hash_tableINS_17__hash_value_typeI16ResourceLocation11eINSTANCEOFEENS_22__unordered_map_hasherIS2_S4_NS_4hashIS2_EELb1EEENS_21__unordered_map_equalIS2_S4_NS_8equal_toIS2_EELb1EEENS_9allocatorIS4_EEE21__construct_node_hashIRKNS_21piecewise_construct_tEJNS_5tupleIJRKS2_EEENSK_IJEEEEEENS_10unique_ptrINS_11__hash_nodeIS4_PvEENS_22__hash_node_destructorINSD_ISS_EEEEEEmOT_DpOT0_ 0x00000071000b4e10,U,000932, @@ -4282,7 +4282,7 @@ Address,Quality,Size,Name 0x00000071000b6778,O,000004,_ZN11InputStreamD2Ev 0x00000071000b677c,O,000036,_ZN11InputStreamD0Ev 0x00000071000b67a0,O,000004,_ZN3TagD2Ev -0x00000071000b67a4,U,000036,_ZN10NumericTagD0Ev +0x00000071000b67a4,O,000036,_ZN10NumericTagD0Ev 0x00000071000b67c8,O,000004,_ZN12ChunkStorageD2Ev 0x00000071000b67cc,O,000036,_ZN12ChunkStorageD0Ev 0x00000071000b67f0,U,000060, @@ -4782,10 +4782,10 @@ Address,Quality,Size,Name 0x00000071000c2e4c,O,000120,_ZNSt3__16vectorIP4AABBNS_9allocatorIS2_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS2_RS4_EE 0x00000071000c2ec4,O,000052,_ZNSt3__114__split_bufferIP4AABBRNS_9allocatorIS2_EEED2Ev 0x00000071000c2ef8,O,000008,_ZNKSt3__16vectorIP4AABBNS_9allocatorIS2_EEE8max_sizeEv -0x00000071000c2f00,U,000036,_ZNSt3__120__shared_ptr_pointerIP10ItemEntityNS_14default_deleteIS1_EENS_9allocatorIS1_EEED0Ev -0x00000071000c2f24,U,000024,_ZNSt3__120__shared_ptr_pointerIP10ItemEntityNS_14default_deleteIS1_EENS_9allocatorIS1_EEE16__on_zero_sharedEv -0x00000071000c2f3c,U,000028,_ZNKSt3__120__shared_ptr_pointerIP10ItemEntityNS_14default_deleteIS1_EENS_9allocatorIS1_EEE13__get_deleterERKSt9type_info -0x00000071000c2f58,U,000004,_ZNSt3__120__shared_ptr_pointerIP10ItemEntityNS_14default_deleteIS1_EENS_9allocatorIS1_EEE21__on_zero_shared_weakEv +0x00000071000c2f00,O,000036,_ZNSt3__120__shared_ptr_pointerIP10ItemEntityNS_14default_deleteIS1_EENS_9allocatorIS1_EEED0Ev +0x00000071000c2f24,O,000024,_ZNSt3__120__shared_ptr_pointerIP10ItemEntityNS_14default_deleteIS1_EENS_9allocatorIS1_EEE16__on_zero_sharedEv +0x00000071000c2f3c,O,000028,_ZNKSt3__120__shared_ptr_pointerIP10ItemEntityNS_14default_deleteIS1_EENS_9allocatorIS1_EEE13__get_deleterERKSt9type_info +0x00000071000c2f58,O,000004,_ZNSt3__120__shared_ptr_pointerIP10ItemEntityNS_14default_deleteIS1_EENS_9allocatorIS1_EEE21__on_zero_shared_weakEv 0x00000071000c2f5c,O,000036,_ZNSt3__120__shared_ptr_pointerIP13ExperienceOrbNS_14default_deleteIS1_EENS_9allocatorIS1_EEED0Ev 0x00000071000c2f80,O,000024,_ZNSt3__120__shared_ptr_pointerIP13ExperienceOrbNS_14default_deleteIS1_EENS_9allocatorIS1_EEE16__on_zero_sharedEv 0x00000071000c2f98,O,000028,_ZNKSt3__120__shared_ptr_pointerIP13ExperienceOrbNS_14default_deleteIS1_EENS_9allocatorIS1_EEE13__get_deleterERKSt9type_info @@ -5145,9 +5145,9 @@ Address,Quality,Size,Name 0x00000071000cbb7c,O,000096,_ZN27ClientboundLevelEventPacketC1Ev 0x00000071000cbbdc,U,000120,_ZN27ClientboundLevelEventPacketC_gen 0x00000071000cbc54,O,000112,_ZN27ClientboundLevelEventPacket4readEP15DataInputStream -0x00000071000cbcc4,U,000036,_ZN15DataInputStream12readBlockPosEv +0x00000071000cbcc4,O,000036,_ZN15DataInputStream12readBlockPosEv 0x00000071000cbce8,O,000100,_ZN27ClientboundLevelEventPacket5writeEP16DataOutputStream -0x00000071000cbd4c,U,000060,_ZN16DataOutputStream13writeBlockPosERK8BlockPos +0x00000071000cbd4c,O,000060,_ZN16DataOutputStream13writeBlockPosERK8BlockPos 0x00000071000cbd88,O,000080,_ZN27ClientboundLevelEventPacket6handleEP14PacketListener 0x00000071000cbdd8,O,000016,_ZNSt3__110shared_ptrI27ClientboundLevelEventPacketED2Ev 0x00000071000cbde8,O,000008,_ZN27ClientboundLevelEventPacket16getEstimatedSizeEv @@ -5197,10 +5197,10 @@ Address,Quality,Size,Name 0x00000071000cd400,U,000080,_ZN28ClientboundMapItemDataPacket6handleEP14PacketListener 0x00000071000cd450,U,000016,_ZNSt3__110shared_ptrI28ClientboundMapItemDataPacketED2Ev 0x00000071000cd460,U,000656,_ZN28ClientboundMapItemDataPacket4readEP15DataInputStream -0x00000071000cd6f0,U,000124,_ZN15DataInputStream10readVarIntEv +0x00000071000cd6f0,M,000124,_ZN15DataInputStream10readVarIntEv 0x00000071000cd76c,U,000244, 0x00000071000cd860,U,000520,_ZN28ClientboundMapItemDataPacket5writeEP16DataOutputStream -0x00000071000cda68,U,000116,_ZN16DataOutputStream11writeVarIntEi +0x00000071000cda68,M,000116,_ZN16DataOutputStream11writeVarIntEi 0x00000071000cdadc,U,000008, 0x00000071000cdae4,O,000008,_ZNK13MapDecoration5isIdkEv 0x00000071000cdaec,U,000008, @@ -5619,9 +5619,9 @@ Address,Quality,Size,Name 0x00000071000d6ad4,O,000040,_ZN26ClientboundSetBorderPacketD2Ev 0x00000071000d6afc,O,000036,_ZN26ClientboundSetBorderPacketD0Ev 0x00000071000d6b20,O,000352,_ZN26ClientboundSetBorderPacket4readEP15DataInputStream -0x00000071000d6c80,U,000124,_ZN15DataInputStream11readVarLongEv +0x00000071000d6c80,M,000124,_ZN15DataInputStream11readVarLongEv 0x00000071000d6cfc,O,000348,_ZN26ClientboundSetBorderPacket5writeEP16DataOutputStream -0x00000071000d6e58,U,000124,_ZN16DataOutputStream12writeVarLongEl +0x00000071000d6e58,M,000124,_ZN16DataOutputStream12writeVarLongEl 0x00000071000d6ed4,O,000080,_ZN26ClientboundSetBorderPacket6handleEP14PacketListener 0x00000071000d6f24,O,000016,_ZNSt3__110shared_ptrI26ClientboundSetBorderPacketED2Ev 0x00000071000d6f34,U,000248, @@ -5684,9 +5684,9 @@ Address,Quality,Size,Name 0x00000071000d7c64,U,000084,_ZN32ClientboundSetEquippedItemPacketC1Ev 0x00000071000d7cb8,U,000172,_ZN32ClientboundSetEquippedItemPacketC_gen 0x00000071000d7d64,U,000120,_ZN32ClientboundSetEquippedItemPacket4readEP15DataInputStream -0x00000071000d7ddc,U,000232,_ZN15DataInputStream8readItemEv +0x00000071000d7ddc,M,000232,_ZN15DataInputStream8readItemEv 0x00000071000d7ec4,U,000120,_ZN32ClientboundSetEquippedItemPacket5writeEP16DataOutputStream -0x00000071000d7f3c,U,000188,_ZN16DataOutputStream9writeItemE12not_null_ptrI12ItemInstanceE +0x00000071000d7f3c,O,000188,_ZN16DataOutputStream9writeItemE12not_null_ptrI12ItemInstanceE 0x00000071000d7ff8,U,000080,_ZN32ClientboundSetEquippedItemPacket6handleEP14PacketListener 0x00000071000d8048,U,000016,_ZNSt3__110shared_ptrI32ClientboundSetEquippedItemPacketED2Ev 0x00000071000d8058,U,000008,_ZN32ClientboundSetEquippedItemPacket16getEstimatedSizeEv @@ -5972,8 +5972,8 @@ Address,Quality,Size,Name 0x00000071000df04c,U,000044, 0x00000071000df078,U,000136,_ZN10CocoaBlock20getStateForPlacementEP5LevelRK8BlockPosPK9DirectionfffiSt10shared_ptrI12LivingEntityE 0x00000071000df100,O,000008,_ZNK9Direction7getAxisEv -0x00000071000df108,U,000028,_ZN9Direction4Axis12isHorizontalEv -0x00000071000df124,U,000008,_ZNK9Direction11getOppositeEv +0x00000071000df108,O,000028,_ZN9Direction4Axis12isHorizontalEv +0x00000071000df124,O,000008,_ZNK9Direction11getOppositeEv 0x00000071000df12c,U,000108,_ZN10CocoaBlock15neighborChangedEPK10BlockStateP5LevelRK8BlockPosP5BlockRK8BlockPos 0x00000071000df198,U,000208,_ZN10CocoaBlock14spawnResourcesEP5LevelRK8BlockPosPK10BlockStatefi 0x00000071000df268,U,000104,_ZN10CocoaBlock20getCloneItemInstanceEP5LevelRK8BlockPosPK10BlockState @@ -5985,9 +5985,9 @@ Address,Quality,Size,Name 0x00000071000df394,U,000004, 0x00000071000df398,U,000008,_ZN10CocoaBlock14getRenderLayerEv 0x00000071000df3a0,U,000096,_ZN10CocoaBlock13getBlockStateEi -0x00000071000df400,U,000052,_ZN9Direction15from2DDataValueEi +0x00000071000df400,O,000052,_ZN9Direction15from2DDataValueEi 0x00000071000df434,U,000080,_ZN10CocoaBlock29convertBlockStateToLegacyDataEPK10BlockState -0x00000071000df484,U,000008, +0x00000071000df484,O,000008,_ZNK9Direction14get2DDataValueEv 0x00000071000df48c,U,000112,_ZN10CocoaBlock18GetInteractTooltipERK22BlockTooltipDataHolder 0x00000071000df4fc,U,000028,_ZN8DyeColor10byItemDataEi 0x00000071000df518,U,000136,_ZN10CocoaBlock26createBlockStateDefinitionEv @@ -6048,7 +6048,7 @@ Address,Quality,Size,Name 0x00000071000e1380,U,000008, 0x00000071000e1388,U,000008, 0x00000071000e1390,U,000260, -0x00000071000e1494,U,000028,_ZN11CompoundTag10getBooleanERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE +0x00000071000e1494,O,000028,_ZN11CompoundTag10getBooleanERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE 0x00000071000e14b0,U,000224, 0x00000071000e1590,U,000008, 0x00000071000e1598,U,000012, @@ -6067,12 +6067,12 @@ Address,Quality,Size,Name 0x00000071000e1c74,U,000176,_ZN12CommandStatsC1Ev 0x00000071000e1d24,U,000004, 0x00000071000e1d28,U,000056, -0x00000071000e1d60,U,000032,_ZN11CompoundTag8containsERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE -0x00000071000e1d80,U,000084,_ZN11CompoundTag11getCompoundERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE +0x00000071000e1d60,O,000032,_ZN11CompoundTag8containsERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE +0x00000071000e1d80,O,000084,_ZN11CompoundTag11getCompoundERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE 0x00000071000e1dd4,U,000140, -0x00000071000e1e60,U,000136,_ZN11CompoundTag9getStringERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE -0x00000071000e1ee8,U,000100,_ZN11CompoundTag9putStringERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEES8_ -0x00000071000e1f4c,U,000112,_ZN11CompoundTag3putERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEP3Tag +0x00000071000e1e60,O,000136,_ZN11CompoundTag9getStringERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE +0x00000071000e1ee8,O,000100,_ZN11CompoundTag9putStringERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEES8_ +0x00000071000e1f4c,O,000112,_ZN11CompoundTag3putERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEP3Tag 0x00000071000e1fbc,U,000008, 0x00000071000e1fc4,U,000016, 0x00000071000e1fd4,U,000016, @@ -6184,9 +6184,9 @@ Address,Quality,Size,Name 0x00000071000e432c,U,000012, 0x00000071000e4338,U,000168,_ZN15ComparatorBlock10getTextureEPK9DirectionPK10BlockState 0x00000071000e43e0,U,000120, -0x00000071000e4458,U,000100,_ZN11CompoundTag6putIntERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEi +0x00000071000e4458,O,000100,_ZN11CompoundTag6putIntERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEi 0x00000071000e44bc,U,000116, -0x00000071000e4530,U,000084,_ZN11CompoundTag6getIntERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE +0x00000071000e4530,O,000084,_ZN11CompoundTag6getIntERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE 0x00000071000e4584,U,000168, 0x00000071000e462c,U,000180,_ZN11CompassItemC_gen 0x00000071000e46e0,U,000048,_ZN11CompassItem32CompassItem_ItemPropertyFunctionC_gen @@ -6248,52 +6248,52 @@ Address,Quality,Size,Name 0x00000071000e5908,U,000220, 0x00000071000e59e4,U,000080, 0x00000071000e5a34,U,000016, -0x00000071000e5a44,U,000064,_ZN11CompoundTagC1Ev -0x00000071000e5a84,U,000068,_ZN11CompoundTagD1Ev +0x00000071000e5a44,O,000064,_ZN11CompoundTagC1Ev +0x00000071000e5a84,M,000068,_ZN11CompoundTagD1Ev 0x00000071000e5ac8,U,000148, 0x00000071000e5b5c,U,000004, -0x00000071000e5b60,U,000036,_ZN11CompoundTagD0Ev -0x00000071000e5b84,U,000076,_ZN11CompoundTag5writeEP10DataOutput +0x00000071000e5b60,O,000036,_ZN11CompoundTagD0Ev +0x00000071000e5b84,M,000076,_ZN11CompoundTag5writeEP10DataOutput 0x00000071000e5bd0,U,000156, -0x00000071000e5c6c,U,000176,_ZN11CompoundTag4loadEP9DataInputi +0x00000071000e5c6c,M,000176,_ZN11CompoundTag4loadEP9DataInputi 0x00000071000e5d1c,U,000012, 0x00000071000e5d28,U,000012, 0x00000071000e5d34,U,000072, 0x00000071000e5d7c,O,000752,_ZNSt3__113unordered_mapINS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEEP3TagNS_4hashIS6_EENS_8equal_toIS6_EENS4_INS_4pairIKS6_S8_EEEEEixERSE_ -0x00000071000e606c,U,000132, -0x00000071000e60f0,U,000008, -0x00000071000e60f8,U,000008,_ZN11CompoundTag5getIdEv +0x00000071000e606c,O,000132,_ZN11CompoundTag10getAllKeysEv +0x00000071000e60f0,O,000008,_ZN11CompoundTag10getAllTagsEv +0x00000071000e60f8,O,000008,_ZN11CompoundTag5getIdEv 0x00000071000e6100,U,000008, -0x00000071000e6108,U,000032,_ZN11CompoundTag3getERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE +0x00000071000e6108,O,000032,_ZN11CompoundTag3getERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE 0x00000071000e6128,O,000024,_Z16erease_if_existsRKNSt3__113unordered_mapINS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEEP3TagNS_4hashIS6_EENS_8equal_toIS6_EENS4_INS_4pairIKS6_S8_EEEEEERSE_S8_ 0x00000071000e6140,O,000100,_ZN11CompoundTag7putByteERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEh -0x00000071000e61a4,U,000100,_ZN11CompoundTag8putShortERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEs -0x00000071000e6208,U,000100,CompoundTag__putLong -0x00000071000e626c,U,000108,putFloat__11CompoundTagFRCQ2_3std78basic_string__tm__58_wQ2_3std20char_traits__tm__2_wQ2_3std18allocator__tm__2_wf +0x00000071000e61a4,O,000100,_ZN11CompoundTag8putShortERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEs +0x00000071000e6208,O,000100,_ZN11CompoundTag7putLongERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEx +0x00000071000e626c,O,000108,_ZN11CompoundTag8putFloatERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEf 0x00000071000e62d8,U,000108, -0x00000071000e6344,U,000120,_ZN11CompoundTag12putByteArrayERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE15arrayWithLengthIhE +0x00000071000e6344,O,000120,_ZN11CompoundTag12putByteArrayERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE15arrayWithLengthIhE 0x00000071000e63bc,U,000116, -0x00000071000e6430,U,000048, -0x00000071000e6460,U,000072,_ZN11CompoundTag8containsERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEi -0x00000071000e64a8,U,000084,_ZN11CompoundTag7getByteERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE -0x00000071000e64fc,U,000084,_ZN11CompoundTag8getShortERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE +0x00000071000e6430,O,000048,_ZNK11CompoundTag10getTagTypeERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE +0x00000071000e6460,M,000072,_ZN11CompoundTag8containsERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEi +0x00000071000e64a8,O,000084,_ZN11CompoundTag7getByteERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE +0x00000071000e64fc,O,000084,_ZN11CompoundTag8getShortERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE 0x00000071000e6550,U,000084, -0x00000071000e65a4,U,000084,_ZN11CompoundTag8getFloatERKSt12basic_stringIwSt11char_traitsIwESt9allocatorIwEE +0x00000071000e65a4,O,000084,_ZN11CompoundTag8getFloatERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE 0x00000071000e65f8,U,000084, -0x00000071000e664c,U,000092,_ZN11CompoundTag12getByteArrayERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE +0x00000071000e664c,M,000092,_ZN11CompoundTag12getByteArrayERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE 0x00000071000e66a8,U,000092, 0x00000071000e6704,U,000072, 0x00000071000e674c,U,000024, -0x00000071000e6764,U,000136,_ZN11CompoundTag7getListERKSt12basic_stringIwSt11char_traitsIwESt9allocatorIwEEi -0x00000071000e67ec,U,000140,_ZNK11CompoundTag16fjSafeGetListTagERKSt12basic_stringIwSt11char_traitsIwESt9allocatorIwEEi +0x00000071000e6764,M,000136,_ZN11CompoundTag7getListERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEi +0x00000071000e67ec,M,000140,_ZNK11CompoundTag16fjSafeGetListTagERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEi 0x00000071000e6878,U,000024, -0x00000071000e6890,U,000064,remove__11CompoundTagFRCQ2_3std78basic_string__tm__58_wQ2_3std20char_traits__tm__2_wQ2_3std18allocator__tm__2_w -0x00000071000e68d0,U,000136,_ZN11CompoundTag18stripEmptyChildrenEv -0x00000071000e6958,U,000016,_ZN11CompoundTag8toStringEv -0x00000071000e6968,U,000004,_ZN11CompoundTag5printERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEPcRNS0_13basic_ostreamIwS3_EE -0x00000071000e696c,U,000016,_ZNK11CompoundTag7isEmptyEv -0x00000071000e697c,U,000176,_ZN11CompoundTag4copyEv -0x00000071000e6a2c,U,000156,_ZN11CompoundTag6equalsEP3Tag +0x00000071000e6890,O,000064,_ZN11CompoundTag6removeERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE +0x00000071000e68d0,O,000136,_ZN11CompoundTag18stripEmptyChildrenEv +0x00000071000e6958,O,000016,_ZN11CompoundTag8toStringEv +0x00000071000e6968,O,000004,_ZN11CompoundTag5printERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEPcRNS0_13basic_ostreamIwS3_EE +0x00000071000e696c,O,000016,_ZNK11CompoundTag7isEmptyEv +0x00000071000e697c,O,000176,_ZN11CompoundTag4copyEv +0x00000071000e6a2c,M,000156,_ZN11CompoundTag6equalsEP3Tag 0x00000071000e6ac8,U,000448, 0x00000071000e6c88,U,000056, 0x00000071000e6cc0,U,000332, @@ -6346,7 +6346,7 @@ Address,Quality,Size,Name 0x00000071000e9190,O,000072,_ZN10Connection16getAndSetRunningEb 0x00000071000e91d8,O,000100,_ZN10Connection5_initEv 0x00000071000e923c,O,000344,_ZN10ConnectionD1Ev -0x00000071000e9394,U,000024,_ZN16DataOutputStream17deleteChildStreamEv +0x00000071000e9394,O,000024,_ZN16DataOutputStream17deleteChildStreamEv 0x00000071000e93ac,O,000072,_ZNSt3__112__deque_baseINS_10shared_ptrI6PacketEENS_9allocatorIS3_EEED2Ev 0x00000071000e93f4,U,000004, 0x00000071000e93f8,O,000604,_ZN10ConnectionC1EP6SocketRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEEP14PacketListener @@ -6358,8 +6358,8 @@ Address,Quality,Size,Name 0x00000071000e99b4,O,000124,_ZN10Connection9queueSendENSt3__110shared_ptrI6PacketEE 0x00000071000e9a30,O,000984,_ZN10Connection9writeTickEv 0x00000071000e9e08,O,000116,_ZNSt3__15dequeINS_10shared_ptrI6PacketEENS_9allocatorIS3_EEE9pop_frontEv -0x00000071000e9e7c,U,000008,_ZN21ByteArrayOutputStream4sizeEv -0x00000071000e9e84,U,000008,_ZN21ByteArrayOutputStream5clearEv +0x00000071000e9e7c,O,000008,_ZN21ByteArrayOutputStream4sizeEv +0x00000071000e9e84,O,000008,_ZN21ByteArrayOutputStream5clearEv 0x00000071000e9e8c,O,000056,_ZN10Connection5flushEv 0x00000071000e9ec4,O,000244,_ZN10Connection8readTickEv 0x00000071000e9fb8,O,000284,_ZN10Connection5closeEN16DisconnectPacket17eDisconnectReasonE @@ -6415,7 +6415,7 @@ Address,Quality,Size,Name 0x00000071000eb108,O,000008,_ZN10FileHeader9setEndianE9ByteOrder 0x00000071000eb110,U,000060,_ZN21ConsoleSaveFileCommon22isLocalEndianDifferentE13ESavePlatform 0x00000071000eb14c,U,000328,_ZN21ConsoleSaveFileCommon17ConvertRegionFileE4File -0x00000071000eb294,U,000024,_ZN15DataInputStream17deleteChildStreamEv +0x00000071000eb294,O,000024,_ZN15DataInputStream17deleteChildStreamEv 0x00000071000eb2ac,U,000396,_ZN21ConsoleSaveFileCommon22ConvertToLocalPlatformEv 0x00000071000eb438,O,000004,_ZN4FileD1Ev 0x00000071000eb43c,U,000220,fjGetSaveThumbnailData__21ConsoleSaveFileCommonFPUcUi @@ -6725,64 +6725,64 @@ Address,Quality,Size,Name 0x00000071000f4f58,U,000044,_ZN12DamageSourceC_gen 0x00000071000f4f84,O,000008,_ZN12DamageSource17getSourcePositionEv 0x00000071000f4f8c,U,000004,_ZN12DamageSource19GetBaseDamageSourceEv -0x00000071000f4f90,U,000068,_ZN15DataInputStreamC1EP11InputStream +0x00000071000f4f90,O,000068,_ZN15DataInputStreamC1EP11InputStream 0x00000071000f4fd4,U,000020,_ZN9DataInputC1Ev -0x00000071000f4fe8,U,000016,_ZN15DataInputStream4readEv +0x00000071000f4fe8,O,000016,_ZN15DataInputStream4readEv 0x00000071000f4ff8,U,000008,vtbl_710103D840_func_2 -0x00000071000f5000,U,000020,_ZN15DataInputStream4readE15arrayWithLengthIhE +0x00000071000f5000,O,000020,_ZN15DataInputStream4readE15arrayWithLengthIhE 0x00000071000f5014,U,000008,vtbl_710103D840_func_3 -0x00000071000f501c,U,000016,_ZN15DataInputStream4readE15arrayWithLengthIhEjj +0x00000071000f501c,O,000016,_ZN15DataInputStream4readE15arrayWithLengthIhEjj 0x00000071000f502c,U,000008,vtbl_710103D840_func_4 -0x00000071000f5034,U,000016,_ZN15DataInputStream5closeEv -0x00000071000f5044,U,000040,_ZN15DataInputStream11readBooleanEv +0x00000071000f5034,O,000016,_ZN15DataInputStream5closeEv +0x00000071000f5044,O,000040,_ZN15DataInputStream11readBooleanEv 0x00000071000f506c,U,000008,vtbl_710103D840_func_5 -0x00000071000f5074,U,000032,_ZN15DataInputStream8readByteEv +0x00000071000f5074,O,000032,_ZN15DataInputStream8readByteEv 0x00000071000f5094,U,000008,vtbl_710103D840_func_6 -0x00000071000f509c,U,000032,_ZN15DataInputStream16readUnsignedByteEv +0x00000071000f509c,O,000032,_ZN15DataInputStream16readUnsignedByteEv 0x00000071000f50bc,U,000008,vtbl_710103D840_func_7 -0x00000071000f50c4,U,000068,_ZN15DataInputStream8readCharEv +0x00000071000f50c4,O,000068,_ZN15DataInputStream8readCharEv 0x00000071000f5108,U,000008,vtbl_710103D840_func_15 -0x00000071000f5110,U,000128,_ZN15DataInputStream9readFullyE15arrayWithLengthIhE +0x00000071000f5110,O,000128,_ZN15DataInputStream9readFullyE15arrayWithLengthIhE 0x00000071000f5190,U,000008,vtbl_710103D840_func_8 -0x00000071000f5198,U,000012,_ZN15DataInputStream9readFullyE15arrayWithLengthIcE +0x00000071000f5198,M,000012,_ZN15DataInputStream9readFullyE15arrayWithLengthIcE 0x00000071000f51a4,U,000008,vtbl_710103D840_func_9 -0x00000071000f51ac,U,000128,_ZN15DataInputStream9readBytesE15arrayWithLengthIhE +0x00000071000f51ac,O,000128,_ZN15DataInputStream9readBytesE15arrayWithLengthIhE 0x00000071000f522c,U,000012, -0x00000071000f5238,U,000028,_ZN15DataInputStream10readDoubleEv +0x00000071000f5238,M,000028,_ZN15DataInputStream10readDoubleEv 0x00000071000f5254,U,000008, 0x00000071000f525c,U,000008,vtbl_710103D840_func_10 -0x00000071000f5264,U,000036,_ZN15DataInputStream9readFloatEv +0x00000071000f5264,M,000036,_ZN15DataInputStream9readFloatEv 0x00000071000f5288,U,000008,vtbl_710103D840_func_11 -0x00000071000f5290,U,000132,_ZN15DataInputStream7readIntEv +0x00000071000f5290,O,000132,_ZN15DataInputStream7readIntEv 0x00000071000f5314,U,000008,vtbl_710103D840_func_12 -0x00000071000f531c,U,000268,_ZN15DataInputStream8readLongEv +0x00000071000f531c,O,000268,_ZN15DataInputStream8readLongEv 0x00000071000f5428,U,000008,vtbl_710103D840_func_13 -0x00000071000f5430,U,000068,_ZN15DataInputStream9readShortEv +0x00000071000f5430,O,000068,_ZN15DataInputStream9readShortEv 0x00000071000f5474,U,000008,vtbl_710103D840_func_14 -0x00000071000f547c,U,000068,_ZN15DataInputStream17readUnsignedShortEv -0x00000071000f54c0,U,000416,_ZN15DataInputStream7readUTFEv +0x00000071000f547c,O,000068,_ZN15DataInputStream17readUnsignedShortEv +0x00000071000f54c0,M,000416,_ZN15DataInputStream7readUTFEv 0x00000071000f5660,U,000008,vtbl_710103D840_func_16 -0x00000071000f5668,U,000284,_ZN15DataInputStream11readUTFCharEv -0x00000071000f5784,U,000088,_ZN15DataInputStream13readPlayerUIDEv +0x00000071000f5668,M,000284,_ZN15DataInputStream11readUTFCharEv +0x00000071000f5784,O,000088,_ZN15DataInputStream13readPlayerUIDEv 0x00000071000f57dc,U,000008,vtbl_710103D840_func_17 -0x00000071000f57e4,U,000028,_ZN15DataInputStream19readBlockPosPointerEv -0x00000071000f5800,U,000124,_ZN15DataInputStream7readNbtEv -0x00000071000f587c,U,000204,_ZN15DataInputStream17readCompressedNbtEv -0x00000071000f5948,U,000016,_ZN15DataInputStream4skipEx -0x00000071000f5958,U,000012,_ZN15DataInputStream9skipBytesEx +0x00000071000f57e4,M,000028,_ZN15DataInputStream19readBlockPosPointerEv +0x00000071000f5800,M,000124,_ZN15DataInputStream7readNbtEv +0x00000071000f587c,M,000204,_ZN15DataInputStream17readCompressedNbtEv +0x00000071000f5948,O,000016,_ZN15DataInputStream4skipEx +0x00000071000f5958,O,000012,_ZN15DataInputStream9skipBytesEx 0x00000071000f5964,U,000008,vtbl_710103D840_func_18 -0x00000071000f596c,U,000072,_ZN16DataOutputStreamC1EP12OutputStream -0x00000071000f59b4,U,000020,_ZN10DataOutputC1Ev +0x00000071000f596c,O,000072,_ZN16DataOutputStreamC1EP12OutputStream +0x00000071000f59b4,O,000020,_ZN10DataOutputC2Ev 0x00000071000f59c8,O,000056,_ZN16DataOutputStream5writeEj 0x00000071000f5a00,U,000008,vtbl_710103D998_func_2 -0x00000071000f5a08,U,000016,_ZN16DataOutputStream5flushEv -0x00000071000f5a18,U,000020,_ZN16DataOutputStream5writeE15arrayWithLengthIhE +0x00000071000f5a08,O,000016,_ZN16DataOutputStream5flushEv +0x00000071000f5a18,O,000020,_ZN16DataOutputStream5writeE15arrayWithLengthIhE 0x00000071000f5a2c,U,000008,vtbl_710103D998_func_3 -0x00000071000f5a34,U,000020,_ZN16DataOutputStream10writeBytesE15arrayWithLengthIhE +0x00000071000f5a34,O,000020,_ZN16DataOutputStream10writeBytesE15arrayWithLengthIhE 0x00000071000f5a48,U,000008,vtbl_710103D998_func_4 -0x00000071000f5a50,U,000060,_ZN16DataOutputStream5writeE15arrayWithLengthIhEjj +0x00000071000f5a50,O,000060,_ZN16DataOutputStream5writeE15arrayWithLengthIhEjj 0x00000071000f5a8c,U,000008,vtbl_710103D998_func_5 -0x00000071000f5a94,U,000016,_ZN16DataOutputStream5closeEv +0x00000071000f5a94,O,000016,_ZN16DataOutputStream5closeEv 0x00000071000f5aa4,O,000020,_ZN16DataOutputStream9writeByteEh 0x00000071000f5ab8,O,000008,_ZThn8_N16DataOutputStream9writeByteEh 0x00000071000f5ac0,O,000064,_ZN16DataOutputStream11writeDoubleEd @@ -6797,7 +6797,7 @@ Address,Quality,Size,Name 0x00000071000f5ccc,O,000084,_ZN16DataOutputStream10writeShortEs 0x00000071000f5d20,U,000008,vtbl_710103D998_func_11 0x00000071000f5d28,O,000084,_ZN16DataOutputStream18writeUnsignedShortEt -0x00000071000f5d7c,U,000084,_ZN16DataOutputStream9writeCharEw +0x00000071000f5d7c,O,000084,_ZN16DataOutputStream9writeCharEw 0x00000071000f5dd0,U,000008,vtbl_710103D998_func_13 0x00000071000f5dd8,U,000136,_ZN16DataOutputStream10writeCharsERKSt12basic_stringIwSt11char_traitsIwESt9allocatorIwEE 0x00000071000f5e60,O,000008,_ZThn8_N16DataOutputStream10writeCharsERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE @@ -6805,9 +6805,9 @@ Address,Quality,Size,Name 0x00000071000f5ea4,O,000012,_ZThn8_N16DataOutputStream12writeBooleanEb 0x00000071000f5eb0,U,000572,_ZN16DataOutputStream8writeUTFERKSt12basic_stringIwSt11char_traitsIwESt9allocatorIwEE 0x00000071000f60ec,U,000008,vtbl_710103D998_func_15 -0x00000071000f60f4,U,000076,_ZN16DataOutputStream14writePlayerUIDE9PlayerUID +0x00000071000f60f4,O,000076,_ZN16DataOutputStream14writePlayerUIDE9PlayerUID 0x00000071000f6140,U,000008,vtbl_710103D998_func_16 -0x00000071000f6148,U,000152,_ZN16DataOutputStream8writeNbtEP11CompoundTag +0x00000071000f6148,O,000152,_ZN16DataOutputStream8writeNbtEP11CompoundTag 0x00000071000f61e0,U,000104, 0x00000071000f6248,U,000260, 0x00000071000f634c,U,000172,_ZN21DaylightDetectorBlockC_gen @@ -7086,9 +7086,9 @@ Address,Quality,Size,Name 0x00000071000fcd6c,O,000752,_ZNSt3__113unordered_mapINS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEEPK9DirectionNS_4hashIS6_EENS_8equal_toIS6_EENS4_INS_4pairIKS6_S9_EEEEEixERSF_ 0x00000071000fd05c,O,000012,_ZNK9Direction7getNameEv 0x00000071000fd068,O,000272,_ZN9DirectionC1EiiiRKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEPNS_13AxisDirectionEPNS_4AxisEP5Vec3ih -0x00000071000fd178,U,000008, -0x00000071000fd180,U,000064,from3DDataValue__9DirectionSFi -0x00000071000fd1c0,U,000008,_ZN9Direction4Axis5getIdEv +0x00000071000fd178,O,000008,_ZNK9Direction16getAxisDirectionEv +0x00000071000fd180,O,000064,_ZN9Direction15from3DDataValueEi +0x00000071000fd1c0,O,000008,_ZN9Direction4Axis5getIdEv 0x00000071000fd1c8,U,000076, 0x00000071000fd214,U,000028, 0x00000071000fd230,U,000056, @@ -7111,7 +7111,7 @@ Address,Quality,Size,Name 0x00000071000fd814,U,000056, 0x00000071000fd84c,U,000008, 0x00000071000fd854,U,000008, -0x00000071000fd85c,U,000016, +0x00000071000fd85c,O,000016,_ZNK9Direction9getNormalEv 0x00000071000fd86c,U,000048,_ZN9Direction5PlaneC_gen 0x00000071000fd89c,U,000272, 0x00000071000fd9ac,U,000016, @@ -8184,7 +8184,7 @@ Address,Quality,Size,Name 0x0000007100129ad0,U,000080,_ZN11EndRodBlock11getShapeRodEPK10BlockState 0x0000007100129b20,U,000080, 0x0000007100129b70,U,000016,_ZN11EndRodBlock25getSpawnResourcesAuxValueEPK10BlockState -0x0000007100129b80,U,000048,_ZN6EndTagC1Ev +0x0000007100129b80,O,000048,_ZN6EndTagC1Ev 0x0000007100129bb0,O,000004,_ZN6EndTag4loadEP9DataInputi 0x0000007100129bb4,O,000004,_ZN6EndTag5writeEP10DataOutput 0x0000007100129bb8,O,000008,_ZN6EndTag5getIdEv @@ -8302,7 +8302,7 @@ Address,Quality,Size,Name 0x000000710012a784,U,000036,_ZN32ClientboundUpdateMobEffectPacketD0Ev 0x000000710012a7a8,U,000008,_ZN32ClientboundUpdateMobEffectPacket11getPacketIdEv 0x000000710012a7b0,U,000036,_ZN9ClockItemD0Ev -0x000000710012a7d4,U,000036,_ZN15DataInputStreamD0Ev +0x000000710012a7d4,O,000036,_ZN15DataInputStreamD0Ev 0x000000710012a7f8,U,000008,vtbl_710103D840_func_0 0x000000710012a800,U,000008,vtbl_710103D840_func_1 0x000000710012a808,O,000036,_ZN8CoalItemD0Ev @@ -8329,7 +8329,7 @@ Address,Quality,Size,Name 0x000000710012aa68,U,000016, 0x000000710012aa78,U,000016, 0x000000710012aa88,U,000036,_ZN19ConcretePowderBlockD0Ev -0x000000710012aaac,U,000036,_ZN16DataOutputStreamD0Ev +0x000000710012aaac,O,000036,_ZN16DataOutputStreamD0Ev 0x000000710012aad0,U,000008,vtbl_710103D998_func_0 0x000000710012aad8,U,000008,vtbl_710103D998_func_1 0x000000710012aae0,U,000004,_ZN15ConsoleSaveFile4tickEv @@ -8562,8 +8562,8 @@ Address,Quality,Size,Name 0x000000710012cab0,U,000004,_ZN14ChunkGeneratorD1Ev 0x000000710012cab4,U,000036,_ZN14ChunkGeneratorD0Ev 0x000000710012cad8,O,000004,_ZN14ChunkGenerator10lightChunkEP10LevelChunk -0x000000710012cadc,U,000036,_ZN9DataInputD0Ev -0x000000710012cb00,U,000036,_ZN10DataOutputD0Ev +0x000000710012cadc,M,000036,_ZN9DataInputD0Ev +0x000000710012cb00,M,000036,_ZN10DataOutputD0Ev 0x000000710012cb24,O,000008,_ZN6Double13convertToLongEd 0x000000710012cb2c,U,000060, 0x000000710012cb68,U,000060, @@ -10625,17 +10625,17 @@ Address,Quality,Size,Name 0x000000710016e6dc,O,000020,_ZN4FileC1Ev 0x000000710016e6f0,M,000264,_ZN4FileC1ERKS_RKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEE 0x000000710016e7f8,O,000088,_ZNSt3__1plIwNS_11char_traitsIwEENS_9allocatorIwEEEENS_12basic_stringIT_T0_T1_EERKS9_S6_ -0x000000710016e850,U,000016,_ZNK4File7getPathEv +0x000000710016e850,O,000016,_ZNK4File7getPathEv 0x000000710016e860,O,000224,_ZN4FileC1ERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE -0x000000710016e940,U,000088,_ZN4File7_deleteEv -0x000000710016e998,U,000080,_ZNK4File5mkdirEv -0x000000710016e9e8,U,000076,_ZNK4File6existsEv -0x000000710016ea34,U,000096,_Z11isDirectoryRKNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEE -0x000000710016ea94,U,000204,_ZN4File8renameToE4File +0x000000710016e940,M,000088,_ZN4File7_deleteEv +0x000000710016e998,O,000080,_ZNK4File5mkdirEv +0x000000710016e9e8,O,000076,_ZNK4File6existsEv +0x000000710016ea34,O,000096,_Z11isDirectoryRKNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEE +0x000000710016ea94,M,000204,_ZN4File8renameToES_ 0x000000710016eb60,U,000292,_ZNK4File9listFilesEv -0x000000710016ec84,U,000144,_ZN4File6lengthEv -0x000000710016ed14,U,000104,_ZNK4File7getNameEv -0x000000710016ed7c,U,000304,_ZNK4File3extEv +0x000000710016ec84,O,000144,_ZN4File6lengthEv +0x000000710016ed14,M,000104,_ZNK4File7getNameEv +0x000000710016ed7c,M,000304,_ZNK4File3extEv 0x000000710016eeac,U,000188, 0x000000710016ef68,U,000112, 0x000000710016efd8,O,000040,_ZN10FileHeaderC1Ev @@ -10663,22 +10663,22 @@ Address,Quality,Size,Name 0x0000007100170538,U,000236,_ZNSt3__115basic_stringbufIwNS_11char_traitsIwEENS_9allocatorIwEEEC_gen3 0x0000007100170624,U,000044, 0x0000007100170650,U,000200,getEndian__10FileHeaderSF13ESavePlatform -0x0000007100170718,U,000228,_ZN15FileInputStreamC1ERK4File -0x00000071001707fc,U,000064,_ZN15FileInputStreamD2Ev -0x000000710017083c,U,000036,_ZN15FileInputStreamD0Ev -0x0000007100170860,U,000124,vtbl_7101057E68_func_2 -0x00000071001708dc,U,000112,_ZN15FileInputStream4readE15arrayWithLengthIhE -0x000000710017094c,U,000160,vtbl_7101057E68_func_4 -0x00000071001709ec,U,000052,_ZN15FileInputStream5closeEv -0x0000007100170a20,U,000008,vtbl_7101057E68_func_6 -0x0000007100170a28,U,000028,_ZN15FileInputStream8filesizeEv -0x0000007100170a44,U,000160,_ZN16FileOutputStreamC1ERK4File -0x0000007100170ae4,U,000064,_ZN16FileOutputStreamD2Ev -0x0000007100170b24,U,000036,_ZN16FileOutputStreamD0Ev -0x0000007100170b48,U,000052,vtbl_7101057EB0_func_2 -0x0000007100170b7c,U,000040,vtbl_7101057EB0_func_3 -0x0000007100170ba4,U,000080,vtbl_7101057EB0_func_4 -0x0000007100170bf4,U,000044,_ZN16FileOutputStream5closeEv +0x0000007100170718,M,000228,_ZN15FileInputStreamC1ERK4File +0x00000071001707fc,O,000064,_ZN15FileInputStreamD2Ev +0x000000710017083c,O,000036,_ZN15FileInputStreamD0Ev +0x0000007100170860,M,000124,_ZN15FileInputStream4readEv +0x00000071001708dc,M,000112,_ZN15FileInputStream4readE15arrayWithLengthIhE +0x000000710017094c,M,000160,_ZN15FileInputStream4readE15arrayWithLengthIhEjj +0x00000071001709ec,O,000052,_ZN15FileInputStream5closeEv +0x0000007100170a20,O,000008,_ZN15FileInputStream4skipEx +0x0000007100170a28,O,000028,_ZN15FileInputStream8filesizeEv +0x0000007100170a44,O,000160,_ZN16FileOutputStreamC1ERK4File +0x0000007100170ae4,O,000064,_ZN16FileOutputStreamD2Ev +0x0000007100170b24,O,000036,_ZN16FileOutputStreamD0Ev +0x0000007100170b48,M,000052,_ZN16FileOutputStream5writeEj +0x0000007100170b7c,O,000040,_ZN16FileOutputStream5writeE15arrayWithLengthIhE +0x0000007100170ba4,O,000080,_ZN16FileOutputStream5writeE15arrayWithLengthIhEjj +0x0000007100170bf4,O,000044,_ZN16FileOutputStream5closeEv 0x0000007100170c20,U,000132,_ZN13FindMountGoalC_gen 0x0000007100170ca4,U,000024,_ZN4GoalC_gen 0x0000007100170cbc,U,001232, @@ -10812,7 +10812,7 @@ Address,Quality,Size,Name 0x0000007100177e38,U,000196, 0x0000007100177efc,U,000176,_ZN21FireworksRocketEntityC_gen2 0x0000007100177fac,U,000296,_ZN21FireworksRocketEntityC_gen3 -0x00000071001780d4,U,000032, +0x00000071001780d4,O,000032,_ZN3Mth5roundEd 0x00000071001780f4,U,000264,_ZN21FireworksRocketEntityC_gen4 0x00000071001781fc,U,000260,_ZN21FireworksRocketEntityC_gen5 0x0000007100178300,U,000184,_ZN21FireworksRocketEntity10lerpMotionEddd @@ -12258,9 +12258,9 @@ Address,Quality,Size,Name 0x00000071001a26cc,U,000568, 0x00000071001a2904,O,000076,_ZN17HellSpringFeatureC1EP5Blockb 0x00000071001a2950,O,000916,_ZN17HellSpringFeature5placeEP5LevelR6RandomRK8BlockPos -0x00000071001a2ce4,U,000212,_ZN9HitResultC1EP4Vec3PK9DirectionRK8BlockPos -0x00000071001a2db8,U,000156,__ct__9HitResultFP4Vec3PC9Direction -0x00000071001a2e54,U,000152,_ZN9HitResultC1ENSt3__110shared_ptrI6EntityEE +0x00000071001a2ce4,O,000212,_ZN9HitResultC1EP4Vec3PK9DirectionRK8BlockPos +0x00000071001a2db8,O,000156,_ZN9HitResultC1EP4Vec3PK9Direction +0x00000071001a2e54,O,000152,_ZN9HitResultC1ENSt3__110shared_ptrI6EntityEE 0x00000071001a2eec,U,000212, 0x00000071001a2fc0,U,000140, 0x00000071001a304c,U,000104,_ZN7HoeItemC_gen @@ -13015,10 +13015,10 @@ Address,Quality,Size,Name 0x00000071001cd6dc,U,000056,_ZN8ItemStatC_gen 0x00000071001cd714,U,000008, 0x00000071001cd71c,U,000036, -0x00000071001cd740,U,000008, -0x00000071001cd748,U,000320, -0x00000071001cd888,U,000008, -0x00000071001cd890,U,000808, +0x00000071001cd740,O,000008,_ZN18ItemTotemRenameFix10getVersionEv +0x00000071001cd748,O,000320,_ZN18ItemTotemRenameFix3fixEP11CompoundTag +0x00000071001cd888,O,000008,_ZN18ItemWaterPotionFix10getVersionEv +0x00000071001cd890,O,000808,_ZN18ItemWaterPotionFix3fixEP11CompoundTag 0x00000071001cdbb8,U,000036, 0x00000071001cdbdc,U,000012, 0x00000071001cdbe8,U,000012, @@ -13358,8 +13358,8 @@ Address,Quality,Size,Name 0x00000071001d1e30,U,000012,_ZN10ItemEntity7GetTypeEv 0x00000071001d1e3c,U,000012, 0x00000071001d1e48,U,000036,_ZN22ItemShulkerBoxColorFixD0Ev -0x00000071001d1e6c,U,000036,_ZN18ItemTotemRenameFixD0Ev -0x00000071001d1e90,U,000036,_ZN18ItemWaterPotionFixD0Ev +0x00000071001d1e6c,O,000036,_ZN18ItemTotemRenameFixD0Ev +0x00000071001d1e90,O,000036,_ZN18ItemWaterPotionFixD0Ev 0x00000071001d1eb4,U,000012, 0x00000071001d1ec0,U,000052,_ZN12JukeboxBlock6EntityD2Ev 0x00000071001d1ef4,U,000036,_ZN12JukeboxBlock6EntityD0Ev @@ -13393,11 +13393,11 @@ Address,Quality,Size,Name 0x00000071001d2330,U,000084, 0x00000071001d2384,U,000008, 0x00000071001d238c,U,000084, -0x00000071001d23e0,U,000020,_ZN10DataWalkerC1Ev -0x00000071001d23f4,U,000004, +0x00000071001d23e0,O,000020,_ZN10DataWalkerC2Ev +0x00000071001d23f4,O,000004,_ZN10DataWalkerD2Ev 0x00000071001d23f8,U,000036,_ZN16EntityDataWalkerD0Ev 0x00000071001d241c,U,000300, -0x00000071001d2548,U,000036,_ZN10DataWalkerD0Ev +0x00000071001d2548,M,000036,_ZN10DataWalkerD0Ev 0x00000071001d256c,U,000060, 0x00000071001d25a8,U,000060, 0x00000071001d25e4,U,000004, @@ -13499,7 +13499,7 @@ Address,Quality,Size,Name 0x00000071001d463c,U,000060, 0x00000071001d4678,U,000004, 0x00000071001d467c,O,000024,_ZNSt3__113unordered_mapI16ResourceLocationP4ItemNS_4hashIS1_EENS_8equal_toIS1_EENS_9allocatorINS_4pairIKS1_S3_EEEEE2atERSA_ -0x00000071001d4694,M,000300,_ZNSt3__112__hash_tableINS_17__hash_value_typeI16ResourceLocationP4ItemEENS_22__unordered_map_hasherIS2_S5_NS_4hashIS2_EELb1EEENS_21__unordered_map_equalIS2_S5_NS_8equal_toIS2_EELb1EEENS_9allocatorIS5_EEE4findIS2_EENS_15__hash_iteratorIPNS_11__hash_nodeIS5_PvEEEERKT_ +0x00000071001d4694,O,000300,_ZNSt3__112__hash_tableINS_17__hash_value_typeI16ResourceLocationP4ItemEENS_22__unordered_map_hasherIS2_S5_NS_4hashIS2_EELb1EEENS_21__unordered_map_equalIS2_S5_NS_8equal_toIS2_EELb1EEENS_9allocatorIS5_EEE4findIS2_EENS_15__hash_iteratorIPNS_11__hash_nodeIS5_PvEEEERKT_ 0x00000071001d47c0,U,000604, 0x00000071001d4a1c,U,000108, 0x00000071001d4a88,U,000932, @@ -14553,7 +14553,7 @@ Address,Quality,Size,Name 0x00000071001fdd44,O,000072,_ZN5Level11addListenerEP13LevelListener 0x00000071001fdd8c,O,000140,_ZN5Level14removeListenerEP13LevelListener 0x00000071001fde18,U,001852,_ZN5Level25internalGetCollisionAABBsENSt3__110shared_ptrI6EntityEEPK4AABBbPSt6vectorIP4AABBSt9allocatorIP4AABBEEbbb -0x00000071001fe554,U,000024, +0x00000071001fe554,O,000024,_ZN3Mth4ceilEf 0x00000071001fe56c,U,000196, 0x00000071001fe630,U,000164, 0x00000071001fe6d4,U,000664,_ZN5Level17getCollisionAABBsENSt3__110shared_ptrI6EntityEEPK4AABBbbb @@ -14803,10 +14803,10 @@ Address,Quality,Size,Name 0x000000710020af60,U,000588, 0x000000710020b1ac,U,000176,_ZN10LevelChunk17removeBlockEntityERK8BlockPos 0x000000710020b25c,U,001768,_ZN10LevelChunk4loadEb -0x000000710020b944,U,000016,size__7ListTagCFv -0x000000710020b954,U,000108,getCompound__7ListTagCFi +0x000000710020b944,M,000016,_ZNK7ListTag4sizeEv +0x000000710020b954,M,000108,_ZNK7ListTag11getCompoundEi 0x000000710020b9c0,U,001544,_ZN10LevelChunk6unloadEbb -0x000000710020bfc8,U,000176,ListTag__add +0x000000710020bfc8,M,000176,_ZN7ListTag3addEP3Tag 0x000000710020c078,U,000056, 0x000000710020c0b0,M,000072,_ZNSt3__113__vector_baseIP16TickNextTickDataNS_9allocatorIS2_EEED2Ev 0x000000710020c0f8,U,000188,_ZN10LevelChunk14containsPlayerEv @@ -15112,28 +15112,28 @@ Address,Quality,Size,Name 0x0000007100216224,U,000084, 0x0000007100216278,U,000008,_ZN17StaticLiquidBlock17getBlockFaceShapeEP11LevelSourcePK10BlockStateRK8BlockPosPK9Direction 0x0000007100216280,O,000060,_ZN7ListTagC2Ei -0x00000071002162bc,U,000068,_ZN7ListTagD1Ev -0x0000007100216300,U,000068,_ZN3Tag14deleteElementsIPS_EEvRKNSt3__16vectorIT_NS2_9allocatorIS4_EEEE +0x00000071002162bc,M,000068,_ZN7ListTagD1Ev +0x0000007100216300,O,000068,_ZN3Tag14deleteElementsIPS_EEvRKNSt3__16vectorIT_NS2_9allocatorIS4_EEEE 0x0000007100216344,U,000056, -0x000000710021637c,U,000036,_ZN7ListTagD0Ev +0x000000710021637c,O,000036,_ZN7ListTagD0Ev 0x00000071002163a0,O,000168,_ZN7ListTag5writeEP10DataOutput 0x0000007100216448,O,000252,_ZN7ListTag4loadEP9DataInputi 0x0000007100216544,O,000008,_ZN7ListTag5getIdEv 0x000000710021654c,O,000120,_ZN7ListTag8toStringEv 0x00000071002165c4,M,000396,_ZN7ListTag5printERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEPcRNS0_13basic_ostreamIwS3_EE -0x0000007100216750,U,000208, +0x0000007100216750,O,000208,_ZN7ListTag3setEiP3Tag 0x0000007100216820,U,000124, 0x000000710021689c,U,000084, -0x00000071002168f0,U,000184,_ZN7ListTag18stripEmptyChildrenEv -0x00000071002169a8,U,000016,_ZNK7ListTag7isEmptyEv +0x00000071002168f0,O,000184,_ZN7ListTag18stripEmptyChildrenEv +0x00000071002169a8,O,000016,_ZNK7ListTag7isEmptyEv 0x00000071002169b8,U,000040, -0x00000071002169e0,U,000116, -0x0000007100216a54,U,000116,_ZNK7ListTag9getDoubleEi +0x00000071002169e0,O,000116,_ZNK7ListTag6getIntEi +0x0000007100216a54,O,000116,_ZNK7ListTag9getDoubleEi 0x0000007100216ac8,U,000116,_ZNK7ListTag8getFloatEi 0x0000007100216b3c,U,000168, 0x0000007100216be4,O,000168,_ZN7ListTag4copyEv 0x0000007100216c8c,M,000188,_ZN7ListTag6equalsEP3Tag -0x0000007100216d48,U,000008, +0x0000007100216d48,O,000008,_ZNK7ListTag14getElementTypeEv 0x0000007100216d50,U,000196,_ZN12LivingEntity10staticCtorEv 0x0000007100216e14,U,000036,_ZN12LivingEntity4killEv 0x0000007100216e38,U,000564,_ZN12LivingEntity4initEv @@ -15280,10 +15280,10 @@ Address,Quality,Size,Name 0x000000710021f364,U,001732,_ZN12LivingEntity4tickEv 0x000000710021fa28,U,000216,_ZNSt3__120__shared_ptr_pointerIP32ClientboundSetEquippedItemPacketNS_14default_deleteIS1_EENS_9allocatorIS1_EEEC_gen 0x000000710021fb00,O,000016,_ZN3Mth3absEf -0x000000710021fb10,U,000088,_ZN3Mth11wrapDegreesEf +0x000000710021fb10,O,000088,_ZN3Mth11wrapDegreesEf 0x000000710021fb68,U,000192,_ZN12LivingEntity12tickHeadTurnEff 0x000000710021fc28,U,001144,_ZN12LivingEntity6aiStepEv -0x00000071002200a0,U,000088,_ZN3Mth11wrapDegreesEd +0x00000071002200a0,O,000088,_ZN3Mth11wrapDegreesEd 0x00000071002200f8,U,000580, 0x000000710022033c,O,000004,_ZN12LivingEntity12serverAiStepEv 0x0000007100220340,U,000520,_ZN12LivingEntity12pushEntitiesEv @@ -16654,9 +16654,9 @@ Address,Quality,Size,Name 0x000000710025a124,U,000236, 0x000000710025a210,U,000068, 0x000000710025a254,U,000060, -0x000000710025a290,U,000012,_ZN3Mth17cached_atan_indexEii +0x000000710025a290,O,000012,_ZN3Mth17cached_atan_indexEii 0x000000710025a29c,U,000176, -0x000000710025a34c,U,000232,_ZN3Mth4initEv +0x000000710025a34c,O,000232,_ZN3Mth4initEv 0x000000710025a434,U,000228, 0x000000710025a518,U,000080, 0x000000710025a568,O,000024,_ZN3Mth6lfloorEd @@ -16665,8 +16665,8 @@ Address,Quality,Size,Name 0x000000710025a5b0,O,000044,_ZN3Mth11clampedLerpEddd 0x000000710025a5dc,O,000036,_ZN3Mth6asbMaxEdd 0x000000710025a600,U,000028, -0x000000710025a61c,U,000060, -0x000000710025a658,U,000060, +0x000000710025a61c,O,000060,_ZN3Mth9nextFloatEP6Randomff +0x000000710025a658,O,000060,_ZN3Mth10nextDoubleEP6Randomdd 0x000000710025a694,U,000064, 0x000000710025a6d4,U,000120, 0x000000710025a74c,U,000212,_ZNSt3__115basic_stringbufIwNS_11char_traitsIwEENS_9allocatorIwEEEC_gen10 @@ -16679,12 +16679,12 @@ Address,Quality,Size,Name 0x000000710025a924,U,000056, 0x000000710025a95c,U,000048, 0x000000710025a98c,O,000040,_ZN3Mth4fracEd -0x000000710025a9b4,U,000060,_ZN3Mth7getSeedEiii -0x000000710025a9f0,U,000192,createInsecureUUID__3MthSFP6Random +0x000000710025a9b4,O,000060,_ZN3Mth7getSeedEiii +0x000000710025a9f0,M,000192,createInsecureUUID__3MthSFP6Random 0x000000710025aab0,U,000012, 0x000000710025aabc,O,000016,_ZN3Mth3pctEddd 0x000000710025aacc,U,000044, -0x000000710025aaf8,U,000348,_ZN3Mth8hsvToRgbEfff +0x000000710025aaf8,O,000348,_ZN3Mth8hsvToRgbEfff 0x000000710025ac54,U,000076,_ZN4MuleC_gen 0x000000710025aca0,U,000012,_ZN4Mule14addDataWalkersEP14DataFixerUpper 0x000000710025acac,U,000012, @@ -16936,8 +16936,8 @@ Address,Quality,Size,Name 0x000000710026ab1c,O,000324,_ZN21NetherFlatLevelSource11createChunkEii 0x000000710026ac60,O,000016,_ZN21NetherFlatLevelSource10lightChunkEP10LevelChunk 0x000000710026ac70,M,000604,_ZN21NetherFlatLevelSource11postProcessEii -0x000000710026aecc,O,000052,_ZN15HellFireFeatureC1Ev -0x000000710026af00,O,000052,_ZN15LightGemFeatureC1Ev +0x000000710026aecc,O,000052,_ZN15HellFireFeatureC2Ev +0x000000710026af00,O,000052,_ZN15LightGemFeatureC2Ev 0x000000710026af34,O,000068,_ZN21NetherFlatLevelSource9getMobsAtEP11MobCategoryRK8BlockPos 0x000000710026af78,O,000008,_ZN21NetherFlatLevelSource22postProcessLoadedChunkEP10LevelChunkii 0x000000710026af80,O,000008,_ZN21NetherFlatLevelSource21findNearestMapFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPosb @@ -23786,7 +23786,7 @@ Address,Quality,Size,Name 0x000000710034b63c,U,000060, 0x000000710034b678,U,000064, 0x000000710034b6b8,U,000064, -0x000000710034b6f8,U,000064, +0x000000710034b6f8,O,000064,_ZN4Vec310staticCtorEv 0x000000710034b738,U,000040, 0x000000710034b760,U,000092, 0x000000710034b7bc,U,000092, @@ -24033,7 +24033,7 @@ Address,Quality,Size,Name 0x000000710035cf24,U,000076,_ZN12SpawnEggItemC_gen 0x000000710035cf70,U,000440,_ZN12SpawnEggItem7getNameERKNSt3__110shared_ptrI12ItemInstanceEE 0x000000710035d128,U,000448, -0x000000710035d2e8,U,000268,replaceAll__FRCQ2_3std78basic_string__tm__58_wQ2_3std20char_traits__tm__2_wQ2_3std18allocator__tm__2_wN21 +0x000000710035d2e8,O,000268,_Z10replaceAllRKNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEES7_S7_ 0x000000710035d3f4,U,000508, 0x000000710035d5f0,U,000064, 0x000000710035d630,U,001040,_ZN12SpawnEggItem5useOnENSt3__110shared_ptrI6PlayerEEP5LevelRK8BlockPosN15InteractionHand16EInteractionHandEPK9Directionfffb @@ -24130,7 +24130,7 @@ Address,Quality,Size,Name 0x000000710035feb4,U,000008, 0x000000710035febc,U,000012, 0x000000710035fec8,U,001344, -0x0000007100360408,U,000120, +0x0000007100360408,O,000120,_ZNK5Vec3i7distSqrEddd 0x0000007100360480,U,000128, 0x0000007100360500,U,000008, 0x0000007100360508,U,000072, @@ -24187,8 +24187,8 @@ Address,Quality,Size,Name 0x0000007100362564,U,000276, 0x0000007100362678,U,000232, 0x0000007100362760,U,000036, -0x0000007100362784,U,000120,_ZN4Vec37newTempEddd -0x00000071003627fc,U,000156,_ZN4Vec39normalizeEv +0x0000007100362784,O,000120,_ZN4Vec37newTempEddd +0x00000071003627fc,O,000156,_ZN4Vec39normalizeEv 0x0000007100362898,U,000016, 0x00000071003628a8,U,000100, 0x000000710036290c,U,000124,_ZN17StainedGlassBlock15blockStaticCtorEv @@ -24270,7 +24270,7 @@ Address,Quality,Size,Name 0x0000007100364ac8,U,000020,_ZN10StairBlock11getMapColorEPK10BlockStateP11LevelSourceRK8BlockPos 0x0000007100364adc,U,000336,_ZN10StairBlock20getStateForPlacementEP5LevelRK8BlockPosPK9DirectionfffiSt10shared_ptrI12LivingEntityE 0x0000007100364c2c,U,000356,_ZN10StairBlock4clipEPK10BlockStateP5LevelRK8BlockPosP4Vec3P4Vec3 -0x0000007100364d90,U,000052,_ZN4Vec313distanceToSqrEPS_ +0x0000007100364d90,O,000052,_ZN4Vec313distanceToSqrEPS_ 0x0000007100364dc4,U,000056, 0x0000007100364dfc,U,000128,_ZN10StairBlock13getBlockStateEi 0x0000007100364e7c,U,000104,_ZN10StairBlock29convertBlockStateToLegacyDataEPK10BlockState @@ -24453,14 +24453,14 @@ Address,Quality,Size,Name 0x000000710036d258,U,000172, 0x000000710036d304,U,000056, 0x000000710036d33c,U,000088, -0x000000710036d394,U,000136,_Z17wstringtofilenameRKNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEERA256_c +0x000000710036d394,M,000136,_Z17wstringtofilenameRKNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEERA256_c 0x000000710036d41c,U,000136, 0x000000710036d4a4,U,000136, -0x000000710036d52c,U,000088,_Z17filenametowstringPKc +0x000000710036d52c,M,000088,_Z17filenametowstringPKc 0x000000710036d584,U,000048, -0x000000710036d5b4,U,000376,_ZNSt3__115basic_stringbufIwNS_11char_traitsIwEENS_9allocatorIwEEEC_gen14 +0x000000710036d5b4,O,000376,_Z5splitRKNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEEwRNS_6vectorIS5_NS3_IS5_EEEE 0x000000710036d72c,U,000352, -0x000000710036d88c,U,000068, +0x000000710036d88c,O,000068,_Z5splitRKNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEEw 0x000000710036d8d0,U,000116, 0x000000710036d944,U,000588, 0x000000710036db90,U,000092, @@ -24469,21 +24469,21 @@ Address,Quality,Size,Name 0x000000710036dcd0,U,000688,escapeXML__FRCQ2_3std78basic_string__tm__58_wQ2_3std20char_traits__tm__2_wQ2_3std18allocator__tm__2_w 0x000000710036df80,U,000228,_Z10formatwstrPKwz 0x000000710036e064,U,000224,formatstr__FPCce -0x000000710036e144,U,000120,_Z18javaStringHashCodeRKNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEE -0x000000710036e1bc,U,000068,_Z15char16towstringPw +0x000000710036e144,M,000120,_Z18javaStringHashCodeRKNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEE +0x000000710036e1bc,O,000068,_Z15char16towstringPw 0x000000710036e200,U,000192,wstringtochar16__wstring -0x000000710036e2c0,U,000068,_ZN9StringTagC1Ev -0x000000710036e304,U,000020,_ZN3TagC1Ev -0x000000710036e318,U,000068,_ZN9StringTagC_gen -0x000000710036e35c,U,000024,_ZN9StringTag5writeEP10DataOutput -0x000000710036e374,U,000164,_ZN9StringTag4loadEP9DataInputi -0x000000710036e418,U,000008,_ZN9StringTag5getIdEv -0x000000710036e420,U,000012,_ZN9StringTag8toStringEv -0x000000710036e42c,U,000052,_ZN9StringTag4copyEv -0x000000710036e460,U,000032,_ZNK9StringTag7isEmptyEv -0x000000710036e480,U,000248,_ZN9StringTag6equalsEP3Tag +0x000000710036e2c0,M,000068,_ZN9StringTagC1Ev +0x000000710036e304,O,000020,_ZN3TagC2Ev +0x000000710036e318,M,000068,_ZN9StringTagC1ERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE +0x000000710036e35c,O,000024,_ZN9StringTag5writeEP10DataOutput +0x000000710036e374,M,000164,_ZN9StringTag4loadEP9DataInputi +0x000000710036e418,O,000008,_ZN9StringTag5getIdEv +0x000000710036e420,O,000012,_ZN9StringTag8toStringEv +0x000000710036e42c,O,000052,_ZN9StringTag4copyEv +0x000000710036e460,O,000032,_ZNK9StringTag7isEmptyEv +0x000000710036e480,M,000248,_ZN9StringTag6equalsEP3Tag 0x000000710036e578,O,000080,_ZN3Tag6equalsEPS_ -0x000000710036e5c8,U,000012,_ZN9StringTag11getAsStringEv +0x000000710036e5c8,O,000012,_ZN9StringTag11getAsStringEv 0x000000710036e5d4,U,000232, 0x000000710036e6bc,U,000068,_ZN17StrongholdFeatureC_gen 0x000000710036e700,U,000108,_ZN16StructureFeatureC_gen @@ -24494,7 +24494,7 @@ Address,Quality,Size,Name 0x000000710036e958,U,000016,vtbl_71010C4E18_func_4 0x000000710036e968,U,000308,vtbl_71010C4E18_func_8 0x000000710036ea9c,U,000636, -0x000000710036ed18,U,000088,distSqr_vec3i +0x000000710036ed18,O,000088,_ZNK5Vec3i7distSqrERKS_ 0x000000710036ed70,U,000192,vtbl_71010C4E18_func_12 0x000000710036ee30,U,000104, 0x000000710036ee98,U,000184,vtbl_71010C4E18_func_9 @@ -24798,14 +24798,14 @@ Address,Quality,Size,Name 0x000000710037fbe4,U,000108, 0x000000710037fc50,U,000684, 0x000000710037fefc,U,000252, -0x000000710037fff8,U,000024,_ZN4Vec33addEddd +0x000000710037fff8,O,000024,_ZN4Vec33addEddd 0x0000007100380010,U,000148, 0x00000071003800a4,U,000140, 0x0000007100380130,U,000240, 0x0000007100380220,U,000060,_ZN17StructureTemplate10addWalkersEP14DataFixerUpper 0x000000710038025c,U,000048,_ZN19AnonymousDataWalkerC_gen 0x000000710038028c,U,000072, -0x00000071003802d4,U,000084,_ZN4Vec312newPermanentEddd +0x00000071003802d4,O,000084,_ZN4Vec312newPermanentEddd 0x0000007100380328,U,000080, 0x0000007100380378,U,000064,_ZN18StructureVoidBlockC_gen 0x00000071003803b8,U,000008,_ZN18StructureVoidBlock14getRenderShapeEPK10BlockState @@ -25496,7 +25496,7 @@ Address,Quality,Size,Name 0x000000710039bb50,O,000096,_ZN4phys4Vec222CreateNewThreadStorageEv 0x000000710039bbb0,O,000028,_ZN4phys4Vec223UseDefaultThreadStorageEv 0x000000710039bbcc,O,000092,_ZN4phys4Vec220ReleaseThreadStorageEv -0x000000710039bc28,U,000084,_ZN4phys4Vec27newTempEff +0x000000710039bc28,O,000084,_ZN4phys4Vec27newTempEff 0x000000710039bc7c,U,000012, 0x000000710039bc88,O,000080,_ZN4Vec313ThreadStorageC1Ev 0x000000710039bcd8,O,000004,_ZN4Vec3C2Ev @@ -25504,32 +25504,32 @@ Address,Quality,Size,Name 0x000000710039bcec,O,000096,_ZN4Vec322CreateNewThreadStorageEv 0x000000710039bd4c,O,000028,_ZN4Vec323UseDefaultThreadStorageEv 0x000000710039bd68,O,000092,_ZN4Vec320ReleaseThreadStorageEv -0x000000710039bdc4,U,000056, +0x000000710039bdc4,O,000056,_ZN4Vec312newPermanentEPKS_ 0x000000710039bdfc,O,000004,_ZN4Vec39resetPoolEv 0x000000710039be00,O,000016,_ZN4Vec33setEddd -0x000000710039be10,U,000076, -0x000000710039be5c,U,000012,_ZN4Vec37newTempEPK4Vec3 -0x000000710039be68,U,000052, +0x000000710039be10,O,000076,_ZN4Vec37newTempERK5Vec3i +0x000000710039be5c,O,000012,_ZN4Vec37newTempEPKS_ +0x000000710039be68,O,000052,_ZN4Vec3C2Eddd 0x000000710039be9c,U,000004, 0x000000710039bea0,U,000028, -0x000000710039bebc,U,000060, -0x000000710039bef8,U,000032, +0x000000710039bebc,O,000060,_ZN4Vec34lerpEPS_d +0x000000710039bef8,O,000032,_ZN4Vec38vectorToEPS_ 0x000000710039bf18,O,000040,_ZN4Vec33dotEPS_ -0x000000710039bf40,U,000056, -0x000000710039bf78,U,000012,_ZN4Vec38subtractEPS_ -0x000000710039bf84,U,000016,_ZN4Vec38subtractEddd -0x000000710039bf94,U,000012, -0x000000710039bfa0,U,000104, -0x000000710039c008,U,000028, +0x000000710039bf40,O,000056,_ZN4Vec35crossEPS_ +0x000000710039bf78,O,000012,_ZN4Vec38subtractEPS_ +0x000000710039bf84,O,000016,_ZN4Vec38subtractEddd +0x000000710039bf94,O,000012,_ZN4Vec33addEPS_ +0x000000710039bfa0,O,000104,_ZN4Vec310distanceToEPS_ +0x000000710039c008,O,000028,_ZN4Vec35scaleEd 0x000000710039c024,O,000084,_ZN4Vec36lengthEv -0x000000710039c078,U,000032, -0x000000710039c098,U,000108, -0x000000710039c104,U,000116, -0x000000710039c178,U,000108, -0x000000710039c1e4,U,000068, -0x000000710039c228,U,000092,_ZN4Vec34xRotEf -0x000000710039c284,U,000092,_ZN4Vec34yRotEf -0x000000710039c2e0,U,000092, +0x000000710039c078,O,000032,_ZN4Vec39lengthSqrEv +0x000000710039c098,O,000108,_ZN4Vec325getIntermediateWithXValueEPS_d +0x000000710039c104,O,000116,_ZN4Vec325getIntermediateWithYValueEPS_d +0x000000710039c178,O,000108,_ZN4Vec325getIntermediateWithZValueEPS_d +0x000000710039c1e4,O,000068,_ZN4Vec36equalsEPS_ +0x000000710039c228,O,000092,_ZN4Vec34xRotEf +0x000000710039c284,O,000092,_ZN4Vec34yRotEf +0x000000710039c2e0,O,000092,_ZN4Vec34zRotEf 0x000000710039c33c,U,000008, 0x000000710039c344,U,000012, 0x000000710039c350,O,000256,_ZN4Vec310distanceToEP4AABB @@ -25540,7 +25540,7 @@ Address,Quality,Size,Name 0x000000710039c674,U,000112, 0x000000710039c6e4,U,000096, 0x000000710039c744,U,000096, -0x000000710039c7a4,U,000104, +0x000000710039c7a4,O,000104,_ZNK5Vec3i8multiplyEi 0x000000710039c80c,U,000244, 0x000000710039c900,U,000088, 0x000000710039c958,U,000056,_ZN3Vex10staticCtorEv @@ -26753,8 +26753,8 @@ Address,Quality,Size,Name 0x00000071003d8b10,U,000012, 0x00000071003d8b1c,U,000008, 0x00000071003d8b24,U,000008, -0x00000071003d8b2c,U,000052,_ZN9StringTagD1Ev -0x00000071003d8b60,U,000036,_ZN9StringTagD0Ev +0x00000071003d8b2c,O,000052,_ZN9StringTagD1Ev +0x00000071003d8b60,O,000036,_ZN9StringTagD0Ev 0x00000071003d8b84,U,000036,_ZN16StrongholdPieces11PieceWeightD0Ev 0x00000071003d8ba8,U,000004,_ZN16StrongholdPieces19SmoothStoneSelectorD2Ev 0x00000071003d8bac,U,000004,_ZN16StrongholdPieces19SmoothStoneSelectorD0Ev @@ -39488,7 +39488,7 @@ Address,Quality,Size,Name 0x0000007100608088,U,000276, 0x000000710060819c,U,000056,ReadDir 0x00000071006081d4,U,000028,CloseDir -0x00000071006081f0,U,000008, +0x00000071006081f0,O,000008,_Z11DeleteFileAPKc 0x00000071006081f8,U,000360,_Z18GetFileAttributesAPKc 0x0000007100608360,U,000008,_Z9MoveFileAPKcS0_ 0x0000007100608368,U,000116, @@ -39497,7 +39497,7 @@ Address,Quality,Size,Name 0x0000007100608478,U,000008, 0x0000007100608480,U,000008, 0x0000007100608488,U,000140, -0x0000007100608514,U,000008, +0x0000007100608514,O,000008,_Z9WriteFilePN2nn2fs10FileHandleEPKvjPjP11_OVERLAPPED 0x000000710060851c,U,000044,_Z14FindFirstFileAPKcP17_WIN32_FIND_DATAA 0x0000007100608548,U,000008,_Z13FindNextFileAiP17_WIN32_FIND_DATAA 0x0000007100608550,U,000012,GlobalMemoryStatus @@ -40510,7 +40510,7 @@ Address,Quality,Size,Name 0x0000007100657eac,U,001220, 0x0000007100658370,U,000008, 0x0000007100658378,U,001220,_ZN10DataFixers9addFixersEP14DataFixerUpper -0x000000710065883c,U,000244, +0x000000710065883c,M,000244,_ZN14DataFixerUpper8addFixerEN12DataFixTypes13EDataFixTypesEP7DataFix 0x0000007100658930,U,000048,_ZN32EntityEquipmentToArmorAndHandFixC_gen 0x0000007100658960,U,000048,_ZN21SignTextStrictJsonFixC_gen 0x0000007100658990,U,000048,_ZN9ItemIdFixC_gen @@ -40535,27 +40535,27 @@ Address,Quality,Size,Name 0x0000007100658d20,U,000048,_ZN16BlockEntityIdFixC_gen 0x0000007100658d50,U,000048,_ZN11EntityIdFixC_gen 0x0000007100658d80,U,000048,_ZN18ItemBannerColorFixC_gen -0x0000007100658db0,U,000048,_ZN18ItemWaterPotionFixC_gen +0x0000007100658db0,O,000048,_ZN18ItemWaterPotionFixC1Ev 0x0000007100658de0,U,000048,_ZN21EntityShulkerColorFixC_gen 0x0000007100658e10,U,000048,_ZN22ItemShulkerBoxColorFixC_gen 0x0000007100658e40,U,000048,_ZN29BlockEntityShulkerBoxColorFixC_gen 0x0000007100658e70,U,000048,_ZN27OptionsLowerCaseLanguageFixC_gen -0x0000007100658ea0,U,000048,_ZN18ItemTotemRenameFixC_gen +0x0000007100658ea0,O,000048,_ZN18ItemTotemRenameFixC1Ev 0x0000007100658ed0,U,000048,_ZN22BedBlockEntityInjecterC_gen 0x0000007100658f00,U,000048,_ZN15BedItemColorFixC_gen 0x0000007100658f30,U,000752,_ZN10DataFixers16createFixerUpperEv -0x0000007100659220,U,000136, -0x00000071006592a8,U,000204, -0x0000007100659374,U,000084,_ZN14DataFixerUpperC1Ei -0x00000071006593c8,U,000020,_ZN9DataFixerC1Ev -0x00000071006593dc,U,000140,updateData__14DataFixerUpperFQ2_12DataFixTypes13EDataFixTypesP11CompoundTag -0x0000007100659468,U,000108, -0x00000071006594d4,U,000164, -0x0000007100659578,U,000132, +0x0000007100659220,O,000136,_ZN10DataFixers10updateItemEP9DataFixerP11CompoundTagiRKNSt3__112basic_stringIwNS4_11char_traitsIwEENS4_9allocatorIwEEEE +0x00000071006592a8,O,000204,_ZN10DataFixers11updateItemsEP9DataFixerP11CompoundTagiRKNSt3__112basic_stringIwNS4_11char_traitsIwEENS4_9allocatorIwEEEE +0x0000007100659374,O,000084,_ZN14DataFixerUpperC1Ei +0x00000071006593c8,O,000020,_ZN9DataFixerC2Ev +0x00000071006593dc,O,000140,_ZN14DataFixerUpper10updateDataEN12DataFixTypes13EDataFixTypesEP11CompoundTag +0x0000007100659468,O,000108,_ZN14DataFixerUpper6updateEN12DataFixTypes13EDataFixTypesEP11CompoundTagi +0x00000071006594d4,O,000164,_ZN14DataFixerUpper10applyFixesEN12DataFixTypes13EDataFixTypesEP11CompoundTagi +0x0000007100659578,O,000132,_ZN14DataFixerUpper12applyWalkersEN12DataFixTypes13EDataFixTypesEP11CompoundTagi 0x00000071006595fc,U,000556, -0x0000007100659828,U,000076, -0x0000007100659874,U,000112, -0x00000071006598e4,U,000112, +0x0000007100659828,O,000076,_ZN14DataFixerUpper9addWalkerEN12DataFixTypes13EDataFixTypesEP10DataWalker +0x0000007100659874,O,000112,_ZN14DataFixerUpper17getOrCreateWalkerEN12DataFixTypes13EDataFixTypesE +0x00000071006598e4,O,000112,_ZN14DataFixerUpper14getOrCreateFixEN12DataFixTypes13EDataFixTypesE 0x0000007100659954,U,000556, 0x0000007100659b80,U,000224, 0x0000007100659c60,U,000052,_ZN17Deadmau5EarsLayerC_gen @@ -41030,8 +41030,8 @@ Address,Quality,Size,Name 0x000000710066cc54,U,000152, 0x000000710066ccec,U,000116, 0x000000710066cd60,U,000096, -0x000000710066cdc0,U,000020,_ZN7DataFixC1Ev -0x000000710066cdd4,U,000036,_ZN7DataFixD0Ev +0x000000710066cdc0,O,000020,_ZN7DataFixC2Ev +0x000000710066cdd4,M,000036,_ZN7DataFixD0Ev 0x000000710066cdf8,U,000036,_ZN20BorderChangeListenerD0Ev 0x000000710066ce1c,U,000048,_ZN34AbstractProjectileDispenseBehaviorC_gen 0x000000710066ce4c,U,000036,_ZNZN18DispenserBootstrap10StaticCtorEvE21ArrowDispenseBehaviorD0Ev @@ -42403,7 +42403,7 @@ Address,Quality,Size,Name 0x00000071006b0c64,U,000336, 0x00000071006b0db4,U,000068,_ZN14ItemDataWalkerC_gen 0x00000071006b0df8,U,000236,_ZN15KeyedDataWalkerC_gen -0x00000071006b0ee4,U,000100, +0x00000071006b0ee4,O,000100,_ZN14ItemDataWalker6doWalkEP9DataFixerP11CompoundTagi 0x00000071006b0f48,U,000088,_ZN18ItemEntityRendererC_gen 0x00000071006b0fa0,U,002360,_ZN18ItemEntityRenderer6renderERNSt3__110shared_ptrI6EntityEEdddff 0x00000071006b18d8,U,005840,_ZN14ItemTransforms13getTransformsEPK12ItemInstanceP12LivingEntity @@ -42426,7 +42426,7 @@ Address,Quality,Size,Name 0x00000071006b4558,O,000036,_ZN11MapRenderer6renderERKNSt3__110shared_ptrI16MapItemSavedDataEERKNS1_I6PlayerEE 0x00000071006b457c,U,000416, 0x00000071006b471c,U,000044, -0x00000071006b4748,U,010112,_ZN9ItemIdFix10staticCtorEv +0x00000071006b4748,O,010112,_ZN9ItemIdFix10staticCtorEv 0x00000071006b6ec8,U,000008, 0x00000071006b6ed0,U,000272, 0x00000071006b6fe0,U,000472, @@ -42462,7 +42462,7 @@ Address,Quality,Size,Name 0x00000071006bbcdc,U,000960, 0x00000071006bc09c,U,000156,_ZN18ItemListDataWalkerC_gen 0x00000071006bc138,U,000088,_ZN18ItemListDataWalkerC_gen2 -0x00000071006bc190,U,000100, +0x00000071006bc190,O,000100,_ZN18ItemListDataWalker6doWalkEP9DataFixerP11CompoundTagi 0x00000071006bc1f4,U,000272,_ZN18ItemPickupParticleC_gen 0x00000071006bc304,U,000392, 0x00000071006bc48c,U,000032, @@ -42519,7 +42519,7 @@ Address,Quality,Size,Name 0x00000071006c1a1c,U,000140, 0x00000071006c1aa8,U,000068, 0x00000071006c1aec,U,000660, -0x00000071006c1d80,U,000212, +0x00000071006c1d80,O,000212,_ZN15KeyedDataWalker4walkEP9DataFixerP11CompoundTagi 0x00000071006c1e54,O,000048,_ZN10KeyMappingC1ERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEi 0x00000071006c1e84,U,000512,_ZN15LargeChestModelC_gen 0x00000071006c2084,U,000052,_ZN18LargeSmokeParticleC_gen @@ -43257,7 +43257,7 @@ Address,Quality,Size,Name 0x00000071006ef260,U,000052, 0x00000071006ef294,U,000260, 0x00000071006ef398,U,000280, -0x00000071006ef4b0,U,000796, +0x00000071006ef4b0,O,000796,_ZN8NbtUtils14readBlockStateEP11CompoundTag 0x00000071006ef7cc,U,000336,_ZN20NetherPortalParticleC_gen 0x00000071006ef91c,U,000100, 0x00000071006ef980,U,000056, @@ -43528,18 +43528,18 @@ Address,Quality,Size,Name 0x00000071006f7e54,U,000036,_ZN5InputD0Ev 0x00000071006f7e78,U,000008, 0x00000071006f7e80,U,000036,_ZN19ItemCookedFishIdFixD0Ev -0x00000071006f7ea4,U,000052,_ZN15KeyedDataWalkerC_gen2 -0x00000071006f7ed8,U,000036,_ZN15KeyedDataWalkerD0Ev -0x00000071006f7efc,U,000052,_ZN14ItemDataWalkerD2Ev -0x00000071006f7f30,U,000036,_ZN14ItemDataWalkerD0Ev +0x00000071006f7ea4,O,000052,_ZN15KeyedDataWalkerD2Ev +0x00000071006f7ed8,O,000036,_ZN15KeyedDataWalkerD0Ev +0x00000071006f7efc,O,000052,_ZN14ItemDataWalkerD2Ev +0x00000071006f7f30,O,000036,_ZN14ItemDataWalkerD0Ev 0x00000071006f7f54,U,000036,_ZN18ItemEntityRendererD0Ev 0x00000071006f7f78,U,000012,_ZN18ItemEntityRenderer12SetItemFrameEb 0x00000071006f7f84,U,000036,_ZN17ItemFrameRendererD0Ev 0x00000071006f7fa8,U,000036,_ZN9ItemIdFixD0Ev 0x00000071006f7fcc,U,000036,_ZN32ItemInstanceBlockEntityTagWalkerD0Ev 0x00000071006f7ff0,U,000036,_ZN27ItemInstanceEntityTagWalkerD0Ev -0x00000071006f8014,U,000052,_ZN18ItemListDataWalkerD2Ev -0x00000071006f8048,U,000036,_ZN18ItemListDataWalkerD0Ev +0x00000071006f8014,O,000052,_ZN18ItemListDataWalkerD2Ev +0x00000071006f8048,O,000036,_ZN18ItemListDataWalkerD0Ev 0x00000071006f806c,U,000012, 0x00000071006f8078,U,000064,_ZN18ItemPickupParticleD2Ev 0x00000071006f80b8,U,000036,_ZN18ItemPickupParticleD0Ev diff --git a/src/4JLibraries_Source/fui/fui.cpp b/src/4JLibraries_Source/fui/fui.cpp index 703cd822..18051b8c 100644 --- a/src/4JLibraries_Source/fui/fui.cpp +++ b/src/4JLibraries_Source/fui/fui.cpp @@ -96,7 +96,7 @@ void fui::render(fuiFile* file, float a1, float a2, float a3, float a4, float a5 } void fui::dispatchKeyboardEvent(fuiFile* file, bool state, int c) { - FJ_FuiNode* node = file->m_data.m_fuiSymbol->m_stage; // ??? + FJ_FuiNode* node = file->m_renderNodeStage->m_fuiNodeStage; if (FJ_FuiNode* focus = static_cast(node)->getFocus()) node = focus; @@ -106,7 +106,7 @@ void fui::dispatchKeyboardEvent(fuiFile* file, bool state, int c) { // param names guessed void fui::dispatchMouseMoveEvent(fuiFile* file, float x, float y) { - FJ_FuiNode* node = file->m_data.m_fuiSymbol->m_stage; + FJ_FuiNode* node = file->m_renderNodeStage->m_fuiNodeStage; if (FJ_FuiNode* focus = static_cast(node)->getFocus()) node = focus; diff --git a/src/4JLibraries_Source/fui/fuiFile.h b/src/4JLibraries_Source/fui/fuiFile.h index e234f508..a948ba41 100644 --- a/src/4JLibraries_Source/fui/fuiFile.h +++ b/src/4JLibraries_Source/fui/fuiFile.h @@ -3,6 +3,7 @@ #include "fui/fuiSymbol.h" #include "net/minecraft/world/ArrayWithLength.h" #include "types.h" +#include // Most structs derived from // https://github.com/NessieHax/fui-research-repo/blob/main/DOCUMENTATION.md @@ -46,47 +47,107 @@ struct fuiMatrix { static void mul(const fuiMatrix& lhs, const fuiMatrix& rhs, fuiMatrix& out); }; struct fuiColorTransform { - float m_redMultTerm; - float m_greenMultTerm; - float m_blueMultTerm; - float m_alphaMultTerm; float m_redAddTerm; float m_greenAddTerm; float m_blueAddTerm; float m_alphaAddTerm; + float m_redMultTerm; + float m_greenMultTerm; + float m_blueMultTerm; + float m_alphaMultTerm; }; struct fuiTimeline { int m_symbolIndex; - short m_frameIndex; - short m_frameCount; - short m_actionIndex; - short m_actionCount; + uint16_t m_frameIndex; + uint16_t m_frameCount; + uint16_t m_actionIndex; + uint16_t m_actionCount; fuiRect m_rect; }; -struct fuiTimelineAction; -struct fuiShape; -struct fuiShapeComponent; -struct fuiVert; -struct fuiTimelineFrame; -struct fuiTimelineEvent; -struct timelineEventName; +struct fuiTimelineAction { + uint16_t m_type; + int16_t m_frame; + char m_argument0[64]; + char m_argument1[64]; +}; +struct fuiShape { + int m_symbolIndex; + int m_componentIndex; + int m_componentCount; + fuiRect m_rect; +}; +struct fuiFillStyle { + int m_type; + fuiRGBA m_colour; + int m_bitmapIndex; + fuiMatrix m_matrix; +}; +struct fuiShapeComponent { + fuiFillStyle m_fill; + int m_vertexIndex; + int m_vertexCount; +}; +struct fuiVert { + float m_x, m_y; +}; +struct fuiTimelineFrame { + char m_name[64]; + int m_eventIndex; + int m_eventCount; +}; +struct fuiTimelineEvent { + uint16_t m_type; + uint8_t m_objectType; + uint8_t m_flags; + int16_t m_depth; + int16_t m_objectIndex; + int16_t m_unknown; + int16_t m_nameIndex; + fuiMatrix m_matrix; + fuiColorTransform m_colourTransform; + fuiRGBA m_colour; +}; +struct timelineEventName { + char m_name[64]; +}; struct fuiReference { int m_symbolIndex; char m_name[64]; int m_index; }; -struct fuiEdittext; -struct fuiBitmap; -struct fuiFontName; -struct fuiImportAsset; +struct fuiEdittext { + int m_symbolIndex; + fuiRect m_rect; + int m_fontId; + float m_fontSize; + fuiRGBA m_colour; + int m_flags[6]; + char m_text[256]; +}; +struct fuiBitmap { + int m_symbolIndex; + int m_format; + int m_width; + int m_height; + int m_offset; + int m_size; + int m_alphaOffset; + int m_texture; +}; +struct fuiFontName { + int m_id; + char m_name[256]; +}; +struct fuiImportAsset { + char m_name[64]; +}; class FJ_FuiNode; struct fuiHeader { - bool m_field0; + unsigned char m_signature[8]; int m_contentSize; - int m_field8; - char m_fileName[60]; + char m_fileName[64]; int m_timelineCount; int m_timelineEventNameCount; int m_timelineActionCount; @@ -97,12 +158,11 @@ struct fuiHeader { int m_timelineEventCount; int m_referenceCount; int m_editTextCount; + int m_symbolCount; int m_bitmapCount; int m_imagesSize; - int m_field7C; int m_fontNameCount; int m_importAssetCount; - int m_unk; fuiRect m_stageSize; int m_index; }; @@ -123,7 +183,7 @@ struct fuiData { fuiReference* m_fuiReference; fuiEdittext* m_fuiEdittext; fuiSymbol* m_fuiSymbol; - fuiBitmapFont* m_fuiBitmap; + fuiBitmap* m_fuiBitmap; void* m_imageMaybe; fuiFontName* m_fuiFontName; fuiImportAsset* m_fuiImportAsset; @@ -132,10 +192,10 @@ struct fuiData { struct fuiFile { fuiFile(); ~fuiFile(); - // NOTE: HAD TO CHANGE THE SIGNATURE BECAUSE OF THE METHOD BEING DIFFERENT - // ORIG HAD A CALLBACK METHOD INSTEAD OF DATA + // Retain the recovered symbol's ABI; its third argument is a byte stride, + // despite the old unsigned-char** declaration in the symbol map. static uint64_t addDataRegion(uint a1, uint a2, uchar** ptr, uint64_t* callbackData); - void load(arrayWithLength, int); + bool load(arrayWithLength, int); bool resolveReferences(fuiFile*); void dumpUnresolvedReferences(); void initialiseRenderTexture(fuiBitmap*, bool); @@ -159,3 +219,15 @@ struct fuiFile { void* m_callbackData; void* m_field138; }; + +static_assert(sizeof(fuiHeader) == 0x9c, "FUI header including runtime file index"); +static_assert(offsetof(fuiHeader, m_contentSize) == 8, "FUI content size"); +static_assert(offsetof(fuiHeader, m_stageSize) == 0x88, "FUI stage rectangle"); +static_assert(sizeof(fuiTimeline) == 0x1c && sizeof(fuiTimelineAction) == 0x84); +static_assert(sizeof(fuiShape) == 0x1c && sizeof(fuiShapeComponent) == 0x2c); +static_assert(sizeof(fuiTimelineFrame) == 0x48 && sizeof(fuiTimelineEvent) == 0x48); +static_assert(sizeof(fuiReference) == 0x48 && sizeof(fuiEdittext) == 0x138); +static_assert(sizeof(fuiBitmap) == 0x20 && sizeof(fuiFontName) == 0x104); +static_assert(offsetof(fuiFile, m_data) == 0xa0); +static_assert(offsetof(fuiFile, m_renderNodeStage) == 0x118); +static_assert(offsetof(fuiFile, m_field138) == 0x138); diff --git a/src/4JLibraries_Source/fui/fuiSymbol.h b/src/4JLibraries_Source/fui/fuiSymbol.h index a880d1e0..33e1c08d 100644 --- a/src/4JLibraries_Source/fui/fuiSymbol.h +++ b/src/4JLibraries_Source/fui/fuiSymbol.h @@ -1,9 +1,9 @@ #pragma once -class FJ_FuiNodeStage; - struct fuiSymbol { - char m_padding[0xf8]; - FJ_FuiNodeStage* - m_stage; // not sure if this is meant to be stage but fui::dispatchKeyboardEvent likes it sooo + char m_name[64]; + int m_objectType; + int m_objectIndex; }; + +static_assert(sizeof(fuiSymbol) == 0x48, "FUI on-disk symbol layout"); diff --git a/src/DecompUtils.h b/src/DecompUtils.h index ae1e85b9..4c155ff1 100644 --- a/src/DecompUtils.h +++ b/src/DecompUtils.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + // this can be depracated if musl is fixed inline __attribute__((__always_inline__)) float decomp_fmax1(float x, float y) { @@ -16,3 +19,14 @@ inline __attribute__((__always_inline__)) float decomp_fminf(float x, float y) { __asm__("fminnm %s0, %s1, %s2" : "=w"(x) : "w"(x), "w"(y)); return x; } + +// AArch64 fmax/fmin propagate NaNs; the C math functions use different semantics. +inline __attribute__((__always_inline__)) double decomp_fmax64(double x, double y) { + __asm__("fmax %d0, %d1, %d2" : "=w"(x) : "w"(x), "w"(y)); + return x; +} + +inline __attribute__((__always_inline__)) double decomp_fmin64(double x, double y) { + __asm__("fmin %d0, %d1, %d2" : "=w"(x) : "w"(x), "w"(y)); + return x; +} diff --git a/src/Minecraft.Client/com/mojang/nbt/ByteArrayTag.cpp b/src/Minecraft.Client/com/mojang/nbt/ByteArrayTag.cpp index 50a306ef..abb7f710 100644 --- a/src/Minecraft.Client/com/mojang/nbt/ByteArrayTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/ByteArrayTag.cpp @@ -1,5 +1,7 @@ #include "com/mojang/nbt/ByteArrayTag.h" + #include "net/minecraft/world/ArrayWithLength.h" +#include #include "java/io/DataInput.h" #include "java/io/DataOutput.h" @@ -15,8 +17,9 @@ ByteArrayTag::ByteArrayTag(arrayWithLength data, bool unk) { } ByteArrayTag::~ByteArrayTag() { - if (m_unknown) + if (m_unknown) { delete m_data.m_data; + } } void ByteArrayTag::write(DataOutput* outputStream) { diff --git a/src/Minecraft.Client/com/mojang/nbt/ByteTag.cpp b/src/Minecraft.Client/com/mojang/nbt/ByteTag.cpp index e3ec5d84..65f96db5 100644 --- a/src/Minecraft.Client/com/mojang/nbt/ByteTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/ByteTag.cpp @@ -30,7 +30,7 @@ bool ByteTag::equals(Tag* other) { return Tag::equals(other) && m_data == otherCasted->m_data; } -long ByteTag::getAsLong() { +JavaLong ByteTag::getAsLong() { return m_data; } diff --git a/src/Minecraft.Client/com/mojang/nbt/ByteTag.h b/src/Minecraft.Client/com/mojang/nbt/ByteTag.h index 3faa16a1..699a8e3b 100644 --- a/src/Minecraft.Client/com/mojang/nbt/ByteTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/ByteTag.h @@ -12,7 +12,7 @@ class ByteTag : public NumericTag { std::wstring toString() override; u8 getId() override; bool equals(Tag*) override; - long getAsLong() override; + JavaLong getAsLong() override; int getAsInt() override; short getAsShort() override; u8 getAsByte() override; diff --git a/src/Minecraft.Client/com/mojang/nbt/CompoundTag.cpp b/src/Minecraft.Client/com/mojang/nbt/CompoundTag.cpp index 19d86678..70d7af7b 100644 --- a/src/Minecraft.Client/com/mojang/nbt/CompoundTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/CompoundTag.cpp @@ -1,20 +1,207 @@ -#include "CompoundTag.h" +#include "com/mojang/nbt/CompoundTag.h" + +#include "com/mojang/nbt/ByteArrayTag.h" #include "com/mojang/nbt/ByteTag.h" -#include +#include "com/mojang/nbt/FloatTag.h" +#include "com/mojang/nbt/IntTag.h" +#include "com/mojang/nbt/ListTag.h" +#include "com/mojang/nbt/LongTag.h" +#include "com/mojang/nbt/ShortTag.h" +#include "com/mojang/nbt/StringTag.h" +#include "java/io/DataInput.h" +#include "java/io/DataOutput.h" +#include "java/io/File.h" +#include +#include -void CompoundTag::putBoolean(const std::wstring& name, bool value) { - this->putByte(name, value); +CompoundTag::CompoundTag() = default; +CompoundTag::~CompoundTag() { + for (const auto& child : m_childTags) + delete child.second; +} + +void CompoundTag::write(DataOutput* output) { + for (const auto& child : m_childTags) { + u8 id = child.second->getId(); + output->writeByte(id); + if (id != TAG_End) { + output->writeUTF(child.first); + child.second->write(output); + } + } + output->writeByte(TAG_End); +} + +void CompoundTag::load(DataInput* input, int depth) { + if (depth > 512) + return; + for (const auto& child : m_childTags) + delete child.second; + m_childTags.clear(); + for (u8 id = Tag::readType(input); id != TAG_End; id = Tag::readType(input)) { + std::wstring name = input->readUTF(); + std::unique_ptr child(Tag::newTag(id)); + child->load(input, depth + 1); + put(name, child.release()); + } +} + +std::wstring CompoundTag::toString() { + return formatwstr(L"%zd entries", m_childTags.size()); +} +u8 CompoundTag::getId() { + return TAG_Compound; +} +// The original CompoundTag printer is empty (0x71000e6968). +void CompoundTag::print(const std::wstring&, char*, std::wostream&) {} +bool CompoundTag::isEmpty() const { + return m_childTags.empty(); +} + +bool CompoundTag::equals(Tag* other) { + if (!Tag::equals(other)) + return false; + auto compound = static_cast(other); + if (m_childTags.size() != compound->m_childTags.size()) + return false; + for (const auto& child : m_childTags) { + Tag* value = compound->get(child.first); + if (!value || !child.second->equals(value)) + return false; + } + return true; +} + +CompoundTag* CompoundTag::copy() { + CompoundTag* result = new CompoundTag(); + for (const auto& child : m_childTags) + result->put(std::wstring(child.first.c_str()), child.second->copy()); + return result; +} + +void CompoundTag::stripEmptyChildren() { + for (auto it = m_childTags.begin(); it != m_childTags.end();) { + Tag* child = it->second; + child->stripEmptyChildren(); + if (child->isEmpty()) { + delete it->second; + it = m_childTags.erase(it); + } else { + ++it; + } + } +} + +void CompoundTag::remove(const std::wstring& name) { + auto it = m_childTags.find(name); + if (it != m_childTags.end()) { + m_childTags.erase(it); + } +} + +Tag* CompoundTag::get(const std::wstring& name) { + auto it = m_childTags.find(name); + return it == m_childTags.end() ? nullptr : it->second; +} +bool CompoundTag::contains(const std::wstring& name) { + return m_childTags.find(name) != m_childTags.end(); +} +u8 CompoundTag::getTagType(const std::wstring& name) const { + auto it = m_childTags.find(name); + return it == m_childTags.end() ? TAG_End : it->second->getId(); +} +bool CompoundTag::contains(const std::wstring& name, int type) { + u8 id = getTagType(name); + return id == type || (type == 99 && id >= TAG_Byte && id <= TAG_Double); } -// idk if this is some std function or not but until someone figures out what that crap it says here -// had to insert those queries cause if they are not here they are getting stripped and call doesn't match +CompoundTag* CompoundTag::getCompound(const std::wstring& name) { + return contains(name, TAG_Compound) ? static_cast(m_childTags[name]) : new CompoundTag(); +} +ListTag* CompoundTag::getList(const std::wstring& name, int type) { + if (getTagType(name) == TAG_List) { + auto list = static_cast(m_childTags[name]); + if (list->isEmpty() || list->getElementType() == type) + return list; + } + return new ListTag(0); +} +const ListTag* CompoundTag::fjSafeGetListTag(const std::wstring& name, int type) const { + static const ListTag empty; + auto it = m_childTags.find(name); + if (it != m_childTags.end() && it->second->getId() == TAG_List) { + auto list = static_cast(it->second); + if (list->isEmpty() || list->getElementType() == type) + return list; + } + return ∅ +} + +bool CompoundTag::getBoolean(const std::wstring& name) { + return getByte(name) != 0; +} +byte CompoundTag::getByte(const std::wstring& name) { + return contains(name, 99) ? static_cast(m_childTags[name])->getAsByte() : 0; +} +short CompoundTag::getShort(const std::wstring& name) { + return contains(name, 99) ? static_cast(m_childTags[name])->getAsShort() : 0; +} +int CompoundTag::getInt(const std::wstring& name) { + return contains(name, 99) ? static_cast(m_childTags[name])->getAsInt() : 0; +} +float CompoundTag::getFloat(const std::wstring& name) { + return contains(name, 99) ? static_cast(m_childTags[name])->getAsFloat() : 0; +} +std::wstring CompoundTag::getString(const std::wstring& name) { + return contains(name, TAG_String) ? m_childTags[name]->getAsString() : L""; +} +arrayWithLength CompoundTag::getByteArray(const std::wstring& name) { + return contains(name, TAG_Byte_Array) ? static_cast(get(name))->m_data : + arrayWithLength(); +} + +// Keep the recovered helper for matching metadata already attached to it. void erease_if_exists(const std::unordered_map& map, const std::wstring& key, Tag* tag) { map.size(); key.length(); delete tag; } - +void CompoundTag::put(const std::wstring& name, Tag* tag) { + Tag* old = get(name); + if (old != tag) + erease_if_exists(m_childTags, name, old); + // Retain the original virtual type query before insertion. + tag->getId(); + m_childTags[name] = tag; +} +void CompoundTag::putBoolean(const std::wstring& name, bool value) { + putByte(name, value); +} void CompoundTag::putByte(const std::wstring& name, byte value) { - erease_if_exists(this->m_childTags, name, this->get(name)); + erease_if_exists(m_childTags, name, get(name)); m_childTags[name] = new ByteTag(value); } +void CompoundTag::putShort(const std::wstring& name, short value) { + erease_if_exists(m_childTags, name, get(name)); + m_childTags[name] = new ShortTag(value); +} +void CompoundTag::putInt(const std::wstring& name, int value) { + erease_if_exists(m_childTags, name, get(name)); + m_childTags[name] = new IntTag(value); +} +void CompoundTag::putLong(const std::wstring& name, long long value) { + erease_if_exists(m_childTags, name, get(name)); + m_childTags[name] = new LongTag(value); +} +void CompoundTag::putFloat(const std::wstring& name, float value) { + erease_if_exists(m_childTags, name, get(name)); + m_childTags[name] = new FloatTag(value); +} +void CompoundTag::putString(const std::wstring& name, const std::wstring& value) { + erease_if_exists(m_childTags, name, get(name)); + m_childTags[name] = new StringTag(value); +} +void CompoundTag::putByteArray(const std::wstring& name, arrayWithLength value) { + erease_if_exists(m_childTags, name, get(name)); + m_childTags[name] = new ByteArrayTag(value, true); +} diff --git a/src/Minecraft.Client/com/mojang/nbt/CompoundTag.h b/src/Minecraft.Client/com/mojang/nbt/CompoundTag.h index 096796a5..7549e926 100644 --- a/src/Minecraft.Client/com/mojang/nbt/CompoundTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/CompoundTag.h @@ -5,6 +5,9 @@ #include "nn/types.h" #include "types.h" #include +#include + +class ListTag; class CompoundTag : public Tag { public: @@ -21,6 +24,9 @@ class CompoundTag : public Tag { void stripEmptyChildren() override; bool isEmpty() const override; void remove(const std::wstring&); + // Caller owns the returned vector; entries are copies of child names. + std::vector* getAllKeys(); + std::unordered_map* getAllTags(); /** Gets a child `Compound Tag` * @@ -64,27 +70,25 @@ class CompoundTag : public Tag { */ float getFloat(const std::wstring& name); - /** Gets a child `List Tag` (but returns void???) + /** Gets a child `List Tag` * * @param name The name of the child tag - * @param length The length of the list (unconfirmed) + * @param length The element tag type */ - void getList(const std::wstring& name, int length); + ListTag* getList(const std::wstring& name, int length); /** Gets a child `Tag` with the provided name * * @param name The name of the tag that you want to get. */ - CompoundTag* get(const std::wstring& name); + Tag* get(const std::wstring& name); - /** Gets a child `List Tag` (Safe) - * - * Why does this return void + /** Gets a child `List Tag` without allocating * * @param name The name of the child tag - * @param length The length of the list (unconfirmed) + * @param length The element tag type */ - void fjSafeGetListTag(const std::wstring& name, int length); + const ListTag* fjSafeGetListTag(const std::wstring& name, int type) const; /** Checks if a child with the provided name exists * @@ -98,6 +102,7 @@ class CompoundTag : public Tag { * @param type Type of the child tag */ bool contains(const std::wstring& name, int type); + u8 getTagType(const std::wstring& name) const; /** Adds a `Tag` * diff --git a/src/Minecraft.Client/com/mojang/nbt/CompoundTagKeys.cpp b/src/Minecraft.Client/com/mojang/nbt/CompoundTagKeys.cpp new file mode 100644 index 00000000..0b5e6328 --- /dev/null +++ b/src/Minecraft.Client/com/mojang/nbt/CompoundTagKeys.cpp @@ -0,0 +1,12 @@ +#include "com/mojang/nbt/CompoundTag.h" + +std::vector* CompoundTag::getAllKeys() { + auto keys = new std::vector(); + for (const auto& child : m_childTags) + keys->push_back(child.first); + return keys; +} + +std::unordered_map* CompoundTag::getAllTags() { + return &m_childTags; +} diff --git a/src/Minecraft.Client/com/mojang/nbt/DoubleTag.cpp b/src/Minecraft.Client/com/mojang/nbt/DoubleTag.cpp index 6b30a66f..7ad030e6 100644 --- a/src/Minecraft.Client/com/mojang/nbt/DoubleTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/DoubleTag.cpp @@ -32,7 +32,7 @@ bool DoubleTag::equals(Tag* other) { return Tag::equals(other) && m_data == otherCasted->m_data; } -long DoubleTag::getAsLong() { +JavaLong DoubleTag::getAsLong() { return floor(m_data); } diff --git a/src/Minecraft.Client/com/mojang/nbt/DoubleTag.h b/src/Minecraft.Client/com/mojang/nbt/DoubleTag.h index 550c70e3..ce7a4426 100644 --- a/src/Minecraft.Client/com/mojang/nbt/DoubleTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/DoubleTag.h @@ -12,7 +12,7 @@ class DoubleTag : public NumericTag { std::wstring toString() override; u8 getId() override; bool equals(Tag*) override; - long getAsLong() override; + JavaLong getAsLong() override; int getAsInt() override; short getAsShort() override; u8 getAsByte() override; diff --git a/src/Minecraft.Client/com/mojang/nbt/EndTag.cpp b/src/Minecraft.Client/com/mojang/nbt/EndTag.cpp index f99b6940..026d91ee 100644 --- a/src/Minecraft.Client/com/mojang/nbt/EndTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/EndTag.cpp @@ -1,5 +1,7 @@ #include "com/mojang/nbt/EndTag.h" +EndTag::EndTag() = default; + void EndTag::write(DataOutput*) {} void EndTag::load(DataInput*, int) {} diff --git a/src/Minecraft.Client/com/mojang/nbt/FloatTag.cpp b/src/Minecraft.Client/com/mojang/nbt/FloatTag.cpp index 559255e6..541abb86 100644 --- a/src/Minecraft.Client/com/mojang/nbt/FloatTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/FloatTag.cpp @@ -31,7 +31,7 @@ bool FloatTag::equals(Tag* other) { return Tag::equals(other) && m_data == otherCasted->m_data; } -long FloatTag::getAsLong() { +JavaLong FloatTag::getAsLong() { return m_data; } diff --git a/src/Minecraft.Client/com/mojang/nbt/FloatTag.h b/src/Minecraft.Client/com/mojang/nbt/FloatTag.h index aa683d6e..75da0eaa 100644 --- a/src/Minecraft.Client/com/mojang/nbt/FloatTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/FloatTag.h @@ -12,7 +12,7 @@ class FloatTag : public NumericTag { std::wstring toString() override; u8 getId() override; bool equals(Tag*) override; - long getAsLong() override; + JavaLong getAsLong() override; int getAsInt() override; short getAsShort() override; u8 getAsByte() override; diff --git a/src/Minecraft.Client/com/mojang/nbt/IntArrayTag.cpp b/src/Minecraft.Client/com/mojang/nbt/IntArrayTag.cpp index 76c458d9..00eee361 100644 --- a/src/Minecraft.Client/com/mojang/nbt/IntArrayTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/IntArrayTag.cpp @@ -1,4 +1,5 @@ #include "com/mojang/nbt/IntArrayTag.h" + #include "net/minecraft/world/ArrayWithLength.h" #include "java/io/DataInput.h" @@ -30,8 +31,9 @@ void IntArrayTag::load(DataInput* inputStream, int) { // create a copy of the data int* data = m_data.m_data; - if (data) + if (data) { delete data; + } m_data = arrayWithLength(size, true); diff --git a/src/Minecraft.Client/com/mojang/nbt/IntTag.cpp b/src/Minecraft.Client/com/mojang/nbt/IntTag.cpp index d24e5757..557aa289 100644 --- a/src/Minecraft.Client/com/mojang/nbt/IntTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/IntTag.cpp @@ -30,7 +30,7 @@ bool IntTag::equals(Tag* other) { return Tag::equals(other) && m_data == otherCasted->m_data; } -long IntTag::getAsLong() { +JavaLong IntTag::getAsLong() { return m_data; } diff --git a/src/Minecraft.Client/com/mojang/nbt/IntTag.h b/src/Minecraft.Client/com/mojang/nbt/IntTag.h index cc0df298..afc83e91 100644 --- a/src/Minecraft.Client/com/mojang/nbt/IntTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/IntTag.h @@ -14,7 +14,7 @@ class IntTag : public NumericTag { bool equals(Tag*) override; Tag* copy() override; - long getAsLong() override; + JavaLong getAsLong() override; int getAsInt() override; short getAsShort() override; u8 getAsByte() override; diff --git a/src/Minecraft.Client/com/mojang/nbt/ListTag.cpp b/src/Minecraft.Client/com/mojang/nbt/ListTag.cpp index 2cc6caa1..465f9dc1 100644 --- a/src/Minecraft.Client/com/mojang/nbt/ListTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/ListTag.cpp @@ -1,14 +1,59 @@ #include "com/mojang/nbt/ListTag.h" +#include "com/mojang/nbt/CompoundTag.h" + #include "java/io/DataInput.h" #include "java/io/DataOutput.h" #include -ListTag::ListTag() {} +ListTag::ListTag() : m_tagId(TAG_End) {} ListTag::ListTag(int id) : m_tagId(id) {} +ListTag::~ListTag() { + for (Tag* tag : m_data) + delete tag; +} + +void ListTag::add(Tag* tag) { + if (tag->getId() == TAG_End) + return; + u8 id = tag->getId(); + if (m_tagId != TAG_End && m_tagId != id) { + if (!m_data.empty()) + return; + id = tag->getId(); + } + m_tagId = id; + m_data.push_back(tag); +} + +size_t ListTag::size() const { + return m_data.size(); +} + +CompoundTag* ListTag::getCompound(int index) const { + if (index >= 0 && static_cast(index) < m_data.size() && m_data[index]->getId() == TAG_Compound) + return static_cast(m_data[index]); + return new CompoundTag(); +} + +bool ListTag::isEmpty() const { + return m_data.empty(); +} + +void ListTag::stripEmptyChildren() { + for (auto it = m_data.begin(); it != m_data.end();) { + if ((*it)->isEmpty()) { + delete *it; + it = m_data.erase(it); + } else { + ++it; + } + } +} + void ListTag::write(DataOutput* outputStream) { if (m_data.empty()) { m_tagId = TAG_End; diff --git a/src/Minecraft.Client/com/mojang/nbt/ListTag.h b/src/Minecraft.Client/com/mojang/nbt/ListTag.h index d3a79141..b7bfba21 100644 --- a/src/Minecraft.Client/com/mojang/nbt/ListTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/ListTag.h @@ -3,6 +3,8 @@ #include "com/mojang/nbt/Tag.h" #include +class CompoundTag; + class ListTag : public Tag { public: ListTag(); @@ -20,6 +22,14 @@ class ListTag : public Tag { bool isEmpty() const override; void add(Tag* tag); + // Replaces an accepted element and deletes its previous owner. Rejected + // replacements remain caller-owned; assigning the same pointer is a no-op. + void set(int index, Tag* tag); + size_t size() const; + int getElementType() const { return m_tagId; } + CompoundTag* getCompound(int) const; + int getInt(int) const; + double getDouble(int) const; private: std::vector m_data; diff --git a/src/Minecraft.Client/com/mojang/nbt/ListTagNumeric.cpp b/src/Minecraft.Client/com/mojang/nbt/ListTagNumeric.cpp new file mode 100644 index 00000000..9486447e --- /dev/null +++ b/src/Minecraft.Client/com/mojang/nbt/ListTagNumeric.cpp @@ -0,0 +1,20 @@ +#include "com/mojang/nbt/ListTag.h" +#include "com/mojang/nbt/NumericTag.h" + +int ListTag::getInt(int index) const { + if (index >= 0 && static_cast(index) < m_data.size()) { + Tag* tag = m_data.at(index); + if (tag->getId() == TAG_Int) + return static_cast(tag)->getAsInt(); + } + return 0; +} + +double ListTag::getDouble(int index) const { + if (index >= 0 && static_cast(index) < m_data.size()) { + Tag* tag = m_data.at(index); + if (tag->getId() == TAG_Double) + return static_cast(tag)->getAsDouble(); + } + return 0.0; +} diff --git a/src/Minecraft.Client/com/mojang/nbt/ListTagSet.cpp b/src/Minecraft.Client/com/mojang/nbt/ListTagSet.cpp new file mode 100644 index 00000000..3febd0b0 --- /dev/null +++ b/src/Minecraft.Client/com/mojang/nbt/ListTagSet.cpp @@ -0,0 +1,21 @@ +#include "com/mojang/nbt/ListTag.h" + +void ListTag::set(int index, Tag* tag) { + u8 id = tag->getId(); + if (index < 0 || id == TAG_End || static_cast(index) >= m_data.size()) + return; + u8 type = m_tagId; + id = tag->getId(); + if (type == TAG_End) { + m_tagId = id; + } else if (type != id) { + if (index != 0 || m_data.end() != m_data.begin()) + return; + m_tagId = tag->getId(); + } + Tag* old = m_data[index]; + if (old != tag) { + delete old; + m_data[index] = tag; + } +} diff --git a/src/Minecraft.Client/com/mojang/nbt/LongTag.cpp b/src/Minecraft.Client/com/mojang/nbt/LongTag.cpp index 186f8d8e..b14baeef 100644 --- a/src/Minecraft.Client/com/mojang/nbt/LongTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/LongTag.cpp @@ -5,7 +5,7 @@ LongTag::LongTag() : m_data(0) {} -LongTag::LongTag(long data) : m_data(data) {} +LongTag::LongTag(JavaLong data) : m_data(data) {} void LongTag::write(DataOutput* outputStream) { outputStream->writeLong(m_data); @@ -30,7 +30,7 @@ bool LongTag::equals(Tag* other) { return Tag::equals(other) && m_data == otherCasted->m_data; } -long LongTag::getAsLong() { +JavaLong LongTag::getAsLong() { return m_data; } diff --git a/src/Minecraft.Client/com/mojang/nbt/LongTag.h b/src/Minecraft.Client/com/mojang/nbt/LongTag.h index b7ece3f3..82286812 100644 --- a/src/Minecraft.Client/com/mojang/nbt/LongTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/LongTag.h @@ -5,14 +5,14 @@ class LongTag : public NumericTag { public: LongTag(); - LongTag(long data); + LongTag(JavaLong data); void write(DataOutput*) override; void load(DataInput*, int) override; std::wstring toString() override; u8 getId() override; bool equals(Tag*) override; - long getAsLong() override; + JavaLong getAsLong() override; int getAsInt() override; short getAsShort() override; u8 getAsByte() override; @@ -20,5 +20,5 @@ class LongTag : public NumericTag { float getAsFloat() override; Tag* copy() override; - long m_data; + JavaLong m_data; }; diff --git a/src/Minecraft.Client/com/mojang/nbt/NbtIo.cpp b/src/Minecraft.Client/com/mojang/nbt/NbtIo.cpp index 830f2dea..fa08ebaa 100644 --- a/src/Minecraft.Client/com/mojang/nbt/NbtIo.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/NbtIo.cpp @@ -1,29 +1,25 @@ #include "com/mojang/nbt/NbtIo.h" -#include "NX/Platform.h" #include "com/mojang/nbt/CompoundTag.h" #include "com/mojang/nbt/EndTag.h" -#include "java/io/BufferedOutputStream.h" -#include "java/io/ByteArrayInputStream.h" -#include "java/io/ByteArrayOutputStream.h" -#include "java/io/DataInputStream.h" -#include "java/io/DataOutputStream.h" -#include "net/minecraft/core/System.h" +#include "java/io/DataInput.h" +#include "java/io/DataOutput.h" +#include +#include -// NON_MATCHING: The original has a std::wstring destructor call without constructing one Tag* NbtIo::readUnnamedTag(DataInput* input, int unk) { - u8 ch = input->readChar(); + u8 ch = Tag::readType(input); if (ch == 0) return new EndTag(); if (ch == 255) return new EndTag(); - int utfChar = input->readUTFChar(); + input->readUTF(); - Tag* tag = Tag::newTag(ch); + std::unique_ptr tag(Tag::newTag(ch)); tag->load(input, unk); - return tag; + return tag.release(); } CompoundTag* NbtIo::read(DataInput* input) { @@ -37,15 +33,6 @@ CompoundTag* NbtIo::read(DataInput* input) { return nullptr; } -CompoundTag* NbtIo::readCompressed(InputStream* inputStream) { - MemSect(26); - DataInputStream dataInputStream(inputStream); - CompoundTag* tag = read(&dataInputStream); - dataInputStream.close(); - MemSect(0); - return tag; -} - void NbtIo::writeUnnamedTag(Tag* tag, DataOutput* output) { output->writeByte(tag->getId()); if (tag->getId() == 0) @@ -58,37 +45,3 @@ void NbtIo::writeUnnamedTag(Tag* tag, DataOutput* output) { void NbtIo::write(CompoundTag* tag, DataOutput* output) { return writeUnnamedTag(tag, output); } - -void NbtIo::writeCompressed(CompoundTag* tag, OutputStream* outputStream) { - BufferedOutputStream bufferedOutputStream(outputStream, 1024); - - DataOutputStream dataOutputStream(&bufferedOutputStream); - NbtIo::write((CompoundTag*)tag, &dataOutputStream); - - dataOutputStream.close(); -} - -CompoundTag* NbtIo::decompress(arrayWithLength array) { - ByteArrayInputStream byteArrayInputStream(array); - DataInputStream dataInputStream(&byteArrayInputStream); - - CompoundTag* tag = NbtIo::read(&dataInputStream); - byteArrayInputStream.close(); - dataInputStream.close(); - - return tag; -} - -arrayWithLength NbtIo::compress(CompoundTag* tag) { - ByteArrayOutputStream byteArrayOutputStream; - DataOutputStream dataOutputStream(&byteArrayOutputStream); - - NbtIo::write(tag, &dataOutputStream); - - arrayWithLength compressedData(byteArrayOutputStream.size(), true); - System::arraycopy(byteArrayOutputStream.m_buffer, 0, &compressedData, 0, byteArrayOutputStream.size()); - - dataOutputStream.close(); - - return compressedData; -} diff --git a/src/Minecraft.Client/com/mojang/nbt/NbtIoStreams.cpp b/src/Minecraft.Client/com/mojang/nbt/NbtIoStreams.cpp new file mode 100644 index 00000000..53c8532f --- /dev/null +++ b/src/Minecraft.Client/com/mojang/nbt/NbtIoStreams.cpp @@ -0,0 +1,55 @@ +#include "NX/Platform.h" +#include "com/mojang/nbt/CompoundTag.h" +#include "com/mojang/nbt/NbtIo.h" +#include "java/io/BufferedOutputStream.h" +#include "java/io/ByteArrayInputStream.h" +#include "java/io/ByteArrayOutputStream.h" +#include "java/io/DataInputStream.h" +#include "java/io/DataOutputStream.h" +#include "net/minecraft/core/System.h" +#include + +CompoundTag* NbtIo::readCompressed(InputStream* inputStream) { + MemSect(26); + DataInputStream dataInputStream(inputStream); + CompoundTag* tag = read(&dataInputStream); + dataInputStream.close(); + MemSect(0); + return tag; +} + +void NbtIo::writeCompressed(CompoundTag* tag, OutputStream* outputStream) { + BufferedOutputStream bufferedOutputStream(outputStream, 1024); + + DataOutputStream dataOutputStream(&bufferedOutputStream); + NbtIo::write((CompoundTag*)tag, &dataOutputStream); + + dataOutputStream.close(); +} + +CompoundTag* NbtIo::decompress(arrayWithLength array) { + ByteArrayInputStream byteArrayInputStream(array); + DataInputStream dataInputStream(&byteArrayInputStream); + + CompoundTag* tag = NbtIo::read(&dataInputStream); + // The target resets its borrowed array view before destroying the stream. + // 0x7100016654 was named as a default constructor, but preserves the vptr. + byteArrayInputStream.reset(); + dataInputStream.close(); + + return tag; +} + +arrayWithLength NbtIo::compress(CompoundTag* tag) { + ByteArrayOutputStream byteArrayOutputStream; + DataOutputStream dataOutputStream(&byteArrayOutputStream); + + NbtIo::write(tag, &dataOutputStream); + + arrayWithLength compressedData(byteArrayOutputStream.size(), true); + System::arraycopy(byteArrayOutputStream.m_buffer, 0, &compressedData, 0, byteArrayOutputStream.size()); + + dataOutputStream.close(); + + return compressedData; +} diff --git a/src/Minecraft.Client/com/mojang/nbt/NbtUtils.cpp b/src/Minecraft.Client/com/mojang/nbt/NbtUtils.cpp new file mode 100644 index 00000000..eeed0437 --- /dev/null +++ b/src/Minecraft.Client/com/mojang/nbt/NbtUtils.cpp @@ -0,0 +1,35 @@ +#include "com/mojang/nbt/NbtUtils.h" + +#include "com/mojang/nbt/CompoundTag.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/state/BlockStateDefinition.h" + +const BlockState* NbtUtils::readBlockState(CompoundTag* tag) { + if (!tag->contains(L"Name", Tag::TAG_String)) + return Blocks::AIR->defaultBlockState(); + + Block* block = Blocks::byString(tag->getString(L"Name")); + const BlockState* state = block->defaultBlockState(); + if (tag->contains(L"Properties", Tag::TAG_Compound)) { + CompoundTag* propertyTag = tag->getCompound(L"Properties"); + BlockStateDefinition* definition = block->getBlockStateDefinition(); + using KeyList = std::vector; + KeyList* keys = propertyTag->getAllKeys(); + auto properties = definition->getProperties(); + for (auto keyIt = keys->begin(); keyIt != keys->end(); ++keyIt) { + auto key = *keyIt; + for (auto propertyIt = properties.begin(); propertyIt != properties.end(); ++propertyIt) { + const Property* property = *propertyIt; + if (key == property->getName()) { + Boxed* value = property->getValue(propertyTag->getString(key)); + state = state->setBoxedValue(property, value); + delete value; + } + } + } + // getAllKeys always allocates this vector; retire it as in the original. + keys->~KeyList(); + ::operator delete(keys); + } + return state; +} diff --git a/src/Minecraft.Client/com/mojang/nbt/NbtUtils.h b/src/Minecraft.Client/com/mojang/nbt/NbtUtils.h new file mode 100644 index 00000000..c61677bd --- /dev/null +++ b/src/Minecraft.Client/com/mojang/nbt/NbtUtils.h @@ -0,0 +1,10 @@ +#pragma once + +class BlockState; +class CompoundTag; + +class NbtUtils { +public: + // Switch registry/property decoder at 0x71006ef4b0. + static const BlockState* readBlockState(CompoundTag*); +}; diff --git a/src/Minecraft.Client/com/mojang/nbt/NumericTag.cpp b/src/Minecraft.Client/com/mojang/nbt/NumericTag.cpp new file mode 100644 index 00000000..92e31563 --- /dev/null +++ b/src/Minecraft.Client/com/mojang/nbt/NumericTag.cpp @@ -0,0 +1,3 @@ +#include "com/mojang/nbt/NumericTag.h" + +NumericTag::NumericTag() = default; diff --git a/src/Minecraft.Client/com/mojang/nbt/NumericTag.h b/src/Minecraft.Client/com/mojang/nbt/NumericTag.h index 4d11cee4..3c53684d 100644 --- a/src/Minecraft.Client/com/mojang/nbt/NumericTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/NumericTag.h @@ -1,12 +1,13 @@ #pragma once #include "com/mojang/nbt/Tag.h" +#include "java/io/JavaLong.h" class NumericTag : public Tag { public: NumericTag(); - virtual long getAsLong() = 0; + virtual JavaLong getAsLong() = 0; virtual int getAsInt() = 0; virtual short getAsShort() = 0; virtual u8 getAsByte() = 0; diff --git a/src/Minecraft.Client/com/mojang/nbt/ShortTag.cpp b/src/Minecraft.Client/com/mojang/nbt/ShortTag.cpp index 77cdd219..7cc6d5fa 100644 --- a/src/Minecraft.Client/com/mojang/nbt/ShortTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/ShortTag.cpp @@ -30,7 +30,7 @@ bool ShortTag::equals(Tag* other) { return Tag::equals(other) && m_data == otherCasted->m_data; } -long ShortTag::getAsLong() { +JavaLong ShortTag::getAsLong() { return m_data; } diff --git a/src/Minecraft.Client/com/mojang/nbt/ShortTag.h b/src/Minecraft.Client/com/mojang/nbt/ShortTag.h index 209871be..fb4f2798 100644 --- a/src/Minecraft.Client/com/mojang/nbt/ShortTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/ShortTag.h @@ -12,7 +12,7 @@ class ShortTag : public NumericTag { std::wstring toString() override; u8 getId() override; bool equals(Tag*) override; - long getAsLong() override; + JavaLong getAsLong() override; int getAsInt() override; short getAsShort() override; u8 getAsByte() override; diff --git a/src/Minecraft.Client/com/mojang/nbt/StringTag.cpp b/src/Minecraft.Client/com/mojang/nbt/StringTag.cpp new file mode 100644 index 00000000..bf68354b --- /dev/null +++ b/src/Minecraft.Client/com/mojang/nbt/StringTag.cpp @@ -0,0 +1,32 @@ +#include "com/mojang/nbt/StringTag.h" + +#include "java/io/DataInput.h" +#include "java/io/DataOutput.h" + +StringTag::StringTag() = default; +StringTag::StringTag(const std::wstring& value) : m_data(value) {} +StringTag::~StringTag() = default; +void StringTag::write(DataOutput* output) { + output->writeUTF(m_data); +} +void StringTag::load(DataInput* input, int) { + m_data = input->readUTF(); +} +std::wstring StringTag::toString() { + return m_data; +} +u8 StringTag::getId() { + return TAG_String; +} +bool StringTag::equals(Tag* other) { + return Tag::equals(other) && m_data == static_cast(other)->m_data; +} +Tag* StringTag::copy() { + return new StringTag(m_data); +} +bool StringTag::isEmpty() const { + return m_data.empty(); +} +std::wstring StringTag::getAsString() { + return m_data; +} diff --git a/src/Minecraft.Client/com/mojang/nbt/StringTag.h b/src/Minecraft.Client/com/mojang/nbt/StringTag.h index 09bae96e..027587ad 100644 --- a/src/Minecraft.Client/com/mojang/nbt/StringTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/StringTag.h @@ -5,6 +5,7 @@ class StringTag : public Tag { public: StringTag(); + explicit StringTag(const std::wstring&); void write(DataOutput*) override; void load(DataInput*, int) override; diff --git a/src/Minecraft.Client/com/mojang/nbt/Tag.cpp b/src/Minecraft.Client/com/mojang/nbt/Tag.cpp index d59693ba..1993571f 100644 --- a/src/Minecraft.Client/com/mojang/nbt/Tag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/Tag.cpp @@ -12,8 +12,11 @@ #include "com/mojang/nbt/LongTag.h" #include "com/mojang/nbt/ShortTag.h" #include "com/mojang/nbt/StringTag.h" +#include "java/io/DataInput.h" #include +Tag::Tag() = default; + void Tag::print(const std::wstring& name, char* prefix, std::wostream& output) { output << prefix; diff --git a/src/Minecraft.Client/com/mojang/nbt/Tag.h b/src/Minecraft.Client/com/mojang/nbt/Tag.h index 0abd8c0f..1620d8b8 100644 --- a/src/Minecraft.Client/com/mojang/nbt/Tag.h +++ b/src/Minecraft.Client/com/mojang/nbt/Tag.h @@ -1,5 +1,6 @@ #pragma once +#include "java/io/DataInput.h" #include "nn/types.h" #include #include @@ -23,11 +24,17 @@ class Tag { virtual bool isEmpty() const; virtual std::wstring getAsString(); + // The exported DataInput vtable is still incomplete on Switch. Host NBT uses + // the one-byte reader explicitly; readChar reads two bytes in Java streams. + static u8 readType(DataInput* input) { return input->readChar(); } static Tag* newTag(u8 id); static const wchar_t* getTagTypeName(u8 id); template - static void deleteElements(const std::vector&); + static void deleteElements(const std::vector& data) { + for (T tag : data) + delete tag; + } static const u8 TAG_End = 0; static const u8 TAG_Byte = 1; diff --git a/src/Minecraft.Client/net/minecraft/client/CMinecraftApp.h b/src/Minecraft.Client/net/minecraft/client/CMinecraftApp.h index ab70ffe7..3cec5bda 100644 --- a/src/Minecraft.Client/net/minecraft/client/CMinecraftApp.h +++ b/src/Minecraft.Client/net/minecraft/client/CMinecraftApp.h @@ -71,6 +71,8 @@ class CMinecraftApp { bool IsAppPaused(); void SetAction(int, eXuiAction, void*); void setLevelGenerationOptions(LevelGenerationOptions* options); + // Inferred name: records a unique (type, x, z) generation marker. + void addGeneratedFeature(int type, int x, int z); void SetGameHostOption(eGameHostOption option, unsigned int value); void UpdateTrialPausedTimer(); diff --git a/src/Minecraft.Client/net/minecraft/client/color/ColourTable.h b/src/Minecraft.Client/net/minecraft/client/color/ColourTable.h index f1bfa74b..6dacdef0 100644 --- a/src/Minecraft.Client/net/minecraft/client/color/ColourTable.h +++ b/src/Minecraft.Client/net/minecraft/client/color/ColourTable.h @@ -1,9 +1,24 @@ #pragma once #include "net/minecraft/world/level/material/MaterialColor.h" +#include +#include class ColourTable { public: + ColourTable(unsigned char*, unsigned int); + ColourTable(const ColourTable&, unsigned char*, unsigned int); static void staticCtor(); unsigned int getColour(eMinecraftColour); + void read(unsigned char*, unsigned int); + void setColour(const std::wstring&, unsigned int); + + static constexpr unsigned int COLOUR_COUNT = 486; + unsigned int m_colours[COLOUR_COUNT]; + +private: + static const wchar_t* const s_colourNames[COLOUR_COUNT]; + static std::unordered_map s_nameToColour; }; + +static_assert(sizeof(ColourTable) == 0x798, "Original colour table contains 486 words"); diff --git a/src/Minecraft.Client/net/minecraft/client/multiplayer/ClientChunkCache.h b/src/Minecraft.Client/net/minecraft/client/multiplayer/ClientChunkCache.h index 6ed5841d..afc6c1f0 100644 --- a/src/Minecraft.Client/net/minecraft/client/multiplayer/ClientChunkCache.h +++ b/src/Minecraft.Client/net/minecraft/client/multiplayer/ClientChunkCache.h @@ -23,7 +23,7 @@ class ClientChunkCache : public ChunkSource { void save(bool, ProgressListener*) override; bool shouldSave() override; ChunkSource* getCache() override; - std::vector* getMobsAt(MobCategory*, const BlockPos&) override; + std::vector* getMobsAt(MobCategory*, const BlockPos&) override; void findNearestMapFeature(Level*, const std::wstring&, const BlockPos&, bool) override; int getLoadedChunks() override; void recreateLogicStructuresForChunk(LevelChunk*, int, int) override; diff --git a/src/Minecraft.Client/net/minecraft/client/renderer/texture/TextureAtlasSprite.h b/src/Minecraft.Client/net/minecraft/client/renderer/texture/TextureAtlasSprite.h index 35ca2881..0a26f298 100644 --- a/src/Minecraft.Client/net/minecraft/client/renderer/texture/TextureAtlasSprite.h +++ b/src/Minecraft.Client/net/minecraft/client/renderer/texture/TextureAtlasSprite.h @@ -33,5 +33,16 @@ class TextureAtlasSprite { void adjustUV(float&, float&); void initUVs(float u0, float v0, float u1, float v1); - char m_filler[0x90 - 8]; + char m_filler[0x60 - 8]; + int m_x; + int m_y; + int m_width; + int m_height; + float m_u0; + float m_u1; + float m_v0; + float m_v1; + char m_gap80[0x10]; }; + +static_assert(sizeof(TextureAtlasSprite) == 0x90, "TextureAtlasSprite size"); diff --git a/src/Minecraft.Client/net/minecraft/core/BlockPos.cpp b/src/Minecraft.Client/net/minecraft/core/BlockPos.cpp index 6d5caf6c..fc8d49ca 100644 --- a/src/Minecraft.Client/net/minecraft/core/BlockPos.cpp +++ b/src/Minecraft.Client/net/minecraft/core/BlockPos.cpp @@ -1,23 +1,8 @@ #include "net/minecraft/core/BlockPos.h" + #include "net/minecraft/core/Direction.h" #include "net/minecraft/world/phys/Vec3.h" -BlockPos::BlockPos(int x, int y, int z) : Vec3i(x, y, z) {} - -BlockPos::BlockPos() : Vec3i(0, 0, 0) {} - -BlockPos::BlockPos(Vec3* vec) : Vec3i(vec->m_x, vec->m_y, vec->m_z) {} - -BlockPos::BlockPos(const Vec3i& vec) : Vec3i(vec.getX(), vec.getY(), vec.getZ()) {} - -bool BlockPos::equals(const BlockPos& pos) const { - return getX() == pos.getX() && getY() == pos.getY() && getZ() == pos.getZ(); -} - -bool BlockPos::equals(const BlockPos* pos) const { - return equals(*pos); -} - BlockPos BlockPos::offset(int x, int y, int z) const { return BlockPos(getX() + x, getY() + y, getZ() + z); } diff --git a/src/Minecraft.Client/net/minecraft/core/BlockPos.h b/src/Minecraft.Client/net/minecraft/core/BlockPos.h index 7a3aacad..dcbca8ba 100644 --- a/src/Minecraft.Client/net/minecraft/core/BlockPos.h +++ b/src/Minecraft.Client/net/minecraft/core/BlockPos.h @@ -23,9 +23,12 @@ class BlockPos : public Vec3i { static BlockPosIterator* between(const BlockPos&, const BlockPos&); bool equals(const BlockPos& pos) const; + bool operator!=(const BlockPos& pos) const; bool equals(const BlockPos* pos) const; BlockPos offset(int x, int y, int z) const; + BlockPos offset(double x, double y, double z) const; + BlockPos offset(const Vec3i&) const; BlockPos relative(const Direction*) const; BlockPos relative(const Direction*, int) const; @@ -44,7 +47,7 @@ class BlockPos : public Vec3i { BlockPos east(int) const; long long compressBlockPos() const; - void decompressBlockPos(long long); + static BlockPos decompressBlockPos(long long); }; ASSERT_SIZEOF(BlockPos, 0xC) diff --git a/src/Minecraft.Client/net/minecraft/core/BlockPosBasics.cpp b/src/Minecraft.Client/net/minecraft/core/BlockPosBasics.cpp new file mode 100644 index 00000000..8694e020 --- /dev/null +++ b/src/Minecraft.Client/net/minecraft/core/BlockPosBasics.cpp @@ -0,0 +1,28 @@ +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/phys/Vec3.h" + +BlockPos::BlockPos(int x, int y, int z) : Vec3i(x, y, z) {} + +BlockPos::BlockPos(double x, double y, double z) : Vec3i(x, y, z) {} + +BlockPos::BlockPos() : Vec3i(0, 0, 0) {} + +BlockPos::BlockPos(Vec3* vec) : Vec3i(vec->m_x, vec->m_y, vec->m_z) {} + +BlockPos::BlockPos(const Vec3i& vec) : Vec3i(vec.getX(), vec.getY(), vec.getZ()) {} + +bool BlockPos::equals(const BlockPos& pos) const { + return getX() == pos.getX() && getY() == pos.getY() && getZ() == pos.getZ(); +} + +bool BlockPos::equals(const BlockPos* pos) const { + return equals(*pos); +} + +bool BlockPos::operator!=(const BlockPos& pos) const { + return !equals(pos); +} + +BlockPos BlockPos::offset(double x, double y, double z) const { + return BlockPos(getX() + x, getY() + y, getZ() + z); +} diff --git a/src/Minecraft.Client/net/minecraft/core/BlockPosPacking.cpp b/src/Minecraft.Client/net/minecraft/core/BlockPosPacking.cpp new file mode 100644 index 00000000..7511dec2 --- /dev/null +++ b/src/Minecraft.Client/net/minecraft/core/BlockPosPacking.cpp @@ -0,0 +1,17 @@ +#include "net/minecraft/core/BlockPos.h" +#include + +// The original static initializers derive 26 X/Z bits from the 30,000,000 +// world border, leaving 12 Y bits. Positions are packed X:Y:Z, high to low. +long long BlockPos::compressBlockPos() const { + return (std::uint64_t(getX()) & 0x3ffffffULL) << 38 | (std::uint64_t(getY()) & 0xfffULL) << 26 + | (std::uint64_t(getZ()) & 0x3ffffffULL); +} + +BlockPos BlockPos::decompressBlockPos(long long value) { + const std::uint64_t bits = static_cast(value); + const int x = static_cast(bits) >> 38; + const int y = static_cast(bits << 26) >> 52; + const int z = static_cast(bits << 38) >> 38; + return BlockPos(x, y, z); +} diff --git a/src/Minecraft.Client/net/minecraft/core/Direction.cpp b/src/Minecraft.Client/net/minecraft/core/Direction.cpp index b02ae1cd..9c0716c6 100644 --- a/src/Minecraft.Client/net/minecraft/core/Direction.cpp +++ b/src/Minecraft.Client/net/minecraft/core/Direction.cpp @@ -1,6 +1,7 @@ #include "net/minecraft/core/Direction.h" #include "net/minecraft/core/Vec3i.h" +#include "net/minecraft/util/Mth.h" #include @@ -49,7 +50,15 @@ Direction::Direction(int dirX, int dirY, int dirZ, const std::wstring& name, } const Direction* Direction::from3DDataValue(int value) { - return Direction::BY_3D_DATA[std::abs(value % 6)]; + return Direction::BY_3D_DATA[Mth::abs(value % 6)]; +} + +const Direction* Direction::from2DDataValue(int value) { + return Direction::BY_2D_DATA[Mth::abs(value % 4)]; +} + +const Direction* Direction::getOpposite() const { + return from3DDataValue(m_dirY); } unsigned int Direction::get3DDataValue() const { @@ -64,6 +73,18 @@ Direction::Axis* Direction::getAxis() const { return m_axis; } +Direction::AxisDirection* Direction::getAxisDirection() const { + return m_axisDirection; +} + +bool Direction::Axis::isHorizontal() { + return m_plane == Plane::HORIZONTAL; +} + +int Direction::Axis::getId() { + return m_id; +} + std::wstring Direction::getName() const { return m_name; } diff --git a/src/Minecraft.Client/net/minecraft/core/Direction.h b/src/Minecraft.Client/net/minecraft/core/Direction.h index 7f2dc9de..cc7a77e7 100644 --- a/src/Minecraft.Client/net/minecraft/core/Direction.h +++ b/src/Minecraft.Client/net/minecraft/core/Direction.h @@ -1,6 +1,7 @@ #pragma once #include "net/minecraft/core/StringRepresentable.h" +#include "net/minecraft/world/ArrayWithLength.h" #include "net/minecraft/world/level/block/state/properties/AbstractProperty.h" #include #include @@ -20,6 +21,7 @@ class Direction : public StringRepresentable { bool apply(const Direction*) const override; const Direction* getRandomDirection(Random&); + arrayWithLength iterator(); }; class AxisDirection { public: @@ -44,6 +46,11 @@ class Direction : public StringRepresentable { std::wstring toString() const override; std::wstring getSerializedName() const override; + + private: + std::wstring m_name; + Plane* m_plane; + int m_id; }; static const Direction* DOWN; @@ -62,6 +69,7 @@ class Direction : public StringRepresentable { static void staticCtor(); static const Direction* from3DDataValue(int value); + static const Direction* from2DDataValue(int value); Direction(int, int, int, const std::wstring&, Direction::AxisDirection*, Direction::Axis*, Vec3i*, unsigned char); @@ -75,6 +83,8 @@ class Direction : public StringRepresentable { int get2DDataValue() const; Axis* getAxis() const; + Vec3i getNormal() const; + AxisDirection* getAxisDirection() const; std::wstring getName() const; @@ -93,3 +103,6 @@ class Direction : public StringRepresentable { int m_y; int m_z; }; + +static_assert(sizeof(Direction::Axis) == 0x38, "Direction::Axis Switch layout"); +static_assert(sizeof(Direction) == 0x58, "Direction Switch layout"); diff --git a/src/Minecraft.Client/net/minecraft/core/MutableBlockPos.cpp b/src/Minecraft.Client/net/minecraft/core/MutableBlockPos.cpp index c6180606..3c0702a3 100644 --- a/src/Minecraft.Client/net/minecraft/core/MutableBlockPos.cpp +++ b/src/Minecraft.Client/net/minecraft/core/MutableBlockPos.cpp @@ -1,3 +1,5 @@ #include "net/minecraft/core/MutableBlockPos.h" +MutableBlockPos::MutableBlockPos() : BlockPos(0, 0, 0) {} + MutableBlockPos::MutableBlockPos(int x, int y, int z) : BlockPos(x, y, z) {} diff --git a/src/Minecraft.Client/net/minecraft/core/MutableBlockPos.h b/src/Minecraft.Client/net/minecraft/core/MutableBlockPos.h index 11777a7c..12f0b268 100644 --- a/src/Minecraft.Client/net/minecraft/core/MutableBlockPos.h +++ b/src/Minecraft.Client/net/minecraft/core/MutableBlockPos.h @@ -4,6 +4,7 @@ class MutableBlockPos : public BlockPos { public: + MutableBlockPos(); MutableBlockPos(int, int, int); MutableBlockPos(const BlockPos&); @@ -19,4 +20,6 @@ class MutableBlockPos : public BlockPos { } void set(const BlockPos&); + MutableBlockPos* set(const Vec3i&); + MutableBlockPos* move(const Direction*, int amount); }; diff --git a/src/Minecraft.Client/net/minecraft/core/NonNullList.h b/src/Minecraft.Client/net/minecraft/core/NonNullList.h index 06262f7e..88564e0b 100644 --- a/src/Minecraft.Client/net/minecraft/core/NonNullList.h +++ b/src/Minecraft.Client/net/minecraft/core/NonNullList.h @@ -5,7 +5,37 @@ template class NonNullList : arrayWithLength { public: - static NonNullList withSize(int, const T&); + NonNullList() = default; + + // Copies are views of the same array. The owner must delete the backing data; + // destroying a view only releases its default value, as in the executable. + static NonNullList withSize(int size, const T& defaultValue) { + NonNullList list; + if (size > 0) { + list.m_data = new T[size]; + list.m_length = size; + for (unsigned int i = 0; i < list.m_length; ++i) + list.m_data[i] = defaultValue; + } + list.m_baseNotNull = defaultValue; + return list; + } + + unsigned int size() const { return this->m_length; } + T& operator[](unsigned int index) { return this->m_data[index]; } + const T& operator[](unsigned int index) const { return this->m_data[index]; } + void set(unsigned int index, const T& value) { this->m_data[index] = value; } + + void clear() { + for (unsigned int i = 0; i < size(); ++i) + set(i, m_baseNotNull); + } + + void deleteData() { + delete[] this->m_data; + this->m_data = nullptr; + this->m_length = 0; + } T m_baseNotNull; // idk if this should be not_null_ptr by default or specified in template, so decided it // not to be for a while diff --git a/src/Minecraft.Client/net/minecraft/core/StringHash.cpp b/src/Minecraft.Client/net/minecraft/core/StringHash.cpp new file mode 100644 index 00000000..bd3578f6 --- /dev/null +++ b/src/Minecraft.Client/net/minecraft/core/StringHash.cpp @@ -0,0 +1,20 @@ +#include "net/minecraft/core/System.h" +#include + +// This is the original position-dependent LCE hash, including 32-bit wraparound. +size_t javaStringHashCode(const std::wstring& value) { + std::uint32_t length = static_cast(value.size()); + std::uint64_t last = length - 1; + std::uint64_t index = 0; + std::uint32_t remaining = last; + std::uint32_t result = 0; + if (length != 0) + do { + std::uint32_t character = static_cast(value[index]); + character = index >= last ? character : (character * 31u) ^ remaining; + result += character; + --remaining; + ++index; + } while (index != length); + return result; +} diff --git a/src/Minecraft.Client/net/minecraft/core/System.cpp b/src/Minecraft.Client/net/minecraft/core/System.cpp index 9303d624..a67976e3 100644 --- a/src/Minecraft.Client/net/minecraft/core/System.cpp +++ b/src/Minecraft.Client/net/minecraft/core/System.cpp @@ -1,6 +1,6 @@ #include "net/minecraft/core/System.h" + #include "nn/os/os_Mutex.h" -#include void InitializeCriticalSection(nn::os::MutexType* mutex) { nn::os::InitializeMutex(mutex, 1, 0); @@ -12,28 +12,6 @@ void InitializeCriticalSectionAndSpinCount(nn::os::MutexType* mutexType, unsigne InitializeCriticalSection(mutexType); } -long System::currentRealTimeMillis() { - nn::time::PosixTime t; - nn::time::StandardUserSystemClock::GetCurrentTime(&t); - return t.time; -} - -long System::currentUnixEpochTimeSeconds() { - return currentRealTimeMillis() / 1000; -} - -long System::processTimeInSeconds() { - return processTime(MILLISECONDS) / 1000; -} - -long System::processTimeInMilliSecs() { - return processTime(MILLISECONDS); -} - -long System::processTimeInNanoSecs() { - return processTime(NANOSECONDS); -} - void System::ReverseSHORT(short* shart) { const short lb = *shart; diff --git a/src/Minecraft.Client/net/minecraft/core/System.h b/src/Minecraft.Client/net/minecraft/core/System.h index fca8e4c7..ef334a3e 100644 --- a/src/Minecraft.Client/net/minecraft/core/System.h +++ b/src/Minecraft.Client/net/minecraft/core/System.h @@ -1,5 +1,9 @@ #pragma once +#include "java/io/JavaLong.h" +#include +#include + #include "net/minecraft/world/ArrayWithLength.h" #include "net/minecraft/world/level/biome/Biome.h" #include "nn/os/os_MutexTypes.h" @@ -12,7 +16,8 @@ class Node; // TODO: Find locations void InitializeCriticalSection(nn::os::MutexType* mutexType); void InitializeCriticalSectionAndSpinCount(nn::os::MutexType* mutexType, unsigned long spinCount); -long InterlockedCompareExchangeRelease(volatile long*, long, long); +void DeleteCriticalSection(nn::os::MutexType* mutexType); +std::intptr_t InterlockedCompareExchangeRelease(volatile std::intptr_t*, std::intptr_t, std::intptr_t); template const std::wstring _toString(T type) { std::wstringstream ss; @@ -30,14 +35,14 @@ class System { public: enum ETimeGranularity { MILLISECONDS, MICROSECONDS, NANOSECONDS }; - static long currentRealTimeMillis(); - static long currentUnixEpochTimeSeconds(); + static JavaLong currentRealTimeMillis(); + static JavaLong currentUnixEpochTimeSeconds(); - static long processTimeInSeconds(); - static long processTimeInMilliSecs(); - static long processTimeInNanoSecs(); - static long processTimeInMicroSecs(); - static long processTime(System::ETimeGranularity); + static JavaLong processTimeInSeconds(); + static JavaLong processTimeInMilliSecs(); + static JavaLong processTimeInNanoSecs(); + static JavaLong processTimeInMicroSecs(); + static JavaLong processTime(System::ETimeGranularity); template static void arraycopy(arrayWithLength src, unsigned int srcOff, arrayWithLength* dest, diff --git a/src/Minecraft.Client/net/minecraft/core/SystemClock.cpp b/src/Minecraft.Client/net/minecraft/core/SystemClock.cpp new file mode 100644 index 00000000..fc2dae11 --- /dev/null +++ b/src/Minecraft.Client/net/minecraft/core/SystemClock.cpp @@ -0,0 +1,44 @@ +#include "net/minecraft/core/System.h" +#include +#include + +// The bundled SDK header aliases Tick to u64. Bind the ABI-compatible +// eight-byte argument to the real SDK import's value-class mangled name. +extern nn::TimeSpan convertSystemTick(nn::os::Tick) asm("_ZN2nn2os17ConvertToTimeSpanENS0_4TickE"); + +JavaLong System::currentRealTimeMillis() { + nn::time::PosixTime t; + nn::time::StandardUserSystemClock::GetCurrentTime(&t); + return t.time; +} + +JavaLong System::currentUnixEpochTimeSeconds() { + return currentRealTimeMillis() / 1000; +} + +JavaLong System::processTime(ETimeGranularity granularity) { + const nn::os::Tick tick = nn::os::GetSystemTick(); + switch (granularity) { + case NANOSECONDS: + return convertSystemTick(tick).nanoseconds; + case MICROSECONDS: + return static_cast(convertSystemTick(tick).nanoseconds) / 1000; + case MILLISECONDS: + return static_cast(convertSystemTick(tick).nanoseconds) / 1000000; + default: + return 0; + } +} + +JavaLong System::processTimeInSeconds() { + return processTime(MILLISECONDS) / 1000; +} +JavaLong System::processTimeInMilliSecs() { + return processTime(MILLISECONDS); +} +JavaLong System::processTimeInMicroSecs() { + return processTime(MICROSECONDS); +} +JavaLong System::processTimeInNanoSecs() { + return processTime(NANOSECONDS); +} diff --git a/src/Minecraft.Client/net/minecraft/core/TreePositionHelpers.cpp b/src/Minecraft.Client/net/minecraft/core/TreePositionHelpers.cpp new file mode 100644 index 00000000..b3fb7a77 --- /dev/null +++ b/src/Minecraft.Client/net/minecraft/core/TreePositionHelpers.cpp @@ -0,0 +1,25 @@ +#include "net/minecraft/core/Direction.h" +#include "net/minecraft/core/MutableBlockPos.h" + +BlockPos BlockPos::offset(const Vec3i& delta) const { + return offset(delta.getX(), delta.getY(), delta.getZ()); +} + +Vec3i Vec3i::multiply(int amount) const { + return Vec3i(getX() * amount, getY() * amount, getZ() * amount); +} + +Vec3i Direction::getNormal() const { + return *m_pos; +} + +MutableBlockPos* MutableBlockPos::set(const Vec3i& pos) { + m_x = pos.getX(); + m_y = pos.getY(); + m_z = pos.getZ(); + return this; +} + +MutableBlockPos* MutableBlockPos::move(const Direction* direction, int amount) { + return set(static_cast(BlockPos(*this).offset(direction->getNormal().multiply(amount)))); +} diff --git a/src/Minecraft.Client/net/minecraft/core/Vec3i.cpp b/src/Minecraft.Client/net/minecraft/core/Vec3i.cpp index a820cdf3..eabcb6ca 100644 --- a/src/Minecraft.Client/net/minecraft/core/Vec3i.cpp +++ b/src/Minecraft.Client/net/minecraft/core/Vec3i.cpp @@ -1,4 +1,5 @@ #include "net/minecraft/core/Vec3i.h" + #include "net/minecraft/util/Mth.h" Vec3i::Vec3i(int x, int y, int z) { @@ -24,3 +25,14 @@ int Vec3i::getY() const { int Vec3i::getZ() const { return m_z; } + +double Vec3i::distSqr(double x, double y, double z) const { + double dx = getX() - x; + double dy = getY() - y; + double dz = getZ() - z; + return dx * dx + dy * dy + dz * dz; +} + +double Vec3i::distSqr(const Vec3i& other) const { + return distSqr(other.getX(), other.getY(), other.getZ()); +} diff --git a/src/Minecraft.Client/net/minecraft/core/Vec3i.h b/src/Minecraft.Client/net/minecraft/core/Vec3i.h index 5b383dd9..ca111e86 100644 --- a/src/Minecraft.Client/net/minecraft/core/Vec3i.h +++ b/src/Minecraft.Client/net/minecraft/core/Vec3i.h @@ -9,7 +9,9 @@ class Vec3i { int getX() const; int getY() const; int getZ() const; + Vec3i multiply(int) const; double distSqr(const Vec3i&) const; + double distSqr(double x, double y, double z) const; int m_x; int m_y; diff --git a/src/Minecraft.Client/net/minecraft/resources/ResourceLocation.h b/src/Minecraft.Client/net/minecraft/resources/ResourceLocation.h index 30b79d90..6e525283 100644 --- a/src/Minecraft.Client/net/minecraft/resources/ResourceLocation.h +++ b/src/Minecraft.Client/net/minecraft/resources/ResourceLocation.h @@ -13,6 +13,7 @@ class ResourceLocation { ResourceLocation(); ResourceLocation(const std::wstring&); ResourceLocation(const ResourceLocation&); + ResourceLocation& operator=(const ResourceLocation&); ~ResourceLocation(); bool operator==(const ResourceLocation* other) const; @@ -22,6 +23,7 @@ class ResourceLocation { const std::wstring& getNamespace() const; const std::wstring& getPath() const; + std::int64_t hashCode() const; virtual std::wstring toString() const; @@ -31,10 +33,15 @@ class ResourceLocation { char m_byte48; }; -// this is actually ResourceLocation::hashCode template <> -struct std::hash { - std::size_t operator()(const ResourceLocation& rl) const { - return std::hash()(rl.getPath()) ^ (std::hash()(rl.getNamespace()) << 1); +struct std::equal_to { + bool operator()(const ResourceLocation& lhs, const ResourceLocation& rhs) const { + return lhs.operator==(&rhs); } }; + +// Uses the original LCE resource-key hash. +template <> +struct std::hash { + std::size_t operator()(const ResourceLocation& rl) const { return rl.hashCode(); } +}; diff --git a/src/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.cpp b/src/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.cpp index 8e44a8e8..262f34f7 100644 --- a/src/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.cpp +++ b/src/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.cpp @@ -1,5 +1,7 @@ #include "net/minecraft/server/level/ServerChunkCache.h" +#include + #include "NX/Platform.h" #include "net/minecraft/core/BlockPos.h" @@ -58,7 +60,7 @@ ServerChunkCache::~ServerChunkCache() { delete *it; } - nn::os::FinalizeMutex(&m_mutex); + DeleteCriticalSection(&m_mutex); } LevelChunk* ServerChunkCache::getChunkIfLoaded(int chunkX, int chunkZ) { @@ -154,8 +156,9 @@ LevelChunk* ServerChunkCache::updateCacheAndPostProcess(int chunkX, int chunkZ, int idx = computeIdx(chunkX, chunkZ); - if (InterlockedCompareExchangeRelease((volatile long*)&m_chunks[idx], (long)newChunk, (long)oldChunk) - == (long)oldChunk) { + if (InterlockedCompareExchangeRelease((volatile intptr_t*)&m_chunks[idx], (intptr_t)newChunk, + (intptr_t)oldChunk) + == (intptr_t)oldChunk) { EnterCriticalSection(&m_mutex); PIXBeginNamedEvent(0.0, "Lighting chunk"); @@ -440,7 +443,7 @@ std::wstring ServerChunkCache::gatherStats() { return L"ServerChunkCache: "; } -std::vector* ServerChunkCache::getMobsAt(MobCategory* category, const BlockPos& pos) { +std::vector* ServerChunkCache::getMobsAt(MobCategory* category, const BlockPos& pos) { return m_chunkGenerator->getMobsAt(category, pos); } diff --git a/src/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.h b/src/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.h index ffad2af7..f1dfa15c 100644 --- a/src/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.h +++ b/src/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.h @@ -37,7 +37,7 @@ class ServerChunkCache : public ChunkSource { void save(bool, ProgressListener*) override; bool shouldSave() override; ChunkSource* getCache() override; - std::vector* getMobsAt(MobCategory* category, const BlockPos& pos) override; + std::vector* getMobsAt(MobCategory* category, const BlockPos& pos) override; void findNearestMapFeature(Level* level, const std::wstring& name, const BlockPos& pos, bool unk) override; int getLoadedChunks() override; diff --git a/src/Minecraft.World/java/io/ByteArrayInputStream.cpp b/src/Minecraft.World/java/io/ByteArrayInputStream.cpp index e39b5f5c..42674434 100644 --- a/src/Minecraft.World/java/io/ByteArrayInputStream.cpp +++ b/src/Minecraft.World/java/io/ByteArrayInputStream.cpp @@ -1,6 +1,9 @@ #include "java/io/ByteArrayInputStream.h" #include "NX/Platform.h" +#include + +ByteArrayInputStream::ByteArrayInputStream() : m_buffer(), m_length(0), m_currentPos(0), m_nextPos(0) {} ByteArrayInputStream::ByteArrayInputStream(arrayWithLength array, unsigned int start, unsigned int length) { @@ -45,6 +48,14 @@ int ByteArrayInputStream::read(arrayWithLength array, unsigned in void ByteArrayInputStream::close() {} +void ByteArrayInputStream::reset() { + arrayWithLength empty; + m_buffer = empty; + m_length = 0; + m_currentPos = 0; + m_nextPos = 0; +} + long long ByteArrayInputStream::skip(long long amount) { int newPos = m_nextPos + amount; diff --git a/src/Minecraft.World/java/io/ByteArrayInputStream.h b/src/Minecraft.World/java/io/ByteArrayInputStream.h index 49bfdb02..8b3c0f7e 100644 --- a/src/Minecraft.World/java/io/ByteArrayInputStream.h +++ b/src/Minecraft.World/java/io/ByteArrayInputStream.h @@ -13,6 +13,7 @@ class ByteArrayInputStream : public InputStream { int read(arrayWithLength) override; int read(arrayWithLength, unsigned int, unsigned int) override; void close() override; + void reset(); long long skip(long long) override; arrayWithLength m_buffer; diff --git a/src/Minecraft.World/java/io/ByteArrayOutputStream.cpp b/src/Minecraft.World/java/io/ByteArrayOutputStream.cpp index 43b9cff3..bdd3fe6c 100644 --- a/src/Minecraft.World/java/io/ByteArrayOutputStream.cpp +++ b/src/Minecraft.World/java/io/ByteArrayOutputStream.cpp @@ -1,6 +1,7 @@ #include "java/io/ByteArrayOutputStream.h" #include "NX/Platform.h" +#include ByteArrayOutputStream::ByteArrayOutputStream() { m_size = 0; @@ -32,7 +33,6 @@ void ByteArrayOutputStream::write(arrayWithLength array, unsigned unsigned int length) { if (m_size + length >= m_buffer.m_length) m_buffer.resize(std::max(m_size + length + 1, m_buffer.m_length * 2)); - XMemCpy(&m_buffer[m_size], &array[start], length); m_size += length; @@ -43,3 +43,11 @@ void ByteArrayOutputStream::close() {} arrayWithLength ByteArrayOutputStream::toByteArray() { return arrayWithLength::createFromOther(m_buffer); } + +void ByteArrayOutputStream::flush() {} +unsigned int ByteArrayOutputStream::size() { + return m_size; +} +void ByteArrayOutputStream::clear() { + m_size = 0; +} diff --git a/src/Minecraft.World/java/io/DataInput.cpp b/src/Minecraft.World/java/io/DataInput.cpp new file mode 100644 index 00000000..e77ee3db --- /dev/null +++ b/src/Minecraft.World/java/io/DataInput.cpp @@ -0,0 +1,3 @@ +#include "java/io/DataInput.h" + +DataInput::~DataInput() = default; diff --git a/src/Minecraft.World/java/io/DataInput.h b/src/Minecraft.World/java/io/DataInput.h index eb87b6a9..8b2bd53b 100644 --- a/src/Minecraft.World/java/io/DataInput.h +++ b/src/Minecraft.World/java/io/DataInput.h @@ -1,5 +1,7 @@ #pragma once +#include "java/io/JavaLong.h" + #include "net/minecraft/world/ArrayWithLength.h" #include "net/minecraft/world/PlayerUID.h" @@ -12,13 +14,13 @@ class DataInput { virtual int readUnsignedShort() = 0; virtual wchar_t readChar() = 0; // is this correct? i swapped the two readFully methods for a match in ByteArrayTag::load - virtual void readFully(arrayWithLength) = 0; - virtual void readFully(arrayWithLength) = 0; - virtual void readBytes(arrayWithLength) = 0; + virtual bool readFully(arrayWithLength) = 0; + virtual bool readFully(arrayWithLength) = 0; + virtual bool readBytes(arrayWithLength) = 0; virtual double readDouble() = 0; virtual float readFloat() = 0; virtual int readInt() = 0; - virtual long readLong() = 0; + virtual JavaLong readLong() = 0; virtual short readShort() = 0; virtual std::wstring readUTF() = 0; virtual int readUTFChar() = 0; diff --git a/src/Minecraft.World/java/io/DataInputStream.cpp b/src/Minecraft.World/java/io/DataInputStream.cpp new file mode 100644 index 00000000..d5e85ad2 --- /dev/null +++ b/src/Minecraft.World/java/io/DataInputStream.cpp @@ -0,0 +1,211 @@ +#include "java/io/DataInputStream.h" + +#include +#include + +#define READ_PRIMITIVE_BYTE() m_inputStream->read() + +DataInputStream::DataInputStream(InputStream* stream) : m_inputStream(stream) {} +DataInputStream::~DataInputStream() = default; + +// Destruction of the wrapper does not destroy its child. The binary exposes +// this explicit operation for callers that transferred ownership. +void DataInputStream::deleteChildStream() { + delete m_inputStream; +} + +int DataInputStream::read() { + return m_inputStream->read(); +} +int DataInputStream::read(arrayWithLength array) { + return read(array, 0, array.m_length); +} +int DataInputStream::read(arrayWithLength array, unsigned int start, unsigned int length) { + return m_inputStream->read(array, start, length); +} +void DataInputStream::close() { + m_inputStream->close(); +} +long long DataInputStream::skip(long long amount) { + return m_inputStream->skip(amount); +} +void DataInputStream::skipBytes(long long amount) { + skip(amount); +} + +bool DataInputStream::readBoolean() { + return READ_PRIMITIVE_BYTE() != 0; +} +unsigned char DataInputStream::readByte() { + return READ_PRIMITIVE_BYTE(); +} +unsigned char DataInputStream::readUnsignedByte() { + return READ_PRIMITIVE_BYTE(); +} +wchar_t DataInputStream::readChar() { + const std::uint32_t high = READ_PRIMITIVE_BYTE(); + const std::uint32_t low = READ_PRIMITIVE_BYTE(); + return (high << 8) | (low & 0xff); +} +bool DataInputStream::readFully(arrayWithLength array) { + for (unsigned int i = 0; i < array.m_length; ++i) { + const int value = m_inputStream->read(); + if (value == -1) { + return false; + } + array[i] = value; + } + return true; +} +bool DataInputStream::readFully(arrayWithLength array) { + return readFully( + arrayWithLength(reinterpret_cast(array.m_data), array.m_length)); +} +bool DataInputStream::readBytes(arrayWithLength array) { + for (unsigned int i = 0; i < array.m_length; ++i) { + const int value = m_inputStream->read(); + if (value == -1) { + return false; + } + array[i] = value; + } + return true; +} +int DataInputStream::readInt() { + const std::uint32_t b0 = READ_PRIMITIVE_BYTE(); + const std::uint32_t b1 = READ_PRIMITIVE_BYTE(); + const std::uint32_t b2 = READ_PRIMITIVE_BYTE(); + const std::uint32_t b3 = READ_PRIMITIVE_BYTE(); + return (b0 << 24) | ((b1 & 0xff) << 16) | ((b2 & 0xff) << 8) | (b3 & 0xff); +} +JavaLong DataInputStream::readLong() { + const std::uint64_t b0 = READ_PRIMITIVE_BYTE(); + const std::uint32_t b1 = READ_PRIMITIVE_BYTE(); + const std::uint32_t b2 = READ_PRIMITIVE_BYTE(); + const std::uint32_t b3 = READ_PRIMITIVE_BYTE(); + const std::uint32_t b4 = READ_PRIMITIVE_BYTE(); + const std::uint32_t b5 = READ_PRIMITIVE_BYTE(); + const std::uint32_t b6 = READ_PRIMITIVE_BYTE(); + const std::uint32_t b7 = READ_PRIMITIVE_BYTE(); + return (b0 << 56) | (std::uint64_t(b1 & 0xff) << 48) | (std::uint64_t(b2 & 0xff) << 40) + | (std::uint64_t(b3 & 0xff) << 32) | (b4 << 24) | ((b5 & 0xff) << 16) | ((b6 & 0xff) << 8) + | (b7 & 0xff); +} +short DataInputStream::readShort() { + const std::uint32_t high = READ_PRIMITIVE_BYTE(); + const std::uint32_t low = READ_PRIMITIVE_BYTE(); + return (high << 8) | (low & 0xff); +} +int DataInputStream::readUnsignedShort() { + const std::uint32_t high = READ_PRIMITIVE_BYTE(); + const std::uint32_t low = READ_PRIMITIVE_BYTE(); + return (high << 8) | (low & 0xff); +} +double DataInputStream::readDouble() { + const JavaLong bits = readLong(); + double result; + std::memcpy(&result, &bits, sizeof(result)); + return result; +} +float DataInputStream::readFloat() { + const int bits = readInt(); + float result; + std::memcpy(&result, &bits, sizeof(result)); + return result; +} + +std::wstring DataInputStream::readUTF() { + std::wstring result; + auto invalid = [&result]() -> std::wstring { return result; }; + const unsigned short length = readUnsignedShort(); + unsigned short consumed = 0; + while (consumed < length) { + const int first = m_inputStream->read(); + if (first == -1 || (first & 0xc0) == 0x80 || (first & 0xf0) == 0xf0) + return invalid(); + ++consumed; + if ((first & 0x80) == 0) { + result.push_back(first); + } else if ((first & 0xe0) == 0xc0) { + if (consumed >= length) + return invalid(); + const int second = m_inputStream->read(); + if (second == -1 || (second & 0xc0) != 0x80) + return invalid(); + ++consumed; + result.push_back(((first & 0x1f) << 6) | (second & 0x3f)); + } else if ((first & 0xf0) == 0xe0) { + if (consumed >= length) + return invalid(); + const int second = m_inputStream->read(); + ++consumed; + if (consumed >= length || second == -1) + return invalid(); + const int third = m_inputStream->read(); + if (third == -1 || (second & 0xc0) != 0x80 || (third & 0xc0) != 0x80) + return invalid(); + ++consumed; + result.push_back(((first & 0xf) << 12) | ((second & 0x3f) << 6) | (third & 0x3f)); + } + } + return result; +} +int DataInputStream::readUTFChar() { + const int first = m_inputStream->read(); + if (first == -1 || (first & 0xc0) == 0x80 || (first & 0xf0) == 0xf0) + return -1; + if ((first & 0x80) == 0) + return first; + if ((first & 0xe0) == 0xc0) { + const int second = m_inputStream->read(); + if (second == -1 || (second & 0xc0) != 0x80) + return -1; + return ((first & 0x1f) << 6) | (second & 0x3f); + } + if ((first & 0xf0) == 0xe0) { + const int second = m_inputStream->read(); + if (second == -1) + return -1; + const int third = m_inputStream->read(); + if (third == -1 || (second & 0xc0) != 0x80 || (third & 0xc0) != 0x80) + return -1; + return ((first & 0xf) << 12) | ((second & 0x3f) << 6) | (third & 0x3f); + } + return -1; +} +PlayerUID DataInputStream::readPlayerUID() { + static_assert(sizeof(PlayerUID) == 32, "The original PlayerUID wire format is 32 bytes"); + PlayerUID result; + unsigned char* bytes = reinterpret_cast(&result); + for (unsigned int i = 0; i < 32; ++i) + bytes[i] = readByte(); + return result; +} +int DataInputStream::readVarInt() { + std::uint32_t result = 0; + unsigned int shift = 0; + int count = -1; + unsigned char byte; + do { + byte = readByte(); + if (++count > 4) + return -1; + result |= std::uint32_t(byte & 0x7f) << shift; + shift += 7; + } while (byte & 0x80); + return result; +} +JavaLong DataInputStream::readVarLong() { + std::uint64_t result = 0; + unsigned int shift = 0; + JavaLong count = -1; + unsigned char byte; + do { + byte = readByte(); + if (++count > 9) + return -1; + result |= std::uint64_t(byte & 0x7f) << shift; + shift += 7; + } while (byte & 0x80); + return result; +} diff --git a/src/Minecraft.World/java/io/DataInputStream.h b/src/Minecraft.World/java/io/DataInputStream.h index c4dcf4e5..b076ca76 100644 --- a/src/Minecraft.World/java/io/DataInputStream.h +++ b/src/Minecraft.World/java/io/DataInputStream.h @@ -25,13 +25,13 @@ class DataInputStream : public InputStream, public DataInput { int readUnsignedShort() override; wchar_t readChar() override; // todo: wrong order likely, need to maintain matching tho - void readBytes(arrayWithLength) override; - void readFully(arrayWithLength) override; - void readFully(arrayWithLength) override; + bool readBytes(arrayWithLength) override; + bool readFully(arrayWithLength) override; + bool readFully(arrayWithLength) override; double readDouble() override; float readFloat() override; int readInt() override; - long readLong() override; + JavaLong readLong() override; short readShort() override; std::wstring readUTF() override; int readUTFChar() override; @@ -39,11 +39,13 @@ class DataInputStream : public InputStream, public DataInput { void skipBytes(long long) override; int readVarInt(); - long readVarLong(); + JavaLong readVarLong(); BlockPos readBlockPos(); BlockPos* readBlockPosPointer(); not_null_ptr readItem(); CompoundTag* readNbt(); + CompoundTag* readCompressedNbt(); + void deleteChildStream(); InputStream* m_inputStream; }; diff --git a/src/Minecraft.World/java/io/DataInputStreamCompressedNbt.cpp b/src/Minecraft.World/java/io/DataInputStreamCompressedNbt.cpp new file mode 100644 index 00000000..371cf998 --- /dev/null +++ b/src/Minecraft.World/java/io/DataInputStreamCompressedNbt.cpp @@ -0,0 +1,22 @@ +#include "com/mojang/nbt/NbtIo.h" +#include "java/io/DataInputStream.h" +#include "net/minecraft/client/Compression.h" + +CompoundTag* DataInputStream::readCompressedNbt() { + const short length = readShort(); + if (length < 0) + return nullptr; + const short compressedLength = readShort(); + if (compressedLength < 0) + return nullptr; + arrayWithLength compressed(compressedLength, true); + readFully(compressed); + arrayWithLength bytes(length, true); + unsigned int actualLength = length; + Compression::getCompression()->Decompress(bytes.m_data, &actualLength, compressed.m_data, + compressed.m_length); + CompoundTag* result = NbtIo::decompress(bytes); + delete[] bytes.m_data; + delete[] compressed.m_data; + return result; +} diff --git a/src/Minecraft.World/java/io/DataInputStreamNbt.cpp b/src/Minecraft.World/java/io/DataInputStreamNbt.cpp new file mode 100644 index 00000000..09d4840a --- /dev/null +++ b/src/Minecraft.World/java/io/DataInputStreamNbt.cpp @@ -0,0 +1,13 @@ +#include "com/mojang/nbt/NbtIo.h" +#include "java/io/DataInputStream.h" + +CompoundTag* DataInputStream::readNbt() { + const short length = readShort(); + if (length < 0) + return nullptr; + arrayWithLength bytes(length, true); + readFully(bytes); + CompoundTag* result = NbtIo::decompress(bytes); + delete[] bytes.m_data; + return result; +} diff --git a/src/Minecraft.World/java/io/DataInputStreamProtocol.cpp b/src/Minecraft.World/java/io/DataInputStreamProtocol.cpp new file mode 100644 index 00000000..7383b288 --- /dev/null +++ b/src/Minecraft.World/java/io/DataInputStreamProtocol.cpp @@ -0,0 +1,25 @@ +#include "java/io/DataInputStream.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/item/Item.h" +#include "net/minecraft/world/item/ItemInstance.h" + +BlockPos DataInputStream::readBlockPos() { + return BlockPos::decompressBlockPos(readLong()); +} + +BlockPos* DataInputStream::readBlockPosPointer() { + const BlockPos pos = BlockPos::decompressBlockPos(readLong()); + return new BlockPos(pos.getX(), pos.getY(), pos.getZ()); +} + +not_null_ptr DataInputStream::readItem() { + not_null_ptr result = ItemInstance::EMPTY; + const short id = readShort(); + if (id >= 0) { + const unsigned char count = readByte(); + const short auxiliary = readShort(); + result = not_null_ptr(new ItemInstance(Item::byId(id), count, auxiliary)); + result->setTag(readNbt()); + } + return result; +} diff --git a/src/Minecraft.World/java/io/DataOutput.cpp b/src/Minecraft.World/java/io/DataOutput.cpp new file mode 100644 index 00000000..9a908650 --- /dev/null +++ b/src/Minecraft.World/java/io/DataOutput.cpp @@ -0,0 +1,4 @@ +#include "java/io/DataOutput.h" + +DataOutput::DataOutput() = default; +DataOutput::~DataOutput() = default; diff --git a/src/Minecraft.World/java/io/DataOutputStream.cpp b/src/Minecraft.World/java/io/DataOutputStream.cpp index 6a7686b4..475d3067 100644 --- a/src/Minecraft.World/java/io/DataOutputStream.cpp +++ b/src/Minecraft.World/java/io/DataOutputStream.cpp @@ -1,4 +1,30 @@ #include "DataOutputStream.h" +#include "net/minecraft/world/PlayerUID.h" +#include +#include + +DataOutputStream::DataOutputStream(OutputStream* output) : m_outputStream(output), m_size(0) {} +DataOutputStream::~DataOutputStream() {} + +void DataOutputStream::flush() { + m_outputStream->flush(); +} +void DataOutputStream::close() { + m_outputStream->close(); +} +void DataOutputStream::write(arrayWithLength bytes) { + write(bytes, 0, bytes.m_length); +} +void DataOutputStream::writeBytes(arrayWithLength bytes) { + write(bytes, 0, bytes.m_length); +} +void DataOutputStream::write(arrayWithLength bytes, unsigned int start, unsigned int length) { + m_outputStream->write(bytes, start, length); + m_size += length; +} +void DataOutputStream::deleteChildStream() { + delete m_outputStream; +} void DataOutputStream::writeInt(int value) { this->m_outputStream->write((value >> 24) & 0xFF); @@ -65,3 +91,63 @@ void DataOutputStream::writeChars(const std::wstring& value) { this->writeChar(value.at(i)); }; } + +void DataOutputStream::writeChar(wchar_t value) { + m_outputStream->write((value >> 8) & 0xff); + m_outputStream->write(value & 0xff); + m_size += 2; +} + +void DataOutputStream::writeVarInt(int value) { + unsigned int bits; + std::memcpy(&bits, &value, sizeof(bits)); + while (bits > 0x7f) { + writeByte(static_cast(bits | 0x80)); + bits >>= 7; + } + writeByte(static_cast(bits)); +} + +void DataOutputStream::writeVarLong(JavaLong value) { + std::uint64_t bits; + std::memcpy(&bits, &value, sizeof(bits)); + while (bits > 0x7f) { + writeByte(static_cast(bits | 0x80)); + bits >>= 7; + } + writeByte(static_cast(bits)); +} + +void DataOutputStream::writePlayerUID(PlayerUID uid) { + static_assert(sizeof(PlayerUID) == 32, "PlayerUID wire format is 32 bytes"); + const unsigned char* bytes = reinterpret_cast(&uid); + for (unsigned int i = 0; i < 32; ++i) + writeByte(bytes[i]); +} + +void DataOutputStream::writeUTF(const std::wstring& value) { + unsigned int length = 0; + for (unsigned int i = 0; i < value.length(); ++i) { + unsigned int ch = value.at(i); + length += ch >= 1 && ch <= 0x7f ? 1 : ch > 0x7ff ? 3 : 2; + } + arrayWithLength bytes(length + 2, true); + bytes[0] = (length >> 8) & 0xff; + bytes[1] = length & 0xff; + unsigned int offset = 2; + for (unsigned int i = 0; i < value.length(); ++i) { + unsigned int ch = value.at(i); + if (ch >= 1 && ch <= 0x7f) { + bytes[offset++] = ch; + } else if (ch < 0x800) { + bytes[offset++] = 0xc0 | ((ch >> 6) & 0x1f); + bytes[offset++] = 0x80 | (ch & 0x3f); + } else { + bytes[offset++] = 0xe0 | ((ch >> 12) & 0x0f); + bytes[offset++] = 0x80 | ((ch >> 6) & 0x3f); + bytes[offset++] = 0x80 | (ch & 0x3f); + } + } + write(bytes, 0, length + 2); + delete[] bytes.m_data; +} diff --git a/src/Minecraft.World/java/io/DataOutputStream.h b/src/Minecraft.World/java/io/DataOutputStream.h index 9ca985d5..cb6c49a4 100644 --- a/src/Minecraft.World/java/io/DataOutputStream.h +++ b/src/Minecraft.World/java/io/DataOutputStream.h @@ -3,6 +3,7 @@ #include #include "java/io/DataOutput.h" +#include "java/io/JavaLong.h" #include "java/io/OutputStream.h" #include "java/io/types/Double.h" #include "java/io/types/Float.h" @@ -38,8 +39,8 @@ class DataOutputStream : public OutputStream, public DataOutput { void writePlayerUID(PlayerUID) override; void writeVarInt(int); - void writeVarLong(long); - void writeBlockPos(const BlockPos&) const; + void writeVarLong(JavaLong); + void writeBlockPos(const BlockPos&); void writeItem(not_null_ptr); void writeNbt(CompoundTag*); diff --git a/src/Minecraft.World/java/io/DataOutputStreamNbt.cpp b/src/Minecraft.World/java/io/DataOutputStreamNbt.cpp new file mode 100644 index 00000000..17ef3fae --- /dev/null +++ b/src/Minecraft.World/java/io/DataOutputStreamNbt.cpp @@ -0,0 +1,13 @@ +#include "com/mojang/nbt/NbtIo.h" +#include "java/io/DataOutputStream.h" + +void DataOutputStream::writeNbt(CompoundTag* tag) { + if (!tag) { + writeShort(-1); + return; + } + arrayWithLength bytes = NbtIo::compress(tag); + writeShort(bytes.m_length); + write(bytes); + delete[] bytes.m_data; +} diff --git a/src/Minecraft.World/java/io/DataOutputStreamProtocol.cpp b/src/Minecraft.World/java/io/DataOutputStreamProtocol.cpp new file mode 100644 index 00000000..683c185f --- /dev/null +++ b/src/Minecraft.World/java/io/DataOutputStreamProtocol.cpp @@ -0,0 +1,19 @@ +#include "java/io/DataOutputStream.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/item/Item.h" +#include "net/minecraft/world/item/ItemInstance.h" + +void DataOutputStream::writeBlockPos(const BlockPos& pos) { + writeLong(pos.compressBlockPos()); +} + +void DataOutputStream::writeItem(not_null_ptr item) { + if (item->isEmpty()) { + writeShort(-1); + return; + } + writeShort(Item::VALIDgetId(item->getItem())); + writeByte(item->getCount()); + writeShort(item->getAuxValue()); + writeNbt(item->getTag()); +} diff --git a/src/Minecraft.World/java/io/File.cpp b/src/Minecraft.World/java/io/File.cpp index 63071d75..a7c5e4b3 100644 --- a/src/Minecraft.World/java/io/File.cpp +++ b/src/Minecraft.World/java/io/File.cpp @@ -30,3 +30,72 @@ File& File::operator=(const File& rhs) { this->m_name = rhs.m_name; return *this; } + +std::wstring File::getPath() const { + return m_name; +} + +std::wstring File::getName() const { + int separator = static_cast(m_name.rfind(L'\\')); + if (separator == -1) + separator = static_cast(m_name.rfind(L'/')); + return std::wstring(m_name, separator + 1, m_name.size()); +} + +std::wstring File::ext() const { + const std::wstring name = getName(); + const auto dot = name.find(std::wstring(L".")); + // The executable uses the first dot and includes it in the extension. + if (dot == std::wstring::npos || dot == 0) + return std::wstring(L""); + return std::wstring(name, dot, std::wstring::npos); +} + +int DeleteFileA(const char*); + +bool File::_delete() { + char buffer[256]; + const bool result = DeleteFileA(wstringtofilename(getPath(), buffer)) != 0; + if (!result) + GetLastError(); + return result; +} + +bool File::mkdir() const { + char buffer[256]; + return CreateDirectoryA(wstringtofilename(getPath(), buffer), nullptr) != 0; +} + +bool File::exists() const { + char buffer[256]; + return GetFileAttributesA(wstringtofilename(getPath(), buffer)) != -1; +} + +bool isDirectory(const std::wstring& path) { + const File& file = reinterpret_cast(path); + if (!file.exists()) + return false; + char buffer[256]; + return (GetFileAttributesA(wstringtofilename(file.getPath(), buffer)) & 0x10) != 0; +} + +bool File::renameTo(File dest) { + char buffer[256]; + const std::string source(wstringtofilename(getPath(), buffer)); + const char* destination = wstringtofilename(dest.getPath(), buffer); + const bool result = MoveFileA(source.c_str(), destination) != 0; + if (!result) + GetLastError(); + return result; +} + +long File::length() { + char buffer[256]; + auto* handle + = CreateFileA(wstringtofilename(getPath(), buffer), 0x80000000, 0, nullptr, 3, 0x80, nullptr); + if (handle == reinterpret_cast(-1)) + return 0; + const int size = GetFileSize(handle, nullptr); + CloseHandle(handle); + return size; +} diff --git a/src/Minecraft.World/java/io/File.h b/src/Minecraft.World/java/io/File.h index e74a5ab7..a5c634d6 100644 --- a/src/Minecraft.World/java/io/File.h +++ b/src/Minecraft.World/java/io/File.h @@ -20,15 +20,15 @@ class File { File& operator=(const File& rhs); std::wstring getPath() const; - void _delete(); + bool _delete(); bool mkdir() const; bool exists() const; bool isDirectory() const; bool isFile() const; - bool renameTo(const File& dest); - std::vector listFiles() const; + bool renameTo(File dest); + std::vector* listFiles() const; std::vector listFiles(FileFilter* filter) const; // unused in switch edition - long length() const; + long length(); std::wstring getName() const; std::wstring ext() const; @@ -42,18 +42,20 @@ std::wstring char16towstring(wchar_t*); const char* wstringtofilename(const std::wstring&, char (&)[256]); std::string formatstr(const char* format, ...); std::wstring formatwstr(const wchar_t* format, ...); -bool CreateDirectoryA(const char*, void*); -bool GetFileAttributesA(const char*); -bool MoveFileA(const char*, const char*); +int CreateDirectoryA(const char*, void*); +int GetFileAttributesA(const char*); +int MoveFileA(const char*, const char*); int GetLastError(); bool isDirectory(const std::wstring&); bool FindFirstFileA(const char*, _WIN32_FIND_DATAA*); std::wstring filenametowstring(const char*); bool FindNextFileA(int, _WIN32_FIND_DATAA*); -bool CloseHandle(nn::fs::FileHandle*); +bool CloseHandle(nn::fs::FileHandle*) asm("_Z11CloseHandlei"); // NOTE: this function declaration may be wrong as it seems that last argument differs with WiiU declaration nn::fs::FileHandle* CreateFileA(const char*, unsigned int, unsigned int, void*, unsigned int, unsigned int, void*); int GetFileSize(nn::fs::FileHandle*, unsigned int*); -int ReadFile(nn::fs::FileHandle*, void*, unsigned int, unsigned int*, _OVERLAPPED*); +int ReadFile(nn::fs::FileHandle*, void*, unsigned int, unsigned int*, + _OVERLAPPED*) asm("_Z8ReadFileiPvjPjP11_OVERLAPPED"); +unsigned int SetFilePointer(nn::fs::FileHandle*, int, int*, unsigned int); diff --git a/src/Minecraft.World/java/io/FileInputStream.cpp b/src/Minecraft.World/java/io/FileInputStream.cpp new file mode 100644 index 00000000..0d32e9b5 --- /dev/null +++ b/src/Minecraft.World/java/io/FileInputStream.cpp @@ -0,0 +1,81 @@ +#include "java/io/FileInputStream.h" + +#include "java/io/File.h" + +// The target supplies no usable app object at these call sites. Keep its +// argument registers and ABI symbol without constructing a host app singleton. +[[noreturn]] void fileLoadError(nn::fs::FileHandle*, const wchar_t*, + ...) asm("_ZN20CConsoleMinecraftApp14FatalLoadErrorEPKwz"); + +FileInputStream::FileInputStream(const File& file) { + m_eof = false; + char buffer[256]; + const char* filename = wstringtofilename(file.getPath(), buffer); + m_file = CreateFileA(filename, 0x80000000, 0, nullptr, 3, 0x80, nullptr); + if (m_file == reinterpret_cast(-1)) + fileLoadError(m_file, L" Failed to open %ls", 0x34, file.getPath().c_str()); +} + +FileInputStream::~FileInputStream() { + if (m_file != reinterpret_cast(-1)) + CloseHandle(m_file); +} + +int FileInputStream::read() { + if (m_eof) + return -1; + unsigned char value = 0; + unsigned int count; + if (!ReadFile(m_file, &value, 1, &count, nullptr)) + fileLoadError(reinterpret_cast(0), L" Failed to read", 0x58); + if (count != 0) + return value; + m_eof = true; + return -1; +} + +int FileInputStream::read(arrayWithLength bytes) { + if (m_eof) + return -1; + unsigned int count; + if (!ReadFile(m_file, bytes.m_data, bytes.m_length, &count, nullptr)) + fileLoadError(reinterpret_cast(0), L" Failed to read array", + 0x7f); + if (count != 0) + return count; + m_eof = true; + return -1; +} + +int FileInputStream::read(arrayWithLength bytes, unsigned int offset, unsigned int length) { + if (m_eof) + return -1; + unsigned int count; + const int result = ReadFile(m_file, &bytes[offset], length, &count, nullptr); + if (!result) + fileLoadError(reinterpret_cast(0), + L" Failed to read special", 0xac); + // Ghidra loses the returned count on this path; ARM64 execution confirms + // that the offset overload also returns the number of bytes read. + if (count != 0) + return count; + m_eof = true; + return -1; +} + +void FileInputStream::close() { + if (m_file != reinterpret_cast(-1)) { + CloseHandle(m_file); + m_file = reinterpret_cast(-1); + } +} + +long long FileInputStream::skip(long long amount) { + return 0; +} + +unsigned int FileInputStream::filesize() { + if (m_file != reinterpret_cast(-1)) + return GetFileSize(m_file, nullptr); + return 0; +} diff --git a/src/Minecraft.World/java/io/FileInputStream.h b/src/Minecraft.World/java/io/FileInputStream.h index 8483743c..15ff93fe 100644 --- a/src/Minecraft.World/java/io/FileInputStream.h +++ b/src/Minecraft.World/java/io/FileInputStream.h @@ -1,20 +1,26 @@ #pragma once #include "java/io/InputStream.h" +#include "nn/fs/fs_types.h" class File; class FileInputStream : public InputStream { public: FileInputStream(const File& file); + ~FileInputStream() override; - unsigned int read() override; - void read(arrayWithLength) override; - void read(arrayWithLength, unsigned int, unsigned int) override; + int read() override; + int read(arrayWithLength) override; + int read(arrayWithLength, unsigned int, unsigned int) override; void close() override; - void skip(long long) override; + long long skip(long long) override; + unsigned int filesize(); + + FileInputStream(const FileInputStream&) = delete; + FileInputStream& operator=(const FileInputStream&) = delete; private: - File* file; - bool _10; + nn::fs::FileHandle* m_file; + bool m_eof; }; diff --git a/src/Minecraft.World/java/io/FileOutputStream.cpp b/src/Minecraft.World/java/io/FileOutputStream.cpp new file mode 100644 index 00000000..935d5872 --- /dev/null +++ b/src/Minecraft.World/java/io/FileOutputStream.cpp @@ -0,0 +1,42 @@ +#include "java/io/FileOutputStream.h" + +#include "java/io/File.h" + +bool WriteFile(nn::fs::FileHandle*, const void*, unsigned int, unsigned int*, _OVERLAPPED*); + +FileOutputStream::FileOutputStream(const File& file) { + m_file = reinterpret_cast(-1); + if (!file.exists() || !isDirectory(file.m_name)) { + char buffer[256]; + m_file = CreateFileA(wstringtofilename(file.getPath(), buffer), 0x40000000, 0, nullptr, 4, 0x80, + nullptr); + } +} + +FileOutputStream::~FileOutputStream() { + if (m_file != reinterpret_cast(-1)) + CloseHandle(m_file); +} + +void FileOutputStream::write(unsigned int value) { + const unsigned char byte = static_cast(value); + unsigned int count; + WriteFile(m_file, &byte, 1, &count, nullptr); +} + +void FileOutputStream::write(arrayWithLength bytes) { + unsigned int count; + WriteFile(m_file, bytes.m_data, bytes.m_length, &count, nullptr); +} + +void FileOutputStream::write(arrayWithLength bytes, unsigned int offset, unsigned int length) { + unsigned int count; + WriteFile(m_file, &bytes[offset], length, &count, nullptr); +} + +void FileOutputStream::close() { + CloseHandle(m_file); + m_file = reinterpret_cast(-1); +} + +void FileOutputStream::flush() {} diff --git a/src/Minecraft.World/java/io/FileOutputStream.h b/src/Minecraft.World/java/io/FileOutputStream.h index cb4b0394..e7902e0f 100644 --- a/src/Minecraft.World/java/io/FileOutputStream.h +++ b/src/Minecraft.World/java/io/FileOutputStream.h @@ -1,6 +1,7 @@ #pragma once #include "java/io/OutputStream.h" +#include "nn/fs/fs_types.h" class File; @@ -15,5 +16,8 @@ class FileOutputStream : public OutputStream { void close() override; void flush() override; - void* m_field8; + FileOutputStream(const FileOutputStream&) = delete; + FileOutputStream& operator=(const FileOutputStream&) = delete; + + nn::fs::FileHandle* m_file; }; diff --git a/src/Minecraft.World/java/io/FilePaths.cpp b/src/Minecraft.World/java/io/FilePaths.cpp new file mode 100644 index 00000000..4aaabc83 --- /dev/null +++ b/src/Minecraft.World/java/io/FilePaths.cpp @@ -0,0 +1,29 @@ +#include "java/io/File.h" +#include +#include + +const char* wstringtofilename(const std::wstring& name, char (&buffer)[256]) { + for (unsigned int i = 0; i < name.size(); ++i) + buffer[i] = static_cast(name[i] == L'/' ? L'\\' : name[i]); + buffer[name.size()] = 0; + return buffer; +} + +std::wstring filenametowstring(const char* name) { + const std::string encoded(name); + const auto length = encoded.size() + 1; + wchar_t* buffer = new wchar_t[length]; + std::mbstowcs(buffer, encoded.c_str(), length); + const std::wstring decoded(buffer); + delete[] buffer; + return decoded; +} + +std::wstring char16towstring(wchar_t* name) { + // FileEntry stores 16-bit characters even where wchar_t is 32 bits. + const unsigned short* units = reinterpret_cast(name); + std::wstring decoded; + while (*units) + decoded.push_back(*units++); + return decoded; +} diff --git a/src/Minecraft.World/java/io/IntCache.h b/src/Minecraft.World/java/io/IntCache.h index 07f52e70..c690b044 100644 --- a/src/Minecraft.World/java/io/IntCache.h +++ b/src/Minecraft.World/java/io/IntCache.h @@ -1,10 +1,4 @@ #pragma once -class IntCache { -public: - static void CreateNewThreadStorage(); - - class ThreadStorage {}; - - static void Reset(); -}; +// Both historical include paths refer to the biome-layer cache. +#include "net/minecraft/world/level/newbiome/layer/IntCache.h" diff --git a/src/Minecraft.World/java/io/JavaLong.h b/src/Minecraft.World/java/io/JavaLong.h new file mode 100644 index 00000000..25327209 --- /dev/null +++ b/src/Minecraft.World/java/io/JavaLong.h @@ -0,0 +1,5 @@ +#pragma once + +#include + +using JavaLong = long; diff --git a/src/Minecraft.World/java/io/SwitchFileStubs.cpp b/src/Minecraft.World/java/io/SwitchFileStubs.cpp new file mode 100644 index 00000000..e4569653 --- /dev/null +++ b/src/Minecraft.World/java/io/SwitchFileStubs.cpp @@ -0,0 +1,11 @@ +// These two legacy Windows adapters really are constant-return stubs in the +// Switch executable (0x71006081f0 and 0x7100608514). Do not use them on PC. +#include "java/io/File.h" + +int DeleteFileA(const char*) { + return 0; +} + +bool WriteFile(nn::fs::FileHandle*, const void*, unsigned int, unsigned int*, _OVERLAPPED*) { + return true; +} diff --git a/src/Minecraft.World/net/minecraft/util/Mth.cpp b/src/Minecraft.World/net/minecraft/util/Mth.cpp index ff19a355..b0d1f3b3 100644 --- a/src/Minecraft.World/net/minecraft/util/Mth.cpp +++ b/src/Minecraft.World/net/minecraft/util/Mth.cpp @@ -3,27 +3,39 @@ #include "cmath" #include "net/minecraft/world/Random.h" +float* Mth::SIN = nullptr; +float* Mth::ATAN = nullptr; + +int Mth::cached_atan_index(int x, int y) { + return static_cast(static_cast(x) + static_cast(y) * 40); +} + +void Mth::init() { + SIN = new float[65536]; + for (long i = 0; i < 65536; ++i) + SIN[i] = ::sinf(static_cast(static_cast(i)) / 10430.3779296875f); + + ATAN = new float[cached_atan_index(40, 40) + 1]; + for (int x = 0; x < 40; ++x) { + for (int y = 0; y < 40; ++y) { + int index = cached_atan_index(x, y); + ATAN[index] = ::atanf(static_cast(x) / static_cast(y)); + } + } +} + float Mth::sin(float v) { if (!SIN) init(); - return SIN[static_cast(v * 10430.0F) & 0xFFFF]; + return SIN[static_cast(v * 10430.3779296875f) & 0xFFFF]; } float Mth::cos(float v) { if (!SIN) init(); - // original had 10430.3779296875 but .0 also matches - return SIN[static_cast(v * 10430.0f + 16384.0f) & 0xFFFF]; -} - -int Mth::floor(double value) { - return (int)value - ((int)value > value); -} - -int Mth::floor(float value) { - return (int)value - ((int)value > value); + return SIN[static_cast(v * 10430.3779296875f + 16384.0f) & 0xFFFF]; } float Mth::sqrt(float v) { @@ -69,8 +81,8 @@ double Mth::abs(double i) { return (i >= 0.0) ? i : -i; } -long Mth::lfloor(double value) { - return (long)value - ((long)value > value); +MthLong Mth::lfloor(double value) { + return static_cast(value) - (static_cast(value) > value); } double Mth::clampedLerp(double i, double j, double k) { @@ -86,6 +98,82 @@ double Mth::frac(double value) { return value - Mth::floor(value); } +float Mth::wrapDegrees(float value) { + value = ::fmodf(value, 360.0f); + if (value >= 180.0f) + value -= 360.0f; + if (value < -180.0f) + value += 360.0f; + return value; +} + +double Mth::wrapDegrees(double value) { + value = ::fmod(value, 360.0); + if (value >= 180.0) + value -= 360.0; + if (value < -180.0) + value += 360.0; + return value; +} + +int64_t Mth::getSeed(int x, int y, int z) { + // The first product wraps at 32 bits before sign extension; the final + // products wrap at 64 bits, as in the original ARM64 integer operations. + uint32_t wrappedX = static_cast(x) * 3129871U; + int64_t mixed = static_cast(static_cast(wrappedX)) + ^ (static_cast(z) * 116129781LL) ^ static_cast(y); + uint64_t seed = static_cast(mixed); + return static_cast((seed * 42317861ULL + 11ULL) * seed); +} + +int Mth::hsvToRgb(float hue, float saturation, float value) { + int sector = static_cast(hue * 6.0f) % 6; + float fraction = hue * 6.0f - static_cast(sector); + float low = (1.0f - saturation) * value; + float falling = (1.0f - fraction * saturation) * value; + float rising = (1.0f - (1.0f - fraction) * saturation) * value; + float red, green, blue; + switch (sector) { + default: + red = green = blue = 0.0f; + break; + case 0: + red = value; + green = rising; + blue = low; + break; + case 1: + red = falling; + green = value; + blue = low; + break; + case 2: + red = low; + green = value; + blue = rising; + break; + case 3: + red = low; + green = falling; + blue = value; + break; + case 4: + red = rising; + green = low; + blue = value; + break; + case 5: + red = value; + green = low; + blue = falling; + break; + } + int r = clamp(static_cast(red * 255.0f), 0, 255); + int g = clamp(static_cast(green * 255.0f), 0, 255); + int b = clamp(static_cast(blue * 255.0f), 0, 255); + return r << 16 | g << 8 | b; +} + int Mth::nextInt(Random* random, int i, int j) { if (j > i) return random->nextInt(1 - i + j) + i; @@ -93,16 +181,32 @@ int Mth::nextInt(Random* random, int i, int j) { return i; } -// float Mth::nextFloat(Random* random, float i, float j) { -// if (j > i) -// return random->nextFloat() * (j - i) + i; -// -// return i; -// } -// -// double Mth::nextDouble(Random* random, double i, double j) { -// if (j > i) -// return random->nextDouble() * (j - i) + i; -// -// return i; -// } +float Mth::nextFloat(Random* random, float lower, float upper) { + if (lower >= upper) + return lower; + return random->nextFloat() * (upper - lower) + lower; +} + +double Mth::nextDouble(Random* random, double lower, double upper) { + if (lower >= upper) + return lower; + return random->nextDouble() * (upper - lower) + lower; +} + +std::wstring Mth::createInsecureUUID(Random* random) { + wchar_t text[33]; + text[32] = L'\0'; + MthLong high = (random->nextLong() & INT64_C(0xffffffffffff0fff)) | INT64_C(0x4000); + MthLong low = (random->nextLong() & INT64_C(0x3fffffffffffffff)) | INT64_MIN; + for (int i = 15; i != -1; --i) { + unsigned int a = high & 15; + unsigned int b = low & 15; + a += a > 9 ? L'a' - 10 : L'0'; + b += b > 9 ? L'a' - 10 : L'0'; + text[i] = a; + text[i + 16] = b; + high >>= 4; + low >>= 4; + } + return std::wstring(text); +} diff --git a/src/Minecraft.World/net/minecraft/util/Mth.h b/src/Minecraft.World/net/minecraft/util/Mth.h index 97227879..fb1e6cb2 100644 --- a/src/Minecraft.World/net/minecraft/util/Mth.h +++ b/src/Minecraft.World/net/minecraft/util/Mth.h @@ -1,20 +1,25 @@ #pragma once +#include #include class Random; +using MthLong = long; + // Meth class Mth { public: static constexpr float PI = 3.1415927; static float* SIN; + static float* ATAN; static float sin(float); static float cos(float); static int floor(double); static int floor(float); + static int ceil(float); static float sqrt(float v); static float sqrt(double v); static double clamp(double, double, double); @@ -26,15 +31,17 @@ class Mth { static float abs(float i); static double abs(double i); static float wrapDegrees(float); - static void cached_atan_index(int, int); + static double wrapDegrees(double); + static int cached_atan_index(int, int); static void init(); - static long lfloor(double); + static MthLong lfloor(double); + static MthLong round(double); static double clampedLerp(double, double, double); static double frac(double); static int hsvToRgb(float, float, float); static int nextInt(Random* random, int i, int j); static float nextFloat(Random* random, float i, float j); static double nextDouble(Random* random, double i, double j); - static std::wstring createInsecureUUID(Random* random); + static std::wstring createInsecureUUID(Random* random) asm("createInsecureUUID__3MthSFP6Random"); static int64_t getSeed(int, int, int); }; diff --git a/src/Minecraft.World/net/minecraft/util/MthCeil.cpp b/src/Minecraft.World/net/minecraft/util/MthCeil.cpp new file mode 100644 index 00000000..a7ed71ae --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/MthCeil.cpp @@ -0,0 +1,6 @@ +#include "net/minecraft/util/Mth.h" + +int Mth::ceil(float value) { + int truncated = static_cast(value); + return truncated + (truncated < value); +} diff --git a/src/Minecraft.World/net/minecraft/util/MthFloor.cpp b/src/Minecraft.World/net/minecraft/util/MthFloor.cpp new file mode 100644 index 00000000..31f89d4f --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/MthFloor.cpp @@ -0,0 +1,9 @@ +#include "net/minecraft/util/Mth.h" + +int Mth::floor(double value) { + return (int)value - ((int)value > value); +} + +int Mth::floor(float value) { + return (int)value - ((int)value > value); +} diff --git a/src/Minecraft.World/net/minecraft/util/MthRound.cpp b/src/Minecraft.World/net/minecraft/util/MthRound.cpp new file mode 100644 index 00000000..5a9794ae --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/MthRound.cpp @@ -0,0 +1,6 @@ +#include "net/minecraft/util/Mth.h" +#include + +MthLong Mth::round(double value) { + return static_cast(std::floor(value + 0.5)); +} diff --git a/src/Minecraft.World/net/minecraft/util/StringUtils.cpp b/src/Minecraft.World/net/minecraft/util/StringUtils.cpp new file mode 100644 index 00000000..b1ab7725 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/StringUtils.cpp @@ -0,0 +1,25 @@ +#include "StringUtils.h" + +std::wstring replaceAll(const std::wstring& input, const std::wstring& from, const std::wstring& to) { + std::wstring result(input); + std::size_t pos = 0; + while ((pos = result.find(from, pos)) != std::wstring::npos) { + result.replace(pos, from.size(), to); + ++pos; // Original advances by one, including when replacement shrinks. + } + return result; +} + +std::vector& split(const std::wstring& text, wchar_t delimiter, + std::vector& output) { + std::wstringstream stream(text); + std::wstring token; + while (std::getline(stream, token, delimiter)) + output.push_back(token); + return output; +} + +std::vector split(const std::wstring& text, wchar_t delimiter) { + std::vector output; + return split(text, delimiter, output); +} diff --git a/src/Minecraft.World/net/minecraft/util/StringUtils.h b/src/Minecraft.World/net/minecraft/util/StringUtils.h new file mode 100644 index 00000000..3071a8ef --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/StringUtils.h @@ -0,0 +1,25 @@ +#pragma once + +#include +#include +#include + +// Additional formatting overload supplied by the Switch runtime. +namespace std { +inline namespace __1 { +wstring to_wstring(bool); +} +} // namespace std + +std::wstring replaceAll(const std::wstring&, const std::wstring&, const std::wstring&); + +std::vector& split(const std::wstring&, wchar_t, std::vector&); +std::vector split(const std::wstring&, wchar_t); + +template +T _fromString(const std::wstring& text) { + std::wistringstream stream(text); + T value; + stream >> value; + return value; +} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/DataFix.h b/src/Minecraft.World/net/minecraft/util/datafix/DataFix.h new file mode 100644 index 00000000..b4eb33b6 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/DataFix.h @@ -0,0 +1,11 @@ +#pragma once + +class CompoundTag; + +class DataFix { +public: + DataFix(); + virtual ~DataFix(); + virtual int getVersion() = 0; + virtual CompoundTag* fix(CompoundTag*) = 0; +}; diff --git a/src/Minecraft.World/net/minecraft/util/datafix/DataFixLifecycle.cpp b/src/Minecraft.World/net/minecraft/util/datafix/DataFixLifecycle.cpp new file mode 100644 index 00000000..ece4fcce --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/DataFixLifecycle.cpp @@ -0,0 +1,4 @@ +#include "net/minecraft/util/datafix/DataFix.h" + +DataFix::DataFix() {} +DataFix::~DataFix() {} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/DataFixTypes.h b/src/Minecraft.World/net/minecraft/util/datafix/DataFixTypes.h new file mode 100644 index 00000000..ed344804 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/DataFixTypes.h @@ -0,0 +1,6 @@ +#pragma once + +class DataFixTypes { +public: + enum EDataFixTypes { ITEM = 5, STRUCTURE = 7 }; +}; diff --git a/src/Minecraft.World/net/minecraft/util/datafix/DataFixer.h b/src/Minecraft.World/net/minecraft/util/datafix/DataFixer.h new file mode 100644 index 00000000..4210b16f --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/DataFixer.h @@ -0,0 +1,11 @@ +#pragma once + +#include "net/minecraft/util/datafix/DataFixTypes.h" + +class CompoundTag; + +class DataFixer { +public: + DataFixer(); + virtual CompoundTag* update(DataFixTypes::EDataFixTypes, CompoundTag*, int version) = 0; +}; diff --git a/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpper.h b/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpper.h new file mode 100644 index 00000000..00e312ea --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpper.h @@ -0,0 +1,33 @@ +#pragma once + +#include "net/minecraft/util/datafix/DataFixer.h" +#include +#include +#include + +class CompoundTag; +class DataFix; +class DataWalker; + +class DataFixerUpper : public DataFixer { +public: + explicit DataFixerUpper(int version); + CompoundTag* updateData(DataFixTypes::EDataFixTypes, CompoundTag*); + CompoundTag* update(DataFixTypes::EDataFixTypes, CompoundTag*, int version) override; + CompoundTag* applyFixes(DataFixTypes::EDataFixTypes, CompoundTag*, int version); + CompoundTag* applyWalkers(DataFixTypes::EDataFixTypes, CompoundTag*, int version); + std::vector* getOrCreateWalker(DataFixTypes::EDataFixTypes); + std::vector* getOrCreateFix(DataFixTypes::EDataFixTypes); + void addWalker(DataFixTypes::EDataFixTypes, DataWalker*); + void addFixer(DataFixTypes::EDataFixTypes, DataFix*); + + int m_version; + std::unordered_map*> m_walkers; + std::unordered_map*> m_fixes; + static const std::wstring DATA_VERSION_KEY; +}; + +static_assert(sizeof(DataFixerUpper) == 0x60, "Original fixer-upper allocation"); +static_assert(__builtin_offsetof(DataFixerUpper, m_version) == 8, "Original target-version offset"); +static_assert(__builtin_offsetof(DataFixerUpper, m_walkers) == 0x10, "Original walker registry offset"); +static_assert(__builtin_offsetof(DataFixerUpper, m_fixes) == 0x38, "Original fix registry offset"); diff --git a/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperRegistration.cpp b/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperRegistration.cpp new file mode 100644 index 00000000..ff99645e --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperRegistration.cpp @@ -0,0 +1,56 @@ +#include "net/minecraft/util/datafix/DataFix.h" +#include "net/minecraft/util/datafix/DataFixerUpper.h" +#include "net/minecraft/util/datafix/walker/DataWalker.h" + +DataFixer::DataFixer() {} + +DataFixerUpper::DataFixerUpper(int version) { + m_version = version; +} + +std::vector* DataFixerUpper::getOrCreateWalker(DataFixTypes::EDataFixTypes type) { + auto* walkers = m_walkers[type]; + // The original replaces even an existing empty vector without deleting it. + if (!walkers || walkers->empty()) { + walkers = new std::vector(); + m_walkers[type] = walkers; + } + return walkers; +} + +std::vector* DataFixerUpper::getOrCreateFix(DataFixTypes::EDataFixTypes type) { + auto* fixes = m_fixes[type]; + if (!fixes || fixes->empty()) { + fixes = new std::vector(); + m_fixes[type] = fixes; + } + return fixes; +} + +void DataFixerUpper::addWalker(DataFixTypes::EDataFixTypes type, DataWalker* walker) { + auto* walkers = getOrCreateWalker(type); + walkers->push_back(walker); +} + +void DataFixerUpper::addFixer(DataFixTypes::EDataFixTypes type, DataFix* fix) { + auto* fixes = getOrCreateFix(type); + int version = fix->getVersion(); + if (version > m_version) + return; + auto end = fixes->end(); + if (fixes->begin() != end) { + int lastVersion = (*(end - 1))->getVersion(); + end = fixes->end(); + if (lastVersion > version) { + // The Switch routine appends after this scan rather than inserting in order. + for (auto it = fixes->begin(); it != end; ++it) { + if ((*it)->getVersion() > version) { + fixes->push_back(fix); + return; + } + } + return; + } + } + fixes->push_back(fix); +} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperUpdate.cpp b/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperUpdate.cpp new file mode 100644 index 00000000..350734dd --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperUpdate.cpp @@ -0,0 +1,44 @@ +#include "com/mojang/nbt/CompoundTag.h" +#include "net/minecraft/util/datafix/DataFix.h" +#include "net/minecraft/util/datafix/DataFixerUpper.h" +#include "net/minecraft/util/datafix/walker/DataWalker.h" + +const std::wstring DataFixerUpper::DATA_VERSION_KEY = L"DataVersion"; + +CompoundTag* DataFixerUpper::updateData(DataFixTypes::EDataFixTypes type, CompoundTag* tag) { + int version = -1; + if (tag->contains(DATA_VERSION_KEY, 99)) { + version = tag->getInt(DATA_VERSION_KEY); + if (version > 921) + return tag; + } + return update(type, tag, version); +} + +CompoundTag* DataFixerUpper::update(DataFixTypes::EDataFixTypes type, CompoundTag* tag, int version) { + if (version < m_version) { + tag = applyFixes(type, tag, version); + tag = applyWalkers(type, tag, version); + } + return tag; +} + +CompoundTag* DataFixerUpper::applyFixes(DataFixTypes::EDataFixTypes type, CompoundTag* tag, int version) { + if (m_fixes.find(type) != m_fixes.end()) { + auto* fixes = m_fixes[type]; + for (auto it = fixes->begin(), end = fixes->end(); it != end; ++it) { + if (version < (*it)->getVersion()) + tag = (*it)->fix(tag); + } + } + return tag; +} + +CompoundTag* DataFixerUpper::applyWalkers(DataFixTypes::EDataFixTypes type, CompoundTag* tag, int version) { + auto found = m_walkers.find(type); + if (found != m_walkers.end()) { + for (auto* walker : *found->second) + tag = walker->walk(this, tag, version); + } + return tag; +} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/DataFixers.h b/src/Minecraft.World/net/minecraft/util/datafix/DataFixers.h index 6ec63a49..b2d5c073 100644 --- a/src/Minecraft.World/net/minecraft/util/datafix/DataFixers.h +++ b/src/Minecraft.World/net/minecraft/util/datafix/DataFixers.h @@ -1,8 +1,14 @@ #pragma once +#include + +class CompoundTag; +class DataFixer; class DataFixerUpper; class DataFixers { public: static DataFixerUpper* createFixerUpper(); + static CompoundTag* updateItem(DataFixer*, CompoundTag*, int version, const std::wstring& key); + static CompoundTag* updateItems(DataFixer*, CompoundTag*, int version, const std::wstring& key); }; diff --git a/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemIdFix.cpp b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemIdFix.cpp new file mode 100644 index 00000000..f047e1a5 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemIdFix.cpp @@ -0,0 +1,321 @@ +#include "net/minecraft/util/datafix/fixes/ItemIdFix.h" + +std::unordered_map ItemIdFix::ID_TO_NAME; + +void ItemIdFix::staticCtor() { + ID_TO_NAME[1] = L"minecraft:stone"; + ID_TO_NAME[2] = L"minecraft:grass"; + ID_TO_NAME[3] = L"minecraft:dirt"; + ID_TO_NAME[4] = L"minecraft:cobblestone"; + ID_TO_NAME[5] = L"minecraft:planks"; + ID_TO_NAME[6] = L"minecraft:sapling"; + ID_TO_NAME[7] = L"minecraft:bedrock"; + ID_TO_NAME[8] = L"minecraft:flowing_water"; + ID_TO_NAME[9] = L"minecraft:water"; + ID_TO_NAME[10] = L"minecraft:flowing_lava"; + ID_TO_NAME[11] = L"minecraft:lava"; + ID_TO_NAME[12] = L"minecraft:sand"; + ID_TO_NAME[13] = L"minecraft:gravel"; + ID_TO_NAME[14] = L"minecraft:gold_ore"; + ID_TO_NAME[15] = L"minecraft:iron_ore"; + ID_TO_NAME[16] = L"minecraft:coal_ore"; + ID_TO_NAME[17] = L"minecraft:log"; + ID_TO_NAME[18] = L"minecraft:leaves"; + ID_TO_NAME[19] = L"minecraft:sponge"; + ID_TO_NAME[20] = L"minecraft:glass"; + ID_TO_NAME[21] = L"minecraft:lapis_ore"; + ID_TO_NAME[22] = L"minecraft:lapis_block"; + ID_TO_NAME[23] = L"minecraft:dispenser"; + ID_TO_NAME[24] = L"minecraft:sandstone"; + ID_TO_NAME[25] = L"minecraft:noteblock"; + ID_TO_NAME[27] = L"minecraft:golden_rail"; + ID_TO_NAME[28] = L"minecraft:detector_rail"; + ID_TO_NAME[29] = L"minecraft:sticky_piston"; + ID_TO_NAME[30] = L"minecraft:web"; + ID_TO_NAME[31] = L"minecraft:tallgrass"; + ID_TO_NAME[32] = L"minecraft:deadbush"; + ID_TO_NAME[33] = L"minecraft:piston"; + ID_TO_NAME[35] = L"minecraft:wool"; + ID_TO_NAME[37] = L"minecraft:yellow_flower"; + ID_TO_NAME[38] = L"minecraft:red_flower"; + ID_TO_NAME[39] = L"minecraft:brown_mushroom"; + ID_TO_NAME[40] = L"minecraft:red_mushroom"; + ID_TO_NAME[41] = L"minecraft:gold_block"; + ID_TO_NAME[42] = L"minecraft:iron_block"; + ID_TO_NAME[43] = L"minecraft:double_stone_slab"; + ID_TO_NAME[44] = L"minecraft:stone_slab"; + ID_TO_NAME[45] = L"minecraft:brick_block"; + ID_TO_NAME[46] = L"minecraft:tnt"; + ID_TO_NAME[47] = L"minecraft:bookshelf"; + ID_TO_NAME[48] = L"minecraft:mossy_cobblestone"; + ID_TO_NAME[49] = L"minecraft:obsidian"; + ID_TO_NAME[50] = L"minecraft:torch"; + ID_TO_NAME[51] = L"minecraft:fire"; + ID_TO_NAME[52] = L"minecraft:mob_spawner"; + ID_TO_NAME[53] = L"minecraft:oak_stairs"; + ID_TO_NAME[54] = L"minecraft:chest"; + ID_TO_NAME[56] = L"minecraft:diamond_ore"; + ID_TO_NAME[57] = L"minecraft:diamond_block"; + ID_TO_NAME[58] = L"minecraft:crafting_table"; + ID_TO_NAME[60] = L"minecraft:farmland"; + ID_TO_NAME[61] = L"minecraft:furnace"; + ID_TO_NAME[62] = L"minecraft:lit_furnace"; + ID_TO_NAME[65] = L"minecraft:ladder"; + ID_TO_NAME[66] = L"minecraft:rail"; + ID_TO_NAME[67] = L"minecraft:stone_stairs"; + ID_TO_NAME[69] = L"minecraft:lever"; + ID_TO_NAME[70] = L"minecraft:stone_pressure_plate"; + ID_TO_NAME[72] = L"minecraft:wooden_pressure_plate"; + ID_TO_NAME[73] = L"minecraft:redstone_ore"; + ID_TO_NAME[76] = L"minecraft:redstone_torch"; + ID_TO_NAME[77] = L"minecraft:stone_button"; + ID_TO_NAME[78] = L"minecraft:snow_layer"; + ID_TO_NAME[79] = L"minecraft:ice"; + ID_TO_NAME[80] = L"minecraft:snow"; + ID_TO_NAME[81] = L"minecraft:cactus"; + ID_TO_NAME[82] = L"minecraft:clay"; + ID_TO_NAME[84] = L"minecraft:jukebox"; + ID_TO_NAME[85] = L"minecraft:fence"; + ID_TO_NAME[86] = L"minecraft:pumpkin"; + ID_TO_NAME[87] = L"minecraft:netherrack"; + ID_TO_NAME[88] = L"minecraft:soul_sand"; + ID_TO_NAME[89] = L"minecraft:glowstone"; + ID_TO_NAME[90] = L"minecraft:portal"; + ID_TO_NAME[91] = L"minecraft:lit_pumpkin"; + ID_TO_NAME[95] = L"minecraft:stained_glass"; + ID_TO_NAME[96] = L"minecraft:trapdoor"; + ID_TO_NAME[97] = L"minecraft:monster_egg"; + ID_TO_NAME[98] = L"minecraft:stonebrick"; + ID_TO_NAME[99] = L"minecraft:brown_mushroom_block"; + ID_TO_NAME[100] = L"minecraft:red_mushroom_block"; + ID_TO_NAME[101] = L"minecraft:iron_bars"; + ID_TO_NAME[102] = L"minecraft:glass_pane"; + ID_TO_NAME[103] = L"minecraft:melon_block"; + ID_TO_NAME[106] = L"minecraft:vine"; + ID_TO_NAME[107] = L"minecraft:fence_gate"; + ID_TO_NAME[108] = L"minecraft:brick_stairs"; + ID_TO_NAME[109] = L"minecraft:stone_brick_stairs"; + ID_TO_NAME[110] = L"minecraft:mycelium"; + ID_TO_NAME[111] = L"minecraft:waterlily"; + ID_TO_NAME[112] = L"minecraft:nether_brick"; + ID_TO_NAME[113] = L"minecraft:nether_brick_fence"; + ID_TO_NAME[114] = L"minecraft:nether_brick_stairs"; + ID_TO_NAME[116] = L"minecraft:enchanting_table"; + ID_TO_NAME[119] = L"minecraft:end_portal"; + ID_TO_NAME[120] = L"minecraft:end_portal_frame"; + ID_TO_NAME[121] = L"minecraft:end_stone"; + ID_TO_NAME[122] = L"minecraft:dragon_egg"; + ID_TO_NAME[123] = L"minecraft:redstone_lamp"; + ID_TO_NAME[125] = L"minecraft:double_wooden_slab"; + ID_TO_NAME[126] = L"minecraft:wooden_slab"; + ID_TO_NAME[127] = L"minecraft:cocoa"; + ID_TO_NAME[128] = L"minecraft:sandstone_stairs"; + ID_TO_NAME[129] = L"minecraft:emerald_ore"; + ID_TO_NAME[130] = L"minecraft:ender_chest"; + ID_TO_NAME[131] = L"minecraft:tripwire_hook"; + ID_TO_NAME[133] = L"minecraft:emerald_block"; + ID_TO_NAME[134] = L"minecraft:spruce_stairs"; + ID_TO_NAME[135] = L"minecraft:birch_stairs"; + ID_TO_NAME[136] = L"minecraft:jungle_stairs"; + ID_TO_NAME[137] = L"minecraft:command_block"; + ID_TO_NAME[138] = L"minecraft:beacon"; + ID_TO_NAME[139] = L"minecraft:cobblestone_wall"; + ID_TO_NAME[141] = L"minecraft:carrots"; + ID_TO_NAME[142] = L"minecraft:potatoes"; + ID_TO_NAME[143] = L"minecraft:wooden_button"; + ID_TO_NAME[145] = L"minecraft:anvil"; + ID_TO_NAME[146] = L"minecraft:trapped_chest"; + ID_TO_NAME[147] = L"minecraft:light_weighted_pressure_plate"; + ID_TO_NAME[148] = L"minecraft:heavy_weighted_pressure_plate"; + ID_TO_NAME[151] = L"minecraft:daylight_detector"; + ID_TO_NAME[152] = L"minecraft:redstone_block"; + ID_TO_NAME[153] = L"minecraft:quartz_ore"; + ID_TO_NAME[154] = L"minecraft:hopper"; + ID_TO_NAME[155] = L"minecraft:quartz_block"; + ID_TO_NAME[156] = L"minecraft:quartz_stairs"; + ID_TO_NAME[157] = L"minecraft:activator_rail"; + ID_TO_NAME[158] = L"minecraft:dropper"; + ID_TO_NAME[159] = L"minecraft:stained_hardened_clay"; + ID_TO_NAME[160] = L"minecraft:stained_glass_pane"; + ID_TO_NAME[161] = L"minecraft:leaves2"; + ID_TO_NAME[162] = L"minecraft:log2"; + ID_TO_NAME[163] = L"minecraft:acacia_stairs"; + ID_TO_NAME[164] = L"minecraft:dark_oak_stairs"; + ID_TO_NAME[170] = L"minecraft:hay_block"; + ID_TO_NAME[171] = L"minecraft:carpet"; + ID_TO_NAME[172] = L"minecraft:hardened_clay"; + ID_TO_NAME[173] = L"minecraft:coal_block"; + ID_TO_NAME[174] = L"minecraft:packed_ice"; + ID_TO_NAME[175] = L"minecraft:double_plant"; + ID_TO_NAME[256] = L"minecraft:iron_shovel"; + ID_TO_NAME[257] = L"minecraft:iron_pickaxe"; + ID_TO_NAME[258] = L"minecraft:iron_axe"; + ID_TO_NAME[259] = L"minecraft:flint_and_steel"; + ID_TO_NAME[260] = L"minecraft:apple"; + ID_TO_NAME[261] = L"minecraft:bow"; + ID_TO_NAME[262] = L"minecraft:arrow"; + ID_TO_NAME[263] = L"minecraft:coal"; + ID_TO_NAME[264] = L"minecraft:diamond"; + ID_TO_NAME[265] = L"minecraft:iron_ingot"; + ID_TO_NAME[266] = L"minecraft:gold_ingot"; + ID_TO_NAME[267] = L"minecraft:iron_sword"; + ID_TO_NAME[268] = L"minecraft:wooden_sword"; + ID_TO_NAME[269] = L"minecraft:wooden_shovel"; + ID_TO_NAME[270] = L"minecraft:wooden_pickaxe"; + ID_TO_NAME[271] = L"minecraft:wooden_axe"; + ID_TO_NAME[272] = L"minecraft:stone_sword"; + ID_TO_NAME[273] = L"minecraft:stone_shovel"; + ID_TO_NAME[274] = L"minecraft:stone_pickaxe"; + ID_TO_NAME[275] = L"minecraft:stone_axe"; + ID_TO_NAME[276] = L"minecraft:diamond_sword"; + ID_TO_NAME[277] = L"minecraft:diamond_shovel"; + ID_TO_NAME[278] = L"minecraft:diamond_pickaxe"; + ID_TO_NAME[279] = L"minecraft:diamond_axe"; + ID_TO_NAME[280] = L"minecraft:stick"; + ID_TO_NAME[281] = L"minecraft:bowl"; + ID_TO_NAME[282] = L"minecraft:mushroom_stew"; + ID_TO_NAME[283] = L"minecraft:golden_sword"; + ID_TO_NAME[284] = L"minecraft:golden_shovel"; + ID_TO_NAME[285] = L"minecraft:golden_pickaxe"; + ID_TO_NAME[286] = L"minecraft:golden_axe"; + ID_TO_NAME[287] = L"minecraft:string"; + ID_TO_NAME[288] = L"minecraft:feather"; + ID_TO_NAME[289] = L"minecraft:gunpowder"; + ID_TO_NAME[290] = L"minecraft:wooden_hoe"; + ID_TO_NAME[291] = L"minecraft:stone_hoe"; + ID_TO_NAME[292] = L"minecraft:iron_hoe"; + ID_TO_NAME[293] = L"minecraft:diamond_hoe"; + ID_TO_NAME[294] = L"minecraft:golden_hoe"; + ID_TO_NAME[295] = L"minecraft:wheat_seeds"; + ID_TO_NAME[296] = L"minecraft:wheat"; + ID_TO_NAME[297] = L"minecraft:bread"; + ID_TO_NAME[298] = L"minecraft:leather_helmet"; + ID_TO_NAME[299] = L"minecraft:leather_chestplate"; + ID_TO_NAME[300] = L"minecraft:leather_leggings"; + ID_TO_NAME[301] = L"minecraft:leather_boots"; + ID_TO_NAME[302] = L"minecraft:chainmail_helmet"; + ID_TO_NAME[303] = L"minecraft:chainmail_chestplate"; + ID_TO_NAME[304] = L"minecraft:chainmail_leggings"; + ID_TO_NAME[305] = L"minecraft:chainmail_boots"; + ID_TO_NAME[306] = L"minecraft:iron_helmet"; + ID_TO_NAME[307] = L"minecraft:iron_chestplate"; + ID_TO_NAME[308] = L"minecraft:iron_leggings"; + ID_TO_NAME[309] = L"minecraft:iron_boots"; + ID_TO_NAME[310] = L"minecraft:diamond_helmet"; + ID_TO_NAME[311] = L"minecraft:diamond_chestplate"; + ID_TO_NAME[312] = L"minecraft:diamond_leggings"; + ID_TO_NAME[313] = L"minecraft:diamond_boots"; + ID_TO_NAME[314] = L"minecraft:golden_helmet"; + ID_TO_NAME[315] = L"minecraft:golden_chestplate"; + ID_TO_NAME[316] = L"minecraft:golden_leggings"; + ID_TO_NAME[317] = L"minecraft:golden_boots"; + ID_TO_NAME[318] = L"minecraft:flint"; + ID_TO_NAME[319] = L"minecraft:porkchop"; + ID_TO_NAME[320] = L"minecraft:cooked_porkchop"; + ID_TO_NAME[321] = L"minecraft:painting"; + ID_TO_NAME[322] = L"minecraft:golden_apple"; + ID_TO_NAME[323] = L"minecraft:sign"; + ID_TO_NAME[324] = L"minecraft:wooden_door"; + ID_TO_NAME[325] = L"minecraft:bucket"; + ID_TO_NAME[326] = L"minecraft:water_bucket"; + ID_TO_NAME[327] = L"minecraft:lava_bucket"; + ID_TO_NAME[328] = L"minecraft:minecart"; + ID_TO_NAME[329] = L"minecraft:saddle"; + ID_TO_NAME[330] = L"minecraft:iron_door"; + ID_TO_NAME[331] = L"minecraft:redstone"; + ID_TO_NAME[332] = L"minecraft:snowball"; + ID_TO_NAME[333] = L"minecraft:boat"; + ID_TO_NAME[334] = L"minecraft:leather"; + ID_TO_NAME[335] = L"minecraft:milk_bucket"; + ID_TO_NAME[336] = L"minecraft:brick"; + ID_TO_NAME[337] = L"minecraft:clay_ball"; + ID_TO_NAME[338] = L"minecraft:reeds"; + ID_TO_NAME[339] = L"minecraft:paper"; + ID_TO_NAME[340] = L"minecraft:book"; + ID_TO_NAME[341] = L"minecraft:slime_ball"; + ID_TO_NAME[342] = L"minecraft:chest_minecart"; + ID_TO_NAME[343] = L"minecraft:furnace_minecart"; + ID_TO_NAME[344] = L"minecraft:egg"; + ID_TO_NAME[345] = L"minecraft:compass"; + ID_TO_NAME[346] = L"minecraft:fishing_rod"; + ID_TO_NAME[347] = L"minecraft:clock"; + ID_TO_NAME[348] = L"minecraft:glowstone_dust"; + ID_TO_NAME[349] = L"minecraft:fish"; + ID_TO_NAME[350] = L"minecraft:cooked_fished"; + ID_TO_NAME[351] = L"minecraft:dye"; + ID_TO_NAME[352] = L"minecraft:bone"; + ID_TO_NAME[353] = L"minecraft:sugar"; + ID_TO_NAME[354] = L"minecraft:cake"; + ID_TO_NAME[355] = L"minecraft:bed"; + ID_TO_NAME[356] = L"minecraft:repeater"; + ID_TO_NAME[357] = L"minecraft:cookie"; + ID_TO_NAME[358] = L"minecraft:filled_map"; + ID_TO_NAME[359] = L"minecraft:shears"; + ID_TO_NAME[360] = L"minecraft:melon"; + ID_TO_NAME[361] = L"minecraft:pumpkin_seeds"; + ID_TO_NAME[362] = L"minecraft:melon_seeds"; + ID_TO_NAME[363] = L"minecraft:beef"; + ID_TO_NAME[364] = L"minecraft:cooked_beef"; + ID_TO_NAME[365] = L"minecraft:chicken"; + ID_TO_NAME[366] = L"minecraft:cooked_chicken"; + ID_TO_NAME[367] = L"minecraft:rotten_flesh"; + ID_TO_NAME[368] = L"minecraft:ender_pearl"; + ID_TO_NAME[369] = L"minecraft:blaze_rod"; + ID_TO_NAME[370] = L"minecraft:ghast_tear"; + ID_TO_NAME[371] = L"minecraft:gold_nugget"; + ID_TO_NAME[372] = L"minecraft:nether_wart"; + ID_TO_NAME[373] = L"minecraft:potion"; + ID_TO_NAME[374] = L"minecraft:glass_bottle"; + ID_TO_NAME[375] = L"minecraft:spider_eye"; + ID_TO_NAME[376] = L"minecraft:fermented_spider_eye"; + ID_TO_NAME[377] = L"minecraft:blaze_powder"; + ID_TO_NAME[378] = L"minecraft:magma_cream"; + ID_TO_NAME[379] = L"minecraft:brewing_stand"; + ID_TO_NAME[380] = L"minecraft:cauldron"; + ID_TO_NAME[381] = L"minecraft:ender_eye"; + ID_TO_NAME[382] = L"minecraft:speckled_melon"; + ID_TO_NAME[383] = L"minecraft:spawn_egg"; + ID_TO_NAME[384] = L"minecraft:experience_bottle"; + ID_TO_NAME[385] = L"minecraft:fire_charge"; + ID_TO_NAME[386] = L"minecraft:writable_book"; + ID_TO_NAME[387] = L"minecraft:written_book"; + ID_TO_NAME[388] = L"minecraft:emerald"; + ID_TO_NAME[389] = L"minecraft:item_frame"; + ID_TO_NAME[390] = L"minecraft:flower_pot"; + ID_TO_NAME[391] = L"minecraft:carrot"; + ID_TO_NAME[392] = L"minecraft:potato"; + ID_TO_NAME[393] = L"minecraft:baked_potato"; + ID_TO_NAME[394] = L"minecraft:poisonous_potato"; + ID_TO_NAME[395] = L"minecraft:map"; + ID_TO_NAME[396] = L"minecraft:golden_carrot"; + ID_TO_NAME[397] = L"minecraft:skull"; + ID_TO_NAME[398] = L"minecraft:carrot_on_a_stick"; + ID_TO_NAME[399] = L"minecraft:nether_star"; + ID_TO_NAME[400] = L"minecraft:pumpkin_pie"; + ID_TO_NAME[401] = L"minecraft:fireworks"; + ID_TO_NAME[402] = L"minecraft:firework_charge"; + ID_TO_NAME[403] = L"minecraft:enchanted_book"; + ID_TO_NAME[404] = L"minecraft:comparator"; + ID_TO_NAME[405] = L"minecraft:netherbrick"; + ID_TO_NAME[406] = L"minecraft:quartz"; + ID_TO_NAME[407] = L"minecraft:tnt_minecart"; + ID_TO_NAME[408] = L"minecraft:hopper_minecart"; + ID_TO_NAME[417] = L"minecraft:iron_horse_armor"; + ID_TO_NAME[418] = L"minecraft:golden_horse_armor"; + ID_TO_NAME[419] = L"minecraft:diamond_horse_armor"; + ID_TO_NAME[420] = L"minecraft:lead"; + ID_TO_NAME[421] = L"minecraft:name_tag"; + ID_TO_NAME[422] = L"minecraft:command_block_minecart"; + ID_TO_NAME[2256] = L"minecraft:record_13"; + ID_TO_NAME[2257] = L"minecraft:record_cat"; + ID_TO_NAME[2258] = L"minecraft:record_blocks"; + ID_TO_NAME[2259] = L"minecraft:record_chirp"; + ID_TO_NAME[2260] = L"minecraft:record_far"; + ID_TO_NAME[2261] = L"minecraft:record_mall"; + ID_TO_NAME[2262] = L"minecraft:record_mellohi"; + ID_TO_NAME[2263] = L"minecraft:record_stal"; + ID_TO_NAME[2264] = L"minecraft:record_strad"; + ID_TO_NAME[2265] = L"minecraft:record_ward"; + ID_TO_NAME[2266] = L"minecraft:record_11"; + ID_TO_NAME[2267] = L"minecraft:record_wait"; +} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemIdFix.h b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemIdFix.h index 34a56660..811d5a26 100644 --- a/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemIdFix.h +++ b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemIdFix.h @@ -1,7 +1,10 @@ #pragma once -// STUB +#include +#include + class ItemIdFix { public: static void staticCtor(); + static std::unordered_map ID_TO_NAME; }; diff --git a/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTagFixes.cpp b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTagFixes.cpp new file mode 100644 index 00000000..b1515b39 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTagFixes.cpp @@ -0,0 +1,32 @@ +#include "com/mojang/nbt/CompoundTag.h" +#include "net/minecraft/util/datafix/fixes/ItemTotemRenameFix.h" +#include "net/minecraft/util/datafix/fixes/ItemWaterPotionFix.h" + +ItemTotemRenameFix::ItemTotemRenameFix() {} +ItemWaterPotionFix::ItemWaterPotionFix() {} + +int ItemTotemRenameFix::getVersion() { + return 820; +} +int ItemWaterPotionFix::getVersion() { + return 806; +} + +CompoundTag* ItemTotemRenameFix::fix(CompoundTag* tag) { + if (tag->getString(L"id") == L"minecraft:totem") + tag->putString(L"id", L"minecraft:totem_of_undying"); + return tag; +} + +CompoundTag* ItemWaterPotionFix::fix(CompoundTag* tag) { + const std::wstring id = tag->getString(L"id"); + if (id == L"minecraft:potion" || id == L"minecraft:splash_potion" || id == L"minecraft:lingering_potion" + || id == L"minecraft:tipped_arrow") { + CompoundTag* itemTag = tag->getCompound(L"tag"); + if (!itemTag->contains(L"Potion", Tag::TAG_String)) + itemTag->putString(L"Potion", L"minecraft:water"); + if (!tag->contains(L"tag", Tag::TAG_Compound)) + tag->put(L"tag", itemTag); + } + return tag; +} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTotemRenameFix.h b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTotemRenameFix.h new file mode 100644 index 00000000..7fb6a078 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTotemRenameFix.h @@ -0,0 +1,10 @@ +#pragma once + +#include "net/minecraft/util/datafix/DataFix.h" + +class ItemTotemRenameFix : public DataFix { +public: + ItemTotemRenameFix(); + int getVersion() override; + CompoundTag* fix(CompoundTag*) override; +}; diff --git a/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemWaterPotionFix.h b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemWaterPotionFix.h new file mode 100644 index 00000000..3f6f22cf --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemWaterPotionFix.h @@ -0,0 +1,10 @@ +#pragma once + +#include "net/minecraft/util/datafix/DataFix.h" + +class ItemWaterPotionFix : public DataFix { +public: + ItemWaterPotionFix(); + int getVersion() override; + CompoundTag* fix(CompoundTag*) override; +}; diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/DataFixerItemTraversal.cpp b/src/Minecraft.World/net/minecraft/util/datafix/walker/DataFixerItemTraversal.cpp new file mode 100644 index 00000000..1e283db3 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/DataFixerItemTraversal.cpp @@ -0,0 +1,23 @@ +#include "com/mojang/nbt/CompoundTag.h" +#include "com/mojang/nbt/ListTag.h" +#include "net/minecraft/util/datafix/DataFixer.h" +#include "net/minecraft/util/datafix/DataFixers.h" + +CompoundTag* DataFixers::updateItem(DataFixer* fixer, CompoundTag* tag, int version, + const std::wstring& key) { + if (tag->contains(key, Tag::TAG_Compound)) { + tag->put(key, fixer->update(DataFixTypes::ITEM, tag->getCompound(key), version)); + } + return tag; +} + +CompoundTag* DataFixers::updateItems(DataFixer* fixer, CompoundTag* tag, int version, + const std::wstring& key) { + if (tag->contains(key, Tag::TAG_List)) { + ListTag* list = tag->getList(key, Tag::TAG_Compound); + for (int index = 0; index < static_cast(list->size()); ++index) { + list->set(index, fixer->update(DataFixTypes::ITEM, list->getCompound(index), version)); + } + } + return tag; +} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/DataWalker.h b/src/Minecraft.World/net/minecraft/util/datafix/walker/DataWalker.h index 582f8b6d..a4a98524 100644 --- a/src/Minecraft.World/net/minecraft/util/datafix/walker/DataWalker.h +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/DataWalker.h @@ -1,4 +1,11 @@ #pragma once -// STUB -class DataWalker {}; +class DataFixer; +class CompoundTag; + +class DataWalker { +public: + DataWalker(); + virtual ~DataWalker(); + virtual CompoundTag* walk(DataFixer*, CompoundTag*, int version) = 0; +}; diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/DataWalkerLifecycle.cpp b/src/Minecraft.World/net/minecraft/util/datafix/walker/DataWalkerLifecycle.cpp new file mode 100644 index 00000000..5f27c308 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/DataWalkerLifecycle.cpp @@ -0,0 +1,4 @@ +#include "net/minecraft/util/datafix/walker/DataWalker.h" + +DataWalker::DataWalker() {} +DataWalker::~DataWalker() {} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalker.h b/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalker.h new file mode 100644 index 00000000..f3f4a2da --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalker.h @@ -0,0 +1,16 @@ +#pragma once + +#include "net/minecraft/util/datafix/walker/KeyedDataWalker.h" +#include + +class ItemDataWalker : public KeyedDataWalker { +public: + // Registry key selection in this constructor is not yet reconstructed. + ItemDataWalker(eINSTANCEOF, const std::wstring&); + ~ItemDataWalker() override; + CompoundTag* doWalk(DataFixer*, CompoundTag*, int version) override; + + std::vector m_keys; +}; + +static_assert(sizeof(ItemDataWalker) == 0x70, "Original item walker allocation"); diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalkers.cpp b/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalkers.cpp new file mode 100644 index 00000000..0028d6e9 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalkers.cpp @@ -0,0 +1,18 @@ +#include "net/minecraft/util/datafix/DataFixers.h" +#include "net/minecraft/util/datafix/walker/ItemDataWalker.h" +#include "net/minecraft/util/datafix/walker/ItemListDataWalker.h" + +ItemDataWalker::~ItemDataWalker() {} +ItemListDataWalker::~ItemListDataWalker() {} + +CompoundTag* ItemDataWalker::doWalk(DataFixer* fixer, CompoundTag* tag, int version) { + for (auto it = m_keys.begin(); it != m_keys.end(); ++it) + tag = DataFixers::updateItem(fixer, tag, version, *it); + return tag; +} + +CompoundTag* ItemListDataWalker::doWalk(DataFixer* fixer, CompoundTag* tag, int version) { + for (auto it = m_keys.begin(); it != m_keys.end(); ++it) + tag = DataFixers::updateItems(fixer, tag, version, *it); + return tag; +} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemListDataWalker.h b/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemListDataWalker.h new file mode 100644 index 00000000..648575ef --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemListDataWalker.h @@ -0,0 +1,17 @@ +#pragma once + +#include "net/minecraft/util/datafix/walker/KeyedDataWalker.h" +#include + +class ItemListDataWalker : public KeyedDataWalker { +public: + // Registry key selection in these constructors is not yet reconstructed. + ItemListDataWalker(eINSTANCEOF, const std::wstring&); + ItemListDataWalker(eINSTANCEOF, const std::vector&); + ~ItemListDataWalker() override; + CompoundTag* doWalk(DataFixer*, CompoundTag*, int version) override; + + std::vector m_keys; +}; + +static_assert(sizeof(ItemListDataWalker) == 0x70, "Original list walker allocation"); diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.cpp b/src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.cpp new file mode 100644 index 00000000..37dee375 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.cpp @@ -0,0 +1,11 @@ +#include "net/minecraft/util/datafix/walker/KeyedDataWalker.h" + +#include "com/mojang/nbt/CompoundTag.h" + +KeyedDataWalker::~KeyedDataWalker() {} + +CompoundTag* KeyedDataWalker::walk(DataFixer* fixer, CompoundTag* tag, int version) { + if (ResourceLocation(tag->getString(L"id")) == &m_key) + return doWalk(fixer, tag, version); + return tag; +} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.h b/src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.h new file mode 100644 index 00000000..98df5886 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.h @@ -0,0 +1,17 @@ +#pragma once + +#include "net/minecraft/resources/ResourceLocation.h" +#include "net/minecraft/util/datafix/walker/DataWalker.h" + +class KeyedDataWalker : public DataWalker { +public: + // Entity/block-entity registry key selection is not reconstructed here. + explicit KeyedDataWalker(eINSTANCEOF); + ~KeyedDataWalker() override; + CompoundTag* walk(DataFixer*, CompoundTag*, int version) override; + virtual CompoundTag* doWalk(DataFixer*, CompoundTag*, int version) = 0; + + ResourceLocation m_key; +}; + +static_assert(sizeof(KeyedDataWalker) == 0x58, "Original keyed walker allocation"); diff --git a/src/Minecraft.World/net/minecraft/world/ArrayWithLength.h b/src/Minecraft.World/net/minecraft/world/ArrayWithLength.h index 7bb6b677..aeb474c0 100644 --- a/src/Minecraft.World/net/minecraft/world/ArrayWithLength.h +++ b/src/Minecraft.World/net/minecraft/world/ArrayWithLength.h @@ -18,6 +18,11 @@ class arrayWithLength { this->m_data = initialData; this->m_length = length; } + template + arrayWithLength(T (&initialData)[N]) { + this->m_data = initialData; + this->m_length = N; + } arrayWithLength(unsigned int size, bool a3) { T* temp; if (a3) @@ -29,6 +34,7 @@ class arrayWithLength { } T& operator[](unsigned int i) { return m_data[i]; } + const T& operator[](unsigned int i) const { return m_data[i]; } T& get(unsigned int i) { return m_data[i]; } void resize(unsigned int newSize) { diff --git a/src/Minecraft.World/net/minecraft/world/Difficulty.h b/src/Minecraft.World/net/minecraft/world/Difficulty.h index 8d04280e..54cd9bd0 100644 --- a/src/Minecraft.World/net/minecraft/world/Difficulty.h +++ b/src/Minecraft.World/net/minecraft/world/Difficulty.h @@ -6,7 +6,13 @@ class Difficulty { static const Difficulty* EASY; static const Difficulty* NORMAL; static const Difficulty* HARD; + static Difficulty* DIFFICULTIES[4]; static Difficulty* byId(int id); int getId() const; + +private: + int m_id; }; + +static_assert(sizeof(Difficulty) == 4, "Difficulty ID layout"); diff --git a/src/Minecraft.World/net/minecraft/world/PlayerUID.h b/src/Minecraft.World/net/minecraft/world/PlayerUID.h index ed3d46dd..374ff3c1 100644 --- a/src/Minecraft.World/net/minecraft/world/PlayerUID.h +++ b/src/Minecraft.World/net/minecraft/world/PlayerUID.h @@ -1,7 +1,9 @@ #pragma once +#include "java/io/JavaLong.h" #include "types.h" #include +#include class PlayerUID { public: @@ -16,8 +18,8 @@ class PlayerUID { const std::wstring UuidString() const; const std::wstring toString() const; - long m_gap0; - long m_mostSigBits; // grabbed from JDK, doubt those are correct but yeah, pure guess - long m_leastSigBits; + JavaLong m_gap0; + JavaLong m_mostSigBits; // grabbed from JDK, doubt those are correct but yeah, pure guess + JavaLong m_leastSigBits; char m_byte18; }; diff --git a/src/Minecraft.World/net/minecraft/world/Random.h b/src/Minecraft.World/net/minecraft/world/Random.h index 3ed8670d..61c70544 100644 --- a/src/Minecraft.World/net/minecraft/world/Random.h +++ b/src/Minecraft.World/net/minecraft/world/Random.h @@ -1,5 +1,7 @@ #pragma once +using RandomLong = long; + class Random { public: Random(); @@ -10,12 +12,12 @@ class Random { double nextDouble(); int nextInt(); void setSeed(long long seed); - long nextLong(); + RandomLong nextLong(); bool nextBoolean(); int next(int bits); double nextGaussian(); - long m_val; + RandomLong m_val; bool m_field8; double m_seed3; }; diff --git a/src/Minecraft.World/net/minecraft/world/entity/Entity.h b/src/Minecraft.World/net/minecraft/world/entity/Entity.h index ea148673..ca4b710f 100644 --- a/src/Minecraft.World/net/minecraft/world/entity/Entity.h +++ b/src/Minecraft.World/net/minecraft/world/entity/Entity.h @@ -59,6 +59,7 @@ class Entity : public std::enable_shared_from_this, public CommandSender static int sEntityAmount; static int sTlsIndex; static double sViewScale; + static const float sDegreesToRadians; static void staticCtor(); static int getSmallId(); @@ -294,6 +295,9 @@ class Entity : public std::enable_shared_from_this, public CommandSender Vec3* getPos(float); bool isType(eINSTANCEOF); + void setRot(float, float); + void interpolateTurn(float, float); + bool getSharedFlag(int); void setSharedFlag(int, bool); Vec3* calculateViewVector(float, float); int getId(); diff --git a/src/Minecraft.World/net/minecraft/world/entity/LivingEntity.h b/src/Minecraft.World/net/minecraft/world/entity/LivingEntity.h index 8d0cc489..a81721be 100644 --- a/src/Minecraft.World/net/minecraft/world/entity/LivingEntity.h +++ b/src/Minecraft.World/net/minecraft/world/entity/LivingEntity.h @@ -93,7 +93,7 @@ class LivingEntity : public Entity { virtual void onEffectUpdated(MobEffectInstance*, bool); virtual void onEffectRemoved(MobEffectInstance*); virtual void heal(float); - virtual void getHealth(); + virtual float getHealth(); virtual void setHealth(float); virtual void getLastDamageSource(); virtual void blockUsingShield(const std::shared_ptr&); @@ -119,7 +119,7 @@ class LivingEntity : public Entity { virtual void actuallyHurt(DamageSource, float); virtual void getCombatTracker(); virtual void getKillCredit(); - virtual void getMaxHealth(); + virtual float getMaxHealth(); virtual void getArrowCount(); virtual void setArrowCount(int); virtual void swing(InteractionHand::EInteractionHand); diff --git a/src/Minecraft.World/net/minecraft/world/entity/ai/attributes/AttributeModifier.h b/src/Minecraft.World/net/minecraft/world/entity/ai/attributes/AttributeModifier.h index ce282531..d89dcb53 100644 --- a/src/Minecraft.World/net/minecraft/world/entity/ai/attributes/AttributeModifier.h +++ b/src/Minecraft.World/net/minecraft/world/entity/ai/attributes/AttributeModifier.h @@ -7,6 +7,15 @@ enum eATTRIBUTE_ID { BASE_ATTACK_DAMAGE = 1, BASE_ATTACK_SPEED = 16 }; class AttributeModifier { public: AttributeModifier(eATTRIBUTE_ID, double, int); + AttributeModifier(double, int); + AttributeModifier(eATTRIBUTE_ID, double, int, bool); + void _init(int, std::wstring, double, int); + eATTRIBUTE_ID getId(); + double getAmount(); + int getOperation(); + bool isSerializable(); + void setSerialize(bool); + bool equals(AttributeModifier*); double m_amount; int m_operation; diff --git a/src/Minecraft.World/net/minecraft/world/entity/player/Player.h b/src/Minecraft.World/net/minecraft/world/entity/player/Player.h index 658b7322..513afb99 100644 --- a/src/Minecraft.World/net/minecraft/world/entity/player/Player.h +++ b/src/Minecraft.World/net/minecraft/world/entity/player/Player.h @@ -193,6 +193,13 @@ class Player : public LivingEntity { void setBool7FC(bool); bool isAllowedToAttackPlayers(); bool hasInvisiblePrivilege(); + bool isAllowedToFly(); + bool hasInvulnerablePrivilege(); + // Inferred names for the unnamed entries at 0x71002d0d68 and 0x71002d0e10. + bool usesLegacyFoodHealing(); + bool isHurt(); + void causeFoodExhaustion(float); + FoodData* getFoodData(); int getPlayerGamePrivilege(EPlayerGamePrivileges); bool CheckPowerup(PowerupItems::eGlide_Timed_Powerup_ID); std::shared_ptr drop(not_null_ptr, bool); diff --git a/src/Minecraft.World/net/minecraft/world/item/BlockItem.h b/src/Minecraft.World/net/minecraft/world/item/BlockItem.h index 4421e48b..71339cfa 100644 --- a/src/Minecraft.World/net/minecraft/world/item/BlockItem.h +++ b/src/Minecraft.World/net/minecraft/world/item/BlockItem.h @@ -5,8 +5,15 @@ class BlockItem : public Item { public: BlockItem(Block* block); + ~BlockItem() override; Block* getBlock(); + BlockItem* setDescriptionId(unsigned int); + unsigned int getDescriptionId(int) override; + unsigned int getDescriptionId(not_null_ptr) override; + unsigned int getUseDescriptionId() override; + unsigned int getUseDescriptionId(not_null_ptr) override; - void* m_filler[2]; + Block* m_block; + void* m_unknown88; }; diff --git a/src/Minecraft.World/net/minecraft/world/item/Item.cpp b/src/Minecraft.World/net/minecraft/world/item/Item.cpp index a95d6aa6..4661b26f 100644 --- a/src/Minecraft.World/net/minecraft/world/item/Item.cpp +++ b/src/Minecraft.World/net/minecraft/world/item/Item.cpp @@ -59,8 +59,9 @@ bool Item::canBeDepleted() { return this->m_maxDamage > 0 && (!this->m_stackedByData || this->m_maxStackSize == 1); } -void Item::setIconName(const std::wstring& iconName) { +Item* Item::setIconName(const std::wstring& iconName) { this->m_iconName = iconName; + return this; } not_null_ptr Item::getDefaultInstance() { @@ -102,6 +103,14 @@ int Item::getMaxStackSize() { return this->m_maxStackSize; } +int Item::getMaxDamage() { + return m_maxDamage; +} + +bool Item::isStackedByData() { + return m_stackedByData; +} + int Item::getLevelDataForAuxValue(int) { return 0; } diff --git a/src/Minecraft.World/net/minecraft/world/item/Item.h b/src/Minecraft.World/net/minecraft/world/item/Item.h index 99756a27..9282a70b 100644 --- a/src/Minecraft.World/net/minecraft/world/item/Item.h +++ b/src/Minecraft.World/net/minecraft/world/item/Item.h @@ -73,7 +73,7 @@ class Item { unsigned int getId(); bool canBeDepleted(); std::wstring getIconName(); - void setIconName(const std::wstring&); + Item* setIconName(const std::wstring&); void setMaxDamage(int); int getMaxDamage(); void setStackedByData(bool); @@ -152,6 +152,17 @@ class Item { virtual int GetOverrideCountColour(); virtual TextureAtlasSprite* GetOverrideCountIcon(not_null_ptr itemInstance); + static unsigned int StoneBlockNameResolver(not_null_ptr); + static unsigned int StoneBlockDescResolver(not_null_ptr); + Item* setBaseItemTypeAndMaterial(int, int); + Item* setDescriptionId(int); + Item* setDescriptionId(int, int); + Item* setUseDescriptionId(int); + Item* setCraftingRemainingItem(Item*); + Item* setMaxStackSize(int); + Item* setHandEquipped(); + Item* setFlag78(bool); + static void staticCtor(); static void staticInit(); diff --git a/src/Minecraft.World/net/minecraft/world/item/ItemInstance.h b/src/Minecraft.World/net/minecraft/world/item/ItemInstance.h index 8cfecdab..51bd6942 100644 --- a/src/Minecraft.World/net/minecraft/world/item/ItemInstance.h +++ b/src/Minecraft.World/net/minecraft/world/item/ItemInstance.h @@ -5,6 +5,7 @@ #include #include +#include class Block; class BlockState; @@ -23,7 +24,7 @@ class Random; class Tag; class CensoredString; -class ItemInstance { +class ItemInstance : public std::enable_shared_from_this { public: static not_null_ptr EMPTY; @@ -53,7 +54,7 @@ class ItemInstance { void use(Level*, std::shared_ptr, InteractionHand::EInteractionHand); void finishUsingItem(Level*, std::shared_ptr); CompoundTag* save(CompoundTag*); - void getMaxStackSize(); + int getMaxStackSize(); bool hasTag(); CompoundTag* getTag(); bool isDamageableItem(); @@ -130,8 +131,6 @@ class ItemInstance { bool operator=(const ItemInstance&); private: - void* m_qword0 = nullptr; - void* m_qword8 = nullptr; int m_count; int m_dword14; Item* m_item; @@ -139,11 +138,12 @@ class ItemInstance { bool m_isEmpty; int m_damage; bool m_byte30; - void* m_qword38 = nullptr; - void* m_qword40 = nullptr; - std::shared_ptr m_censoredString; + std::weak_ptr m_frame; + std::shared_ptr m_censoredString; void* m_qword58; bool m_byte60; void* m_qword68; void* m_qword70; }; + +ASSERT_SIZEOF(ItemInstance, 0x78) diff --git a/src/Minecraft.World/net/minecraft/world/item/Items.h b/src/Minecraft.World/net/minecraft/world/item/Items.h index c41514d8..a799a198 100644 --- a/src/Minecraft.World/net/minecraft/world/item/Items.h +++ b/src/Minecraft.World/net/minecraft/world/item/Items.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "net/minecraft/client/resources/MappedRegistry.h" #include diff --git a/src/Minecraft.World/net/minecraft/world/item/LeadItem.h b/src/Minecraft.World/net/minecraft/world/item/LeadItem.h index e29b734f..c670b19d 100644 --- a/src/Minecraft.World/net/minecraft/world/item/LeadItem.h +++ b/src/Minecraft.World/net/minecraft/world/item/LeadItem.h @@ -4,5 +4,7 @@ class LeadItem : public Item { public: + LeadItem(); + ~LeadItem() override; static bool bindPlayerMobsTest(std::shared_ptr player, Level* level, const BlockPos& pos); }; diff --git a/src/Minecraft.World/net/minecraft/world/level/Level.h b/src/Minecraft.World/net/minecraft/world/level/Level.h index 05a2cd92..0f7240e2 100644 --- a/src/Minecraft.World/net/minecraft/world/level/Level.h +++ b/src/Minecraft.World/net/minecraft/world/level/Level.h @@ -149,6 +149,7 @@ class Level : public LevelSource { ChunkSource* getChunkSource(); long long getSeed(); int getSeaLevel(); + bool setBlockAndData(int x, int y, int z, int id, int data, int flags); void setSeaLevel(int); static void enableLightingCache(); void setSpawnPos(const BlockPos&); @@ -173,6 +174,7 @@ class Level : public LevelSource { int getRawBrightness(const BlockPos&, bool); int getHeightmapHeight(int, int); int getHeightmap(int, int); + bool isSolidBlockingBlockInLoadedChunk(const BlockPos&, bool defaultValue); bool isWithinLevelBounds(int, int); int getBrightnessPropagate(LightLayer::variety, const BlockPos&); long getGameTime(); @@ -200,9 +202,13 @@ class Level : public LevelSource { bool hasChunksAt(const BlockPos&, const BlockPos&); int getAuxValueForMap(PlayerUID, int, int, int, int); std::shared_ptr getSavedData(const std::type_info&, const std::wstring&); + LevelStorage* getLevelStorage(); void setSavedData(const std::wstring&, std::shared_ptr); std::vector>* getEntitiesOfClass(const std::type_info&, AABB const*); bool shouldFreezeIgnoreNeighbors(const BlockPos&); + bool shouldFreeze(const BlockPos&, bool checkNeighbors); + bool shouldFreezeWithNeighbors(const BlockPos&); + bool isWaterAt(const BlockPos&); bool shouldSnow(const BlockPos&, bool); bool isFindingSpawn(); unsigned int countInstanceOf(eINSTANCEOF, bool, unsigned int*, unsigned int*); diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/BeachBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/BeachBiome.h index 55836188..f0cba0b0 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/BeachBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/BeachBiome.h @@ -5,6 +5,7 @@ class BeachBiome : public Biome { public: BeachBiome(EBiomeIDs id, BiomeProperties* properties); + ~BeachBiome() override = default; int getBaseClass() override; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/Biome.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/Biome.cpp index aa2e74fc..ff573330 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/Biome.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/biome/Biome.cpp @@ -145,10 +145,10 @@ Biome* Biome::getBiome(int id, Biome* biome) { return biome; } -Block* Biome::getRandomFlower(Random& random, const BlockPos* pos) { +FlowerBlock::Flower* Biome::getRandomFlower(Random& random, const BlockPos* pos) { if (random.nextInt(3) > 0) - return (Block*)FlowerBlock::Flower::YELLOW_FLOWER; - return (Block*)FlowerBlock::Flower::RED_FLOWER; + return FlowerBlock::Flower::YELLOW_FLOWER; + return FlowerBlock::Flower::RED_FLOWER; } unsigned int Biome::getSkyColor(float timeOfDay) { diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/Biome.h b/src/Minecraft.World/net/minecraft/world/level/biome/Biome.h index c6bafb07..8ae6617b 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/Biome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/Biome.h @@ -4,6 +4,7 @@ #include #include "net/minecraft/world/WeighedRandomItem.h" +#include "net/minecraft/world/level/block/FlowerBlock.h" #include "net/minecraft/world/level/material/MaterialColor.h" #include "net/minecraft/world/phys/Vec3.h" @@ -16,9 +17,11 @@ class MobCategory; class BiomeDecorator; class Feature; class PerlinSimplexNoise; +class DoublePlantFeature; class Biome { public: + static int getId(Biome*); static Biome* BIOMES[256]; static Biome* OCEAN; @@ -86,6 +89,8 @@ class Biome { static Biome* DEFAULT; // anything that gets a biome will fall back to this once nullptr is hit static PerlinSimplexNoise* TEMPERATURE_NOISE; + static PerlinSimplexNoise* BIOME_INFO_NOISE; + static DoublePlantFeature* DOUBLE_PLANT_FEATURE; enum EBiomeIDs : int { BiomeID_OCEAN = 0, @@ -198,6 +203,9 @@ class Biome { }; class MobSpawnerData : public WeighedRandomItem { + friend class DesertBiome; + friend class IceBiome; + public: MobSpawnerData(int instanceType, int weight, int unk, int unk2) : WeighedRandomItem(weight) { m_instanceType = instanceType; @@ -217,6 +225,15 @@ class Biome { int m_data = 0; }; + static LegacyBlockData STONE; + static LegacyBlockData AIR; + static LegacyBlockData BEDROCK; + static LegacyBlockData GRAVEL; + static LegacyBlockData RED_SANDSTONE; + static LegacyBlockData SANDSTONE; + static LegacyBlockData ICE; + static LegacyBlockData WATER; + Biome(Biome::EBiomeIDs, Biome::BiomeProperties*); static Biome** getBiomes(); static Biome* getBiome(int); @@ -227,8 +244,8 @@ class Biome { virtual ~Biome(); virtual Feature* getTreeFeature(Random&); - virtual void getGrassFeature(Random&); - virtual Block* getRandomFlower(Random&, const BlockPos*); + virtual Feature* getGrassFeature(Random&); + virtual FlowerBlock::Flower* getRandomFlower(Random&, const BlockPos*); virtual unsigned int getSkyColor(float); virtual bool hasSnow(); virtual bool hasRain(); @@ -254,9 +271,10 @@ class Biome { Biome* setNameAndDescription(int name, int desc); Biome* setPreviewColor(eMinecraftColour color); + eMinecraftColour getPreviewColor(); Biome* setWaterSkyColor(eMinecraftColour water, eMinecraftColour sky); - std::vector* getMobs(MobCategory*); + std::vector* getMobs(MobCategory*); std::wstring getName(bool); std::wstring getDescription(); diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/BiomeDecorator.h b/src/Minecraft.World/net/minecraft/world/level/biome/BiomeDecorator.h index 07e18dbf..e49289bd 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/BiomeDecorator.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/BiomeDecorator.h @@ -1,11 +1,13 @@ #pragma once +#include "net/minecraft/core/BlockPos.h" + class Level; class Random; class Biome; -class BlockPos; class Feature; -class ClayFeature; +class FlowerFeature; +class CustomizableSourceSettings; class BiomeDecorator { public: @@ -15,40 +17,47 @@ class BiomeDecorator { virtual void decorate(Biome*, Level*, Random&); virtual void decorateOres(Level*, Random&); -private: - char byte_8; - void* qword_c; - void* qword_18; - ClayFeature* field_20; - void* qword_28; - void* qword_30; - void* qword_38; - void* qword_40; - void* qword_48; - void* qword_50; - void* qword_58; - void* qword_60; - void* qword_68; - void* qword_70; - void* qword_78; - void* qword_80; - void* qword_88; - Feature* field_90; - void* field_98; - void* field_a0; - void* field_a8; - void* field_b0; - void* field_b8; - void* qword_c0; - void* qword_c8; - int dword_d0; - int dword_d4; - void* qword_d8; - void* qword_e0; - int dword_e8; - int dword_ec; - int dword_f0; - int dword_f4; - int dword_f8; - char byte_fc; + void decorateDepthSpan(Level*, Random&, int count, Feature*, int minHeight, int maxHeight); + void decorateDepthAverage(Level*, Random&, int count, Feature*, int centerHeight, int spread); + + bool m_decorating; + BlockPos m_origin; + CustomizableSourceSettings* m_settings; + Feature* m_clay; + Feature* m_sand; + Feature* m_gravelPatch; + Feature* m_dirt; + Feature* m_gravel; + Feature* m_granite; + Feature* m_diorite; + Feature* m_andesite; + Feature* m_coal; + Feature* m_iron; + Feature* m_gold; + Feature* m_redstone; + Feature* m_diamond; + Feature* m_lapis; + FlowerFeature* m_flowers; + Feature* m_brownMushrooms; + Feature* m_redMushrooms; + Feature* m_hugeMushrooms; + Feature* m_reeds; + Feature* m_cactus; + Feature* m_waterlilies; + int m_waterlilyCount; + int m_treeCount; + float m_extraTreeChance; + int m_flowerCount; + int m_grassCount; + int m_deadBushCount; + int m_mushroomCount; + int m_reedCount; + int m_cactusCount; + int m_gravelPatchCount; + int m_sandCount; + int m_clayCount; + int m_hugeMushroomCount; + bool m_generateLiquids; }; + +static_assert(sizeof(BiomeDecorator) == 0x100, "Switch biome decorator layout"); diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/BiomeSource.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/BiomeSource.cpp index e12833b2..d26ceb48 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/BiomeSource.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/biome/BiomeSource.cpp @@ -1,5 +1,7 @@ #include "net/minecraft/world/level/biome/BiomeSource.h" + #include +#include #include "NX/Platform.h" #include "net/minecraft/client/Minecraft.h" @@ -113,7 +115,7 @@ void BiomeSource::LayerOverrideSettings::NullBiomeSection(int x, int z, int widt int end = depth + width; unsigned long len = z * sizeof(Biome*); for (int i = width; i < end; i++) { - memset((void*)&m_biomes[x + m_imageWidth * i], 0, len); + memset((void*)&m_biomes.get(x + m_imageWidth * i), 0, len); } } @@ -198,7 +200,7 @@ Biome* BiomeSource::LayerOverrideSettings::GetBiomeAt(float x, float z) { zPos = zThreshold; unsigned int index = getBiomeIndex(xPos, zPos); - return m_biomes[index]; + return m_biomes.get(index); } BiomeSource::CouldSpawnCache::CouldSpawnCache(BiomeSource* biomeSource, @@ -294,7 +296,7 @@ bool BiomeSource::fjCouldSpawn(const FjFeatureBiomeRequirements* biomeRequiremen } BiomeSource::~BiomeSource() { - nn::os::FinalizeMutex(&m_mutexType); + DeleteCriticalSection(&m_mutexType); delete m_biomeCache; } @@ -322,7 +324,7 @@ void BiomeSource::getRawBiomeBlock(arrayWithLength& biomes, int x, int z PIXBeginNamedEvent(0.0, "Copying values"); for (int i = 0; i < width * depth; i++) { - biomes[i] = Biome::getBiome(area[i], Biome::DEFAULT); + biomes.get(i) = Biome::getBiome(area[i], Biome::DEFAULT); } PIXEndNamedEvent(); } @@ -362,7 +364,7 @@ void BiomeSource::getBiomeBlock(arrayWithLength& biomes, int x, int z, i PIXBeginNamedEvent(0.0, "Copying values"); for (int i = 0; i < width * depth; i++) { - biomes[i] = Biome::getBiome(area[i], Biome::DEFAULT); + biomes.get(i) = Biome::getBiome(area[i], Biome::DEFAULT); } PIXEndNamedEvent(); } diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/DesertBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/DesertBiome.h index 218bf613..a98cf144 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/DesertBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/DesertBiome.h @@ -7,4 +7,5 @@ class DesertBiome : public Biome { DesertBiome(EBiomeIDs id, BiomeProperties* properties); int getBaseClass() override; + void decorate(Level*, Random&, const BlockPos&) override; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/ExtremeHillsBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/ExtremeHillsBiome.h index 274f28fe..3d99c95b 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/ExtremeHillsBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/ExtremeHillsBiome.h @@ -2,15 +2,23 @@ #include "net/minecraft/world/level/biome/Biome.h" +class OreFeature; + class ExtremeHillsBiome : public Biome { public: enum EType { DEFAULT = 0, EDGE = 1, M = 2 }; ExtremeHillsBiome(EBiomeIDs id, EType type, BiomeProperties* properties); + ~ExtremeHillsBiome() override; int getBaseClass() override; + Feature* getTreeFeature(Random&) override; + void decorate(Level*, Random&, const BlockPos&) override; + void buildSurfaceAt(Level*, Random&, ChunkPrimer*, int, int, double) override; - char m_padding[0x10]; +private: + OreFeature* m_oreFeature; + EType m_type; }; ASSERT_SIZEOF(ExtremeHillsBiome, 0x158) diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/ForestBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/ForestBiome.h index d4c0d3b0..0803b9de 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/ForestBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/ForestBiome.h @@ -7,6 +7,18 @@ class ForestBiome : public Biome { enum EType { DEFAULT = 0, FLOWER = 1, BIRCH = 2, ROOFED = 3 }; ForestBiome(EBiomeIDs id, EType type, BiomeProperties* properties); + ~ForestBiome() override = default; int getBaseClass() override; + Feature* getTreeFeature(Random&) override; + FlowerBlock::Flower* getRandomFlower(Random&, const BlockPos*) override; + unsigned int getGrassColor(const BlockPos*) override; + void decorate(Level*, Random&, const BlockPos&) override; + void addMushrooms(Level*, Random&, const BlockPos&); + void addDoublePlants(Level*, Random&, const BlockPos&, int); + +private: + EType m_type; }; + +ASSERT_SIZEOF(ForestBiome, 0x148) diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/HellBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/HellBiome.h index 09420259..e6c746e9 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/HellBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/HellBiome.h @@ -5,6 +5,11 @@ class HellBiome : public Biome { public: HellBiome(EBiomeIDs id, BiomeProperties* properties); + ~HellBiome() override = default; int getBaseClass() override; + unsigned int getSkyColor(float) override; + Vec3* getFogColor(float, float) const override; + bool isFoggy() override; + bool isNatural() override; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/IceBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/IceBiome.h index 5256b041..a482a5d5 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/IceBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/IceBiome.h @@ -6,11 +6,17 @@ class IceBiome : public Biome { public: enum EType { DEFAULT = 0, SPIKES = 1 }; - IceBiome(EBiomeIDs id, EType type, BiomeProperties* properties); + IceBiome(EBiomeIDs id, bool spikes, BiomeProperties* properties); int getBaseClass() override; + float getCreatureProbability() override; + Feature* getTreeFeature(Random&) override; + void decorate(Level*, Random&, const BlockPos&) override; - char m_padding[0x10]; +private: + bool m_spikes; + Feature* m_spikeFeature; + Feature* m_patchFeature; }; ASSERT_SIZEOF(IceBiome, 0x158) diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/JungleBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/JungleBiome.h index 1d503b0b..97f19c49 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/JungleBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/JungleBiome.h @@ -6,7 +6,19 @@ class JungleBiome : public Biome { public: enum EType { DEFAULT = 0, EDGE = 1 }; - JungleBiome(EBiomeIDs id, EType type, BiomeProperties* properties); + JungleBiome(EBiomeIDs id, bool edge, BiomeProperties* properties); + static void staticCtor(); int getBaseClass() override; + Feature* getTreeFeature(Random&) override; + Feature* getGrassFeature(Random&) override; + void decorate(Level*, Random&, const BlockPos&) override; + +private: + static const BlockState* TRUNK; + static const BlockState* LEAVES; + static const BlockState* BUSH_LEAVES; + bool m_edge; }; + +ASSERT_SIZEOF(JungleBiome, 0x148) diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/MesaBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/MesaBiome.h index 1675830c..4b6c5a92 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/MesaBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/MesaBiome.h @@ -1,15 +1,43 @@ #pragma once #include "net/minecraft/world/level/biome/Biome.h" +#include "net/minecraft/world/level/biome/BiomeDecorator.h" #include "types.h" class MesaBiome : public Biome { public: - MesaBiome(EBiomeIDs id, bool, bool, BiomeProperties* properties); + class MesaDecorator : public BiomeDecorator { + public: + MesaDecorator() = default; + void decorateOres(Level*, Random&) override; + }; + static LegacyBlockData COARSE_DIRT; + static LegacyBlockData GRASS; + static LegacyBlockData HARDENED_CLAY; + static LegacyBlockData STAINED_HARDENED_CLAY; + static LegacyBlockData ORANGE_CLAY; + static LegacyBlockData RED_SAND; + static void staticCtor(); + + MesaBiome(EBiomeIDs id, bool bryce, bool forest, BiomeProperties* properties); + ~MesaBiome() override; int getBaseClass() override; + Feature* getTreeFeature(Random&) override; + unsigned int getGrassColor(const BlockPos*) override; + unsigned int getFoliageColor(const BlockPos*) override; + void buildSurfaceAt(Level*, Random&, ChunkPrimer*, int, int, double) override; + + void generateBands(long long seed); + LegacyBlockData getBand(int x, int y, int z); - char m_padding[0x30]; + LegacyBlockData* m_clayBands; + long long m_seed; + PerlinSimplexNoise* m_pillarNoise; + PerlinSimplexNoise* m_pillarRoofNoise; + PerlinSimplexNoise* m_clayBandsOffsetNoise; + bool m_bryce; + bool m_forest; }; ASSERT_SIZEOF(MesaBiome, 0x178) diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/MushroomIslandBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/MushroomIslandBiome.h index d3f665aa..4ffa6c07 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/MushroomIslandBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/MushroomIslandBiome.h @@ -5,6 +5,7 @@ class MushroomIslandBiome : public Biome { public: MushroomIslandBiome(EBiomeIDs id, BiomeProperties* properties); + ~MushroomIslandBiome() override = default; int getBaseClass() override; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/MutatedForestBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/MutatedForestBiome.h index 03f9c5c5..179221bd 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/MutatedForestBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/MutatedForestBiome.h @@ -1,10 +1,10 @@ #pragma once -#include "net/minecraft/world/level/biome/Biome.h" +#include "net/minecraft/world/level/biome/ForestBiome.h" -class MutatedForestBiome : public Biome { +class MutatedForestBiome : public ForestBiome { public: MutatedForestBiome(EBiomeIDs id, BiomeProperties* properties); - int getBaseClass() override; + Feature* getTreeFeature(Random&) override; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/MutatedSavannaBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/MutatedSavannaBiome.h index 2683132f..aef574e4 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/MutatedSavannaBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/MutatedSavannaBiome.h @@ -1,10 +1,11 @@ #pragma once -#include "net/minecraft/world/level/biome/Biome.h" +#include "net/minecraft/world/level/biome/SavannaBiome.h" -class MutatedSavannaBiome : public Biome { +class MutatedSavannaBiome : public SavannaBiome { public: MutatedSavannaBiome(EBiomeIDs id, BiomeProperties* properties); - int getBaseClass() override; + void buildSurfaceAt(Level*, Random&, ChunkPrimer*, int, int, double) override; + void decorate(Level*, Random&, const BlockPos&) override; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/OceanBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/OceanBiome.h index 63c22a85..932ec5f7 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/OceanBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/OceanBiome.h @@ -5,6 +5,8 @@ class OceanBiome : public Biome { public: OceanBiome(EBiomeIDs id, BiomeProperties* properties); + ~OceanBiome() override = default; int getBaseClass() override; + int getTemperatureCategory() override; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/PlainsBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/PlainsBiome.h index 582a3980..ed887a32 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/PlainsBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/PlainsBiome.h @@ -5,6 +5,15 @@ class PlainsBiome : public Biome { public: PlainsBiome(EBiomeIDs id, bool, BiomeProperties* properties); + ~PlainsBiome() override = default; int getBaseClass() override; + Feature* getTreeFeature(Random&) override; + FlowerBlock::Flower* getRandomFlower(Random&, const BlockPos*) override; + void decorate(Level*, Random&, const BlockPos&) override; + +private: + bool m_sunflowers; }; + +ASSERT_SIZEOF(PlainsBiome, 0x148) diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/RiverBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/RiverBiome.h index 716c777f..ef12394b 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/RiverBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/RiverBiome.h @@ -5,6 +5,7 @@ class RiverBiome : public Biome { public: RiverBiome(EBiomeIDs id, BiomeProperties* properties); + ~RiverBiome() override = default; int getBaseClass() override; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/SavannaBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/SavannaBiome.h index 0736cc5f..c88c4173 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/SavannaBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/SavannaBiome.h @@ -7,4 +7,6 @@ class SavannaBiome : public Biome { SavannaBiome(EBiomeIDs id, BiomeProperties* properties); int getBaseClass() override; + Feature* getTreeFeature(Random&) override; + void decorate(Level*, Random&, const BlockPos&) override; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/StoneBeachBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/StoneBeachBiome.h index b8ac5286..49db2bb8 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/StoneBeachBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/StoneBeachBiome.h @@ -5,6 +5,7 @@ class StoneBeachBiome : public Biome { public: StoneBeachBiome(EBiomeIDs id, BiomeProperties* properties); + ~StoneBeachBiome() override = default; int getBaseClass() override; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/SwampBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/SwampBiome.h index 9e7a3c7d..dda65f28 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/SwampBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/SwampBiome.h @@ -5,8 +5,17 @@ class SwampBiome : public Biome { public: SwampBiome(EBiomeIDs id, BiomeProperties* properties); + ~SwampBiome() override = default; int getBaseClass() override; + Feature* getTreeFeature(Random&) override; + FlowerBlock::Flower* getRandomFlower(Random&, const BlockPos*) override; + unsigned int getGrassColor(const BlockPos*) override; + unsigned int getFoliageColor(const BlockPos*) override; + void decorate(Level*, Random&, const BlockPos&) override; + void buildSurfaceAt(Level*, Random&, ChunkPrimer*, int, int, double) override; + + static LegacyBlockData WATERLILY; void* m_padding; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/TaigaBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/TaigaBiome.h index 3e5a8ed8..bfe6f492 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/TaigaBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/TaigaBiome.h @@ -7,6 +7,16 @@ class TaigaBiome : public Biome { enum EType { DEFAULT = 0, MEGA = 1, MEGA_SPRUCE = 2 }; TaigaBiome(EBiomeIDs id, EType type, BiomeProperties* properties); + ~TaigaBiome() override = default; int getBaseClass() override; + Feature* getTreeFeature(Random&) override; + Feature* getGrassFeature(Random&) override; + void decorate(Level*, Random&, const BlockPos&) override; + void buildSurfaceAt(Level*, Random&, ChunkPrimer*, int, int, double) override; + +private: + EType m_type; }; + +ASSERT_SIZEOF(TaigaBiome, 0x148) diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/TheEndBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/TheEndBiome.h index 1e1876ec..a0df69e3 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/TheEndBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/TheEndBiome.h @@ -5,6 +5,10 @@ class TheEndBiome : public Biome { public: TheEndBiome(EBiomeIDs id, BiomeProperties* properties); + ~TheEndBiome() override = default; int getBaseClass() override; + unsigned int getSkyColor(float) override; + Vec3* getFogColor(float, float) const override; + bool isNatural() override; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/VoidBiome.h b/src/Minecraft.World/net/minecraft/world/level/biome/VoidBiome.h index 7bac67ec..de318de8 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/VoidBiome.h +++ b/src/Minecraft.World/net/minecraft/world/level/biome/VoidBiome.h @@ -7,4 +7,5 @@ class VoidBiome : public Biome { VoidBiome(EBiomeIDs id, BiomeProperties* properties); int getBaseClass() override; + bool isAlwaysValidSpawn() override; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/Block.cpp b/src/Minecraft.World/net/minecraft/world/level/block/Block.cpp index 0ce58cab..b0d28dcf 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/Block.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/block/Block.cpp @@ -1,5 +1,7 @@ #include "net/minecraft/world/level/block/Block.h" +#include "net/minecraft/world/level/block/BlockBootstrapAllocation.h" + #include "net/minecraft/client/resources/IdMapper.h" #include "net/minecraft/core/Direction.h" #include "net/minecraft/stats/Stats.h" @@ -944,7 +946,7 @@ const Vec3* ZERO = new Vec3(0, 0, 0); Vec3* Block::getOffset(const BlockState* state, LevelSource* levelSource, const BlockPos& pos) { int offsetType = this->getOffsetType(); if (!offsetType) - return Vec3::newTemp(ZERO); + return Vec3::newTemp(Vec3::ZERO); int64_t seed = Mth::getSeed(pos.getX(), 0, pos.getZ()); return Vec3::newTemp((((seed >> 16 & 0xF) / 15.0f) - 0.5) * 0.5, @@ -979,20 +981,10 @@ bool Block::isExceptionBlockForAttachingPlusPiston(Block* block) { return Block::isExceptionBlockForAttaching(block); } -// NON_MATCHING | Score: 333111 (lower is better) -// This is the second-largest method in the entire executable -// I (Dexrn) automated the block registry code, but I'm not sure how well it worked -// Also, there's stuff missing at both the header and the footer... so it won't match until that's done. -// Additionally, it seems that setBaseItemTypeAndMaterial is sometimes called outside of the chain... -// e.g: -// Block *someBlock = new SomeBlock() -// ->setDestroyTime(0) -// ->setExplodeable(10.0); -// someBlock->setBaseItemTypeAndMaterial(14, 2); -// Block::registerBlock(1, L"some_block", someBlock); -// -// The size given in the comments above every block was from the `operator new` call to allocate space for the -// block This gives us the class size of every block that is registered. +// NON_MATCHING: the registration phase now agrees with original ARM64 call +// traces, but the complete initializer still differs in its instructions. +// The original new sizes also cover fields absent from partial block headers; +// BlockBootstrapAllocation preserves those allocations without inventing layouts. void Block::staticCtor() { DEFAULT_FACING = DirectionProperty::create(L"facing"); HORIZONTAL_FACING = DirectionProperty::create(L"facing", Direction::Plane::HORIZONTAL); @@ -1080,7 +1072,7 @@ void Block::staticCtor() { // Size: 0xC8u Block::registerBlock( 2, L"grass", - (new GrassBlock()) + (new (BlockBootstrapAllocation<0xc8>{}) GrassBlock()) ->setDestroyTime(0.6) ->setSoundType(SoundType::GRASS) ->setIconName(L"grass") @@ -1119,15 +1111,15 @@ void Block::staticCtor() { Block::registerBlock(5, L"planks", planksBlock); - Block* saplingBlock - = (new SaplingBlock()) - ->setDestroyTime(0.0) - ->setSoundType(SoundType::GRASS) - ->setIconName(L"sapling") - ->sendBlockData(15) - ->setNameAndDescriptionId(StringIDs::Sapling, StringIDs::CanBePlantedAndWillEventuallyGrowInto) - ->disableMipmap(); - Block::registerBlock(6, L"sapling", saplingBlock); + Block::registerBlock( + 6, L"sapling", + (new (BlockBootstrapAllocation<0xe0>{}) SaplingBlock()) + ->setDestroyTime(0.0) + ->setSoundType(SoundType::GRASS) + ->setIconName(L"sapling") + ->sendBlockData(15) + ->setNameAndDescriptionId(StringIDs::Sapling, StringIDs::CanBePlantedAndWillEventuallyGrowInto) + ->disableMipmap()); Block::registerBlock(7, L"bedrock", (new BlockImpl(Material::STONE)) @@ -1141,7 +1133,7 @@ void Block::staticCtor() { // Size: 0xF0u Block::registerBlock( 8, L"flowing_water", - (new DynamicLiquidBlock(Material::WATER)) + (new (BlockBootstrapAllocation<0xf0>{}) DynamicLiquidBlock(Material::WATER)) ->setDestroyTime(100.0) ->setLightBlock(3) ->setIconName(L"water_flow") @@ -1152,7 +1144,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock( 9, L"water", - (new StaticLiquidBlock(Material::WATER)) + (new (BlockBootstrapAllocation<0xb8>{}) StaticLiquidBlock(Material::WATER)) ->setDestroyTime(100.0) ->setLightBlock(3) ->setIconName(L"water_still") @@ -1163,7 +1155,7 @@ void Block::staticCtor() { // Size: 0xF0u Block::registerBlock( 10, L"flowing_lava", - (new DynamicLiquidBlock(Material::LAVA)) + (new (BlockBootstrapAllocation<0xf0>{}) DynamicLiquidBlock(Material::LAVA)) ->setDestroyTime(100.0) ->setLightEmission(1.0) ->setIconName(L"lava_flow") @@ -1175,7 +1167,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock( 11, L"lava", - (new StaticLiquidBlock(Material::LAVA)) + (new (BlockBootstrapAllocation<0xb8>{}) StaticLiquidBlock(Material::LAVA)) ->setDestroyTime(100.0) ->setLightEmission(1.0) ->setIconName(L"lava_still") @@ -1244,7 +1236,7 @@ void Block::staticCtor() { // Size: 0x110u Block::registerBlock(18, L"leaves", - (new OldLeafBlock()) + (new (BlockBootstrapAllocation<0x110>{}) OldLeafBlock()) ->setIconName(L"leaves") ->sendBlockData(3) ->setNameAndDescriptionId(StringIDs::Leaves, @@ -1253,7 +1245,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock( 19, L"sponge", - (new SpongeBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) SpongeBlock()) ->setDestroyTime(0.6) ->setSoundType(SoundType::GRASS) ->setIconName(L"sponge") @@ -1294,7 +1286,7 @@ void Block::staticCtor() { // Size: 0xE0u Block::registerBlock( 23, L"dispenser", - (new DispenserBlock()) + (new (BlockBootstrapAllocation<0xe0>{}) DispenserBlock()) ->setDestroyTime(3.5) ->setSoundType(SoundType::STONE) ->setIconName(L"dispenser") @@ -1316,7 +1308,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock(25, L"noteblock", - (new NoteBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) NoteBlock()) ->setSoundType(SoundType::WOOD) ->setDestroyTime(0.8) ->setIconName(L"noteblock") @@ -1327,7 +1319,7 @@ void Block::staticCtor() { // Size: 0xE0u Block::registerBlock( 26, L"bed", - (new BedBlock()) + (new (BlockBootstrapAllocation<0xe0>{}) BedBlock()) ->setSoundType(SoundType::WOOD) ->setDestroyTime(0.2) ->setIconName(L"bed") @@ -1338,7 +1330,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock( 27, L"golden_rail", - (new PoweredRailBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) PoweredRailBlock()) ->setDestroyTime(0.7) ->setSoundType(SoundType::METAL) ->setIconName(L"rail_golden") @@ -1350,7 +1342,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock(28, L"detector_rail", - (new DetectorRailBlock()) + (new (BlockBootstrapAllocation<0xb8>{}) DetectorRailBlock()) ->setDestroyTime(0.7) ->setSoundType(SoundType::METAL) ->setIconName(L"rail_detector") @@ -1363,7 +1355,7 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 29, L"sticky_piston", - (new PistonBaseBlock(true)) + (new (BlockBootstrapAllocation<0xc0>{}) PistonBaseBlock(true)) ->sendBlockData(15) ->setNameAndDescriptionId(StringIDs::StickyPiston, StringIDs::WhenPoweredUsingAButtonALeverARetractsPullsBackBlockTouching) @@ -1383,7 +1375,7 @@ void Block::staticCtor() { // Size: 0xC8u Block::registerBlock( 31, L"tallgrass", - (new TallGrassBlock()) + (new (BlockBootstrapAllocation<0xc8>{}) TallGrassBlock()) ->setDestroyTime(0.0) ->setSoundType(SoundType::GRASS) ->setIconName(L"tallgrass") @@ -1402,7 +1394,7 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 33, L"piston", - (new PistonBaseBlock(false)) + (new (BlockBootstrapAllocation<0xc0>{}) PistonBaseBlock(false)) ->sendBlockData(15) ->setNameAndDescriptionId(StringIDs::Piston, StringIDs::WhenPoweredUsingAButtonALeverA) ->setBaseItemTypeAndMaterial(27, 28) @@ -1411,13 +1403,13 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock( 34, L"piston_head", - (new PistonHeadBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) PistonHeadBlock()) ->setNameAndDescriptionId(StringIDs::Piston, StringIDs::WhenPoweredUsingAButtonALeverA) ->sendBlockData(15)); // Size: 0x128u Block::registerBlock(35, L"wool", - (new ColoredBlock(Material::WOOL)) + (new (BlockBootstrapAllocation<0x128>{}) ColoredBlock(Material::WOOL)) ->setDestroyTime(0.8) ->setSoundType(SoundType::WOOL) ->setIconName(L"wool_colored") @@ -1427,7 +1419,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock(36, L"piston_extension", - (new PistonMagicBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) PistonMagicBlock()) ->setIconName(L"pistonBase") ->setNameAndDescriptionId(StringIDs::Piston, 0xFFFFFFFF)); @@ -1494,7 +1486,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock(43, L"double_stone_slab", - (new FullStoneSlabBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) FullStoneSlabBlock()) ->setDestroyTime(2.0) ->setExplodeable(10.0) ->setSoundType(SoundType::STONE) @@ -1505,7 +1497,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock(44, L"stone_slab", - (new HalfStoneSlabBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) HalfStoneSlabBlock()) ->setDestroyTime(2.0) ->setExplodeable(10.0) ->setSoundType(SoundType::STONE) @@ -1526,7 +1518,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock(46, L"tnt", - (new TntBlock()) + (new (BlockBootstrapAllocation<0xb8>{}) TntBlock()) ->setDestroyTime(0.0) ->setSoundType(SoundType::GRASS) ->setIconName(L"tnt") @@ -1593,7 +1585,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock(52, L"mob_spawner", - (new MobSpawnerBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) MobSpawnerBlock()) ->setDestroyTime(5.0) ->setSoundType(SoundType::METAL) ->setIconName(L"mob_spawner") @@ -1601,20 +1593,20 @@ void Block::staticCtor() { ->setNameAndDescriptionId(StringIDs::MonsterSpawner, 0x4330c9)); // Size: 0xC0u - const BlockState* stairBlockVariant = planksBlock->defaultBlockState()->setValue( - PlanksBlock::VARIANT, PlanksBlock::Variant::OAK); - Block* stairBlock - = (new StairBlock(stairBlockVariant)) - ->setIconName(L"stairsWood") - ->sendBlockData(15) - ->setNameAndDescriptionId(StringIDs::OakWoodStairs, StringIDs::UsedForCompactStaircases_1) - ->setBaseItemTypeAndMaterial(16, 1); - Block::registerBlock(53, L"oak_stairs", stairBlock); + Block::registerBlock( + 53, L"oak_stairs", + (new (BlockBootstrapAllocation<0xc0>{}) + StairBlock(planksBlock->defaultBlockState()->setValue( + PlanksBlock::VARIANT, PlanksBlock::Variant::OAK))) + ->setIconName(L"stairsWood") + ->sendBlockData(15) + ->setNameAndDescriptionId(StringIDs::OakWoodStairs, StringIDs::UsedForCompactStaircases_1) + ->setBaseItemTypeAndMaterial(16, 1)); // Size: 0xB8u Block::registerBlock( 54, L"chest", - (new ChestBlock(0)) + (new (BlockBootstrapAllocation<0xb8>{}) ChestBlock(0)) ->setDestroyTime(2.5) ->setSoundType(SoundType::WOOD) ->setIconName(L"chest") @@ -1625,7 +1617,7 @@ void Block::staticCtor() { // Size: 0xF8u Block::registerBlock( 55, L"redstone_wire", - (new RedStoneWireBlock()) + (new (BlockBootstrapAllocation<0xf8>{}) RedStoneWireBlock()) ->setDestroyTime(0.0) ->setSoundType(SoundType::STONE) ->setIconName(L"redstone_dust") @@ -1657,7 +1649,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock(58, L"crafting_table", - (new CraftingTableBlock()) + (new (BlockBootstrapAllocation<0xb8>{}) CraftingTableBlock()) ->setDestroyTime(2.5) ->setSoundType(SoundType::WOOD) ->setIconName(L"crafting_table") @@ -1668,7 +1660,7 @@ void Block::staticCtor() { // Size: 0xF0u Block::registerBlock( 59, L"wheat", - (new CropBlock(false)) + (new (BlockBootstrapAllocation<0xf0>{}) CropBlock(false)) ->setIconName(L"wheat") ->setNotCollectStatistics() ->sendBlockData(15) @@ -1676,7 +1668,7 @@ void Block::staticCtor() { ->disableMipmap()); // Size: 0xB8u - Block* farmBlock = (new FarmBlock()) + Block* farmBlock = (new (BlockBootstrapAllocation<0xb8>{}) FarmBlock()) ->setDestroyTime(0.6) ->setSoundType(SoundType::DIRT) ->setIconName(L"farmland") @@ -1688,7 +1680,7 @@ void Block::staticCtor() { // Size: 0xC8u Block::registerBlock( 61, L"furnace", - (new FurnaceBlock(false)) + (new (BlockBootstrapAllocation<0xc8>{}) FurnaceBlock(false)) ->setDestroyTime(3.5) ->setSoundType(SoundType::STONE) ->setIconName(L"furnace") @@ -1699,7 +1691,7 @@ void Block::staticCtor() { // Size: 0xC8u Block::registerBlock( 62, L"lit_furnace", - (new FurnaceBlock(true)) + (new (BlockBootstrapAllocation<0xc8>{}) FurnaceBlock(true)) ->setDestroyTime(3.5) ->setSoundType(SoundType::STONE) ->setIconName(L"furnace") @@ -1710,7 +1702,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock( 63, L"standing_sign", - (new StandingSignBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) StandingSignBlock()) ->setDestroyTime(1.0) ->setSoundType(SoundType::WOOD) ->setIconName(L"sign") @@ -1720,7 +1712,7 @@ void Block::staticCtor() { // Size: 0xC8u Block::registerBlock(64, L"wooden_door", - (new DoorBlock(Material::WOOD)) + (new (BlockBootstrapAllocation<0xc8>{}) DoorBlock(Material::WOOD)) ->setDestroyTime(3.0) ->setSoundType(SoundType::WOOD) ->setIconName(L"door_wood") @@ -1742,7 +1734,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock(66, L"rail", - (new RailBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) RailBlock()) ->setDestroyTime(0.7) ->setSoundType(SoundType::METAL) ->setIconName(L"rail_normal") @@ -1754,7 +1746,7 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 67, L"stone_stairs", - (new StairBlock(cobblestoneBlock->defaultBlockState())) + (new (BlockBootstrapAllocation<0xc0>{}) StairBlock(cobblestoneBlock->defaultBlockState())) ->setIconName(L"stairsStone") ->sendBlockData(15) ->setNameAndDescriptionId(StringIDs::CobblestoneStairs, StringIDs::UsedForCompactStaircases_1) @@ -1763,7 +1755,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock( 68, L"wall_sign", - (new WallSignBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) WallSignBlock()) ->setDestroyTime(1.0) ->setSoundType(SoundType::WOOD) ->setIconName(L"sign") @@ -1784,20 +1776,20 @@ void Block::staticCtor() { ->setBaseItemTypeAndMaterial(45, 1)); // Size: 0xC8u - Block::registerBlock( - 70, L"stone_pressure_plate", - (new PressurePlateBlock(L"stone", Material::STONE, PressurePlateBlock::Sensitivity::STONE)) - ->setDestroyTime(0.5) - ->setSoundType(SoundType::STONE) - ->sendBlockData(15) - ->setNameAndDescriptionId(StringIDs::StonePressurePlate, - StringIDs::APressureSensitivePadThatWillActivateWhen) - ->setBaseItemTypeAndMaterial(15, 2)); + Block::registerBlock(70, L"stone_pressure_plate", + (new (BlockBootstrapAllocation<0xc8>{}) PressurePlateBlock( + L"stone", Material::STONE, PressurePlateBlock::Sensitivity::STONE)) + ->setDestroyTime(0.5) + ->setSoundType(SoundType::STONE) + ->sendBlockData(15) + ->setNameAndDescriptionId(StringIDs::StonePressurePlate, + StringIDs::APressureSensitivePadThatWillActivateWhen) + ->setBaseItemTypeAndMaterial(15, 2)); // Size: 0xC8u Block::registerBlock( 71, L"iron_door", - (new DoorBlock(Material::METAL)) + (new (BlockBootstrapAllocation<0xc8>{}) DoorBlock(Material::METAL)) ->setIconName(L"door_iron") ->setDestroyTime(5.0) ->setSoundType(SoundType::METAL) @@ -1808,7 +1800,8 @@ void Block::staticCtor() { // Size: 0xC8u Block::registerBlock( 72, L"wooden_pressure_plate", - (new PressurePlateBlock(L"planks_oak", Material::WOOD, PressurePlateBlock::Sensitivity::WOOD)) + (new (BlockBootstrapAllocation<0xc8>{}) + PressurePlateBlock(L"planks_oak", Material::WOOD, PressurePlateBlock::Sensitivity::WOOD)) ->setDestroyTime(0.5) ->setSoundType(SoundType::WOOD) ->sendBlockData(15) @@ -1910,7 +1903,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock( 81, L"cactus", - (new CactusBlock()) + (new (BlockBootstrapAllocation<0xb8>{}) CactusBlock()) ->setIconName(L"cactus") ->setDestroyTime(0.4) ->setSoundType(SoundType::WOOL) @@ -1940,7 +1933,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock(84, L"jukebox", - (new JukeboxBlock()) + (new (BlockBootstrapAllocation<0xb8>{}) JukeboxBlock()) ->setIconName(L"jukebox") ->setDestroyTime(2.0) ->setExplodeable(10.0) @@ -1952,7 +1945,8 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 85, L"fence", - (new FenceBlock(L"planks_oak", Material::WOOD, PlanksBlock::Variant::OAK->getMaterialColor())) + (new (BlockBootstrapAllocation<0xc0>{}) + FenceBlock(L"planks_oak", Material::WOOD, PlanksBlock::Variant::OAK->getMaterialColor())) ->setDestroyTime(2.0) ->setExplodeable(5.0) ->setSoundType(SoundType::WOOD) @@ -1961,7 +1955,7 @@ void Block::staticCtor() { // Size: 0xD8u Block* pumpkinBlock - = (new PumpkinBlock()) + = (new (BlockBootstrapAllocation<0xd8>{}) PumpkinBlock()) ->setIconName(L"pumpkin") ->setDestroyTime(1.0) ->setSoundType(SoundType::WOOD) @@ -2010,7 +2004,7 @@ void Block::staticCtor() { // Size: 0xD8u Block::registerBlock(91, L"lit_pumpkin", - (new PumpkinBlock()) + (new (BlockBootstrapAllocation<0xd8>{}) PumpkinBlock()) ->setIconName(L"pumpkin") ->setDestroyTime(1.0) ->setSoundType(SoundType::WOOD) @@ -2022,7 +2016,7 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 92, L"cake", - (new CakeBlock()) + (new (BlockBootstrapAllocation<0xc0>{}) CakeBlock()) ->setIconName(L"cake") ->setDestroyTime(0.5) ->setSoundType(SoundType::WOOL) @@ -2059,7 +2053,7 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 95, L"stained_glass", - (new StainedGlassBlock(Material::GLASS)) + (new (BlockBootstrapAllocation<0xc0>{}) StainedGlassBlock(Material::GLASS)) ->setIconName(L"glass") ->setDestroyTime(0.3) ->setSoundType(SoundType::GLASS) @@ -2103,7 +2097,8 @@ void Block::staticCtor() { // Size: 0xD8u Block::registerBlock( 99, L"brown_mushroom_block", - (new HugeMushroomBlock(Material::WOOD, MaterialColor::DIRT, brownMushroomBlock)) + (new (BlockBootstrapAllocation<0xd8>{}) + HugeMushroomBlock(Material::WOOD, MaterialColor::DIRT, brownMushroomBlock)) ->setIconName(L"mushroom_block") ->setDestroyTime(0.2) ->setSoundType(SoundType::WOOD) @@ -2113,7 +2108,8 @@ void Block::staticCtor() { // Size: 0xD8u Block::registerBlock( 100, L"red_mushroom_block", - (new HugeMushroomBlock(Material::WOOD, MaterialColor::COLOR_RED, redMushroomBlock)) + (new (BlockBootstrapAllocation<0xd8>{}) + HugeMushroomBlock(Material::WOOD, MaterialColor::COLOR_RED, redMushroomBlock)) ->setIconName(L"mushroom_block") ->setDestroyTime(0.2) ->setSoundType(SoundType::WOOD) @@ -2123,7 +2119,8 @@ void Block::staticCtor() { // Size: 0xE0u Block::registerBlock( 101, L"iron_bars", - (new ThinFenceBlock(L"iron_bars", L"iron_bars", Material::METAL, true)) + (new (BlockBootstrapAllocation<0xe0>{}) + ThinFenceBlock(L"iron_bars", L"iron_bars", Material::METAL, true)) ->setDestroyTime(5.0) ->setExplodeable(10.0) ->setSoundType(SoundType::METAL) @@ -2133,7 +2130,8 @@ void Block::staticCtor() { // Size: 0xE0u Block::registerBlock( 102, L"glass_pane", - (new ThinFenceBlock(L"glass", L"glass_pane_top", Material::GLASS, false)) + (new (BlockBootstrapAllocation<0xe0>{}) + ThinFenceBlock(L"glass", L"glass_pane_top", Material::GLASS, false)) ->setDestroyTime(0.3) ->setSoundType(SoundType::GLASS) ->setNameAndDescriptionId(StringIDs::GlassPane, StringIDs::TransparentBlocksThatCanBeUsedAsAn) @@ -2141,7 +2139,7 @@ void Block::staticCtor() { // Size: 0xB0u Block* melonBlock - = (new MelonBlock()) + = (new (BlockBootstrapAllocation<0xb0>{}) MelonBlock()) ->setIconName(L"melon") ->setDestroyTime(1.0) ->setSoundType(SoundType::WOOD) @@ -2150,7 +2148,7 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock(104, L"pumpkin_stem", - (new StemBlock(pumpkinBlock)) + (new (BlockBootstrapAllocation<0xc0>{}) StemBlock(pumpkinBlock)) ->setIconName(L"pumpkin_stem") ->setDestroyTime(0.0) ->setSoundType(SoundType::WOOD) @@ -2160,7 +2158,7 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock(105, L"melon_stem", - (new StemBlock(melonBlock)) + (new (BlockBootstrapAllocation<0xc0>{}) StemBlock(melonBlock)) ->setIconName(L"melon_stem") ->setDestroyTime(0.0) ->setSoundType(SoundType::WOOD) @@ -2180,33 +2178,33 @@ void Block::staticCtor() { ->disableMipmap()); // Size: 0xC0u - Block::registerBlock(107, L"fence_gate", - (new FenceGateBlock(L"planks_oak", PlanksBlock::Variant::OAK)) - ->setIconName(L"fenceGate") - ->setDestroyTime(2.0) - ->setExplodeable(5.0) - ->setSoundType(SoundType::WOOD) - ->sendBlockData(15) - ->setNameAndDescriptionId(StringIDs::OakFenceGate, - StringIDs::SimilarToADoorButUsedPrimarilyWithFences) - ->setBaseItemTypeAndMaterial(47, 1)); + Block::registerBlock( + 107, L"fence_gate", + (new (BlockBootstrapAllocation<0xc0>{}) FenceGateBlock(L"planks_oak", PlanksBlock::Variant::OAK)) + ->setIconName(L"fenceGate") + ->setDestroyTime(2.0) + ->setExplodeable(5.0) + ->setSoundType(SoundType::WOOD) + ->sendBlockData(15) + ->setNameAndDescriptionId(StringIDs::OakFenceGate, + StringIDs::SimilarToADoorButUsedPrimarilyWithFences) + ->setBaseItemTypeAndMaterial(47, 1)); // Size: 0xC0u Block::registerBlock( 108, L"brick_stairs", - (new StairBlock(brickBlock->defaultBlockState())) + (new (BlockBootstrapAllocation<0xc0>{}) StairBlock(brickBlock->defaultBlockState())) ->setIconName(L"stairsBrick") ->sendBlockData(15) ->setNameAndDescriptionId(StringIDs::BrickStairs, StringIDs::UsedForCompactStaircases_1) ->setBaseItemTypeAndMaterial(16, 14)); // Size: 0xC0u - const BlockState* stoneBrickStairBlockVariant - = stoneBrickBlock->defaultBlockState()->setValue( - StoneBrickBlock::VARIANT, StoneBrickBlock::Variant::DEFAULT); Block::registerBlock( 109, L"stone_brick_stairs", - (new StairBlock(stoneBrickStairBlockVariant)) + (new (BlockBootstrapAllocation<0xc0>{}) + StairBlock(stoneBrickBlock->defaultBlockState()->setValue( + StoneBrickBlock::VARIANT, StoneBrickBlock::Variant::DEFAULT))) ->setIconName(L"stairsStoneBrickSmooth") ->sendBlockData(15) ->setNameAndDescriptionId(StringIDs::StoneBrickStairs, StringIDs::UsedForCompactStaircases_1) @@ -2215,7 +2213,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock( 110, L"mycelium", - (new MyceliumBlock()) + (new (BlockBootstrapAllocation<0xb8>{}) MyceliumBlock()) ->setIconName(L"mycelium") ->setDestroyTime(0.6) ->setSoundType(SoundType::GRASS) @@ -2246,7 +2244,8 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 113, L"nether_brick_fence", - (new FenceBlock(L"nether_brick", Material::STONE, MaterialColor::NETHER)) + (new (BlockBootstrapAllocation<0xc0>{}) + FenceBlock(L"nether_brick", Material::STONE, MaterialColor::NETHER)) ->setDestroyTime(2.0) ->setExplodeable(10.0) ->setSoundType(SoundType::STONE) @@ -2256,7 +2255,7 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 114, L"nether_brick_stairs", - (new StairBlock(netherBrickBlock->defaultBlockState())) + (new (BlockBootstrapAllocation<0xc0>{}) StairBlock(netherBrickBlock->defaultBlockState())) ->setIconName(L"stairsNetherBrick") ->sendBlockData(15) ->setNameAndDescriptionId(StringIDs::NetherBrickStairs, StringIDs::UsedForCompactStaircases_1) @@ -2264,7 +2263,7 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock(115, L"nether_wart", - (new NetherWartBlock()) + (new (BlockBootstrapAllocation<0xc0>{}) NetherWartBlock()) ->setIconName(L"nether_wart") ->sendBlockData(15) ->setNameAndDescriptionId(StringIDs::NetherWart_1, @@ -2274,7 +2273,7 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 116, L"enchanting_table", - (new EnchantmentTableBlock()) + (new (BlockBootstrapAllocation<0xc0>{}) EnchantmentTableBlock()) ->setIconName(L"enchanting_table") ->setDestroyTime(5.0) ->setExplodeable(2000.0) @@ -2284,7 +2283,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock(117, L"brewing_stand", - (new BrewingStandBlock()) + (new (BlockBootstrapAllocation<0xb8>{}) BrewingStandBlock()) ->setIconName(L"brewing_stand") ->setDestroyTime(0.5) ->setLightEmission(0.125) @@ -2296,7 +2295,7 @@ void Block::staticCtor() { // Size: 0xD0u Block::registerBlock( 118, L"cauldron", - (new CauldronBlock()) + (new (BlockBootstrapAllocation<0xd0>{}) CauldronBlock()) ->setIconName(L"cauldron") ->setDestroyTime(2.0) ->sendBlockData(15) @@ -2305,19 +2304,19 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock( 119, L"end_portal", - (new EndPortalBlock(Material::PORTAL)) - ->setDestroyTime(3.4028e38) + (new (BlockBootstrapAllocation<0xb0>{}) EndPortalBlock(Material::PORTAL)) + ->setDestroyTime(3.4028234663852886e38f) ->setExplodeable(6000000.0) ->setNameAndDescriptionId(StringIDs::EndPortal, StringIDs::ThisCanBeActivatedUsingTwelveEyeOf)); // Size: 0xB8u Block::registerBlock( 120, L"end_portal_frame", - (new EndPortalFrameBlock()) + (new (BlockBootstrapAllocation<0xb8>{}) EndPortalFrameBlock()) ->setIconName(L"endframe") ->setSoundType(SoundType::GLASS) ->setLightEmission(0.125) - ->setDestroyTime(3.4028e38) + ->setDestroyTime(3.4028234663852886e38f) ->sendBlockData(15) ->setExplodeable(6000000.0) ->setNameAndDescriptionId(StringIDs::EndPortalFrame, StringIDs::UsedToFormAnEndPortal)); @@ -2388,7 +2387,7 @@ void Block::staticCtor() { // Size: 0xC8u Block::registerBlock( 127, L"cocoa", - (new CocoaBlock()) + (new (BlockBootstrapAllocation<0xc8>{}) CocoaBlock()) ->setIconName(L"cocoa") ->setDestroyTime(0.2) ->setExplodeable(5.0) @@ -2397,16 +2396,15 @@ void Block::staticCtor() { ->setNameAndDescriptionId(StringIDs::Cocoa, StringIDs::CanBeFarmedToCollectCocoaBeans)); // Size: 0xC0u - const BlockState* sandStoneStairBlockVariant - = sandStoneBlock->defaultBlockState()->setValue( - SandStoneBlock::TYPE, SandStoneBlock::Variant::DEFAULT); - Block* sandStoneStairBlock - = (new StairBlock(sandStoneStairBlockVariant)) - ->setIconName(L"stairsSandstone") - ->sendBlockData(15) - ->setNameAndDescriptionId(StringIDs::SandstoneStairs, StringIDs::UsedForCompactStaircases_1) - ->setBaseItemTypeAndMaterial(16, 13); - Block::registerBlock(128, L"sandstone_stairs", sandStoneStairBlock); + Block::registerBlock( + 128, L"sandstone_stairs", + (new (BlockBootstrapAllocation<0xc0>{}) + StairBlock(sandStoneBlock->defaultBlockState()->setValue( + SandStoneBlock::TYPE, SandStoneBlock::Variant::DEFAULT))) + ->setIconName(L"stairsSandstone") + ->sendBlockData(15) + ->setNameAndDescriptionId(StringIDs::SandstoneStairs, StringIDs::UsedForCompactStaircases_1) + ->setBaseItemTypeAndMaterial(16, 13)); // Size: 0xA8u Block::registerBlock( @@ -2421,7 +2419,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock( 130, L"ender_chest", - (new EnderChestBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) EnderChestBlock()) ->setDestroyTime(22.5) ->setIconName(L"enderChest") ->setExplodeable(1000.0) @@ -2461,45 +2459,42 @@ void Block::staticCtor() { ->setBaseItemTypeAndMaterial(32, 44)); // Size: 0xC0u - const BlockState* spruceStairBlockVariant - = planksBlock->defaultBlockState()->setValue(PlanksBlock::VARIANT, - PlanksBlock::Variant::SPRUCE); - Block* spruceStairBlock - = (new StairBlock(spruceStairBlockVariant)) - ->setIconName(L"stairsWoodSpruce") - ->sendBlockData(15) - ->setNameAndDescriptionId(StringIDs::SpruceWoodStairs, StringIDs::UsedForCompactStaircases_1) - ->setBaseItemTypeAndMaterial(16, 39); - Block::registerBlock(134, L"spruce_stairs", stairBlock); + Block::registerBlock( + 134, L"spruce_stairs", + (new (BlockBootstrapAllocation<0xc0>{}) + StairBlock(planksBlock->defaultBlockState()->setValue( + PlanksBlock::VARIANT, PlanksBlock::Variant::SPRUCE))) + ->setIconName(L"stairsWoodSpruce") + ->sendBlockData(15) + ->setNameAndDescriptionId(StringIDs::SpruceWoodStairs, StringIDs::UsedForCompactStaircases_1) + ->setBaseItemTypeAndMaterial(16, 39)); // Size: 0xC0u - const BlockState* birchStairBlockVariant - = planksBlock->defaultBlockState()->setValue(PlanksBlock::VARIANT, - PlanksBlock::Variant::BIRCH); - Block* birchStairBlock - = (new StairBlock(birchStairBlockVariant)) - ->setIconName(L"stairsWoodBirch") - ->sendBlockData(15) - ->setNameAndDescriptionId(StringIDs::BirchWoodStairs, StringIDs::UsedForCompactStaircases_1) - ->setBaseItemTypeAndMaterial(16, 40); - Block::registerBlock(135, L"birch_stairs", birchStairBlock); + Block::registerBlock( + 135, L"birch_stairs", + (new (BlockBootstrapAllocation<0xc0>{}) + StairBlock(planksBlock->defaultBlockState()->setValue( + PlanksBlock::VARIANT, PlanksBlock::Variant::BIRCH))) + ->setIconName(L"stairsWoodBirch") + ->sendBlockData(15) + ->setNameAndDescriptionId(StringIDs::BirchWoodStairs, StringIDs::UsedForCompactStaircases_1) + ->setBaseItemTypeAndMaterial(16, 40)); // Size: 0xC0u - const BlockState* jungleStairBlockVariant - = planksBlock->defaultBlockState()->setValue(PlanksBlock::VARIANT, - PlanksBlock::Variant::JUNGLE); - Block* jungleStairBlock - = (new StairBlock(jungleStairBlockVariant)) - ->setIconName(L"stairsWoodJungle") - ->sendBlockData(15) - ->setNameAndDescriptionId(StringIDs::JungleWoodStairs, StringIDs::UsedForCompactStaircases_1) - ->setBaseItemTypeAndMaterial(16, 41); - Block::registerBlock(136, L"jungle_stairs", jungleStairBlock); + Block::registerBlock( + 136, L"jungle_stairs", + (new (BlockBootstrapAllocation<0xc0>{}) + StairBlock(planksBlock->defaultBlockState()->setValue( + PlanksBlock::VARIANT, PlanksBlock::Variant::JUNGLE))) + ->setIconName(L"stairsWoodJungle") + ->sendBlockData(15) + ->setNameAndDescriptionId(StringIDs::JungleWoodStairs, StringIDs::UsedForCompactStaircases_1) + ->setBaseItemTypeAndMaterial(16, 41)); // Size: 0xB0u Block::registerBlock( 138, L"beacon", - (new BeaconBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) BeaconBlock()) ->setIconName(L"beacon") ->setLightEmission(1.0) ->setSoundType(SoundType::GLASS) @@ -2515,7 +2510,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock(140, L"flower_pot", - (new FlowerPotBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) FlowerPotBlock()) ->setDestroyTime(0.0) ->setIconName(L"flower_pot") ->setSoundType(SoundType::STONE) @@ -2525,7 +2520,7 @@ void Block::staticCtor() { // Size: 0x110u Block::registerBlock( 141, L"carrots", - (new CarrotBlock()) + (new (BlockBootstrapAllocation<0x110>{}) CarrotBlock()) ->setIconName(L"carrots") ->setNameAndDescriptionId(StringIDs::Carrots, StringIDs::Restores15IconShank01AndCan) ->disableMipmap()); @@ -2533,7 +2528,7 @@ void Block::staticCtor() { // Size: 0x110u Block::registerBlock( 142, L"potatoes", - (new PotatoBlock()) + (new (BlockBootstrapAllocation<0x110>{}) PotatoBlock()) ->setIconName(L"potatoes") ->setNameAndDescriptionId(StringIDs::Potatoes, StringIDs::Restores05IconShank01OrCan) ->disableMipmap()); @@ -2552,7 +2547,7 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 144, L"skull", - (new SkullBlock()) + (new (BlockBootstrapAllocation<0xc0>{}) SkullBlock()) ->setIconName(L"") ->setDestroyTime(1.0) ->setSoundType(SoundType::STONE) @@ -2561,7 +2556,7 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 145, L"anvil", - (new AnvilBlock()) + (new (BlockBootstrapAllocation<0xc0>{}) AnvilBlock()) ->setIconName(L"anvil") ->setBaseItemTypeAndMaterial(30, 3) ->setDestroyTime(5.0) @@ -2573,7 +2568,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock( 146, L"trapped_chest", - (new ChestBlock(true)) + (new (BlockBootstrapAllocation<0xb8>{}) ChestBlock(true)) ->setBaseItemTypeAndMaterial(36, 25) ->setDestroyTime(2.5) ->setSoundType(SoundType::WOOD) @@ -2582,18 +2577,19 @@ void Block::staticCtor() { StringIDs::StoresBlocksAndItemsInsidePlaceTwoChestsATrappedAlsoCreatesRedstone)); // Size: 0xC8u - Block::registerBlock( - 147, L"light_weighted_pressure_plate", - (new WeightedPressurePlateBlock(L"gold_block", Material::METAL, 15, MaterialColor::GOLD)) - ->setBaseItemTypeAndMaterial(15, 4) - ->setDestroyTime(0.5) - ->setSoundType(SoundType::WOOD) - ->setNameAndDescriptionId(StringIDs::WeightedPressurePlateLight, - StringIDs::ProvidesARedstoneChargeTheChargeWillBe_1)); + Block::registerBlock(147, L"light_weighted_pressure_plate", + (new (BlockBootstrapAllocation<0xc8>{}) WeightedPressurePlateBlock( + L"gold_block", Material::METAL, 15, MaterialColor::GOLD)) + ->setBaseItemTypeAndMaterial(15, 4) + ->setDestroyTime(0.5) + ->setSoundType(SoundType::WOOD) + ->setNameAndDescriptionId(StringIDs::WeightedPressurePlateLight, + StringIDs::ProvidesARedstoneChargeTheChargeWillBe_1)); // Size: 0xC8u Block::registerBlock(148, L"heavy_weighted_pressure_plate", - (new WeightedPressurePlateBlock(L"iron_block", Material::METAL, 150, 0)) + (new (BlockBootstrapAllocation<0xc8>{}) + WeightedPressurePlateBlock(L"iron_block", Material::METAL, 150, 0)) ->setBaseItemTypeAndMaterial(15, 3) ->setDestroyTime(0.5) ->setSoundType(SoundType::WOOD) @@ -2602,7 +2598,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock(149, L"unpowered_comparator", - (new ComparatorBlock(false)) + (new (BlockBootstrapAllocation<0xb0>{}) ComparatorBlock(false)) ->setIconName(L"comparator_off") ->setDestroyTime(0.0) ->setSoundType(SoundType::WOOD) @@ -2613,7 +2609,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock(150, L"powered_comparator", - (new ComparatorBlock(true)) + (new (BlockBootstrapAllocation<0xb0>{}) ComparatorBlock(true)) ->setIconName(L"comparator_on") ->setDestroyTime(0.0) ->setLightEmission(0.625) @@ -2625,7 +2621,7 @@ void Block::staticCtor() { // Size: 0xD0u Block::registerBlock(151, L"daylight_detector", - (new DaylightDetectorBlock(false)) + (new (BlockBootstrapAllocation<0xd0>{}) DaylightDetectorBlock(false)) ->setIconName(L"daylight_detector") ->setNameAndDescriptionId(StringIDs::DaylightSensor, StringIDs::ABlockThatOutputsARedstoneSignalBased)); @@ -2654,7 +2650,7 @@ void Block::staticCtor() { // Size: 0xC8u Block::registerBlock( 154, L"hopper", - (new HopperBlock()) + (new (BlockBootstrapAllocation<0xc8>{}) HopperBlock()) ->setIconName(L"hopper") ->setDestroyTime(3.0) ->setExplodeable(8.0) @@ -2672,18 +2668,18 @@ void Block::staticCtor() { Block::registerBlock(155, L"quartz_block", quartzBlock); // Size: 0xC0u - const BlockState* variant = quartzBlock->defaultBlockState()->setValue( - QuartzBlock::VARIANT, QuartzBlock::Variant::DEFAULT); - Block* quartzStairsBlock - = (new StairBlock(variant)) - ->setIconName(L"stairsQuartz") - ->setNameAndDescriptionId(StringIDs::QuartzStairs, StringIDs::UsedForCompactStaircases_1) - ->setBaseItemTypeAndMaterial(16, 45); - Block::registerBlock(156, L"quartz_stairs", quartzStairsBlock); + Block::registerBlock( + 156, L"quartz_stairs", + (new (BlockBootstrapAllocation<0xc0>{}) + StairBlock(quartzBlock->defaultBlockState()->setValue( + QuartzBlock::VARIANT, QuartzBlock::Variant::DEFAULT))) + ->setIconName(L"stairsQuartz") + ->setNameAndDescriptionId(StringIDs::QuartzStairs, StringIDs::UsedForCompactStaircases_1) + ->setBaseItemTypeAndMaterial(16, 45)); // Size: 0xB0u Block::registerBlock(157, L"activator_rail", - (new PoweredRailBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) PoweredRailBlock()) ->setIconName(L"rail_activator") ->setDestroyTime(0.7) ->setSoundType(SoundType::METAL) @@ -2693,7 +2689,7 @@ void Block::staticCtor() { // Size: 0xE8u Block::registerBlock( 158, L"dropper", - (new DropperBlock()) + (new (BlockBootstrapAllocation<0xe8>{}) DropperBlock()) ->setIconName(L"dropper") ->setDestroyTime(3.5) ->setSoundType(SoundType::STONE) @@ -2702,7 +2698,7 @@ void Block::staticCtor() { // Size: 0x128u Block::registerBlock(159, L"stained_hardened_clay", - (new StainedHardenedClayBlock()) + (new (BlockBootstrapAllocation<0x128>{}) StainedHardenedClayBlock()) ->setIconName(L"hardened_clay_stained") ->setDestroyTime(1.25) ->setExplodeable(7.0) @@ -2714,7 +2710,7 @@ void Block::staticCtor() { // Size: 0xE0u Block::registerBlock( 160, L"stained_glass_pane", - (new StainedGlassPaneBlock()) + (new (BlockBootstrapAllocation<0xe0>{}) StainedGlassPaneBlock()) ->setIconName(L"glass") ->setDestroyTime(0.3) ->setSoundType(SoundType::GLASS) @@ -2724,7 +2720,7 @@ void Block::staticCtor() { // Size: 0x110u Block::registerBlock(161, L"leaves2", - (new NewLeafBlock()) + (new (BlockBootstrapAllocation<0x110>{}) NewLeafBlock()) ->setIconName(L"leaves") ->sendBlockData(3) ->setNameAndDescriptionId(StringIDs::Leaves, @@ -2739,28 +2735,26 @@ void Block::staticCtor() { ->setNameAndDescriptionId(StringIDs::Wood, StringIDs::ChoppedUsingAnAxeAndCanBeCrafted)); // Size: 0xC0u - const BlockState* acaciaStairsBlockVariant - = planksBlock->defaultBlockState()->setValue(PlanksBlock::VARIANT, - PlanksBlock::Variant::ACACIA); - Block* acaciaStairsBlock - = (new StairBlock(acaciaStairsBlockVariant)) - ->setIconName(L"stairsWoodAcacia") - ->sendBlockData(15) - ->setNameAndDescriptionId(StringIDs::AcaciaWoodStairs, StringIDs::UsedForCompactStaircases_1) - ->setBaseItemTypeAndMaterial(16, 42); - Block::registerBlock(163, L"acacia_stairs", acaciaStairsBlock); + Block::registerBlock( + 163, L"acacia_stairs", + (new (BlockBootstrapAllocation<0xc0>{}) + StairBlock(planksBlock->defaultBlockState()->setValue( + PlanksBlock::VARIANT, PlanksBlock::Variant::ACACIA))) + ->setIconName(L"stairsWoodAcacia") + ->sendBlockData(15) + ->setNameAndDescriptionId(StringIDs::AcaciaWoodStairs, StringIDs::UsedForCompactStaircases_1) + ->setBaseItemTypeAndMaterial(16, 42)); // Size: 0xC0u - const BlockState* darkOakStairsBlockVariant - = planksBlock->defaultBlockState()->setValue(PlanksBlock::VARIANT, - PlanksBlock::Variant::DARK_OAK); - Block* darkOakStairsBlock - = (new StairBlock(darkOakStairsBlockVariant)) - ->setIconName(L"stairsWoodDarkOak") - ->sendBlockData(15) - ->setNameAndDescriptionId(StringIDs::DarkOakWoodStairs, StringIDs::UsedForCompactStaircases_1) - ->setBaseItemTypeAndMaterial(16, 43); - Block::registerBlock(164, L"dark_oak_stairs", darkOakStairsBlock); + Block::registerBlock( + 164, L"dark_oak_stairs", + (new (BlockBootstrapAllocation<0xc0>{}) + StairBlock(planksBlock->defaultBlockState()->setValue( + PlanksBlock::VARIANT, PlanksBlock::Variant::DARK_OAK))) + ->setIconName(L"stairsWoodDarkOak") + ->sendBlockData(15) + ->setNameAndDescriptionId(StringIDs::DarkOakWoodStairs, StringIDs::UsedForCompactStaircases_1) + ->setBaseItemTypeAndMaterial(16, 43)); // Size: 0xC0u Block::registerBlock(165, L"slime", @@ -2863,14 +2857,14 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock(175, L"double_plant", - (new DoublePlantBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) DoublePlantBlock()) ->setNameAndDescriptionId(StringIDs::DoublePlantBlock, StringIDs::ALargePlant) ->disableMipmap()); // Size: 0xB0u Block::registerBlock( 176, L"standing_banner", - (new StandingBannerBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) StandingBannerBlock()) ->setIconName(L"planks_oak") ->setDestroyTime(1.0) ->setSoundType(SoundType::WOOD) @@ -2881,7 +2875,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock( 177, L"wall_banner", - (new WallBannerBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) WallBannerBlock()) ->setIconName(L"planks_oak") ->setDestroyTime(1.0) ->setSoundType(SoundType::WOOD) @@ -2891,7 +2885,7 @@ void Block::staticCtor() { // Size: 0xD0u Block::registerBlock(178, L"daylight_detector_inverted", - (new DaylightDetectorBlock(true)) + (new (BlockBootstrapAllocation<0xd0>{}) DaylightDetectorBlock(true)) ->setIconName(L"daylight_detector") ->setNameAndDescriptionId(StringIDs::DaylightSensor, StringIDs::ABlockThatOutputsARedstoneSignalBased)); @@ -2908,19 +2902,18 @@ void Block::staticCtor() { Block::registerBlock(179, L"red_sandstone", redSandStoneBlock); // Size: 0xC0u - const BlockState* redSandstoneStairsBlockVariant - = redSandStoneBlock->defaultBlockState()->setValue( - RedSandStoneBlock::TYPE, RedSandStoneBlock::Variant::DEFAULT); - Block* redSandstoneStairsBlock - = (new StairBlock(redSandstoneStairsBlockVariant)) - ->setIconName(L"red_sandstone") - ->setNameAndDescriptionId(StringIDs::RedSandstoneStairs, StringIDs::UsedForCompactStaircases_2) - ->setBaseItemTypeAndMaterial(16, 48); - Block::registerBlock(180, L"red_sandstone_stairs", redSandstoneStairsBlock); + Block::registerBlock( + 180, L"red_sandstone_stairs", + (new (BlockBootstrapAllocation<0xc0>{}) + StairBlock(redSandStoneBlock->defaultBlockState()->setValue( + RedSandStoneBlock::TYPE, RedSandStoneBlock::Variant::DEFAULT))) + ->setIconName(L"red_sandstone") + ->setNameAndDescriptionId(StringIDs::RedSandstoneStairs, StringIDs::UsedForCompactStaircases_2) + ->setBaseItemTypeAndMaterial(16, 48)); // Size: 0xB0u Block::registerBlock(181, L"double_stone_slab2", - (new FullNewStoneSlabBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) FullNewStoneSlabBlock()) ->setIconName(L"double_stone_slab2") ->setDestroyTime(2.0) ->setExplodeable(10.0) @@ -2931,7 +2924,7 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock(182, L"stone_slab2", - (new HalfNewStoneSlabBlock()) + (new (BlockBootstrapAllocation<0xb0>{}) HalfNewStoneSlabBlock()) ->setIconName(L"stone_slab2") ->setDestroyTime(2.0) ->setExplodeable(10.0) @@ -2942,7 +2935,8 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock(183, L"spruce_fence_gate", - (new FenceGateBlock(L"planks_spruce", PlanksBlock::Variant::SPRUCE)) + (new (BlockBootstrapAllocation<0xc0>{}) + FenceGateBlock(L"planks_spruce", PlanksBlock::Variant::SPRUCE)) ->setIconName(L"fenceGate") ->setDestroyTime(2.0) ->setExplodeable(5.0) @@ -2953,20 +2947,22 @@ void Block::staticCtor() { ->setBaseItemTypeAndMaterial(47, 39)); // Size: 0xC0u - Block::registerBlock(184, L"birch_fence_gate", - (new FenceGateBlock(L"planks_birch", PlanksBlock::Variant::BIRCH)) - ->setIconName(L"fenceGate") - ->setDestroyTime(2.0) - ->setExplodeable(5.0) - ->setSoundType(SoundType::WOOD) - ->sendBlockData(15) - ->setNameAndDescriptionId(StringIDs::BirchFenceGate, - StringIDs::SimilarToADoorButUsedPrimarilyWithFences) - ->setBaseItemTypeAndMaterial(47, 40)); + Block::registerBlock( + 184, L"birch_fence_gate", + (new (BlockBootstrapAllocation<0xc0>{}) FenceGateBlock(L"planks_birch", PlanksBlock::Variant::BIRCH)) + ->setIconName(L"fenceGate") + ->setDestroyTime(2.0) + ->setExplodeable(5.0) + ->setSoundType(SoundType::WOOD) + ->sendBlockData(15) + ->setNameAndDescriptionId(StringIDs::BirchFenceGate, + StringIDs::SimilarToADoorButUsedPrimarilyWithFences) + ->setBaseItemTypeAndMaterial(47, 40)); // Size: 0xC0u Block::registerBlock(185, L"jungle_fence_gate", - (new FenceGateBlock(L"planks_jungle", PlanksBlock::Variant::JUNGLE)) + (new (BlockBootstrapAllocation<0xc0>{}) + FenceGateBlock(L"planks_jungle", PlanksBlock::Variant::JUNGLE)) ->setIconName(L"fenceGate") ->setDestroyTime(2.0) ->setExplodeable(5.0) @@ -2978,7 +2974,8 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock(186, L"dark_oak_fence_gate", - (new FenceGateBlock(L"planks_big_oak", PlanksBlock::Variant::DARK_OAK)) + (new (BlockBootstrapAllocation<0xc0>{}) + FenceGateBlock(L"planks_big_oak", PlanksBlock::Variant::DARK_OAK)) ->setIconName(L"fenceGate") ->setDestroyTime(2.0) ->setExplodeable(5.0) @@ -2990,7 +2987,8 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock(187, L"acacia_fence_gate", - (new FenceGateBlock(L"planks_acacia", PlanksBlock::Variant::ACACIA)) + (new (BlockBootstrapAllocation<0xc0>{}) + FenceGateBlock(L"planks_acacia", PlanksBlock::Variant::ACACIA)) ->setIconName(L"fenceGate") ->setDestroyTime(2.0) ->setExplodeable(5.0) @@ -3003,7 +3001,8 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 188, L"spruce_fence", - (new FenceBlock(L"planks_spruce", Material::WOOD, PlanksBlock::Variant::SPRUCE->getMaterialColor())) + (new (BlockBootstrapAllocation<0xc0>{}) + FenceBlock(L"planks_spruce", Material::WOOD, PlanksBlock::Variant::SPRUCE->getMaterialColor())) ->setDestroyTime(2.0) ->setExplodeable(5.0) ->setSoundType(SoundType::WOOD) @@ -3013,7 +3012,8 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 189, L"birch_fence", - (new FenceBlock(L"planks_birch", Material::WOOD, PlanksBlock::Variant::BIRCH->getMaterialColor())) + (new (BlockBootstrapAllocation<0xc0>{}) + FenceBlock(L"planks_birch", Material::WOOD, PlanksBlock::Variant::BIRCH->getMaterialColor())) ->setDestroyTime(2.0) ->setExplodeable(5.0) ->setSoundType(SoundType::WOOD) @@ -3023,7 +3023,8 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 190, L"jungle_fence", - (new FenceBlock(L"planks_jungle", Material::WOOD, PlanksBlock::Variant::JUNGLE->getMaterialColor())) + (new (BlockBootstrapAllocation<0xc0>{}) + FenceBlock(L"planks_jungle", Material::WOOD, PlanksBlock::Variant::JUNGLE->getMaterialColor())) ->setDestroyTime(2.0) ->setExplodeable(5.0) ->setSoundType(SoundType::WOOD) @@ -3033,8 +3034,8 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 191, L"dark_oak_fence", - (new FenceBlock(L"planks_big_oak", Material::WOOD, - PlanksBlock::Variant::DARK_OAK->getMaterialColor())) + (new (BlockBootstrapAllocation<0xc0>{}) FenceBlock( + L"planks_big_oak", Material::WOOD, PlanksBlock::Variant::DARK_OAK->getMaterialColor())) ->setDestroyTime(2.0) ->setExplodeable(5.0) ->setSoundType(SoundType::WOOD) @@ -3044,7 +3045,8 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 192, L"acacia_fence", - (new FenceBlock(L"planks_acacia", Material::WOOD, PlanksBlock::Variant::ACACIA->getMaterialColor())) + (new (BlockBootstrapAllocation<0xc0>{}) + FenceBlock(L"planks_acacia", Material::WOOD, PlanksBlock::Variant::ACACIA->getMaterialColor())) ->setDestroyTime(2.0) ->setExplodeable(5.0) ->setSoundType(SoundType::WOOD) @@ -3053,7 +3055,7 @@ void Block::staticCtor() { // Size: 0xC8u Block::registerBlock(193, L"spruce_door", - (new DoorBlock(Material::WOOD)) + (new (BlockBootstrapAllocation<0xc8>{}) DoorBlock(Material::WOOD)) ->setIconName(L"door_spruce") ->setDestroyTime(3.0) ->setSoundType(SoundType::WOOD) @@ -3064,7 +3066,7 @@ void Block::staticCtor() { // Size: 0xC8u Block::registerBlock(194, L"birch_door", - (new DoorBlock(Material::WOOD)) + (new (BlockBootstrapAllocation<0xc8>{}) DoorBlock(Material::WOOD)) ->setIconName(L"door_birch") ->setDestroyTime(3.0) ->setSoundType(SoundType::WOOD) @@ -3075,7 +3077,7 @@ void Block::staticCtor() { // Size: 0xC8u Block::registerBlock(195, L"jungle_door", - (new DoorBlock(Material::WOOD)) + (new (BlockBootstrapAllocation<0xc8>{}) DoorBlock(Material::WOOD)) ->setIconName(L"door_jungle") ->setDestroyTime(3.0) ->setSoundType(SoundType::WOOD) @@ -3086,7 +3088,7 @@ void Block::staticCtor() { // Size: 0xC8u Block::registerBlock(196, L"acacia_door", - (new DoorBlock(Material::WOOD)) + (new (BlockBootstrapAllocation<0xc8>{}) DoorBlock(Material::WOOD)) ->setIconName(L"door_acacia") ->setDestroyTime(3.0) ->setSoundType(SoundType::WOOD) @@ -3097,7 +3099,7 @@ void Block::staticCtor() { // Size: 0xC8u Block::registerBlock(197, L"dark_oak_door", - (new DoorBlock(Material::WOOD)) + (new (BlockBootstrapAllocation<0xc8>{}) DoorBlock(Material::WOOD)) ->setIconName(L"door_dark_oak") ->setDestroyTime(3.0) ->setSoundType(SoundType::WOOD) @@ -3129,7 +3131,7 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock( 200, L"chorus_flower", - (new ChorusFlowerBlock()) + (new (BlockBootstrapAllocation<0xc0>{}) ChorusFlowerBlock()) ->setIconName(L"chorus_flower") ->setDestroyTime(0.4) ->setSoundType(SoundType::WOOD) @@ -3149,7 +3151,8 @@ void Block::staticCtor() { // Size: 0xC8u Block::registerBlock( 202, L"purpur_pillar", - (new RotatedPillarBlockImpl(Material::STONE, MaterialColor::COLOR_MAGENTA)) + (new (BlockBootstrapAllocation<0xc8>{}) + RotatedPillarBlockImpl(Material::STONE, MaterialColor::COLOR_MAGENTA)) ->setIconTopName(L"purpur_pillar_top") // TODO ->setIconName(L"purpur_pillar") ->setDestroyTime(1.5) @@ -3160,7 +3163,7 @@ void Block::staticCtor() { // Size: 0xC0u Block::registerBlock(203, L"purpur_stairs", - (new StairBlock(purpurBlock->defaultBlockState())) + (new (BlockBootstrapAllocation<0xc0>{}) StairBlock(purpurBlock->defaultBlockState())) ->setNameAndDescriptionId(StringIDs::PurpurStairs, 0xdda0c93) ->setBaseItemTypeAndMaterial(16, 62)); @@ -3199,7 +3202,7 @@ void Block::staticCtor() { // Size: 0x110u Block::registerBlock( 207, L"beetroots", - (new BeetrootBlock()) + (new (BlockBootstrapAllocation<0x110>{}) BeetrootBlock()) ->setIconName(L"beetroots") ->disableMipmap() ->setNameAndDescriptionId(StringIDs::Beetroots, @@ -3207,7 +3210,7 @@ void Block::staticCtor() { // Size: 0xB0u Block* grassPathBlock - = (new GrassPathBlock()) + = (new (BlockBootstrapAllocation<0xb0>{}) GrassPathBlock()) ->setDestroyTime(0.65) ->setSoundType(SoundType::GRASS) ->setIconName(L"grass_path") @@ -3218,9 +3221,9 @@ void Block::staticCtor() { // Size: 0xB0u Block::registerBlock( 209, L"end_gateway", - (new EndGatewayBlock(Material::PORTAL)) + (new (BlockBootstrapAllocation<0xb0>{}) EndGatewayBlock(Material::PORTAL)) ->setIconName(L"stone") - ->setDestroyTime(3.4028e38) + ->setDestroyTime(3.4028234663852886e38f) ->setExplodeable(6000000.0) ->setNameAndDescriptionId(StringIDs::EndGateway, StringIDs::GeneratedWhenEnderDragonIsKilledThrowingAn)); @@ -3228,7 +3231,7 @@ void Block::staticCtor() { // Size: 0xD8u Block::registerBlock( 212, L"frosted_ice", - (new FrostedIceBlock()) + (new (BlockBootstrapAllocation<0xd8>{}) FrostedIceBlock()) ->setDestroyTime(0.5) ->setLightBlock(3) ->setSoundType(SoundType::GLASS) @@ -3281,14 +3284,14 @@ void Block::staticCtor() { // Size: 0xD0u Block::registerBlock(218, L"observer", - (new ObserverBlock()) + (new (BlockBootstrapAllocation<0xd0>{}) ObserverBlock()) ->setDestroyTime(3.0) ->setNameAndDescriptionId(StringIDs::Observer, StringIDs::EmitsARedstoneSignalWhenAdjacentBlocksAre)); // Size: 0xB8u Block::registerBlock(219, L"white_shulker_box", - (new ShulkerBoxBlock(DyeColor::WHITE)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::WHITE)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3298,7 +3301,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock(220, L"orange_shulker_box", - (new ShulkerBoxBlock(DyeColor::ORANGE)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::ORANGE)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3308,7 +3311,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock(221, L"magenta_shulker_box", - (new ShulkerBoxBlock(DyeColor::MAGENTA)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::MAGENTA)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3318,7 +3321,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock(222, L"light_blue_shulker_box", - (new ShulkerBoxBlock(DyeColor::LIGHT_BLUE)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::LIGHT_BLUE)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3328,7 +3331,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock(223, L"yellow_shulker_box", - (new ShulkerBoxBlock(DyeColor::YELLOW)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::YELLOW)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3339,7 +3342,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock( 224, L"lime_shulker_box", - (new ShulkerBoxBlock(DyeColor::LIME)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::LIME)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3349,7 +3352,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock( 225, L"pink_shulker_box", - (new ShulkerBoxBlock(DyeColor::PINK)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::PINK)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3359,7 +3362,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock( 226, L"gray_shulker_box", - (new ShulkerBoxBlock(DyeColor::GRAY)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::GRAY)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3368,7 +3371,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock(227, L"silver_shulker_box", - (new ShulkerBoxBlock(DyeColor::SILVER)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::SILVER)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3379,7 +3382,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock( 228, L"cyan_shulker_box", - (new ShulkerBoxBlock(DyeColor::CYAN)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::CYAN)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3388,7 +3391,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock(229, L"purple_shulker_box", - (new ShulkerBoxBlock(DyeColor::PURPLE)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::PURPLE)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3399,7 +3402,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock( 230, L"blue_shulker_box", - (new ShulkerBoxBlock(DyeColor::BLUE)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::BLUE)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3408,7 +3411,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock(231, L"brown_shulker_box", - (new ShulkerBoxBlock(DyeColor::BROWN)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::BROWN)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3418,7 +3421,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock(232, L"green_shulker_box", - (new ShulkerBoxBlock(DyeColor::GREEN)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::GREEN)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3429,7 +3432,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock( 233, L"red_shulker_box", - (new ShulkerBoxBlock(DyeColor::RED)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::RED)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3439,7 +3442,7 @@ void Block::staticCtor() { // Size: 0xB8u Block::registerBlock( 234, L"black_shulker_box", - (new ShulkerBoxBlock(DyeColor::BLACK)) + (new (BlockBootstrapAllocation<0xb8>{}) ShulkerBoxBlock(DyeColor::BLACK)) ->setIconName(L"shulker_top") ->setDestroyTime(2.0) ->setSoundType(SoundType::STONE) @@ -3570,7 +3573,7 @@ void Block::staticCtor() { // Size: 0x128u Block::registerBlock( 251, L"concrete", - (new ColoredBlock(Material::STONE)) + (new (BlockBootstrapAllocation<0x128>{}) ColoredBlock(Material::STONE)) ->setDestroyTime(1.8) ->setSoundType(SoundType::STONE) ->setIconName(L"concrete") @@ -3578,7 +3581,7 @@ void Block::staticCtor() { // Size: 0x128u Block::registerBlock(252, L"concrete_powder", - (new ConcretePowderBlock()) + (new (BlockBootstrapAllocation<0x128>{}) ConcretePowderBlock()) ->setDestroyTime(0.5) ->setSoundType(SoundType::SAND) ->setIconName(L"concrete_powder") @@ -3602,8 +3605,9 @@ void Block::staticCtor() { } else { StairBlock* s = dynamic_cast(block); HalfSlabBlock* b = dynamic_cast(block); - if (block == farmBlock || block == grassPathBlock || !s || b) - block->m_field3C = block->m_lightEmission == 0 || block->m_isBlocksLight; + // The original uses opacity here; emission is a separate field. + if (block != farmBlock && block != grassPathBlock && !s && !b) + block->m_field3C = block->m_lightBlock == 0 || block->m_isBlocksLight; else block->m_field3C = 1; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/Block.h b/src/Minecraft.World/net/minecraft/world/level/block/Block.h index a023fa19..f87d0eb1 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/Block.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/Block.h @@ -217,6 +217,7 @@ class Block { Material* getMaterial(); int getId(); + static int getId(Block*); bool neighbourVisibleThroughShapes(const arrayWithLength*, LevelSource*, const BlockPos&, const Direction*); diff --git a/src/Minecraft.World/net/minecraft/world/level/block/BlockBootstrapAllocation.h b/src/Minecraft.World/net/minecraft/world/level/block/BlockBootstrapAllocation.h new file mode 100644 index 00000000..54f76312 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/block/BlockBootstrapAllocation.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include + +// Several block declarations still expose only their reconstructed prefix. +// Keep the original initializer's allocation size without inventing fields or +// changing those partial class layouts. Placement-new retains allocation before +// constructor argument evaluation, as in the original new expression. +template +struct BlockBootstrapAllocation {}; + +template +inline __attribute__((always_inline)) void* operator new(std::size_t declaredSize, + BlockBootstrapAllocation) { + return ::operator new(OriginalSize); +} + +template +inline void operator delete(void* pointer, BlockBootstrapAllocation) noexcept { + ::operator delete(pointer); +} diff --git a/src/Minecraft.World/net/minecraft/world/level/block/Blocks.h b/src/Minecraft.World/net/minecraft/world/level/block/Blocks.h index b48fce2e..f8a415ed 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/Blocks.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/Blocks.h @@ -20,6 +20,7 @@ class Blocks { static void staticInit(); static Block* get(const std::wstring&); + static Block* byString(const std::wstring&); static inline Block* AIR; static inline Block* STONE; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/CactusBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/CactusBlock.h index 8b28cf17..b3a21a1c 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/CactusBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/CactusBlock.h @@ -1,8 +1,9 @@ -#pragma once - -#include "net/minecraft/world/level/block/Block.h" - -class CactusBlock : public Block { -public: - CactusBlock(); -}; +#pragma once + +#include "net/minecraft/world/level/block/Block.h" + +class CactusBlock : public Block { +public: + CactusBlock(); + virtual bool canSurvive(Level*, const BlockPos&); +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/ChestBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/ChestBlock.h index 550daf3b..1903c70f 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/ChestBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/ChestBlock.h @@ -5,6 +5,7 @@ class ChestBlock : public Block { public: ChestBlock(bool trapped); + const BlockState* reorient(Level*, const BlockPos&, const BlockState*); static void blockStaticCtor(); }; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/ChorusFlowerBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/ChorusFlowerBlock.h index 26e258ac..ed7b58fd 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/ChorusFlowerBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/ChorusFlowerBlock.h @@ -1,8 +1,9 @@ -#pragma once - -#include "net/minecraft/world/level/block/Block.h" - -class ChorusFlowerBlock : public Block { -public: - ChorusFlowerBlock(); -}; +#pragma once + +#include "net/minecraft/world/level/block/Block.h" + +class ChorusFlowerBlock : public Block { +public: + static void generatePlant(Level*, BlockPos, Random*, int); + ChorusFlowerBlock(); +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/CocoaBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/CocoaBlock.h index a432208c..12e5472e 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/CocoaBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/CocoaBlock.h @@ -1,13 +1,14 @@ -#pragma once - -#include "net/minecraft/world/level/block/BonemealableBlock.h" -#include "net/minecraft/world/level/block/HorizontalDirectionalBlock.h" - -class CocoaBlock : public HorizontalDirectionalBlock, public BonemealableBlock { -public: - CocoaBlock(); - - bool isValidBonemealTarget(Level*, const BlockPos&, const BlockState*, bool) override; - bool isBonemealSuccess(Level*, Random*, const BlockPos&, const BlockState*) override; - void performBonemeal(Level*, Random*, const BlockPos&, const BlockState*) override; -}; +#pragma once + +#include "net/minecraft/world/level/block/BonemealableBlock.h" +#include "net/minecraft/world/level/block/HorizontalDirectionalBlock.h" + +class CocoaBlock : public HorizontalDirectionalBlock, public BonemealableBlock { +public: + static Property* AGE; + CocoaBlock(); + + bool isValidBonemealTarget(Level*, const BlockPos&, const BlockState*, bool) override; + bool isBonemealSuccess(Level*, Random*, const BlockPos&, const BlockState*) override; + void performBonemeal(Level*, Random*, const BlockPos&, const BlockState*) override; +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/ColoredBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/ColoredBlock.h index 50e5b4a1..6850ba05 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/ColoredBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/ColoredBlock.h @@ -4,6 +4,7 @@ class ColoredBlock : public Block { public: + static Property* COLOR; ColoredBlock(Material*); static void blockStaticCtor(); diff --git a/src/Minecraft.World/net/minecraft/world/level/block/DoublePlantBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/DoublePlantBlock.h index e1632fc5..64c89707 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/DoublePlantBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/DoublePlantBlock.h @@ -1,10 +1,31 @@ #pragma once +#include "net/minecraft/core/StringRepresentable.h" #include "net/minecraft/world/level/block/Block.h" class DoublePlantBlock : public Block { public: + class Variant : public StringRepresentable { + public: + static Variant* FERN; + static Variant* GRASS; + static Variant* SUNFLOWER; + static Variant* SYRINGA; + static Variant* ROSE; + static Variant* PAEONIA; + static inline Variant* VARIANTS[6]; + static Variant* byData(int data) { return VARIANTS[static_cast(data) > 5 ? 0 : data]; } + int getNameId() { return m_nameId; } + int getDescriptionId() { return m_descriptionId; } + + int m_data; + std::wstring m_name; + int m_nameId; + int m_descriptionId; + }; + DoublePlantBlock(); + void placeAt(Level*, const BlockPos&, Variant*, int); static void blockStaticCtor(); }; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/EndGatewayBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/EndGatewayBlock.h index 975f10f5..6017af17 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/EndGatewayBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/EndGatewayBlock.h @@ -1,8 +1,10 @@ -#pragma once - -#include "net/minecraft/world/level/block/Block.h" - -class EndGatewayBlock : public BaseEntityBlock { -public: - EndGatewayBlock(Material*); -}; +#pragma once + +#include "net/minecraft/world/level/block/BaseEntityBlock.h" +#include "net/minecraft/world/level/block/state/IntegerProperty.h" + +class EndGatewayBlock : public BaseEntityBlock { +public: + static IntegerProperty* FJ_PORTAL_NUMBER; + EndGatewayBlock(Material*); +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/FlowerBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/FlowerBlock.h index 429402f1..81ce2f48 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/FlowerBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/FlowerBlock.h @@ -6,7 +6,10 @@ class FlowerBlock : public Bush, public BonemealableBlock { public: - class FlowerCategory; + class FlowerCategory { + public: + FlowerBlock* getBlock(); + }; class FlowerCategoryPredicate; class Flower { public: @@ -14,6 +17,14 @@ class FlowerBlock : public Bush, public BonemealableBlock { static Flower* RED_FLOWER; static Flower* RED_MUSHROOM; static Flower* BROWN_MUSHROOM; + static Flower* OXEYE_DAISY; + static Flower* BLUE_ORCHID; + static Flower* HOUSTONIA; + static Flower* RED_TULIP; + static Flower* ORANGE_TULIP; + static Flower* WHITE_TULIP; + static Flower* PINK_TULIP; + static Flower* FLOWERS[10]; enum EFlower {}; @@ -21,9 +32,18 @@ class FlowerBlock : public Bush, public BonemealableBlock { FlowerBlock::Flower::EFlower); void* m_field0; + FlowerCategory* getCategory() const; + int getData(); + int getNameId(); + int getDescriptionId(); + int m_field8; + int m_field12; + int m_data; }; virtual FlowerBlock::FlowerCategory* getFlowerCategory() = 0; - virtual void getFlowerProperty(); + virtual Property* getFlowerProperty(); + + Property* m_flowerProperty; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/HalfSlabBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/HalfSlabBlock.h index 413356f6..94666f1f 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/HalfSlabBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/HalfSlabBlock.h @@ -53,7 +53,7 @@ class HalfSlabBlock : public Block { bool isSolidRender(const BlockState*) const override; int getResourceCount(Random*) override; const BlockState* getStateForPlacement(Level*, const BlockPos&, const Direction*, float, float, float, - int, std::__1::shared_ptr) override; + int, std::shared_ptr) override; bool isSilkTouchable() override; virtual std::wstring getAuxName(int aux) = 0; virtual bool isFullSize() const = 0; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/HorizontalDirectionalBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/HorizontalDirectionalBlock.h index 77a4a29e..843c570c 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/HorizontalDirectionalBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/HorizontalDirectionalBlock.h @@ -9,4 +9,5 @@ class HorizontalDirectionalBlock : public Block { static void blockStaticCtor(); static EnumProperty* AXIS; + static Property* FACING; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/HugeMushroomBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/HugeMushroomBlock.h index 220150ff..bf3abb94 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/HugeMushroomBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/HugeMushroomBlock.h @@ -4,6 +4,20 @@ class HugeMushroomBlock : public Block { public: + class Variant { + public: + static Variant* byData(int); + static Variant* NORTH_WEST; + static Variant* NORTH_EAST; + static Variant* SOUTH_WEST; + static Variant* SOUTH_EAST; + static Variant* CENTER; + static Variant* ALL_INSIDE; + static Variant* STEM; + }; + + static Property* VARIANT; + HugeMushroomBlock(Material*, const MaterialColor*, Block*); static void blockStaticCtor(); diff --git a/src/Minecraft.World/net/minecraft/world/level/block/NewLeafBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/NewLeafBlock.h index 9eacf59c..da97518e 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/NewLeafBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/NewLeafBlock.h @@ -1,9 +1,12 @@ #pragma once #include "net/minecraft/world/level/block/LeafBlock.h" +#include "net/minecraft/world/level/block/PlanksBlock.h" +#include "net/minecraft/world/level/block/state/EnumProperty.h" class NewLeafBlock : public LeafBlock { public: + static EnumProperty* VARIANT; NewLeafBlock(); static void blockStaticCtor(); diff --git a/src/Minecraft.World/net/minecraft/world/level/block/OldLeafBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/OldLeafBlock.h index aabba62d..ccbbcbbd 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/OldLeafBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/OldLeafBlock.h @@ -1,9 +1,11 @@ #pragma once #include "net/minecraft/world/level/block/LeafBlock.h" +#include "net/minecraft/world/level/block/PlanksBlock.h" class OldLeafBlock : public LeafBlock { public: + static EnumProperty* VARIANT; OldLeafBlock(); static void blockStaticCtor(); diff --git a/src/Minecraft.World/net/minecraft/world/level/block/OreBlock.cpp b/src/Minecraft.World/net/minecraft/world/level/block/OreBlock.cpp index ded354b1..92a3c2b6 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/OreBlock.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/block/OreBlock.cpp @@ -59,7 +59,7 @@ void OreBlock::spawnResources(Level* level, const BlockPos& pos, const BlockStat int OreBlock::getResourceCountForLootBonus(int fortuneLevel, Random* random) { if (fortuneLevel > 0 && Item::byBlock(this) - != this->getResource(this->getBlockStateDefinition()->getPossibleBlockStates()->get(0), random, + != this->getResource((*this->getBlockStateDefinition()->getPossibleBlockStates())[0], random, fortuneLevel)) { int i = random->nextInt(fortuneLevel + 2) - 1; if (i < 0) { diff --git a/src/Minecraft.World/net/minecraft/world/level/block/PlanksBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/PlanksBlock.h index 987fa049..9df23468 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/PlanksBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/PlanksBlock.h @@ -33,6 +33,7 @@ class PlanksBlock : public Block { } int getData() { return this->m_data; } + int getNameId() { return this->m_nameId; } const MaterialColor* getMaterialColor() { return this->m_materialColor; } std::wstring toString() const override { return this->m_name; } diff --git a/src/Minecraft.World/net/minecraft/world/level/block/RedSandStoneBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/RedSandStoneBlock.h index f663f30a..83472045 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/RedSandStoneBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/RedSandStoneBlock.h @@ -28,6 +28,7 @@ class RedSandStoneBlock : public Block { } int getData() { return this->m_data; } + int getNameId() { return this->m_nameId; } std::wstring toString() const override { return this->m_name; } std::wstring getSerializedName() const override { return this->m_name; } diff --git a/src/Minecraft.World/net/minecraft/world/level/block/SandBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/SandBlock.h index 0ff2ded5..11f8194d 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/SandBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/SandBlock.h @@ -32,6 +32,8 @@ class SandBlock : public FallingBlock { } int getData() { return this->m_data; } + int getNameId() { return this->m_nameId; } + int getDescriptionId() { return this->m_descId; } std::wstring getName() { return this->m_name; } const MaterialColor* getMaterialColor() { return this->m_materialColor; } int getDustColor() { return this->m_dustColor; } diff --git a/src/Minecraft.World/net/minecraft/world/level/block/SandStoneBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/SandStoneBlock.h index 1152ab95..bab82443 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/SandStoneBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/SandStoneBlock.h @@ -27,6 +27,7 @@ class SandStoneBlock : public Block { } int getData() { return this->m_data; } + int getNameId() { return this->m_nameId; } std::wstring toString() const override { return this->m_name; } std::wstring getSerializedName() const override { return this->m_name; } diff --git a/src/Minecraft.World/net/minecraft/world/level/block/SoundType.h b/src/Minecraft.World/net/minecraft/world/level/block/SoundType.h index 65ce03c0..cb41a51d 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/SoundType.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/SoundType.h @@ -22,11 +22,16 @@ class SoundType { SoundType(float volume, float pitch, const SoundEvent* dig, const SoundEvent* step, const SoundEvent* place, const SoundEvent* hit, const SoundEvent* fall); + const SoundEvent* getBreakSound(); + const SoundEvent* getStepSound(); + const SoundEvent* getHitSound(); + const SoundEvent* getFallSound(); + float m_volume; float m_pitch; - SoundEvent* m_digSound; - SoundEvent* m_stepSound; - SoundEvent* m_placeSound; - SoundEvent* m_hitSound; - SoundEvent* m_fallSound; + const SoundEvent* m_digSound; + const SoundEvent* m_stepSound; + const SoundEvent* m_placeSound; + const SoundEvent* m_hitSound; + const SoundEvent* m_fallSound; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/SpongeBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/SpongeBlock.h index 3b8e272a..4330169f 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/SpongeBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/SpongeBlock.h @@ -1,8 +1,11 @@ -#pragma once - -#include "net/minecraft/world/level/block/Block.h" - -class SpongeBlock : public Block { -public: - SpongeBlock(); -}; +#pragma once + +#include "net/minecraft/world/level/block/Block.h" + +class BooleanProperty; + +class SpongeBlock : public Block { +public: + SpongeBlock(); + static BooleanProperty* WET; +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/StoneSlabBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/StoneSlabBlock.h index 079b9960..8c800073 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/StoneSlabBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/StoneSlabBlock.h @@ -1,8 +1,17 @@ #pragma once +#include "net/minecraft/core/StringRepresentable.h" #include "net/minecraft/world/level/block/Block.h" +#include "net/minecraft/world/level/block/state/EnumProperty.h" class StoneSlabBlock : public Block { public: + // Variant interface only; catalogue layout and construction remain unreconstructed. + class Variant : public StringRepresentable { + public: + static Variant* SANDSTONE; + }; + + static EnumProperty* VARIANT; static void blockStaticCtor(); }; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/TallGrassBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/TallGrassBlock.h index 207120ed..f627212d 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/TallGrassBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/TallGrassBlock.h @@ -1,10 +1,18 @@ #pragma once -#include "net/minecraft/world/level/block/Block.h" +#include "net/minecraft/world/level/block/Bush.h" -class TallGrassBlock : public Block { +class TallGrassBlock : public Bush { public: + class Variant { + public: + static Variant* GRASS; + static Variant* FERN; + }; + TallGrassBlock(); static void blockStaticCtor(); + + static Property* TYPE; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/TorchBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/TorchBlock.h index e69cbbcf..1c99fc7f 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/TorchBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/TorchBlock.h @@ -4,6 +4,7 @@ class TorchBlock : public Block { public: + static Property* FACING; TorchBlock(); static void blockStaticCtor(); diff --git a/src/Minecraft.World/net/minecraft/world/level/block/VineBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/VineBlock.h index 4274adad..18681488 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/VineBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/VineBlock.h @@ -1,8 +1,14 @@ -#pragma once - -#include "net/minecraft/world/level/block/Block.h" - -class VineBlock : public Block { -public: - VineBlock(); -}; +#pragma once + +#include "net/minecraft/world/level/block/Block.h" + +class BooleanProperty; + +class VineBlock : public Block { +public: + static BooleanProperty* EAST; + static BooleanProperty* WEST; + static BooleanProperty* SOUTH; + static BooleanProperty* NORTH; + VineBlock(); +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/WallBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/WallBlock.h index bcf900df..93706caa 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/WallBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/WallBlock.h @@ -1,9 +1,21 @@ #pragma once +#include "net/minecraft/core/StringRepresentable.h" #include "net/minecraft/world/level/block/Block.h" class WallBlock : public Block { public: + class Variant : public StringRepresentable { + public: + static inline Variant* VARIANTS[2]; + static Variant* byData(int data) { return VARIANTS[static_cast(data) > 1 ? 0 : data]; } + int getNameId() { return m_nameId; } + + int m_data; + std::wstring m_name; + int m_nameId; + }; + WallBlock(Block*); static void blockStaticCtor(); diff --git a/src/Minecraft.World/net/minecraft/world/level/block/state/BlockStateDefinition.h b/src/Minecraft.World/net/minecraft/world/level/block/state/BlockStateDefinition.h index 7faacad3..1b910af0 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/state/BlockStateDefinition.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/state/BlockStateDefinition.h @@ -3,6 +3,7 @@ #include "net/minecraft/world/ArrayWithLength.h" #include "net/minecraft/world/level/block/state/BlockState.h" #include "net/minecraft/world/level/block/state/properties/AbstractProperty.h" +#include #include class Block; @@ -72,14 +73,19 @@ class BlockStateDefinition { void _init(Block* block, const Property** properties, unsigned int propertiesCount); - Block* getBlock(); + Block* getBlock() const; + const std::vector& getProperties() const; + bool hasProperty(const Property*) const; + Boxed* getPropertyValue(const Property*, unsigned short state) const; + // Property must belong to this definition's encoded state table. + const BlockState* getNeighbour(const Property*, Boxed*, unsigned short state) const; const BlockState* any(); - arrayWithLength* getPossibleBlockStates() { return &this->m_states; } + const arrayWithLength* getPossibleBlockStates() const; private: Block* m_block; std::vector m_properties; arrayWithLength m_states; - void** m_propertiesArr; // this is array - void** m_anotherProperties; // this is also array + std::uint8_t* m_propertyBitOffsets; + std::uint16_t* m_propertyBitMasks; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/state/properties/AbstractProperty.h b/src/Minecraft.World/net/minecraft/world/level/block/state/properties/AbstractProperty.h index 29adffb1..2eef33a3 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/state/properties/AbstractProperty.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/state/properties/AbstractProperty.h @@ -20,6 +20,7 @@ class Predicate { template class Predicates { public: + static Predicate* equalTo(T value) { return new EqualToValuePredicate(value); } // TODO: impl those, and check if those below are correctly declared class ConnectivePredicate : public Predicate { bool apply(T) const override; @@ -46,7 +47,13 @@ class Predicates { bool m_constValue; // I guess it's bool, could be union; if you find possiblity of it, do it }; class EqualToValuePredicate : public Predicate { - bool apply(T) const override; + public: + EqualToValuePredicate(T value) : m_value(value) {} + + bool apply(T value) const override { return m_value == value; } + + private: + T m_value; }; }; @@ -110,7 +117,10 @@ class AbstractProperty : public Property { return this->m_name == otherCasted->m_name; } // TODO: this is wrong as hell btw !!!!! - int hashCode() const override { return 31 * (size_t)this->m_typeInfo + javaStringHashCode(this->m_name); } + int hashCode() const override { + return 31 * static_cast(reinterpret_cast(this->m_typeInfo)) + + static_cast(javaStringHashCode(this->m_name)); + } virtual T getUnboxedValue(const std::wstring&) const = 0; virtual std::wstring getName(const T&) const = 0; diff --git a/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkGenerator.h b/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkGenerator.h index f259aed9..3d27b537 100644 --- a/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkGenerator.h +++ b/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkGenerator.h @@ -17,13 +17,14 @@ class ChunkGenerator { static const std::wstring VILLAGE_NAME; static const std::wstring MINESHAFT_NAME; static const std::wstring TEMPLE_NAME; + static const std::wstring END_CITY_NAME; ChunkGenerator() {} virtual ~ChunkGenerator(); virtual LevelChunk* createChunk(int, int) = 0; virtual void postProcess(int, int) = 0; virtual bool postProcessLoadedChunk(LevelChunk*, int, int) = 0; - virtual std::vector* getMobsAt(MobCategory*, const BlockPos&) = 0; + virtual std::vector* getMobsAt(MobCategory*, const BlockPos&) = 0; virtual BlockPos* findNearestMapFeature(Level*, const std::wstring&, const BlockPos&, bool) = 0; virtual void recreateLogicStructuresForChunk(LevelChunk*, int, int) = 0; virtual bool isPosInFeature(Level*, const std::wstring&, const BlockPos&) = 0; diff --git a/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkSource.h b/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkSource.h index f6f520af..9c71b77a 100644 --- a/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkSource.h +++ b/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkSource.h @@ -32,7 +32,7 @@ class ChunkSource { virtual bool shouldSave() = 0; virtual ChunkSource* getCache(); virtual void dataReceived(int, int); - virtual std::vector* getMobsAt(MobCategory*, const BlockPos&) = 0; + virtual std::vector* getMobsAt(MobCategory*, const BlockPos&) = 0; virtual void findNearestMapFeature(Level*, const std::wstring&, const BlockPos&, bool) = 0; virtual int getLoadedChunks() = 0; virtual void recreateLogicStructuresForChunk(LevelChunk*, int, int) = 0; diff --git a/src/Minecraft.World/net/minecraft/world/level/chunk/LevelChunk.h b/src/Minecraft.World/net/minecraft/world/level/chunk/LevelChunk.h index af6b2f10..cfcdab2b 100644 --- a/src/Minecraft.World/net/minecraft/world/level/chunk/LevelChunk.h +++ b/src/Minecraft.World/net/minecraft/world/level/chunk/LevelChunk.h @@ -33,6 +33,7 @@ class LevelChunk { static bool touchedSky; // Name from b1.2_02 LevelChunk(Level*, ChunkPrimer*, int, int); + void setCheckAllLight(); enum EntityCreationType {}; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/GenericOverworldLevelSource.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/GenericOverworldLevelSource.h index a6380507..dc371f2f 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/GenericOverworldLevelSource.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/GenericOverworldLevelSource.h @@ -7,5 +7,5 @@ class GenericOverworldLevelSource { GenericOverworldLevelSource() {} virtual void prepareHeights(int, int, ChunkPrimer*); - // missing a second unknown virtual function + virtual bool isFlat(); }; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/LevelGenerationOptions.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/LevelGenerationOptions.h index da54064e..1760daf3 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/LevelGenerationOptions.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/LevelGenerationOptions.h @@ -1,9 +1,15 @@ #pragma once #include "net/minecraft/world/level/LevelRuleset.h" +#include "net/minecraft/world/level/biome/Biome.h" + +class BlockPos; class LevelGenerationOptions { public: LevelRuleset* getRequiredGameRules(); void loadBaseSaveData(); + bool intersects(const BlockPos& lower, const BlockPos& upper); + // LegacyBlockData is the reconstruction's existing name for original BlockPair. + void getBiomeOverride(int biomeId, Biome::LegacyBlockData* filler, Biome::LegacyBlockData* surface); }; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherFlatLevelSource.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherFlatLevelSource.cpp index a9162366..28715550 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherFlatLevelSource.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherFlatLevelSource.cpp @@ -172,8 +172,8 @@ bool NetherFlatLevelSource::postProcessLoadedChunk(LevelChunk* chunk, int x, int return false; } -std::vector* NetherFlatLevelSource::getMobsAt(MobCategory* category, - const BlockPos& pos) { +std::vector* NetherFlatLevelSource::getMobsAt(MobCategory* category, + const BlockPos& pos) { Biome* biome = m_level->getBiome(pos); if (biome) return biome->getMobs(category); diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherFlatLevelSource.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherFlatLevelSource.h index a3ee492a..4d89392b 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherFlatLevelSource.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherFlatLevelSource.h @@ -12,7 +12,7 @@ class NetherFlatLevelSource : public ChunkGenerator { LevelChunk* createChunk(int, int) override; void postProcess(int, int) override; bool postProcessLoadedChunk(LevelChunk*, int, int) override; - std::vector* getMobsAt(MobCategory*, const BlockPos&) override; + std::vector* getMobsAt(MobCategory*, const BlockPos&) override; BlockPos* findNearestMapFeature(Level*, const std::wstring&, const BlockPos&, bool) override; void recreateLogicStructuresForChunk(LevelChunk*, int, int) override; bool isPosInFeature(Level*, const std::wstring&, const BlockPos&) override; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.cpp index f2e63c38..169a3542 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.cpp @@ -1,5 +1,7 @@ #include "net/minecraft/world/level/levelgen/OverworldLevelSource.h" +#include + #include "NX/Platform.h" #include "net/minecraft/util/Mth.h" #include "net/minecraft/world/entity/MobCategory.h" @@ -128,7 +130,6 @@ float OverworldLevelSource::getHeightFalloff(int chunkX, int chunkZ, int* distan return result; } -// NON_MATCHING | Score: 1630 (lower is better) int OverworldLevelSource::distanceToEdge(float a, int, int x, int z, int size) { int halfSize = size / 2; @@ -150,18 +151,19 @@ int OverworldLevelSource::distanceToEdge(float a, int, int x, int z, int size) { if (inLeftBand || inRightBand) { Vec3* p = Vec3::newTemp(x, 0.0f, z); - Vec3* edgeStart = (x < 1) ? topLeft : topRight; - Vec3* edgeEnd = (x < 1) ? bottomLeft : bottomRight; - - distance = p->distanceToSegment(edgeStart, edgeEnd); + if (x >= 1) + distance = p->distanceToSegment(topRight, bottomRight); + else + distance = p->distanceToSegment(topLeft, bottomLeft); } if (((z > leftBound) && (z < rightBound)) || ((z > (maxCoord - a)) && (z < (maxCoord + a)))) { Vec3* p = Vec3::newTemp(x, 0.0f, z); - Vec3* edgeStart = (z < 1) ? topLeft : topRight; - Vec3* edgeEnd = (z < 1) ? bottomLeft : bottomRight; - - float verticalDistance = p->distanceToSegment(edgeStart, edgeEnd); + float verticalDistance; + if (z >= 1) + verticalDistance = p->distanceToSegment(bottomLeft, bottomRight); + else + verticalDistance = p->distanceToSegment(topLeft, topRight); if (verticalDistance < distance) { distance = verticalDistance; @@ -184,7 +186,7 @@ void OverworldLevelSource::buildSurfaces(int chunkX, int chunkZ, ChunkPrimer* pr for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { - Biome* biome = biomes[z + x * 16]; + Biome* biome = biomes.get(z + x * 16); { std::wstring biomeName = biome->getName(false); PIXBeginNamedEvent(0.0, "Building surface for biome %ls", biomeName.c_str()); @@ -322,11 +324,11 @@ void OverworldLevelSource::getHeights(int posX, int posY, int posZ, arrayWithLen float weightedScale = 0.0f; float weightedDepth = 0.0f; float totalWeight = 0.0f; - Biome* b = biomes[x + 2 + (z + 2) * 10]; + Biome* b = biomes.get(x + 2 + (z + 2) * 10); for (int xo = -2; xo <= 2; ++xo) { for (int zo = -2; zo <= 2; ++zo) { - Biome* b2 = biomes[x + xo + 2 + (z + zo + 2) * 10]; + Biome* b2 = biomes.get(x + xo + 2 + (z + zo + 2) * 10); float depth = m_sourceSettings->m_biomeDepthOffset + (b2->getDepth() * m_sourceSettings->m_biomeDepthWeight); @@ -563,19 +565,25 @@ void OverworldLevelSource::prepareHeights(int chunkX, int chunkZ, ChunkPrimer* p PIXBeginNamedEvent(0.0, "Generating"); for (int subX = 0; subX < width; subX++) { + int leftColumn = subX * xSize; + int rightColumn = (subX + 1) * xSize; for (int subZ = 0; subZ < width; subZ++) { + int n00 = (subZ + leftColumn) * ySize; + int n10 = n00 + ySize; + int n01 = (subZ + rightColumn) * ySize; + int n11 = n01 + ySize; for (int subY = 0; subY < 16; subY++) { // + 0 is for padding so these look nicer - double h00 = heights[((subX + 0) * xSize + (subZ + 0)) * ySize + subY]; - double h10 = heights[((subX + 0) * xSize + (subZ + 1)) * ySize + subY]; - double h01 = heights[((subX + 1) * xSize + (subZ + 0)) * ySize + subY]; - double h11 = heights[((subX + 1) * xSize + (subZ + 1)) * ySize + subY]; + double h00 = heights[n00 + subY]; + double h10 = heights[n10 + subY]; + double h01 = heights[n01 + subY]; + double h11 = heights[n11 + subY]; // interpolation steps - double iy00 = (heights[((subX + 0) * xSize + (subZ + 0)) * ySize + subY + 1] - h00) * 0.125; - double iy10 = (heights[((subX + 0) * xSize + (subZ + 1)) * ySize + subY + 1] - h10) * 0.125; - double iy01 = (heights[((subX + 1) * xSize + (subZ + 0)) * ySize + subY + 1] - h01) * 0.125; - double iy11 = (heights[((subX + 1) * xSize + (subZ + 1)) * ySize + subY + 1] - h11) * 0.125; + double iy00 = (heights[n00 + subY + 1] - h00) * 0.125; + double iy10 = (heights[n10 + subY + 1] - h10) * 0.125; + double iy01 = (heights[n01 + subY + 1] - h01) * 0.125; + double iy11 = (heights[n11 + subY + 1] - h11) * 0.125; for (int ym = 0; ym < 8; ym++) { double heightAtXZ0 = h00; @@ -591,19 +599,20 @@ void OverworldLevelSource::prepareHeights(int chunkX, int chunkZ, ChunkPrimer* p int defaultId = (subY * height + ym < seaLevel) ? 9 : 0; - double _h = h00; + double _h = heightAtXZ0; double _hStep = (heightAtXZ1 - heightAtXZ0) * 0.25; _h -= _hStep; for (int zm = 0; zm < 4; zm++) { - int x = subX * width + xm; + int x = chunkX * 16 + subX * width + xm; int y = subY * height + ym; - int z = subZ * width + zm; + int z = chunkZ * 16 + subZ * width + zm; int blockId; int distance; // Falloff at the edge of the world, does not exist in Java Edition - if (getHeightFalloff(x, z, &distance) > (_h += _hStep)) { + float falloff = getHeightFalloff(x, z, &distance); + if ((_h += _hStep) > falloff) { blockId = 1; } else { blockId = defaultId; @@ -642,8 +651,8 @@ void OverworldLevelSource::prepareHeights(int chunkX, int chunkZ, ChunkPrimer* p delete[] biomes.m_data; } -std::vector* OverworldLevelSource::getMobsAt(MobCategory* category, - const BlockPos& pos) { +std::vector* OverworldLevelSource::getMobsAt(MobCategory* category, + const BlockPos& pos) { Biome* biome = m_level->getBiome(pos); if (m_shouldGenerateStructures) { @@ -687,30 +696,29 @@ void OverworldLevelSource::recreateLogicStructuresForChunk(LevelChunk* chunk, in } } -// NON_MATCHING | Score: 860- (lower is better) bool OverworldLevelSource::isPosInFeature(Level* level, const std::wstring& featureName, const BlockPos& pos) { if (!m_shouldGenerateStructures) { return false; } - if (ChunkGenerator::STRONGHOLD_NAME.compare(featureName) == 0) { - return m_strongholdFeature && m_strongholdFeature->isInsideFeature(pos); + if (ChunkGenerator::STRONGHOLD_NAME.compare(featureName) == 0 && m_strongholdFeature) { + return m_strongholdFeature->isInsideFeature(pos); } - if (ChunkGenerator::MANSION_NAME.compare(featureName) == 0) { - return m_woodlandMansionFeature && m_woodlandMansionFeature->isInsideFeature(pos); + if (ChunkGenerator::MANSION_NAME.compare(featureName) == 0 && m_woodlandMansionFeature) { + return m_woodlandMansionFeature->isInsideFeature(pos); } - if (ChunkGenerator::MONUMENT_NAME.compare(featureName) == 0) { - return m_oceanMonumentFeature && m_oceanMonumentFeature->isInsideFeature(pos); + if (ChunkGenerator::MONUMENT_NAME.compare(featureName) == 0 && m_oceanMonumentFeature) { + return m_oceanMonumentFeature->isInsideFeature(pos); } - if (ChunkGenerator::VILLAGE_NAME.compare(featureName) == 0) { - return m_villageFeature && m_villageFeature->isInsideFeature(pos); + if (ChunkGenerator::VILLAGE_NAME.compare(featureName) == 0 && m_villageFeature) { + return m_villageFeature->isInsideFeature(pos); } - if (ChunkGenerator::MINESHAFT_NAME.compare(featureName) == 0) { - return m_mineshaftFeature && m_mineshaftFeature->isInsideFeature(pos); + if (ChunkGenerator::MINESHAFT_NAME.compare(featureName) == 0 && m_mineshaftFeature) { + return m_mineshaftFeature->isInsideFeature(pos); } - if (ChunkGenerator::TEMPLE_NAME.compare(featureName) == 0) { - return m_randomScatteredLargeFeature && m_randomScatteredLargeFeature->isInsideFeature(pos); + if (ChunkGenerator::TEMPLE_NAME.compare(featureName) == 0 && m_randomScatteredLargeFeature) { + return m_randomScatteredLargeFeature->isInsideFeature(pos); } return false; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.h index 200aa253..0f46b7f5 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.h @@ -38,7 +38,7 @@ class OverworldLevelSource : public ChunkGenerator, public GenericOverworldLevel LevelChunk* createChunk(int, int) override; void postProcess(int, int) override; bool postProcessLoadedChunk(LevelChunk*, int, int) override; - std::vector* getMobsAt(MobCategory*, const BlockPos&) override; + std::vector* getMobsAt(MobCategory*, const BlockPos&) override; BlockPos* findNearestMapFeature(Level*, const std::wstring&, const BlockPos&, bool) override; void recreateLogicStructuresForChunk(LevelChunk*, int, int) override; bool isPosInFeature(Level*, const std::wstring&, const BlockPos&) override; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/Feature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/Feature.h index 8cdbf359..832283bb 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/Feature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/Feature.h @@ -7,7 +7,7 @@ class BlockState; class Feature { public: - Feature(bool isUpdate); + Feature(bool isUpdate = false); virtual ~Feature(); virtual bool place(Level* level, Random& random, const BlockPos& pos) = 0; virtual void init(); diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/FlowerFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/FlowerFeature.h index dc75dada..13a8daa3 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/FlowerFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/FlowerFeature.h @@ -7,9 +7,9 @@ class FlowerFeature : public Feature { public: FlowerFeature(FlowerBlock*, FlowerBlock::Flower*); - ~FlowerFeature() override; bool place(Level* level, Random& random, const BlockPos& pos) override; + void setFlower(FlowerBlock*, FlowerBlock::Flower*); - void* m_field10; - void* m_field18; + FlowerBlock* m_flower; + const BlockState* m_state; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeFeature.h index 1cef066b..2c0c185b 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeFeature.h @@ -7,11 +7,12 @@ class Level; class LargeFeature { public: + LargeFeature(); virtual ~LargeFeature(); virtual void apply(Level*, int, int, ChunkPrimer*); virtual void addFeature(Level*, int, int, int, int, ChunkPrimer*); int m_radius; Random m_random; - void* m_unused; + Level* m_level; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MineShaftFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MineShaftFeature.h index 9bffdc34..b02cd3c0 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MineShaftFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MineShaftFeature.h @@ -4,6 +4,11 @@ class MineShaftFeature : public StructureFeature { public: + std::wstring getFeatureName() override; + BlockPos* getNearestGeneratedFeature(Level*, const BlockPos&, bool) override; + bool isFeatureChunk(int, int, bool) override; + StructureStart* createStructureStart(int, int) override; + MineShaftFeature(); char m_filler[0x8]; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.h index 371cd466..0b8e69e3 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.h @@ -1,10 +1,14 @@ #pragma once #include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include class MonsterRoomFeature : public Feature { public: MonsterRoomFeature(); bool place(Level* level, Random& random, const BlockPos& pos) override; + +private: + std::wstring randomEntityId(Random&); }; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.h index bfa3f3f9..f7161500 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.h @@ -7,11 +7,16 @@ class OceanMonumentFeature : public StructureFeature { public: - static std::vector MOB_SPAWNERS; + std::wstring getFeatureName() override; + BlockPos* getNearestGeneratedFeature(Level*, const BlockPos&, bool) override; + bool isFeatureChunk(int, int, bool) override; + StructureStart* createStructureStart(int, int) override; + + static std::vector MOB_SPAWNERS; OceanMonumentFeature(); - std::vector* getEnemies(); + std::vector* getEnemies(); static void staticCtor(); diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/RandomScatteredLargeFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/RandomScatteredLargeFeature.h index 72851eb6..12eb4dcb 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/RandomScatteredLargeFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/RandomScatteredLargeFeature.h @@ -7,10 +7,15 @@ class BlockPos; class RandomScatteredLargeFeature : public StructureFeature { public: + std::wstring getFeatureName() override; + BlockPos* getNearestGeneratedFeature(Level*, const BlockPos&, bool) override; + bool isFeatureChunk(int, int, bool) override; + StructureStart* createStructureStart(int, int) override; + RandomScatteredLargeFeature(); bool isSwamphut(const BlockPos&); - std::vector* getSwamphutEnemies(); + std::vector* getSwamphutEnemies(); static void staticCtor(); diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/StrongholdFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/StrongholdFeature.h index ac3cb0ea..c3dd9b6f 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/StrongholdFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/StrongholdFeature.h @@ -4,6 +4,12 @@ class StrongholdFeature : public StructureFeature { public: + std::wstring getFeatureName() override; + BlockPos* getNearestGeneratedFeature(Level*, const BlockPos&, bool) override; + bool isFeatureChunk(int, int, bool) override; + StructureStart* createStructureStart(int, int) override; + std::vector* getGuesstimatedFeaturePositions() override; + StrongholdFeature(); char m_filler[0x48]; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/StructureFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/StructureFeature.h index 9ae37554..d2edc95d 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/StructureFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/StructureFeature.h @@ -2,27 +2,40 @@ #include "net/minecraft/world/level/levelgen/feature/LargeFeature.h" #include "types.h" +#include +#include +#include +#include class BlockPos; class ChunkPos; +class StructureFeatureSavedData; class StructureStart; class StructureFeature : public LargeFeature { public: - virtual std::wstring getFeatureName(); + StructureFeature(); + ~StructureFeature() override; + void addFeature(Level*, int, int, int, int, ChunkPrimer*) override; + virtual std::wstring getFeatureName() = 0; virtual bool postProcess(Level*, Random&, ChunkPos*); virtual bool isIntersection(int, int); virtual bool isInsideFeature(const BlockPos&); - virtual BlockPos* getNearestGeneratedFeature(Level*, const BlockPos&, bool); - virtual void getGuesstimatedFeaturePositions(); + virtual BlockPos* getNearestGeneratedFeature(Level*, const BlockPos&, bool) = 0; + virtual std::vector* getGuesstimatedFeaturePositions(); virtual void restoreSavedData(Level*); virtual void saveFeature(int, int, StructureStart*); - virtual bool isFeatureChunk(int, int, bool); - virtual void createStructureStart(int, int); - - char m_filler[0x38]; + virtual bool isFeatureChunk(int, int, bool) = 0; + virtual StructureStart* createStructureStart(int, int) = 0; + StructureStart* getStructureAt(const BlockPos&); bool isInsideBoundingFeature(Level*, const BlockPos&); + static BlockPos* findNearestFeaturePositionBySpacing(Level*, StructureFeature*, const BlockPos&, + int spacing, int separation, int salt, bool linear, + int maxRadius, bool skipKnown); + + std::shared_ptr m_savedData; + std::unordered_map m_starts; }; ASSERT_SIZEOF(StructureFeature, 0x68) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/VillageFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/VillageFeature.h index df581bf5..569e8fa6 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/VillageFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/VillageFeature.h @@ -1,12 +1,21 @@ #pragma once #include "net/minecraft/world/level/levelgen/feature/StructureFeature.h" +#include + +class Biome; class VillageFeature : public StructureFeature { public: + std::wstring getFeatureName() override; + BlockPos* getNearestGeneratedFeature(Level*, const BlockPos&, bool) override; + bool isFeatureChunk(int, int, bool) override; + StructureStart* createStructureStart(int, int) override; + VillageFeature(int); static void staticCtor(); + static std::vector ALLOWED_BIOMES; char m_filler[0x10]; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/WoodlandMansionFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/WoodlandMansionFeature.h index fb911195..0c2d3c7a 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/WoodlandMansionFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/WoodlandMansionFeature.h @@ -3,10 +3,17 @@ #include "net/minecraft/world/level/levelgen/feature/StructureFeature.h" class GenericOverworldLevelSource; +class SuperflatConfig; class WoodlandMansionFeature : public StructureFeature { public: + std::wstring getFeatureName() override; + BlockPos* getNearestGeneratedFeature(Level*, const BlockPos&, bool) override; + bool isFeatureChunk(int, int, bool) override; + StructureStart* createStructureStart(int, int) override; + WoodlandMansionFeature(GenericOverworldLevelSource*); + WoodlandMansionFeature(GenericOverworldLevelSource*, SuperflatConfig*); static void staticCtor(); diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.h index 4813debe..62d04637 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.h @@ -3,7 +3,7 @@ #include "net/minecraft/world/ArrayWithLength.h" #include "net/minecraft/world/level/levelgen/synth/Synth.h" -class ImprovedNoise; +class SimplexNoise; class Random; class PerlinSimplexNoise : public Synth { @@ -14,7 +14,9 @@ class PerlinSimplexNoise : public Synth { void init(Random*, int); arrayWithLength getRegion(arrayWithLength, double, double, int, int, double, double, double); + arrayWithLength getRegion(arrayWithLength, double, double, int, int, double, double, + double, double); - ImprovedNoise** m_noiseLevels; + SimplexNoise** m_noiseLevels; int m_maxOctaves; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/BiomeInitLayer.cpp b/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/BiomeInitLayer.cpp index 6ac19ccd..415211b1 100644 --- a/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/BiomeInitLayer.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/BiomeInitLayer.cpp @@ -12,41 +12,41 @@ BiomeInitLayer::BiomeInitLayer(long long seed, std::shared_ptr parent, Le m_parent = parent; if (levelType == LevelType::NORMAL_1_1) { m_warmBiomes = {6, true}; - m_warmBiomes[0] = Biome::DESERT; - m_warmBiomes[1] = Biome::FOREST; - m_warmBiomes[2] = Biome::EXTREME_HILLS; - m_warmBiomes[3] = Biome::SWAMP; - m_warmBiomes[4] = Biome::PLAINS; - m_warmBiomes[5] = Biome::TAIGA; + m_warmBiomes.get(0) = Biome::DESERT; + m_warmBiomes.get(1) = Biome::FOREST; + m_warmBiomes.get(2) = Biome::EXTREME_HILLS; + m_warmBiomes.get(3) = Biome::SWAMP; + m_warmBiomes.get(4) = Biome::PLAINS; + m_warmBiomes.get(5) = Biome::TAIGA; } else { m_warmBiomes = {6, true}; - m_warmBiomes[0] = Biome::DESERT; - m_warmBiomes[1] = Biome::DESERT; - m_warmBiomes[2] = Biome::DESERT; - m_warmBiomes[3] = Biome::SAVANNA; - m_warmBiomes[4] = Biome::SAVANNA; - m_warmBiomes[5] = Biome::PLAINS; + m_warmBiomes.get(0) = Biome::DESERT; + m_warmBiomes.get(1) = Biome::DESERT; + m_warmBiomes.get(2) = Biome::DESERT; + m_warmBiomes.get(3) = Biome::SAVANNA; + m_warmBiomes.get(4) = Biome::SAVANNA; + m_warmBiomes.get(5) = Biome::PLAINS; } m_mediumBiomes = {6, true}; - m_mediumBiomes[0] = Biome::FOREST; - m_mediumBiomes[1] = Biome::ROOFED_FOREST; - m_mediumBiomes[2] = Biome::EXTREME_HILLS; - m_mediumBiomes[3] = Biome::PLAINS; - m_mediumBiomes[4] = Biome::BIRCH_FOREST; - m_mediumBiomes[5] = Biome::SWAMP; + m_mediumBiomes.get(0) = Biome::FOREST; + m_mediumBiomes.get(1) = Biome::ROOFED_FOREST; + m_mediumBiomes.get(2) = Biome::EXTREME_HILLS; + m_mediumBiomes.get(3) = Biome::PLAINS; + m_mediumBiomes.get(4) = Biome::BIRCH_FOREST; + m_mediumBiomes.get(5) = Biome::SWAMP; m_coldBiomes = {4, true}; - m_coldBiomes[0] = Biome::FOREST; - m_coldBiomes[1] = Biome::EXTREME_HILLS; - m_coldBiomes[2] = Biome::TAIGA; - m_coldBiomes[3] = Biome::PLAINS; + m_coldBiomes.get(0) = Biome::FOREST; + m_coldBiomes.get(1) = Biome::EXTREME_HILLS; + m_coldBiomes.get(2) = Biome::TAIGA; + m_coldBiomes.get(3) = Biome::PLAINS; m_iceBiomes = {4, true}; - m_iceBiomes[0] = Biome::ICE_PLAINS; - m_iceBiomes[1] = Biome::ICE_PLAINS; - m_iceBiomes[2] = Biome::ICE_PLAINS; - m_iceBiomes[3] = Biome::COLD_TAIGA; + m_iceBiomes.get(0) = Biome::ICE_PLAINS; + m_iceBiomes.get(1) = Biome::ICE_PLAINS; + m_iceBiomes.get(2) = Biome::ICE_PLAINS; + m_iceBiomes.get(3) = Biome::COLD_TAIGA; CustomizableSourceSettings* settings = nullptr; if (levelType != LevelType::NORMAL_1_1 && levelType == LevelType::CUSTOMIZED) { @@ -83,22 +83,22 @@ arrayWithLength BiomeInitLayer::getArea(int x, int y, int width, int height area[n + m * width] = Biome::MESA_PLATEAU->m_biomeId; } } else { - area[n + m * width] = m_warmBiomes[nextRandom(m_warmBiomes.m_length)]->m_biomeId; + area[n + m * width] = m_warmBiomes.get(nextRandom(m_warmBiomes.m_length))->m_biomeId; } } else if (o == 2) { if (p > 0) { area[n + m * width] = Biome::JUNGLE->m_biomeId; } else { - area[n + m * width] = m_mediumBiomes[nextRandom(m_mediumBiomes.m_length)]->m_biomeId; + area[n + m * width] = m_mediumBiomes.get(nextRandom(m_mediumBiomes.m_length))->m_biomeId; } } else if (o == 3) { if (p > 0) { area[n + m * width] = Biome::MEGA_TAIGA->m_biomeId; } else { - area[n + m * width] = m_coldBiomes[nextRandom(m_coldBiomes.m_length)]->m_biomeId; + area[n + m * width] = m_coldBiomes.get(nextRandom(m_coldBiomes.m_length))->m_biomeId; } } else if (o == 4) { - area[n + m * width] = m_iceBiomes[nextRandom(m_iceBiomes.m_length)]->m_biomeId; + area[n + m * width] = m_iceBiomes.get(nextRandom(m_iceBiomes.m_length))->m_biomeId; } else { area[n + m * width] = Biome::MUSHROOM_ISLAND->m_biomeId; } diff --git a/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/IntCache.h b/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/IntCache.h index deee731a..b50a8e0e 100644 --- a/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/IntCache.h +++ b/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/IntCache.h @@ -1,6 +1,7 @@ #pragma once #include "net/minecraft/world/ArrayWithLength.h" +#include class IntCache { public: @@ -14,5 +15,19 @@ class IntCache { static void Reset(); - class ThreadStorage {}; + class ThreadStorage { + public: + ThreadStorage(); + ~ThreadStorage(); + + // Arrays remain owned here; returned arrayWithLength values are views. + int m_maxSize; + std::vector> m_freeSmall; + std::vector> m_activeSmall; + std::vector> m_freeLarge; + std::vector> m_activeLarge; + std::vector> m_retiredLarge; + }; + + static unsigned int sThreadStorageIndex; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/saveddata/MapItemSavedData.h b/src/Minecraft.World/net/minecraft/world/level/saveddata/MapItemSavedData.h index ef5deedf..3d19ae92 100644 --- a/src/Minecraft.World/net/minecraft/world/level/saveddata/MapItemSavedData.h +++ b/src/Minecraft.World/net/minecraft/world/level/saveddata/MapItemSavedData.h @@ -37,7 +37,7 @@ class MapItemSavedData : public SavedData { ~MapItemSavedData() override; void load(CompoundTag*) override; - void save(CompoundTag*) override; + CompoundTag* save(CompoundTag*) override; void tickCarriedBy(std::shared_ptr player, not_null_ptr item); void mergeInMapData(std::shared_ptr mapData); diff --git a/src/Minecraft.World/net/minecraft/world/level/saveddata/SavedData.h b/src/Minecraft.World/net/minecraft/world/level/saveddata/SavedData.h index 9315bdc7..981316a2 100644 --- a/src/Minecraft.World/net/minecraft/world/level/saveddata/SavedData.h +++ b/src/Minecraft.World/net/minecraft/world/level/saveddata/SavedData.h @@ -10,7 +10,7 @@ class SavedData : public std::enable_shared_from_this { SavedData(const std::wstring&); virtual ~SavedData(); virtual void load(CompoundTag*) = 0; - virtual void save(CompoundTag*) = 0; + virtual CompoundTag* save(CompoundTag*) = 0; void setDirty(bool); void setDirty(); diff --git a/src/Minecraft.World/net/minecraft/world/level/storage/LevelData.cpp b/src/Minecraft.World/net/minecraft/world/level/storage/LevelData.cpp index 4ce690d3..a919fd94 100644 --- a/src/Minecraft.World/net/minecraft/world/level/storage/LevelData.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/storage/LevelData.cpp @@ -4,6 +4,7 @@ #include "net/minecraft/core/BlockPos.h" #include "net/minecraft/core/System.h" +#include "net/minecraft/util/datafix/DataFixerUpper.h" #include "net/minecraft/world/Difficulty.h" #include "net/minecraft/world/level/LevelType.h" @@ -68,7 +69,7 @@ CompoundTag* LevelData::createTag(std::vector>*) { } void LevelData::setTagData(CompoundTag* out) { - out->putInt(sLevelDataVersionString, 922); // why is DataVersion it's own static shit wtf + out->putInt(DataFixerUpper::DATA_VERSION_KEY, 922); out->putLong(L"RandomSeed", this->m_seed); out->putString(L"generatorName", this->m_levelType->getGeneratorName()); out->putInt(L"generatorVersion", this->m_levelType->getVersion()); diff --git a/src/Minecraft.World/net/minecraft/world/level/storage/light/SparseLightStorage.h b/src/Minecraft.World/net/minecraft/world/level/storage/light/SparseLightStorage.h index 19c5b031..741e8d3f 100644 --- a/src/Minecraft.World/net/minecraft/world/level/storage/light/SparseLightStorage.h +++ b/src/Minecraft.World/net/minecraft/world/level/storage/light/SparseLightStorage.h @@ -1,10 +1,49 @@ #pragma once #include "java/io/DataOutputStream.h" +#include + +class DataInputStream; +template +class XLockFreeStack; class SparseLightStorage { public: + SparseLightStorage(bool bright); + SparseLightStorage(bool bright, bool compact); + SparseLightStorage(const SparseLightStorage&); + ~SparseLightStorage(); + + void fromNibbles(arrayWithLength, int offset); + void toNibbles(arrayWithLength, unsigned int offset); + unsigned char getLight(int x, int y, int z); + void setLight(int x, int y, int z, int value); + void setFullBright(); + int setDataRegion(arrayWithLength, int x0, int y0, int z0, int x1, int y1, int z1, + int offset); + int getDataRegion(arrayWithLength, int x0, int y0, int z0, int x1, int y1, int z1, + int offset); + unsigned int compress(); + bool isCompressed(); void write(DataOutputStream* out); + void read(DataInputStream* in); static void staticCtor(); + static void tick(); + +private: + static unsigned char* allocate(unsigned int); + static void freeBuffer(unsigned char*, int); + int bufferSize(unsigned long long); + void getBuffers(unsigned char** indices, unsigned char** data); + void replace(unsigned long long); + void expandLayers(std::vector&); + void retire(unsigned char*); + static int sRetirementSlot; + static XLockFreeStack sRetired[3]; + + // Low 48 bits: buffer pointer; high 16 bits: number of explicit 128-byte slabs. + unsigned long long m_packed; }; + +static_assert(sizeof(SparseLightStorage) == 8, "SparseLightStorage Switch layout"); diff --git a/src/Minecraft.World/net/minecraft/world/phys/AABB.cpp b/src/Minecraft.World/net/minecraft/world/phys/AABB.cpp index 5e37dade..ce1081a2 100644 --- a/src/Minecraft.World/net/minecraft/world/phys/AABB.cpp +++ b/src/Minecraft.World/net/minecraft/world/phys/AABB.cpp @@ -6,8 +6,61 @@ #include "net/minecraft/world/phys/Vec3.h" #include +// Keep the ray clip in the original matching translation unit. Host builds +// compile it separately so core subsystem linking needs no game dependencies. +#include "net/minecraft/world/phys/AABBClip.inl" + DEFINE_THREAD_STORAGE(AABB, 1024) +Vec3* AABB::collideWithXPlane(double x, Vec3* start, Vec3* end) const { + Vec3* hit = start->getIntermediateWithXValue(end, x); + return hit && containsYZ(hit) ? hit : nullptr; +} + +Vec3* AABB::collideWithYPlane(double y, Vec3* start, Vec3* end) const { + Vec3* hit = start->getIntermediateWithYValue(end, y); + return hit && containsXZ(hit) ? hit : nullptr; +} + +Vec3* AABB::collideWithZPlane(double z, Vec3* start, Vec3* end) const { + Vec3* hit = start->getIntermediateWithZValue(end, z); + return hit && containsXY(hit) ? hit : nullptr; +} + +bool AABB::isClosest(Vec3* start, Vec3* closest, Vec3* candidate) const { + return !closest || start->distanceToSqr(candidate) < start->distanceToSqr(closest); +} + +bool AABB::containsYZ(Vec3* hit) const { + // Ordered bounds checks reject NaNs, as do the original b.ge/b.ls branches. + if (!hit || !(hit->m_y >= m_inY) || !(hit->m_y <= m_axY) || !(hit->m_z >= m_inZ)) + return false; + return hit->m_z <= m_axZ; +} + +bool AABB::containsXZ(Vec3* hit) const { + if (!hit || !(hit->m_x >= m_inX) || !(hit->m_x <= m_axX) || !(hit->m_z >= m_inZ)) + return false; + return hit->m_z <= m_axZ; +} + +bool AABB::containsXY(Vec3* hit) const { + if (!hit || !(hit->m_x >= m_inX) || !(hit->m_x <= m_axX) || !(hit->m_y >= m_inY)) + return false; + return hit->m_y <= m_axY; +} + +AABB* AABB::divideInternalsBy(double divisor) { + // NON_MATCHING: the reference schedules the divisions and stores differently. + m_inX /= divisor; + m_inY /= divisor; + m_inZ /= divisor; + m_axX /= divisor; + m_axY /= divisor; + m_axZ /= divisor; + return this; +} + AABB::AABB(double x1, double y1, double z1, double x2, double y2, double z2) { m_inX = std::min(x1, x2); m_inY = std::min(y1, y2); @@ -21,6 +74,15 @@ AABB* AABB::newPermanent(double x1, double y1, double z1, double x2, double y2, return new AABB(x1, y1, z1, x2, y2, z2); } +AABB* AABB::newPermanent(const BlockPos& pos) { + return newPermanent(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); +} + +AABB* AABB::newPermanent(const BlockPos& first, const BlockPos& second) { + return newPermanent(first.getX(), first.getY(), first.getZ(), second.getX(), second.getY(), + second.getZ()); +} + AABB* AABB::newPermanent(const AABB* other) { return newPermanent(other->m_inX, other->m_inY, other->m_inZ, other->m_axX, other->m_axY, other->m_axZ); } @@ -36,6 +98,18 @@ AABB* AABB::newTemp(double x1, double y1, double z1, double x2, double y2, doubl return temp; } +AABB* AABB::newTemp(const BlockPos& pos) { + return newTemp(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); +} + +AABB* AABB::newTemp(const BlockPos& first, const BlockPos& second) { + return newTemp(first.getX(), first.getY(), first.getZ(), second.getX(), second.getY(), second.getZ()); +} + +AABB* AABB::newTemp(const AABB* other) { + return newTemp(other->m_inX, other->m_inY, other->m_inZ, other->m_axX, other->m_axY, other->m_axZ); +} + AABB* AABB::set(double x1, double y1, double z1, double x2, double y2, double z2) { m_inX = std::min(x1, x2); m_inY = std::min(y1, y2); @@ -85,6 +159,14 @@ AABB* AABB::grow(double x, double y, double z) const { return this->newTemp(x0, y0, z0, x1, y1, z1); } +AABB* AABB::shrink(double multiplier) const { + return grow(-multiplier); +} + +AABB* AABB::shrink(double x, double y, double z) const { + return grow(-x, -y, -z); +} + AABB* AABB::expand(double dx, double dy, double dz) const { double x1 = this->m_inX; double y1 = this->m_inY; @@ -111,6 +193,68 @@ AABB* AABB::expand(double dx, double dy, double dz) const { return newTemp(tx1, ty1, tz1, tx2, ty2, tz2); } +bool AABB::equals(const AABB* other) const { + if (!other) + return false; + if (other->m_inX != m_inX) + return false; + if (other->m_inY != m_inY) + return false; + if (other->m_inZ != m_inZ) + return false; + if (other->m_axX != m_axX) + return false; + if (other->m_axY != m_axY) + return false; + return other->m_axZ == m_axZ; +} + +AABB* AABB::contract(double x, double y, double z) { + double x0 = m_inX; + double y0 = m_inY; + double z0 = m_inZ; + double x1 = m_axX; + double y1 = m_axY; + double z1 = m_axZ; + if (x < 0.0) + x0 -= x; + else if (x > 0.0) + x1 -= x; + if (y < 0.0) + y0 -= y; + else if (y > 0.0) + y1 -= y; + if (z < 0.0) + z0 -= z; + else if (z > 0.0) + z1 -= z; + return newTemp(x0, y0, z0, x1, y1, z1); +} + +bool AABB::contains(const BlockPos& pos) const { + // The original delegates to the non-const vector overload, which only reads this box. + return const_cast(this)->contains(Vec3::newTemp(pos.getX(), pos.getY(), pos.getZ())); +} + +void AABB::correctMinMax() { + // Copy all endpoints before writing through the references returned by minmax. + const auto x = std::minmax(m_inX, m_axX); + const double x0 = x.first; + const auto y = std::minmax(m_inY, m_axY); + const double y0 = y.first; + const auto z = std::minmax(m_inZ, m_axZ); + const double x1 = x.second; + const double y1 = y.second; + const double z0 = z.first; + const double z1 = z.second; + m_inX = x0; + m_inY = y0; + m_inZ = z0; + m_axX = x1; + m_axY = y1; + m_axZ = z1; +} + bool AABB::contains(Vec3* vec) { if (vec->m_x <= this->m_inX || vec->m_x >= this->m_axX) return false; @@ -124,18 +268,37 @@ bool AABB::contains(Vec3* vec) { return true; } +bool AABB::containsIncludingLowerBound(Vec3* vec) const { + if (vec->m_x < this->m_inX || vec->m_x >= this->m_axX) + return false; + + if (vec->m_y < this->m_inY || vec->m_y >= this->m_axY) + return false; + + if (vec->m_z < this->m_inZ || vec->m_z >= this->m_axZ) + return false; + + return true; +} + bool AABB::intersects(const AABB* rhs) const { return intersects(rhs->m_inX, rhs->m_inY, rhs->m_inZ, rhs->m_axX, rhs->m_axY, rhs->m_axZ); } -// NON_MATCHING SCORE: 1005, i have no idea, it's only the conditional branches bool AABB::intersects(double oMinX, double oMinY, double oMinZ, double oMaxX, double oMaxY, double oMaxZ) const { - if (oMaxX <= m_inX || oMinX >= m_axX) + // Ordered comparisons reject NaNs, as do the original ARM64 branches. + if (!(m_inX < oMaxX)) + return false; + if (!(m_axX > oMinX)) + return false; + if (!(m_inY < oMaxY)) + return false; + if (!(m_axY > oMinY)) return false; - if (oMaxY <= m_inY || oMinY >= m_axY) + if (!(m_inZ < oMaxZ)) return false; - return (!(oMaxZ <= m_inZ)) && (!(oMinZ >= m_axZ)); + return m_axZ > oMinZ; } void AABB::resetPool() {}; diff --git a/src/Minecraft.World/net/minecraft/world/phys/AABB.h b/src/Minecraft.World/net/minecraft/world/phys/AABB.h index 8f6d8460..1351b2ac 100644 --- a/src/Minecraft.World/net/minecraft/world/phys/AABB.h +++ b/src/Minecraft.World/net/minecraft/world/phys/AABB.h @@ -32,8 +32,13 @@ class AABB { AABB(double, double, double, double, double, double); static AABB* newPermanent(double, double, double, double, double, double); + static AABB* newPermanent(const BlockPos&); + static AABB* newPermanent(const BlockPos&, const BlockPos&); static AABB* newPermanent(const AABB*); static AABB* newTemp(double, double, double, double, double, double); + static AABB* newTemp(const BlockPos&); + static AABB* newTemp(const BlockPos&, const BlockPos&); + static AABB* newTemp(const AABB*); bool containsIncludingLowerBound(Vec3*) const; AABB* set(const AABB*); @@ -43,14 +48,26 @@ class AABB { double getSize() const; AABB* grow(double multiplier) const; AABB* grow(double x, double y, double z) const; + AABB* shrink(double multiplier) const; + AABB* shrink(double x, double y, double z) const; AABB* expand(double x, double y, double z) const; + AABB* contract(double x, double y, double z); + bool equals(const AABB* other) const; bool contains(Vec3* vec); + bool contains(const BlockPos& pos) const; bool intersects(const AABB* rhs) const; bool intersects(double, double, double, double, double, double) const; void resetPool(); AABB* move(const BlockPos&) const; AABB* move(double, double, double) const; HitResult* clip(Vec3*, Vec3*) const; + Vec3* collideWithXPlane(double, Vec3*, Vec3*) const; + Vec3* collideWithYPlane(double, Vec3*, Vec3*) const; + Vec3* collideWithZPlane(double, Vec3*, Vec3*) const; + bool isClosest(Vec3* start, Vec3* closest, Vec3* candidate) const; + bool containsYZ(Vec3*) const; + bool containsXZ(Vec3*) const; + bool containsXY(Vec3*) const; void correctMinMax(); double clipXCollide(const AABB*, double); double clipYCollide(const AABB*, double); diff --git a/src/Minecraft.World/net/minecraft/world/phys/AABBClip.cpp b/src/Minecraft.World/net/minecraft/world/phys/AABBClip.cpp new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/phys/AABBClip.cpp @@ -0,0 +1 @@ + diff --git a/src/Minecraft.World/net/minecraft/world/phys/AABBClip.inl b/src/Minecraft.World/net/minecraft/world/phys/AABBClip.inl new file mode 100644 index 00000000..9c611847 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/phys/AABBClip.inl @@ -0,0 +1,37 @@ +#include "net/minecraft/world/phys/AABB.h" + +#include "net/minecraft/core/Direction.h" +#include "net/minecraft/world/phys/HitResult.h" +#include "net/minecraft/world/phys/Vec3.h" + +HitResult* AABB::clip(Vec3* start, Vec3* end) const { + Vec3* closest = collideWithXPlane(m_inX, start, end); + const Direction* face = Direction::WEST; + Vec3* candidate = collideWithXPlane(m_axX, start, end); + if (candidate && isClosest(start, closest, candidate)) { + closest = candidate; + face = Direction::EAST; + } + candidate = collideWithYPlane(m_inY, start, end); + if (candidate && isClosest(start, closest, candidate)) { + closest = candidate; + face = Direction::DOWN; + } + candidate = collideWithYPlane(m_axY, start, end); + if (candidate && isClosest(start, closest, candidate)) { + closest = candidate; + face = Direction::UP; + } + candidate = collideWithZPlane(m_inZ, start, end); + if (candidate && isClosest(start, closest, candidate)) { + closest = candidate; + face = Direction::NORTH; + } + candidate = collideWithZPlane(m_axZ, start, end); + if (candidate && isClosest(start, closest, candidate)) { + closest = candidate; + face = Direction::SOUTH; + } + // Strict distance comparison preserves the earlier face at edges and corners. + return closest ? new HitResult(closest, face) : nullptr; +} diff --git a/src/Minecraft.World/net/minecraft/world/phys/HitResult.cpp b/src/Minecraft.World/net/minecraft/world/phys/HitResult.cpp index a965bb77..43e65a0d 100644 --- a/src/Minecraft.World/net/minecraft/world/phys/HitResult.cpp +++ b/src/Minecraft.World/net/minecraft/world/phys/HitResult.cpp @@ -1,6 +1,32 @@ #include "net/minecraft/world/phys/HitResult.h" #include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/entity/Entity.h" +#include "net/minecraft/world/phys/Vec3.h" + +HitResult::HitResult(Vec3* hit, const Direction* direction) { + m_type = 1; + m_blockPos = BlockPos::zero; + m_direction = direction; + m_hitVector = Vec3::newTemp(hit->m_x, hit->m_y, hit->m_z); + m_entity = nullptr; +} + +HitResult::HitResult(Vec3* hit, const Direction* direction, const BlockPos& pos) { + m_type = 1; + m_blockPos = BlockPos(pos.getX(), pos.getY(), pos.getZ()); + m_direction = direction; + m_hitVector = Vec3::newTemp(hit->m_x, hit->m_y, hit->m_z); + m_entity = nullptr; +} + +HitResult::HitResult(std::shared_ptr entity) { + m_type = 2; + m_entity = entity; + m_hitVector = Vec3::newTemp(entity->m_x, entity->m_y, entity->m_z); +} + +HitResult::~HitResult() = default; const BlockPos& HitResult::getBlockPos() const { return this->m_blockPos; diff --git a/src/Minecraft.World/net/minecraft/world/phys/HitResult.h b/src/Minecraft.World/net/minecraft/world/phys/HitResult.h index 92504665..73d8e1cb 100644 --- a/src/Minecraft.World/net/minecraft/world/phys/HitResult.h +++ b/src/Minecraft.World/net/minecraft/world/phys/HitResult.h @@ -10,12 +10,17 @@ class Entity; class HitResult { public: ~HitResult(); + HitResult(Vec3*, const Direction*); HitResult(Vec3*, const Direction*, const BlockPos&); + HitResult(std::shared_ptr entity); const BlockPos& getBlockPos() const; BlockPos m_blockPos; + int m_type; const Direction* m_direction; Vec3* m_hitVector; std::shared_ptr m_entity; }; + +ASSERT_SIZEOF(HitResult, 0x30) diff --git a/src/Minecraft.World/net/minecraft/world/phys/Vec2.cpp b/src/Minecraft.World/net/minecraft/world/phys/Vec2.cpp index 3e423a32..0e49e46a 100644 --- a/src/Minecraft.World/net/minecraft/world/phys/Vec2.cpp +++ b/src/Minecraft.World/net/minecraft/world/phys/Vec2.cpp @@ -1,3 +1,12 @@ #include "net/minecraft/world/phys/Vec2.h" DEFINE_THREAD_STORAGE(phys::Vec2, 1024) + +phys::Vec2* phys::Vec2::newTemp(float x, float y) { + ThreadStorage* storage = static_cast(TlsGetValue(sThreadStorageIndex)); + Vec2* result = &storage->m_storage[storage->m_unk]; + result->m_x = x; + result->m_y = y; + storage->m_unk = (storage->m_unk + 1) & 0x3ff; + return result; +} diff --git a/src/Minecraft.World/net/minecraft/world/phys/Vec2.h b/src/Minecraft.World/net/minecraft/world/phys/Vec2.h index ee9b2b14..c1e872a5 100644 --- a/src/Minecraft.World/net/minecraft/world/phys/Vec2.h +++ b/src/Minecraft.World/net/minecraft/world/phys/Vec2.h @@ -1,15 +1,17 @@ -#pragma once - -#include "net/minecraft/util/ThreadStorage.h" - -namespace phys { -class Vec2 { -public: - DECLARE_THREAD_STORAGE(Vec2) - - Vec2() {} - - float m_x; - float m_y; -}; -} // namespace phys +#pragma once + +#include "net/minecraft/util/ThreadStorage.h" + +namespace phys { +class Vec2 { +public: + DECLARE_THREAD_STORAGE(Vec2) + + Vec2() {} + + static Vec2* newTemp(float x, float y); + + float m_x; + float m_y; +}; +} // namespace phys diff --git a/src/Minecraft.World/net/minecraft/world/phys/Vec3.cpp b/src/Minecraft.World/net/minecraft/world/phys/Vec3.cpp index dbf75105..da8ea896 100644 --- a/src/Minecraft.World/net/minecraft/world/phys/Vec3.cpp +++ b/src/Minecraft.World/net/minecraft/world/phys/Vec3.cpp @@ -1,10 +1,163 @@ #include "net/minecraft/world/phys/Vec3.h" #include "cmath" +#include "net/minecraft/core/Vec3i.h" #include "net/minecraft/world/phys/AABB.h" DEFINE_THREAD_STORAGE(Vec3, 1024) +Vec3* Vec3::ZERO; + +void Vec3::staticCtor() { + ZERO = new Vec3(0.0, 0.0, 0.0); +} + +Vec3* Vec3::newPermanent(double x, double y, double z) { + return new Vec3(x, y, z); +} + +Vec3* Vec3::newPermanent(const Vec3* other) { + return new Vec3(other->m_x, other->m_y, other->m_z); +} + +Vec3* Vec3::newTemp(double x, double y, double z) { + ThreadStorage* ts = static_cast(TlsGetValue(sThreadStorageIndex)); + Vec3* temp = ts->m_storage[ts->m_unk].set(x, y, z); + ts->m_unk++; + ts->m_unk &= 0x3ff; + return temp; +} + +Vec3* Vec3::newTemp(const Vec3* other) { + return newTemp(other->m_x, other->m_y, other->m_z); +} + +Vec3* Vec3::newTemp(const Vec3i& other) { + return newTemp(other.getX(), other.getY(), other.getZ()); +} + +Vec3* Vec3::normalize() { + double magnitude = sqrt(m_x * m_x + m_y * m_y + m_z * m_z); + if (magnitude < 0.0001) + return newTemp(ZERO); + return newTemp(m_x / magnitude, m_y / magnitude, m_z / magnitude); +} + +Vec3* Vec3::lerp(Vec3* other, double weight) { + return newTemp(m_x + (other->m_x - m_x) * weight, m_y + (other->m_y - m_y) * weight, + m_z + (other->m_z - m_z) * weight); +} + +Vec3* Vec3::vectorTo(Vec3* other) { + return newTemp(other->m_x - m_x, other->m_y - m_y, other->m_z - m_z); +} + +Vec3* Vec3::cross(Vec3* other) { + return newTemp(m_y * other->m_z - m_z * other->m_y, m_z * other->m_x - other->m_z * m_x, + other->m_y * m_x - m_y * other->m_x); +} + +Vec3* Vec3::add(Vec3* other) { + return add(other->m_x, other->m_y, other->m_z); +} + +double Vec3::distanceTo(Vec3* other) { + double dx = other->m_x - m_x; + double dy = other->m_y - m_y; + double dz = other->m_z - m_z; + return sqrt(dx * dx + dy * dy + dz * dz); +} + +Vec3* Vec3::scale(double multiplier) { + return newTemp(m_x * multiplier, m_y * multiplier, m_z * multiplier); +} + +double Vec3::lengthSqr() { + return m_x * m_x + m_y * m_y + m_z * m_z; +} + +Vec3* Vec3::getIntermediateWithXValue(Vec3* other, double x) { + double dx = other->m_x - m_x; + double dy = other->m_y - m_y; + double dz = other->m_z - m_z; + if (dx * dx < double(1.0e-7f)) + return nullptr; + double weight = (x - m_x) / dx; + // Reject out-of-range weights; unordered comparisons fall through in the binary. + if (weight < 0.0 || weight > 1.0) + return nullptr; + return newTemp(m_x + dx * weight, m_y + weight * dy, m_z + weight * dz); +} + +Vec3* Vec3::getIntermediateWithYValue(Vec3* other, double y) { + double dx = other->m_x - m_x; + double dy = other->m_y - m_y; + double dz = other->m_z - m_z; + if (dy * dy < double(1.0e-7f)) + return nullptr; + double weight = (y - m_y) / dy; + if (weight < 0.0 || weight > 1.0) + return nullptr; + return newTemp(m_x + dx * weight, m_y + dy * weight, m_z + weight * dz); +} + +Vec3* Vec3::getIntermediateWithZValue(Vec3* other, double z) { + double dx = other->m_x - m_x; + double dy = other->m_y - m_y; + double dz = other->m_z - m_z; + if (dz * dz < double(1.0e-7f)) + return nullptr; + double weight = (z - m_z) / dz; + if (weight < 0.0 || weight > 1.0) + return nullptr; + return newTemp(m_x + dx * weight, m_y + dy * weight, m_z + dz * weight); +} + +bool Vec3::equals(Vec3* other) { + if (other->m_x != m_x) + return false; + if (other->m_y != m_y) + return false; + return other->m_z == m_z; +} + +Vec3* Vec3::xRot(float angle) { + double cosine = cosf(angle); + double sine = sinf(angle); + return newTemp(m_x, cosine * m_y + sine * m_z, cosine * m_z - sine * m_y); +} + +Vec3* Vec3::yRot(float angle) { + double cosine = cosf(angle); + double sine = sinf(angle); + return newTemp(cosine * m_x + sine * m_z, m_y, cosine * m_z - m_x * sine); +} + +Vec3* Vec3::zRot(float angle) { + double cosine = cosf(angle); + double sine = sinf(angle); + return newTemp(cosine * m_x + sine * m_y, cosine * m_y - m_x * sine, m_z); +} + +Vec3* Vec3::add(double x, double y, double z) { + return newTemp(this->m_x + x, this->m_y + y, this->m_z + z); +} + +Vec3* Vec3::subtract(double x, double y, double z) { + return add(-x, -y, -z); +} + +Vec3* Vec3::subtract(Vec3* other) { + return subtract(other->m_x, other->m_y, other->m_z); +} + +double Vec3::distanceToSqr(Vec3* other) { + double dx = other->m_x - this->m_x; + double dy = other->m_y - this->m_y; + double dz = other->m_z - this->m_z; + return dx * dx + dy * dy + dz * dz; +} + double Vec3::dot(Vec3* rhs) { return this->m_x * rhs->m_x + this->m_y * rhs->m_y + this->m_z * rhs->m_z; } @@ -13,10 +166,11 @@ double Vec3::length() { return sqrt(this->m_x * this->m_x + this->m_y * this->m_y + this->m_z * this->m_z); } -void Vec3::set(double x, double y, double z) { +Vec3* Vec3::set(double x, double y, double z) { this->m_x = x; this->m_y = y; this->m_z = z; + return this; } void Vec3::resetPool() {} diff --git a/src/Minecraft.World/net/minecraft/world/phys/Vec3.h b/src/Minecraft.World/net/minecraft/world/phys/Vec3.h index 6a37420c..6962bf60 100644 --- a/src/Minecraft.World/net/minecraft/world/phys/Vec3.h +++ b/src/Minecraft.World/net/minecraft/world/phys/Vec3.h @@ -3,12 +3,19 @@ #include "net/minecraft/util/ThreadStorage.h" class AABB; +class Vec3i; class Vec3 { public: DECLARE_THREAD_STORAGE(Vec3) Vec3(double x, double y, double z) { + if (x == -0.0) + x = 0.0; + if (y == -0.0) + y = 0.0; + if (z == -0.0) + z = 0.0; this->m_x = x; this->m_y = y; this->m_z = z; @@ -17,6 +24,9 @@ class Vec3 { static Vec3* newTemp(double x, double y, double z); static Vec3* newTemp(const Vec3* other); + static Vec3* newTemp(const Vec3i& other); + static void staticCtor(); + static Vec3* ZERO; Vec3 operator=(Vec3 o); @@ -29,15 +39,30 @@ class Vec3 { Vec3 operator/(Vec3 o) { return Vec3(m_x / o.m_x, m_y / o.m_y, m_z / o.m_z); } static Vec3* newPermanent(double, double, double); + static Vec3* newPermanent(const Vec3* other); - Vec3 yRot(float); + Vec3* xRot(float); + Vec3* yRot(float); + Vec3* zRot(float); double dot(Vec3* rhs); double length(); - void set(double x, double y, double z); + double lengthSqr(); + Vec3* set(double x, double y, double z); static void resetPool(); double distanceTo(AABB* aabb); + double distanceTo(Vec3* other); + double distanceToSqr(Vec3* other); + Vec3* subtract(Vec3* other); Vec3* subtract(double, double, double); Vec3* add(double, double, double); + Vec3* add(Vec3* other); + Vec3* vectorTo(Vec3* other); + Vec3* cross(Vec3* other); + Vec3* lerp(Vec3* other, double weight); + bool equals(Vec3* other); + Vec3* getIntermediateWithXValue(Vec3* other, double x); + Vec3* getIntermediateWithYValue(Vec3* other, double y); + Vec3* getIntermediateWithZValue(Vec3* other, double z); Vec3* normalize(); Vec3* scale(double); diff --git a/src/Minecraft.World/net/minecraft/world/stats/GenericStats.cpp b/src/Minecraft.World/net/minecraft/world/stats/GenericStats.cpp index a572e8f3..186caadb 100644 --- a/src/Minecraft.World/net/minecraft/world/stats/GenericStats.cpp +++ b/src/Minecraft.World/net/minecraft/world/stats/GenericStats.cpp @@ -1,5 +1,14 @@ #include "net/minecraft/world/stats/GenericStats.h" +#include "net/minecraft/world/item/ItemInstance.h" + +arrayWithLength GenericStats::param_itemsUsed(std::shared_ptr player, + not_null_ptr item) { + if (!player || item->isEmpty()) + return sInstance->getParam_noArgs(); + return sInstance->getParam_itemsUsed(player, item); +} + Stat* GenericStats::get_achievement(eAward) { return nullptr; } @@ -192,7 +201,7 @@ arrayWithLength GenericStats::getParam_climbOneM(int) { return getParam_noArgs(); } -arrayWithLength GenericStats::getParam_inecartOneM(int) { +arrayWithLength GenericStats::getParam_minecartOneM(int) { return getParam_noArgs(); } @@ -237,8 +246,8 @@ arrayWithLength GenericStats::getParam_itemsBought(int, int, int) return getParam_noArgs(); } -arrayWithLength GenericStats::getParam_obKill(std::shared_ptr, std::shared_ptr, - DamageSource*) { +arrayWithLength GenericStats::getParam_mobKill(std::shared_ptr, std::shared_ptr, + DamageSource*) { return getParam_noArgs(); } @@ -294,7 +303,7 @@ arrayWithLength GenericStats::getParam_chestfulOfCobblestone(int) return getParam_achievement(eAward_CHESTFUL_OF_COBBLESTONE); } -arrayWithLength GenericStats::getParam_usicToMyEars(int) { +arrayWithLength GenericStats::getParam_musicToMyEars(int) { return getParam_achievement(eAward_MUSIC_TO_MY_EARS); } @@ -366,7 +375,7 @@ arrayWithLength GenericStats::getParam_youWontLikeMeWhenImHungry( return getParam_achievement(eAward_YOU_WONT_LIKE_ME_WHEN_IM_HUNGRY); } -arrayWithLength GenericStats::getParam_ine() { +arrayWithLength GenericStats::getParam_mine() { return getParam_achievement(eAward_MINE); } @@ -382,7 +391,7 @@ arrayWithLength GenericStats::getParam_beamMeUp(int) { return getParam_achievement(eAward_BEAM_ME_UP); } -arrayWithLength GenericStats::getParam_apRoom(int) { +arrayWithLength GenericStats::getParam_mapRoom(int) { return getParam_achievement(eAward_MAP_ROOM); } @@ -738,7 +747,7 @@ arrayWithLength GenericStats::param_buildHoe() { return sInstance->getParam_achievement(eAward_BUILD_HOE); } -arrayWithLength GenericStats::param_akeBread() { +arrayWithLength GenericStats::param_makeBread() { return sInstance->getParam_achievement(eAward_MAKE_BREAD); } @@ -830,7 +839,7 @@ arrayWithLength GenericStats::param_deadshot() { return sInstance->getParam_achievement(eAward_DEADSHOT); } -arrayWithLength GenericStats::param_ountainTop() { +arrayWithLength GenericStats::param_mountainTop() { return sInstance->getParam_achievement(eAward_MOUNTAIN_TOP); } diff --git a/src/Minecraft.World/net/minecraft/world/stats/GenericStats.h b/src/Minecraft.World/net/minecraft/world/stats/GenericStats.h index 943f40f2..26d8bbb2 100644 --- a/src/Minecraft.World/net/minecraft/world/stats/GenericStats.h +++ b/src/Minecraft.World/net/minecraft/world/stats/GenericStats.h @@ -72,7 +72,7 @@ class GenericStats { virtual arrayWithLength getParam_swimOneM(int); virtual arrayWithLength getParam_fallOneM(int); virtual arrayWithLength getParam_climbOneM(int); - virtual arrayWithLength getParam_inecartOneM(int); + virtual arrayWithLength getParam_minecartOneM(int); virtual arrayWithLength getParam_boatOneM(int); virtual arrayWithLength getParam_pigOneM(int); virtual arrayWithLength getParam_cowsMilked(); @@ -84,8 +84,8 @@ class GenericStats { virtual arrayWithLength getParam_itemsUsed(std::shared_ptr, not_null_ptr); virtual arrayWithLength getParam_itemsBought(int, int, int); - virtual arrayWithLength getParam_obKill(std::shared_ptr, std::shared_ptr, - DamageSource*); + virtual arrayWithLength getParam_mobKill(std::shared_ptr, std::shared_ptr, + DamageSource*); virtual arrayWithLength getParam_breedEntity(eINSTANCEOF); virtual arrayWithLength getParam_tamedEntity(eINSTANCEOF); virtual arrayWithLength getParam_curedEntity(eINSTANCEOF); @@ -99,7 +99,7 @@ class GenericStats { virtual arrayWithLength getParam_overkill(int); virtual arrayWithLength getParam_openInventory(int); virtual arrayWithLength getParam_chestfulOfCobblestone(int); - virtual arrayWithLength getParam_usicToMyEars(int); + virtual arrayWithLength getParam_musicToMyEars(int); virtual arrayWithLength getParam_MG03Score(int); virtual arrayWithLength getParam_MG03RingCount(int); virtual arrayWithLength getParam_MG03BestTime(unsigned int); @@ -117,11 +117,11 @@ class GenericStats { virtual arrayWithLength getParam_tisButAScratch(); virtual arrayWithLength getParam_cupid(); virtual arrayWithLength getParam_youWontLikeMeWhenImHungry(); - virtual arrayWithLength getParam_ine(); + virtual arrayWithLength getParam_mine(); virtual arrayWithLength getParam_superSonic(int); virtual arrayWithLength getParam_freeDiver(int); virtual arrayWithLength getParam_beamMeUp(int); - virtual arrayWithLength getParam_apRoom(int); + virtual arrayWithLength getParam_mapRoom(int); virtual arrayWithLength getParam_tenaciousBall(int); virtual arrayWithLength getParam_suckMySnowballs(int); virtual arrayWithLength getParam_greatViewFromUpHere(int); @@ -217,7 +217,7 @@ class GenericStats { static arrayWithLength param_buildPickaxe(); static arrayWithLength param_buildFurnace(); static arrayWithLength param_buildHoe(); - static arrayWithLength param_akeBread(); + static arrayWithLength param_makeBread(); static arrayWithLength param_bakeCake(); static arrayWithLength param_buildBetterPickaxe(); static arrayWithLength param_onARail(int); @@ -240,7 +240,7 @@ class GenericStats { static arrayWithLength param_backFromTheDead(); static arrayWithLength param_equipYourFists(); static arrayWithLength param_deadshot(); - static arrayWithLength param_ountainTop(); + static arrayWithLength param_mountainTop(); static arrayWithLength param_willLikeNoOther(); static arrayWithLength param_changeOfSheets(); static arrayWithLength param_adventuringTime(); diff --git a/src/types.h b/src/types.h index 8873f9d7..1bcb808b 100644 --- a/src/types.h +++ b/src/types.h @@ -15,7 +15,7 @@ template class not_null_ptr : public std::shared_ptr { public: not_null_ptr() = default; - not_null_ptr(T* ptr); + not_null_ptr(T* ptr) : std::shared_ptr(ptr) {} not_null_ptr(const T& other); }; From e165af2a29ef39d41ba1eab98c8dfbcbf5ef00dd Mon Sep 17 00:00:00 2001 From: Cube1ber <202843220+cube-one-ber@users.noreply.github.com> Date: Sun, 18 Oct 2026 07:17:44 +0100 Subject: [PATCH 2/3] Restore symbol mappings lost during PR splitting --- data/data_symbols.csv | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/data/data_symbols.csv b/data/data_symbols.csv index 1f0f3a3c..30d90a47 100644 --- a/data/data_symbols.csv +++ b/data/data_symbols.csv @@ -11,15 +11,19 @@ 0x0000007101781BBC,AABB__sThreadStorageCount 0x0000007101781BC0,AABB__sDefaultThreadStorage 0x0000007101781BE0,_ZN6Blocks8RegistryE +0x0000007101781BF8,_ZN6Blocks5CHESTE 0x0000007101781C18,_ZN6Blocks10SNOW_LAYERE 0x0000007101781C20,_ZN6Blocks9HAY_BLOCKE 0x0000007101781C28,_ZN6Blocks5GRASSE 0x0000007101781C40,_ZN6Blocks11LIT_PUMPKINE 0x0000007101781C48,_ZN6Blocks7PUMPKINE +0x0000007101781C50,_ZN6Blocks4DIRTE 0x0000007101781C58,_ZN6Blocks3LOGE 0x0000007101781C60,_ZN6Blocks4LOG2E 0x0000007101781C68,_ZN6Blocks7SAPLINGE 0x0000007101781C70,_ZN6Blocks4VINEE +0x0000007101781C78,_ZN6Blocks14BROWN_MUSHROOME +0x0000007101781C80,_ZN6Blocks12RED_MUSHROOME 0x0000007101781FA8,_ZN6Blocks14CRAFTING_TABLEE 0x0000007101781FB0,_ZN6Blocks7FURNACEE 0x0000007101781FB8,_ZN6Blocks4RAILE @@ -31,6 +35,7 @@ 0x0000007101782068,_ZN6Blocks5ANVILE 0x0000007101782070,_ZN8BlockPos4zeroE 0x00000071017825B8,_ZN6Blocks6PLANKSE +0x00000071017825D0,_ZN6Blocks3AIRE 0x00000071017825D8,_ZN6Blocks3WEBE 0x00000071017825F8,_ZN6Blocks11MELON_BLOCKE 0x0000007101782600,_ZN6Blocks6LADDERE @@ -52,6 +57,7 @@ 0x0000007101782A78,_ZN6Blocks10IRON_BLOCKE 0x0000007101782A80,_ZN6Blocks13STAINED_GLASSE 0x0000007101782A88,_ZN6Blocks18STAINED_GLASS_PANEE +0x0000007101782A90,_ZN6Blocks7BEDROCKE 0x0000007101782AD8,_ZN5Biome6NETHERE 0x0000007101782AE0,_ZN6Blocks11ACACIA_DOORE 0x0000007101782AE8,_ZN6Blocks10BIRCH_DOORE @@ -125,6 +131,13 @@ 0x0000007101783540,_ZN5Biome14MESA_PLATEAU_ME 0x0000007101783548,_ZN5Biome7DEFAULTE 0x0000007101783590,_ZN5Biome17TEMPERATURE_NOISEE +0x00000071017835C8,_ZN6Blocks6GRAVELE +0x00000071017835D0,_ZN6Blocks13YELLOW_FLOWERE +0x00000071017835D8,_ZN6Blocks5STONEE +0x00000071017835E0,_ZN6Blocks8COAL_OREE +0x00000071017835E8,_ZN6Blocks8IRON_OREE +0x00000071017835F0,_ZN6Blocks8GOLD_OREE +0x00000071017835F8,_ZN6Blocks12REDSTONE_OREE 0x0000007101783600,_ZN6Blocks11DIAMOND_OREE 0x0000007101783608,_ZN6Blocks9LAPIS_OREE 0x0000007101783610,_ZN6Blocks8DEADBUSHE @@ -145,6 +158,7 @@ 0x0000007101783750,_ZN6Blocks7LEAVES2E 0x0000007101783770,_ZN11BlockEntity21blockEntityFactoryMapE 0x0000007101783780,_ZN16ResourceLocation8RegistryE +0x00000071017839C8,_ZN6Blocks11COBBLESTONEE 0x00000071017839D0,_ZN6Blocks5WATERE 0x00000071017839D8,_ZN6Blocks4LAVAE 0x00000071017839E0,_ZN6Blocks6SPONGEE @@ -157,7 +171,11 @@ 0x0000007101783A18,_ZN6Blocks17DOUBLE_STONE_SLABE 0x0000007101783A20,_ZN6Blocks10STONE_SLABE 0x0000007101783A28,_ZN6Blocks3TNTE +0x0000007101783A30,_ZN6Blocks17MOSSY_COBBLESTONEE +0x0000007101783A38,_ZN6Blocks8OBSIDIANE +0x0000007101783A40,_ZN6Blocks5TORCHE 0x0000007101783A48,_ZN6Blocks4FIREE +0x0000007101783A50,_ZN6Blocks11MOB_SPAWNERE 0x0000007101783A58,_ZN6Blocks10OAK_STAIRSE 0x0000007101783A60,_ZN6Blocks13REDSTONE_WIREE 0x0000007101783A68,_ZN6Blocks11LIT_FURNACEE @@ -192,6 +210,7 @@ 0x0000007101783B50,_ZN6Blocks10STONEBRICKE 0x0000007101783B58,_ZN6Blocks20BROWN_MUSHROOM_BLOCKE 0x0000007101783B60,_ZN6Blocks18RED_MUSHROOM_BLOCKE +0x0000007101783B68,_ZN6Blocks9IRON_BARSE 0x0000007101783B70,_ZN6Blocks10GLASS_PANEE 0x0000007101783B78,_ZN6Blocks12PUMPKIN_STEME 0x0000007101783B80,_ZN6Blocks10MELON_STEME @@ -253,6 +272,7 @@ 0x0000007101783D40,_ZN6Blocks13ACACIA_STAIRSE 0x0000007101783D48,_ZN6Blocks15DARK_OAK_STAIRSE 0x0000007101783D50,_ZN6Blocks5SLIMEE +0x0000007101783D58,_ZN6Blocks12DOUBLE_PLANTE 0x0000007101783D60,_ZN6Blocks10PRISMARINEE 0x0000007101783D68,_ZN6Blocks13RED_SANDSTONEE 0x0000007101783D70,_ZN6Blocks20RED_SANDSTONE_STAIRSE @@ -314,6 +334,7 @@ 0x0000007101783F30,_ZN6Blocks8CONCRETEE 0x0000007101783F38,_ZN6Blocks15CONCRETE_POWDERE 0x0000007101783F40,_ZN6Blocks15STRUCTURE_BLOCKE +0x0000007101783F98,_ZN17BuiltInLootTables17SPAWN_BONUS_CHESTE 0x00000071017840A8,_ZN17BuiltInLootTables19ABANDONED_MINESHAFTE 0x00000071017840F8,_ZN17BuiltInLootTables14DESERT_PYRAMIDE 0x0000007101784148,_ZN17BuiltInLootTables14DISPENSER_TRAPE @@ -330,6 +351,8 @@ 0x00000071017844B8,_ZN17BuiltInLootTables18VILLAGE_BLACKSMITHE 0x0000007101784508,_ZN17BuiltInLootTables22VILLAGE_TWO_ROOM_HOUSEE 0x0000007101784558,_ZN17BuiltInLootTables16WOODLAND_MANSIONE +0x00000071017860F0,_ZN8DyeColor5WHITEE +0x00000071017860F8,_ZN8DyeColor6YELLOWE 0x0000007101786100,_ZN8DyeColor3REDE 0x0000007101786108,_ZN8DyeColor4PINKE 0x0000007101786110,_ZN8DyeColor6ORANGEE @@ -443,6 +466,7 @@ 0x000000710178A950,_ZN5Items9FIREWORKSE 0x000000710178A9B0,_ZN5Items11FISHING_RODE 0x000000710178AA48,_ZN11FlowerBlock6Flower10RED_FLOWERE +0x000000710178AA50,_ZN11FlowerBlock6Flower13YELLOW_FLOWERE 0x000000710178AAA8,FlowerBlock::FlowerCategory::YELLOW_FLOWER 0x000000710178AC28,_ZN5Items10FLOWER_POTE 0x000000710178ACE8,_ZN5Items12ROTTEN_FLESHE @@ -661,7 +685,9 @@ 0x000000710178BFD8,_ZN9LevelType10CUSTOMIZEDE 0x000000710178BFE0,_ZN9LevelType12LARGE_BIOMESE 0x000000710178C110,_ZN9LeafBlock11CHECK_DECAYE +0x000000710178C118,_ZN8Material6LEAVESE 0x000000710178C130,_ZN9LevelType4FLATE +0x000000710178C138,_ZN8Material3AIRE 0x000000710178C140,_ZN8Material6PORTALE 0x000000710178C1B0,_ZN10LevelChunk10touchedSkyE 0x000000710178C1B8,_ZN9LevelType6NORMALE @@ -672,6 +698,9 @@ 0x000000710178C5A8,_ZN10MobEffects10LEVITATIONE 0x000000710178C600,_ZN8LogBlock12LOG_VARIANTSE 0x000000710178C690,_ZN8LogBlock8LOG_AXISE +0x000000710178C698,_ZN8LogBlock7LogAxis1XE +0x000000710178C6A0,_ZN8LogBlock7LogAxis1YE +0x000000710178C6A8,_ZN8LogBlock7LogAxis1ZE 0x000000710178C6B8,_ZN8LogBlock9PREDICATEE 0x000000710178C6C0,_ZN8Material4WOODE 0x000000710178C6E0,_ZN8LogBlock7LogAxis4NONEE @@ -808,6 +837,7 @@ 0x000000710178CED0,_ZN15MonsterEggBlock7Variant14CHISELED_BRICKE 0x000000710178cee0,_ZN3Mth3SINE 0x000000710178cee8,_ZN3Mth4ATANE +0x000000710178CFC8,_ZN11NewLogBlock7VARIANTE 0x00000071017A1140,_ZN6Packet11sPacketsMapE 0x00000071017A16D8,_ZN15RangedAttribute13ATTACK_DAMAGEE 0x00000071017A16F0,_ZN11PlanksBlock7Variant6SPRUCEE @@ -885,9 +915,13 @@ 0x00000071017A42E8,SoundType::GRASS 0x00000071017A42F0,SoundType::STONE 0x00000071017A4318,SoundType::SNOW +0x00000071017A4AC0,_ZN10StoneBlock7VARIANTE 0x00000071017A4AC8,_ZN10StoneBlock7Variant5STONEE +0x00000071017A4AD0,_ZN10StoneBlock7Variant7GRANITEE 0x00000071017A4AD8,_ZN10StoneBlock7Variant14SMOOTH_GRANITEE +0x00000071017A4AE0,_ZN10StoneBlock7Variant7DIORITEE 0x00000071017A4AE8,_ZN10StoneBlock7Variant14SMOOTH_DIORITEE +0x00000071017A4AF0,_ZN10StoneBlock7Variant8ANDESITEE 0x00000071017A4AF8,_ZN10StoneBlock7Variant15SMOOTH_ANDESITEE 0x00000071017A4B00,_ZN10StoneBlock7Variant8VARIANTSE 0x00000071017A4B38,_ZN10StoneBlock9PREDICATEE From 9c48d27c0f23da3d8f3feb74f355597e9855b5ca Mon Sep 17 00:00:00 2001 From: Cube1ber <202843220+cube-one-ber@users.noreply.github.com> Date: Mon, 19 Oct 2026 07:00:46 +0100 Subject: [PATCH 3/3] Consolidate reconstructed source files and clarify annotations --- src/4JLibraries_Source/fui/fui.cpp | 3 + src/4JLibraries_Source/fui/fuiFile.h | 6 +- src/DecompUtils.h | 2 +- .../com/mojang/nbt/ByteTag.cpp | 2 +- src/Minecraft.Client/com/mojang/nbt/ByteTag.h | 2 +- .../com/mojang/nbt/CompoundTag.cpp | 29 ++++++- .../com/mojang/nbt/CompoundTag.h | 3 +- .../com/mojang/nbt/CompoundTagKeys.cpp | 12 --- .../com/mojang/nbt/DoubleTag.cpp | 2 +- .../com/mojang/nbt/DoubleTag.h | 2 +- .../com/mojang/nbt/FloatTag.cpp | 2 +- .../com/mojang/nbt/FloatTag.h | 2 +- .../com/mojang/nbt/IntTag.cpp | 2 +- src/Minecraft.Client/com/mojang/nbt/IntTag.h | 2 +- .../com/mojang/nbt/ListTag.cpp | 53 +++++++++++- src/Minecraft.Client/com/mojang/nbt/ListTag.h | 6 +- .../com/mojang/nbt/ListTagNumeric.cpp | 20 ----- .../com/mojang/nbt/ListTagSet.cpp | 21 ----- .../com/mojang/nbt/LongTag.cpp | 4 +- src/Minecraft.Client/com/mojang/nbt/LongTag.h | 6 +- src/Minecraft.Client/com/mojang/nbt/NbtIo.cpp | 55 +++++++++++++ .../com/mojang/nbt/NbtIoStreams.cpp | 55 ------------- .../com/mojang/nbt/NbtUtils.cpp | 8 +- .../com/mojang/nbt/NumericTag.cpp | 1 + .../com/mojang/nbt/NumericTag.h | 3 +- .../com/mojang/nbt/ShortTag.cpp | 2 +- .../com/mojang/nbt/ShortTag.h | 2 +- .../com/mojang/nbt/StringTag.cpp | 5 ++ src/Minecraft.Client/com/mojang/nbt/Tag.cpp | 3 +- src/Minecraft.Client/com/mojang/nbt/Tag.h | 5 +- .../net/minecraft/client/CMinecraftApp.h | 2 +- .../net/minecraft/core/BlockPos.cpp | 56 +++++++++++++ .../net/minecraft/core/BlockPosBasics.cpp | 28 ------- .../net/minecraft/core/BlockPosPacking.cpp | 17 ---- .../net/minecraft/core/Direction.cpp | 10 +++ .../net/minecraft/core/MutableBlockPos.cpp | 16 ++++ .../net/minecraft/core/NonNullList.h | 5 +- .../net/minecraft/core/StringHash.cpp | 20 ----- .../net/minecraft/core/System.cpp | 71 +++++++++++++++- .../net/minecraft/core/System.h | 15 ++-- .../net/minecraft/core/SystemClock.cpp | 44 ---------- .../minecraft/core/TreePositionHelpers.cpp | 25 ------ .../net/minecraft/core/Vec3i.cpp | 10 +++ .../minecraft/resources/ResourceLocation.h | 6 +- .../server/level/ServerChunkCache.cpp | 4 +- .../java/io/ByteArrayInputStream.cpp | 1 + src/Minecraft.World/java/io/DataInput.cpp | 1 + src/Minecraft.World/java/io/DataInput.h | 4 +- .../java/io/DataInputStream.cpp | 82 +++++++++++++++++-- src/Minecraft.World/java/io/DataInputStream.h | 4 +- .../java/io/DataInputStreamCompressedNbt.cpp | 22 ----- .../java/io/DataInputStreamNbt.cpp | 13 --- .../java/io/DataInputStreamProtocol.cpp | 25 ------ src/Minecraft.World/java/io/DataOutput.cpp | 2 + .../java/io/DataOutputStream.cpp | 38 ++++++++- .../java/io/DataOutputStream.h | 3 +- .../java/io/DataOutputStreamNbt.cpp | 13 --- .../java/io/DataOutputStreamProtocol.cpp | 19 ----- src/Minecraft.World/java/io/File.cpp | 55 ++++++++++++- .../java/io/FileInputStream.cpp | 12 ++- .../java/io/FileOutputStream.cpp | 4 + src/Minecraft.World/java/io/FilePaths.cpp | 29 ------- src/Minecraft.World/java/io/IntCache.h | 3 +- src/Minecraft.World/java/io/JavaLong.h | 5 -- .../java/io/SwitchFileStubs.cpp | 11 --- .../net/minecraft/util/Mth.cpp | 34 ++++++-- src/Minecraft.World/net/minecraft/util/Mth.h | 6 +- .../net/minecraft/util/MthCeil.cpp | 6 -- .../net/minecraft/util/MthFloor.cpp | 9 -- .../net/minecraft/util/MthRound.cpp | 6 -- .../net/minecraft/util/StringUtils.cpp | 3 + .../net/minecraft/util/StringUtils.h | 3 +- .../{DataFixLifecycle.cpp => DataFix.cpp} | 3 + ...perRegistration.cpp => DataFixerUpper.cpp} | 55 ++++++++++++- .../util/datafix/DataFixerUpperUpdate.cpp | 44 ---------- ...aFixerItemTraversal.cpp => DataFixers.cpp} | 5 +- .../util/datafix/fixes/ItemIdFix.cpp | 2 +- .../util/datafix/fixes/ItemTotemRenameFix.cpp | 19 +++++ ...temTagFixes.cpp => ItemWaterPotionFix.cpp} | 16 ++-- ...DataWalkerLifecycle.cpp => DataWalker.cpp} | 3 + .../util/datafix/walker/ItemDataWalker.cpp | 13 +++ .../util/datafix/walker/ItemDataWalker.h | 3 +- ...DataWalkers.cpp => ItemListDataWalker.cpp} | 11 +-- .../util/datafix/walker/ItemListDataWalker.h | 3 +- .../util/datafix/walker/KeyedDataWalker.cpp | 2 + .../util/datafix/walker/KeyedDataWalker.h | 3 +- .../net/minecraft/world/ArrayWithLength.h | 3 +- .../net/minecraft/world/PlayerUID.h | 7 +- .../net/minecraft/world/Random.h | 6 +- .../net/minecraft/world/entity/LivingEntity.h | 1 + .../minecraft/world/entity/player/Player.h | 2 +- .../net/minecraft/world/item/Item.cpp | 1 + .../net/minecraft/world/level/biome/Biome.cpp | 11 +-- .../world/level/biome/BiomeSource.cpp | 3 +- .../net/minecraft/world/level/block/Block.cpp | 16 ++-- .../level/block/BlockBootstrapAllocation.h | 5 +- .../world/level/block/StoneSlabBlock.h | 3 +- .../level/block/state/BlockStateDefinition.h | 3 +- .../level/levelgen/LevelGenerationOptions.h | 3 +- .../level/levelgen/NetherFlatLevelSource.cpp | 4 +- .../level/levelgen/OverworldLevelSource.cpp | 4 +- .../world/level/newbiome/layer/IntCache.h | 3 +- .../level/storage/light/SparseLightStorage.h | 3 +- .../net/minecraft/world/phys/AABB.cpp | 51 +++++++++++- .../net/minecraft/world/phys/AABBClip.cpp | 1 - .../net/minecraft/world/phys/AABBClip.inl | 37 --------- .../net/minecraft/world/phys/HitResult.cpp | 1 + .../net/minecraft/world/phys/Vec3.cpp | 18 +++- .../net/minecraft/world/phys/Vec3.h | 1 + 109 files changed, 794 insertions(+), 637 deletions(-) delete mode 100644 src/Minecraft.Client/com/mojang/nbt/CompoundTagKeys.cpp delete mode 100644 src/Minecraft.Client/com/mojang/nbt/ListTagNumeric.cpp delete mode 100644 src/Minecraft.Client/com/mojang/nbt/ListTagSet.cpp delete mode 100644 src/Minecraft.Client/com/mojang/nbt/NbtIoStreams.cpp delete mode 100644 src/Minecraft.Client/net/minecraft/core/BlockPosBasics.cpp delete mode 100644 src/Minecraft.Client/net/minecraft/core/BlockPosPacking.cpp delete mode 100644 src/Minecraft.Client/net/minecraft/core/StringHash.cpp delete mode 100644 src/Minecraft.Client/net/minecraft/core/SystemClock.cpp delete mode 100644 src/Minecraft.Client/net/minecraft/core/TreePositionHelpers.cpp delete mode 100644 src/Minecraft.World/java/io/DataInputStreamCompressedNbt.cpp delete mode 100644 src/Minecraft.World/java/io/DataInputStreamNbt.cpp delete mode 100644 src/Minecraft.World/java/io/DataInputStreamProtocol.cpp delete mode 100644 src/Minecraft.World/java/io/DataOutputStreamNbt.cpp delete mode 100644 src/Minecraft.World/java/io/DataOutputStreamProtocol.cpp delete mode 100644 src/Minecraft.World/java/io/FilePaths.cpp delete mode 100644 src/Minecraft.World/java/io/JavaLong.h delete mode 100644 src/Minecraft.World/java/io/SwitchFileStubs.cpp delete mode 100644 src/Minecraft.World/net/minecraft/util/MthCeil.cpp delete mode 100644 src/Minecraft.World/net/minecraft/util/MthFloor.cpp delete mode 100644 src/Minecraft.World/net/minecraft/util/MthRound.cpp rename src/Minecraft.World/net/minecraft/util/datafix/{DataFixLifecycle.cpp => DataFix.cpp} (54%) rename src/Minecraft.World/net/minecraft/util/datafix/{DataFixerUpperRegistration.cpp => DataFixerUpper.cpp} (53%) delete mode 100644 src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperUpdate.cpp rename src/Minecraft.World/net/minecraft/util/datafix/{walker/DataFixerItemTraversal.cpp => DataFixers.cpp} (96%) create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTotemRenameFix.cpp rename src/Minecraft.World/net/minecraft/util/datafix/fixes/{ItemTagFixes.cpp => ItemWaterPotionFix.cpp} (74%) rename src/Minecraft.World/net/minecraft/util/datafix/walker/{DataWalkerLifecycle.cpp => DataWalker.cpp} (59%) create mode 100644 src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalker.cpp rename src/Minecraft.World/net/minecraft/util/datafix/walker/{ItemDataWalkers.cpp => ItemListDataWalker.cpp} (63%) delete mode 100644 src/Minecraft.World/net/minecraft/world/phys/AABBClip.cpp delete mode 100644 src/Minecraft.World/net/minecraft/world/phys/AABBClip.inl diff --git a/src/4JLibraries_Source/fui/fui.cpp b/src/4JLibraries_Source/fui/fui.cpp index 18051b8c..2a948b3d 100644 --- a/src/4JLibraries_Source/fui/fui.cpp +++ b/src/4JLibraries_Source/fui/fui.cpp @@ -24,6 +24,7 @@ void fui::setScreenSize(float width, float height) { this->m_screenHeight = height; } +// NON_MATCHING | score: 3004 (lower is better) void fui::unloadScene(fuiFile* file) { if (!file) return; @@ -95,6 +96,7 @@ void fui::render(fuiFile* file, float a1, float a2, float a3, float a4, float a5 file->m_renderNodeStage->render(nullptr, nullptr); } +// NON_MATCHING | score: 5 (lower is better) void fui::dispatchKeyboardEvent(fuiFile* file, bool state, int c) { FJ_FuiNode* node = file->m_renderNodeStage->m_fuiNodeStage; @@ -105,6 +107,7 @@ void fui::dispatchKeyboardEvent(fuiFile* file, bool state, int c) { } // param names guessed +// NON_MATCHING | score: 5 (lower is better) void fui::dispatchMouseMoveEvent(fuiFile* file, float x, float y) { FJ_FuiNode* node = file->m_renderNodeStage->m_fuiNodeStage; diff --git a/src/4JLibraries_Source/fui/fuiFile.h b/src/4JLibraries_Source/fui/fuiFile.h index a948ba41..cb8dbbcb 100644 --- a/src/4JLibraries_Source/fui/fuiFile.h +++ b/src/4JLibraries_Source/fui/fuiFile.h @@ -37,6 +37,7 @@ struct fuiMatrix { // spent an hour trying to figure out what this was // finally thought of it being a built in C++ operator... which looks good to me. + // NON_MATCHING | score: 205 (lower is better) fuiMatrix operator*(const fuiMatrix& rhs) const { fuiMatrix out = {}; mul(*this, rhs, out); @@ -192,8 +193,9 @@ struct fuiData { struct fuiFile { fuiFile(); ~fuiFile(); - // Retain the recovered symbol's ABI; its third argument is a byte stride, - // despite the old unsigned-char** declaration in the symbol map. + /** Retain the recovered symbol's ABI; its third argument is a byte stride, + * despite the old unsigned-char** declaration in the symbol map. + */ static uint64_t addDataRegion(uint a1, uint a2, uchar** ptr, uint64_t* callbackData); bool load(arrayWithLength, int); bool resolveReferences(fuiFile*); diff --git a/src/DecompUtils.h b/src/DecompUtils.h index 4c155ff1..1027d6f8 100644 --- a/src/DecompUtils.h +++ b/src/DecompUtils.h @@ -20,7 +20,7 @@ inline __attribute__((__always_inline__)) float decomp_fminf(float x, float y) { return x; } -// AArch64 fmax/fmin propagate NaNs; the C math functions use different semantics. +/** Custom instruction helpers: AArch64 fmax/fmin propagate NaNs, unlike the C math functions. */ inline __attribute__((__always_inline__)) double decomp_fmax64(double x, double y) { __asm__("fmax %d0, %d1, %d2" : "=w"(x) : "w"(x), "w"(y)); return x; diff --git a/src/Minecraft.Client/com/mojang/nbt/ByteTag.cpp b/src/Minecraft.Client/com/mojang/nbt/ByteTag.cpp index 65f96db5..e3ec5d84 100644 --- a/src/Minecraft.Client/com/mojang/nbt/ByteTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/ByteTag.cpp @@ -30,7 +30,7 @@ bool ByteTag::equals(Tag* other) { return Tag::equals(other) && m_data == otherCasted->m_data; } -JavaLong ByteTag::getAsLong() { +long ByteTag::getAsLong() { return m_data; } diff --git a/src/Minecraft.Client/com/mojang/nbt/ByteTag.h b/src/Minecraft.Client/com/mojang/nbt/ByteTag.h index 699a8e3b..3faa16a1 100644 --- a/src/Minecraft.Client/com/mojang/nbt/ByteTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/ByteTag.h @@ -12,7 +12,7 @@ class ByteTag : public NumericTag { std::wstring toString() override; u8 getId() override; bool equals(Tag*) override; - JavaLong getAsLong() override; + long getAsLong() override; int getAsInt() override; short getAsShort() override; u8 getAsByte() override; diff --git a/src/Minecraft.Client/com/mojang/nbt/CompoundTag.cpp b/src/Minecraft.Client/com/mojang/nbt/CompoundTag.cpp index 70d7af7b..531e9137 100644 --- a/src/Minecraft.Client/com/mojang/nbt/CompoundTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/CompoundTag.cpp @@ -15,11 +15,13 @@ #include CompoundTag::CompoundTag() = default; +// NON_MATCHING | score: 1853 (lower is better) CompoundTag::~CompoundTag() { for (const auto& child : m_childTags) delete child.second; } +// NON_MATCHING | score: 2304 (lower is better) void CompoundTag::write(DataOutput* output) { for (const auto& child : m_childTags) { u8 id = child.second->getId(); @@ -32,6 +34,7 @@ void CompoundTag::write(DataOutput* output) { output->writeByte(TAG_End); } +// NON_MATCHING | score: 2625 (lower is better) void CompoundTag::load(DataInput* input, int depth) { if (depth > 512) return; @@ -58,6 +61,7 @@ bool CompoundTag::isEmpty() const { return m_childTags.empty(); } +// NON_MATCHING | score: 1334 (lower is better) bool CompoundTag::equals(Tag* other) { if (!Tag::equals(other)) return false; @@ -92,6 +96,7 @@ void CompoundTag::stripEmptyChildren() { } } +// name guessed void CompoundTag::remove(const std::wstring& name) { auto it = m_childTags.find(name); if (it != m_childTags.end()) { @@ -106,10 +111,12 @@ Tag* CompoundTag::get(const std::wstring& name) { bool CompoundTag::contains(const std::wstring& name) { return m_childTags.find(name) != m_childTags.end(); } +// name guessed u8 CompoundTag::getTagType(const std::wstring& name) const { auto it = m_childTags.find(name); return it == m_childTags.end() ? TAG_End : it->second->getId(); } +// NON_MATCHING | score: 1310 (lower is better) bool CompoundTag::contains(const std::wstring& name, int type) { u8 id = getTagType(name); return id == type || (type == 99 && id >= TAG_Byte && id <= TAG_Double); @@ -118,6 +125,8 @@ bool CompoundTag::contains(const std::wstring& name, int type) { CompoundTag* CompoundTag::getCompound(const std::wstring& name) { return contains(name, TAG_Compound) ? static_cast(m_childTags[name]) : new CompoundTag(); } +// name guessed +// NON_MATCHING | score: 50 (lower is better) ListTag* CompoundTag::getList(const std::wstring& name, int type) { if (getTagType(name) == TAG_List) { auto list = static_cast(m_childTags[name]); @@ -126,6 +135,8 @@ ListTag* CompoundTag::getList(const std::wstring& name, int type) { } return new ListTag(0); } +// name guessed +// NON_MATCHING | score: 4187 (lower is better) const ListTag* CompoundTag::fjSafeGetListTag(const std::wstring& name, int type) const { static const ListTag empty; auto it = m_childTags.find(name); @@ -149,18 +160,19 @@ short CompoundTag::getShort(const std::wstring& name) { int CompoundTag::getInt(const std::wstring& name) { return contains(name, 99) ? static_cast(m_childTags[name])->getAsInt() : 0; } +// name guessed float CompoundTag::getFloat(const std::wstring& name) { return contains(name, 99) ? static_cast(m_childTags[name])->getAsFloat() : 0; } std::wstring CompoundTag::getString(const std::wstring& name) { return contains(name, TAG_String) ? m_childTags[name]->getAsString() : L""; } +// NON_MATCHING | score: 720 (lower is better) arrayWithLength CompoundTag::getByteArray(const std::wstring& name) { return contains(name, TAG_Byte_Array) ? static_cast(get(name))->m_data : arrayWithLength(); } -// Keep the recovered helper for matching metadata already attached to it. void erease_if_exists(const std::unordered_map& map, const std::wstring& key, Tag* tag) { map.size(); key.length(); @@ -189,10 +201,12 @@ void CompoundTag::putInt(const std::wstring& name, int value) { erease_if_exists(m_childTags, name, get(name)); m_childTags[name] = new IntTag(value); } +// name guessed void CompoundTag::putLong(const std::wstring& name, long long value) { erease_if_exists(m_childTags, name, get(name)); m_childTags[name] = new LongTag(value); } +// name guessed void CompoundTag::putFloat(const std::wstring& name, float value) { erease_if_exists(m_childTags, name, get(name)); m_childTags[name] = new FloatTag(value); @@ -205,3 +219,16 @@ void CompoundTag::putByteArray(const std::wstring& name, arrayWithLength val erease_if_exists(m_childTags, name, get(name)); m_childTags[name] = new ByteArrayTag(value, true); } + +// name guessed +std::vector* CompoundTag::getAllKeys() { + auto keys = new std::vector(); + for (const auto& child : m_childTags) + keys->push_back(child.first); + return keys; +} + +// name guessed +std::unordered_map* CompoundTag::getAllTags() { + return &m_childTags; +} diff --git a/src/Minecraft.Client/com/mojang/nbt/CompoundTag.h b/src/Minecraft.Client/com/mojang/nbt/CompoundTag.h index 7549e926..68dcebc8 100644 --- a/src/Minecraft.Client/com/mojang/nbt/CompoundTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/CompoundTag.h @@ -24,7 +24,8 @@ class CompoundTag : public Tag { void stripEmptyChildren() override; bool isEmpty() const override; void remove(const std::wstring&); - // Caller owns the returned vector; entries are copies of child names. + /** Caller owns the returned vector; entries are copies of child names. + */ std::vector* getAllKeys(); std::unordered_map* getAllTags(); diff --git a/src/Minecraft.Client/com/mojang/nbt/CompoundTagKeys.cpp b/src/Minecraft.Client/com/mojang/nbt/CompoundTagKeys.cpp deleted file mode 100644 index 0b5e6328..00000000 --- a/src/Minecraft.Client/com/mojang/nbt/CompoundTagKeys.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "com/mojang/nbt/CompoundTag.h" - -std::vector* CompoundTag::getAllKeys() { - auto keys = new std::vector(); - for (const auto& child : m_childTags) - keys->push_back(child.first); - return keys; -} - -std::unordered_map* CompoundTag::getAllTags() { - return &m_childTags; -} diff --git a/src/Minecraft.Client/com/mojang/nbt/DoubleTag.cpp b/src/Minecraft.Client/com/mojang/nbt/DoubleTag.cpp index 7ad030e6..6b30a66f 100644 --- a/src/Minecraft.Client/com/mojang/nbt/DoubleTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/DoubleTag.cpp @@ -32,7 +32,7 @@ bool DoubleTag::equals(Tag* other) { return Tag::equals(other) && m_data == otherCasted->m_data; } -JavaLong DoubleTag::getAsLong() { +long DoubleTag::getAsLong() { return floor(m_data); } diff --git a/src/Minecraft.Client/com/mojang/nbt/DoubleTag.h b/src/Minecraft.Client/com/mojang/nbt/DoubleTag.h index ce7a4426..550c70e3 100644 --- a/src/Minecraft.Client/com/mojang/nbt/DoubleTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/DoubleTag.h @@ -12,7 +12,7 @@ class DoubleTag : public NumericTag { std::wstring toString() override; u8 getId() override; bool equals(Tag*) override; - JavaLong getAsLong() override; + long getAsLong() override; int getAsInt() override; short getAsShort() override; u8 getAsByte() override; diff --git a/src/Minecraft.Client/com/mojang/nbt/FloatTag.cpp b/src/Minecraft.Client/com/mojang/nbt/FloatTag.cpp index 541abb86..559255e6 100644 --- a/src/Minecraft.Client/com/mojang/nbt/FloatTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/FloatTag.cpp @@ -31,7 +31,7 @@ bool FloatTag::equals(Tag* other) { return Tag::equals(other) && m_data == otherCasted->m_data; } -JavaLong FloatTag::getAsLong() { +long FloatTag::getAsLong() { return m_data; } diff --git a/src/Minecraft.Client/com/mojang/nbt/FloatTag.h b/src/Minecraft.Client/com/mojang/nbt/FloatTag.h index 75da0eaa..aa683d6e 100644 --- a/src/Minecraft.Client/com/mojang/nbt/FloatTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/FloatTag.h @@ -12,7 +12,7 @@ class FloatTag : public NumericTag { std::wstring toString() override; u8 getId() override; bool equals(Tag*) override; - JavaLong getAsLong() override; + long getAsLong() override; int getAsInt() override; short getAsShort() override; u8 getAsByte() override; diff --git a/src/Minecraft.Client/com/mojang/nbt/IntTag.cpp b/src/Minecraft.Client/com/mojang/nbt/IntTag.cpp index 557aa289..d24e5757 100644 --- a/src/Minecraft.Client/com/mojang/nbt/IntTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/IntTag.cpp @@ -30,7 +30,7 @@ bool IntTag::equals(Tag* other) { return Tag::equals(other) && m_data == otherCasted->m_data; } -JavaLong IntTag::getAsLong() { +long IntTag::getAsLong() { return m_data; } diff --git a/src/Minecraft.Client/com/mojang/nbt/IntTag.h b/src/Minecraft.Client/com/mojang/nbt/IntTag.h index afc83e91..cc0df298 100644 --- a/src/Minecraft.Client/com/mojang/nbt/IntTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/IntTag.h @@ -14,7 +14,7 @@ class IntTag : public NumericTag { bool equals(Tag*) override; Tag* copy() override; - JavaLong getAsLong() override; + long getAsLong() override; int getAsInt() override; short getAsShort() override; u8 getAsByte() override; diff --git a/src/Minecraft.Client/com/mojang/nbt/ListTag.cpp b/src/Minecraft.Client/com/mojang/nbt/ListTag.cpp index 465f9dc1..f7ac2c96 100644 --- a/src/Minecraft.Client/com/mojang/nbt/ListTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/ListTag.cpp @@ -1,5 +1,7 @@ #include "com/mojang/nbt/ListTag.h" +#include "com/mojang/nbt/NumericTag.h" + #include "com/mojang/nbt/CompoundTag.h" #include "java/io/DataInput.h" @@ -11,11 +13,14 @@ ListTag::ListTag() : m_tagId(TAG_End) {} ListTag::ListTag(int id) : m_tagId(id) {} +// NON_MATCHING | score: 1697 (lower is better) ListTag::~ListTag() { for (Tag* tag : m_data) delete tag; } +// name guessed +// NON_MATCHING | score: 1095 (lower is better) void ListTag::add(Tag* tag) { if (tag->getId() == TAG_End) return; @@ -29,10 +34,14 @@ void ListTag::add(Tag* tag) { m_data.push_back(tag); } +// name guessed +// NON_MATCHING | score: 200 (lower is better) size_t ListTag::size() const { return m_data.size(); } +// name guessed +// NON_MATCHING | score: 1545 (lower is better) CompoundTag* ListTag::getCompound(int index) const { if (index >= 0 && static_cast(index) < m_data.size() && m_data[index]->getId() == TAG_Compound) return static_cast(m_data[index]); @@ -94,7 +103,7 @@ u8 ListTag::getId() { return TAG_List; } -// NON_MATCHING: Unfinished +// NON_MATCHING | score: 6191 (lower is better) void ListTag::print(const std::wstring& name, char* prefix, std::wostream& output) { Tag::print(name, prefix, output); @@ -103,7 +112,7 @@ void ListTag::print(const std::wstring& name, char* prefix, std::wostream& outpu // finish this } -// NON_MATCHING: Fuck my shitty life because the pseudocode is unreadable +// NON_MATCHING | score: 3610 (lower is better) bool ListTag::equals(Tag* other) { if (!Tag::equals(other)) return false; @@ -135,3 +144,43 @@ Tag* ListTag::copy() { return copy; } + +// name guessed +int ListTag::getInt(int index) const { + if (index >= 0 && static_cast(index) < m_data.size()) { + Tag* tag = m_data.at(index); + if (tag->getId() == TAG_Int) + return static_cast(tag)->getAsInt(); + } + return 0; +} + +double ListTag::getDouble(int index) const { + if (index >= 0 && static_cast(index) < m_data.size()) { + Tag* tag = m_data.at(index); + if (tag->getId() == TAG_Double) + return static_cast(tag)->getAsDouble(); + } + return 0.0; +} + +// name guessed +void ListTag::set(int index, Tag* tag) { + u8 id = tag->getId(); + if (index < 0 || id == TAG_End || static_cast(index) >= m_data.size()) + return; + u8 type = m_tagId; + id = tag->getId(); + if (type == TAG_End) { + m_tagId = id; + } else if (type != id) { + if (index != 0 || m_data.end() != m_data.begin()) + return; + m_tagId = tag->getId(); + } + Tag* old = m_data[index]; + if (old != tag) { + delete old; + m_data[index] = tag; + } +} diff --git a/src/Minecraft.Client/com/mojang/nbt/ListTag.h b/src/Minecraft.Client/com/mojang/nbt/ListTag.h index b7bfba21..953547b5 100644 --- a/src/Minecraft.Client/com/mojang/nbt/ListTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/ListTag.h @@ -22,10 +22,12 @@ class ListTag : public Tag { bool isEmpty() const override; void add(Tag* tag); - // Replaces an accepted element and deletes its previous owner. Rejected - // replacements remain caller-owned; assigning the same pointer is a no-op. + /** Replaces an accepted element and deletes its previous owner. Rejected + * replacements remain caller-owned; assigning the same pointer is a no-op. + */ void set(int index, Tag* tag); size_t size() const; + // name guessed int getElementType() const { return m_tagId; } CompoundTag* getCompound(int) const; int getInt(int) const; diff --git a/src/Minecraft.Client/com/mojang/nbt/ListTagNumeric.cpp b/src/Minecraft.Client/com/mojang/nbt/ListTagNumeric.cpp deleted file mode 100644 index 9486447e..00000000 --- a/src/Minecraft.Client/com/mojang/nbt/ListTagNumeric.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "com/mojang/nbt/ListTag.h" -#include "com/mojang/nbt/NumericTag.h" - -int ListTag::getInt(int index) const { - if (index >= 0 && static_cast(index) < m_data.size()) { - Tag* tag = m_data.at(index); - if (tag->getId() == TAG_Int) - return static_cast(tag)->getAsInt(); - } - return 0; -} - -double ListTag::getDouble(int index) const { - if (index >= 0 && static_cast(index) < m_data.size()) { - Tag* tag = m_data.at(index); - if (tag->getId() == TAG_Double) - return static_cast(tag)->getAsDouble(); - } - return 0.0; -} diff --git a/src/Minecraft.Client/com/mojang/nbt/ListTagSet.cpp b/src/Minecraft.Client/com/mojang/nbt/ListTagSet.cpp deleted file mode 100644 index 3febd0b0..00000000 --- a/src/Minecraft.Client/com/mojang/nbt/ListTagSet.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "com/mojang/nbt/ListTag.h" - -void ListTag::set(int index, Tag* tag) { - u8 id = tag->getId(); - if (index < 0 || id == TAG_End || static_cast(index) >= m_data.size()) - return; - u8 type = m_tagId; - id = tag->getId(); - if (type == TAG_End) { - m_tagId = id; - } else if (type != id) { - if (index != 0 || m_data.end() != m_data.begin()) - return; - m_tagId = tag->getId(); - } - Tag* old = m_data[index]; - if (old != tag) { - delete old; - m_data[index] = tag; - } -} diff --git a/src/Minecraft.Client/com/mojang/nbt/LongTag.cpp b/src/Minecraft.Client/com/mojang/nbt/LongTag.cpp index b14baeef..186f8d8e 100644 --- a/src/Minecraft.Client/com/mojang/nbt/LongTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/LongTag.cpp @@ -5,7 +5,7 @@ LongTag::LongTag() : m_data(0) {} -LongTag::LongTag(JavaLong data) : m_data(data) {} +LongTag::LongTag(long data) : m_data(data) {} void LongTag::write(DataOutput* outputStream) { outputStream->writeLong(m_data); @@ -30,7 +30,7 @@ bool LongTag::equals(Tag* other) { return Tag::equals(other) && m_data == otherCasted->m_data; } -JavaLong LongTag::getAsLong() { +long LongTag::getAsLong() { return m_data; } diff --git a/src/Minecraft.Client/com/mojang/nbt/LongTag.h b/src/Minecraft.Client/com/mojang/nbt/LongTag.h index 82286812..b7ece3f3 100644 --- a/src/Minecraft.Client/com/mojang/nbt/LongTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/LongTag.h @@ -5,14 +5,14 @@ class LongTag : public NumericTag { public: LongTag(); - LongTag(JavaLong data); + LongTag(long data); void write(DataOutput*) override; void load(DataInput*, int) override; std::wstring toString() override; u8 getId() override; bool equals(Tag*) override; - JavaLong getAsLong() override; + long getAsLong() override; int getAsInt() override; short getAsShort() override; u8 getAsByte() override; @@ -20,5 +20,5 @@ class LongTag : public NumericTag { float getAsFloat() override; Tag* copy() override; - JavaLong m_data; + long m_data; }; diff --git a/src/Minecraft.Client/com/mojang/nbt/NbtIo.cpp b/src/Minecraft.Client/com/mojang/nbt/NbtIo.cpp index fa08ebaa..fbd55efe 100644 --- a/src/Minecraft.Client/com/mojang/nbt/NbtIo.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/NbtIo.cpp @@ -1,5 +1,14 @@ #include "com/mojang/nbt/NbtIo.h" +#include "NX/Platform.h" +#include "java/io/BufferedOutputStream.h" +#include "java/io/ByteArrayInputStream.h" +#include "java/io/ByteArrayOutputStream.h" +#include "java/io/DataInputStream.h" +#include "java/io/DataOutputStream.h" +#include "net/minecraft/core/System.h" +#include + #include "com/mojang/nbt/CompoundTag.h" #include "com/mojang/nbt/EndTag.h" #include "java/io/DataInput.h" @@ -7,6 +16,7 @@ #include #include +// NON_MATCHING | score: 425 (lower is better) Tag* NbtIo::readUnnamedTag(DataInput* input, int unk) { u8 ch = Tag::readType(input); if (ch == 0) @@ -45,3 +55,48 @@ void NbtIo::writeUnnamedTag(Tag* tag, DataOutput* output) { void NbtIo::write(CompoundTag* tag, DataOutput* output) { return writeUnnamedTag(tag, output); } + +CompoundTag* NbtIo::readCompressed(InputStream* inputStream) { + MemSect(26); + DataInputStream dataInputStream(inputStream); + CompoundTag* tag = read(&dataInputStream); + dataInputStream.close(); + MemSect(0); + return tag; +} + +void NbtIo::writeCompressed(CompoundTag* tag, OutputStream* outputStream) { + BufferedOutputStream bufferedOutputStream(outputStream, 1024); + + DataOutputStream dataOutputStream(&bufferedOutputStream); + NbtIo::write((CompoundTag*)tag, &dataOutputStream); + + dataOutputStream.close(); +} + +CompoundTag* NbtIo::decompress(arrayWithLength array) { + ByteArrayInputStream byteArrayInputStream(array); + DataInputStream dataInputStream(&byteArrayInputStream); + + CompoundTag* tag = NbtIo::read(&dataInputStream); + // The target resets its borrowed array view before destroying the stream. + // 0x7100016654 was named as a default constructor, but preserves the vptr. + byteArrayInputStream.reset(); + dataInputStream.close(); + + return tag; +} + +arrayWithLength NbtIo::compress(CompoundTag* tag) { + ByteArrayOutputStream byteArrayOutputStream; + DataOutputStream dataOutputStream(&byteArrayOutputStream); + + NbtIo::write(tag, &dataOutputStream); + + arrayWithLength compressedData(byteArrayOutputStream.size(), true); + System::arraycopy(byteArrayOutputStream.m_buffer, 0, &compressedData, 0, byteArrayOutputStream.size()); + + dataOutputStream.close(); + + return compressedData; +} diff --git a/src/Minecraft.Client/com/mojang/nbt/NbtIoStreams.cpp b/src/Minecraft.Client/com/mojang/nbt/NbtIoStreams.cpp deleted file mode 100644 index 53c8532f..00000000 --- a/src/Minecraft.Client/com/mojang/nbt/NbtIoStreams.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "NX/Platform.h" -#include "com/mojang/nbt/CompoundTag.h" -#include "com/mojang/nbt/NbtIo.h" -#include "java/io/BufferedOutputStream.h" -#include "java/io/ByteArrayInputStream.h" -#include "java/io/ByteArrayOutputStream.h" -#include "java/io/DataInputStream.h" -#include "java/io/DataOutputStream.h" -#include "net/minecraft/core/System.h" -#include - -CompoundTag* NbtIo::readCompressed(InputStream* inputStream) { - MemSect(26); - DataInputStream dataInputStream(inputStream); - CompoundTag* tag = read(&dataInputStream); - dataInputStream.close(); - MemSect(0); - return tag; -} - -void NbtIo::writeCompressed(CompoundTag* tag, OutputStream* outputStream) { - BufferedOutputStream bufferedOutputStream(outputStream, 1024); - - DataOutputStream dataOutputStream(&bufferedOutputStream); - NbtIo::write((CompoundTag*)tag, &dataOutputStream); - - dataOutputStream.close(); -} - -CompoundTag* NbtIo::decompress(arrayWithLength array) { - ByteArrayInputStream byteArrayInputStream(array); - DataInputStream dataInputStream(&byteArrayInputStream); - - CompoundTag* tag = NbtIo::read(&dataInputStream); - // The target resets its borrowed array view before destroying the stream. - // 0x7100016654 was named as a default constructor, but preserves the vptr. - byteArrayInputStream.reset(); - dataInputStream.close(); - - return tag; -} - -arrayWithLength NbtIo::compress(CompoundTag* tag) { - ByteArrayOutputStream byteArrayOutputStream; - DataOutputStream dataOutputStream(&byteArrayOutputStream); - - NbtIo::write(tag, &dataOutputStream); - - arrayWithLength compressedData(byteArrayOutputStream.size(), true); - System::arraycopy(byteArrayOutputStream.m_buffer, 0, &compressedData, 0, byteArrayOutputStream.size()); - - dataOutputStream.close(); - - return compressedData; -} diff --git a/src/Minecraft.Client/com/mojang/nbt/NbtUtils.cpp b/src/Minecraft.Client/com/mojang/nbt/NbtUtils.cpp index eeed0437..c20103d7 100644 --- a/src/Minecraft.Client/com/mojang/nbt/NbtUtils.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/NbtUtils.cpp @@ -4,6 +4,7 @@ #include "net/minecraft/world/level/block/Blocks.h" #include "net/minecraft/world/level/block/state/BlockStateDefinition.h" +// name guessed const BlockState* NbtUtils::readBlockState(CompoundTag* tag) { if (!tag->contains(L"Name", Tag::TAG_String)) return Blocks::AIR->defaultBlockState(); @@ -13,8 +14,7 @@ const BlockState* NbtUtils::readBlockState(CompoundTag* tag) { if (tag->contains(L"Properties", Tag::TAG_Compound)) { CompoundTag* propertyTag = tag->getCompound(L"Properties"); BlockStateDefinition* definition = block->getBlockStateDefinition(); - using KeyList = std::vector; - KeyList* keys = propertyTag->getAllKeys(); + std::vector* keys = propertyTag->getAllKeys(); auto properties = definition->getProperties(); for (auto keyIt = keys->begin(); keyIt != keys->end(); ++keyIt) { auto key = *keyIt; @@ -27,8 +27,8 @@ const BlockState* NbtUtils::readBlockState(CompoundTag* tag) { } } } - // getAllKeys always allocates this vector; retire it as in the original. - keys->~KeyList(); + // getAllKeys transfers ownership of the vector to the caller. + keys->~vector(); ::operator delete(keys); } return state; diff --git a/src/Minecraft.Client/com/mojang/nbt/NumericTag.cpp b/src/Minecraft.Client/com/mojang/nbt/NumericTag.cpp index 92e31563..778c9ba2 100644 --- a/src/Minecraft.Client/com/mojang/nbt/NumericTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/NumericTag.cpp @@ -1,3 +1,4 @@ #include "com/mojang/nbt/NumericTag.h" +// name guessed NumericTag::NumericTag() = default; diff --git a/src/Minecraft.Client/com/mojang/nbt/NumericTag.h b/src/Minecraft.Client/com/mojang/nbt/NumericTag.h index 3c53684d..4d11cee4 100644 --- a/src/Minecraft.Client/com/mojang/nbt/NumericTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/NumericTag.h @@ -1,13 +1,12 @@ #pragma once #include "com/mojang/nbt/Tag.h" -#include "java/io/JavaLong.h" class NumericTag : public Tag { public: NumericTag(); - virtual JavaLong getAsLong() = 0; + virtual long getAsLong() = 0; virtual int getAsInt() = 0; virtual short getAsShort() = 0; virtual u8 getAsByte() = 0; diff --git a/src/Minecraft.Client/com/mojang/nbt/ShortTag.cpp b/src/Minecraft.Client/com/mojang/nbt/ShortTag.cpp index 7cc6d5fa..77cdd219 100644 --- a/src/Minecraft.Client/com/mojang/nbt/ShortTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/ShortTag.cpp @@ -30,7 +30,7 @@ bool ShortTag::equals(Tag* other) { return Tag::equals(other) && m_data == otherCasted->m_data; } -JavaLong ShortTag::getAsLong() { +long ShortTag::getAsLong() { return m_data; } diff --git a/src/Minecraft.Client/com/mojang/nbt/ShortTag.h b/src/Minecraft.Client/com/mojang/nbt/ShortTag.h index fb4f2798..209871be 100644 --- a/src/Minecraft.Client/com/mojang/nbt/ShortTag.h +++ b/src/Minecraft.Client/com/mojang/nbt/ShortTag.h @@ -12,7 +12,7 @@ class ShortTag : public NumericTag { std::wstring toString() override; u8 getId() override; bool equals(Tag*) override; - JavaLong getAsLong() override; + long getAsLong() override; int getAsInt() override; short getAsShort() override; u8 getAsByte() override; diff --git a/src/Minecraft.Client/com/mojang/nbt/StringTag.cpp b/src/Minecraft.Client/com/mojang/nbt/StringTag.cpp index bf68354b..92132222 100644 --- a/src/Minecraft.Client/com/mojang/nbt/StringTag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/StringTag.cpp @@ -3,12 +3,16 @@ #include "java/io/DataInput.h" #include "java/io/DataOutput.h" +// NON_MATCHING | score: 815 (lower is better) StringTag::StringTag() = default; +// name guessed +// NON_MATCHING | score: 290 (lower is better) StringTag::StringTag(const std::wstring& value) : m_data(value) {} StringTag::~StringTag() = default; void StringTag::write(DataOutput* output) { output->writeUTF(m_data); } +// NON_MATCHING | score: 5 (lower is better) void StringTag::load(DataInput* input, int) { m_data = input->readUTF(); } @@ -18,6 +22,7 @@ std::wstring StringTag::toString() { u8 StringTag::getId() { return TAG_String; } +// NON_MATCHING | score: 4759 (lower is better) bool StringTag::equals(Tag* other) { return Tag::equals(other) && m_data == static_cast(other)->m_data; } diff --git a/src/Minecraft.Client/com/mojang/nbt/Tag.cpp b/src/Minecraft.Client/com/mojang/nbt/Tag.cpp index 1993571f..c25c60a2 100644 --- a/src/Minecraft.Client/com/mojang/nbt/Tag.cpp +++ b/src/Minecraft.Client/com/mojang/nbt/Tag.cpp @@ -15,6 +15,7 @@ #include "java/io/DataInput.h" #include +// name guessed Tag::Tag() = default; void Tag::print(const std::wstring& name, char* prefix, std::wostream& output) { @@ -81,7 +82,7 @@ Tag* Tag::newTag(u8 id) { return nullptr; } -// NON_MATCHING: Our switch case doesn't get optimized +// NON_MATCHING | score: 4710 (lower is better) const wchar_t* Tag::getTagTypeName(u8 id) { switch (id) { case TAG_End: diff --git a/src/Minecraft.Client/com/mojang/nbt/Tag.h b/src/Minecraft.Client/com/mojang/nbt/Tag.h index 1620d8b8..be5c7732 100644 --- a/src/Minecraft.Client/com/mojang/nbt/Tag.h +++ b/src/Minecraft.Client/com/mojang/nbt/Tag.h @@ -24,8 +24,9 @@ class Tag { virtual bool isEmpty() const; virtual std::wstring getAsString(); - // The exported DataInput vtable is still incomplete on Switch. Host NBT uses - // the one-byte reader explicitly; readChar reads two bytes in Java streams. + /** The exported DataInput vtable is still incomplete on Switch. Host NBT uses + * the one-byte reader explicitly; readChar reads two bytes in Java streams. + */ static u8 readType(DataInput* input) { return input->readChar(); } static Tag* newTag(u8 id); static const wchar_t* getTagTypeName(u8 id); diff --git a/src/Minecraft.Client/net/minecraft/client/CMinecraftApp.h b/src/Minecraft.Client/net/minecraft/client/CMinecraftApp.h index 3cec5bda..d9653c43 100644 --- a/src/Minecraft.Client/net/minecraft/client/CMinecraftApp.h +++ b/src/Minecraft.Client/net/minecraft/client/CMinecraftApp.h @@ -71,7 +71,7 @@ class CMinecraftApp { bool IsAppPaused(); void SetAction(int, eXuiAction, void*); void setLevelGenerationOptions(LevelGenerationOptions* options); - // Inferred name: records a unique (type, x, z) generation marker. + // name guessed: records a unique (type, x, z) generation marker. void addGeneratedFeature(int type, int x, int z); void SetGameHostOption(eGameHostOption option, unsigned int value); diff --git a/src/Minecraft.Client/net/minecraft/core/BlockPos.cpp b/src/Minecraft.Client/net/minecraft/core/BlockPos.cpp index fc8d49ca..044a2f8a 100644 --- a/src/Minecraft.Client/net/minecraft/core/BlockPos.cpp +++ b/src/Minecraft.Client/net/minecraft/core/BlockPos.cpp @@ -1,5 +1,9 @@ #include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/core/MutableBlockPos.h" + +#include + #include "net/minecraft/core/Direction.h" #include "net/minecraft/world/phys/Vec3.h" @@ -63,3 +67,55 @@ BlockPos BlockPos::east() const { BlockPos BlockPos::east(int amount) const { return relative(Direction::EAST, amount); } + +BlockPos::BlockPos(int x, int y, int z) : Vec3i(x, y, z) {} + +// name guessed +BlockPos::BlockPos(double x, double y, double z) : Vec3i(x, y, z) {} + +BlockPos::BlockPos() : Vec3i(0, 0, 0) {} + +BlockPos::BlockPos(Vec3* vec) : Vec3i(vec->m_x, vec->m_y, vec->m_z) {} + +BlockPos::BlockPos(const Vec3i& vec) : Vec3i(vec.getX(), vec.getY(), vec.getZ()) {} + +bool BlockPos::equals(const BlockPos& pos) const { + return getX() == pos.getX() && getY() == pos.getY() && getZ() == pos.getZ(); +} + +bool BlockPos::equals(const BlockPos* pos) const { + return equals(*pos); +} + +// name guessed +bool BlockPos::operator!=(const BlockPos& pos) const { + return !equals(pos); +} + +// name guessed +BlockPos BlockPos::offset(double x, double y, double z) const { + return BlockPos(getX() + x, getY() + y, getZ() + z); +} + +/** The original static initializers derive 26 X/Z bits from the 30,000,000 + * world border, leaving 12 Y bits. Positions are packed X:Y:Z, high to low. + */ +// NON_MATCHING | score: 2615 (lower is better) +long long BlockPos::compressBlockPos() const { + return (std::uint64_t(getX()) & 0x3ffffffULL) << 38 | (std::uint64_t(getY()) & 0xfffULL) << 26 + | (std::uint64_t(getZ()) & 0x3ffffffULL); +} + +// NON_MATCHING | score: 3010 (lower is better) +BlockPos BlockPos::decompressBlockPos(long long value) { + const std::uint64_t bits = static_cast(value); + const int x = static_cast(bits) >> 38; + const int y = static_cast(bits << 26) >> 52; + const int z = static_cast(bits << 38) >> 38; + return BlockPos(x, y, z); +} + +// name guessed +BlockPos BlockPos::offset(const Vec3i& delta) const { + return offset(delta.getX(), delta.getY(), delta.getZ()); +} diff --git a/src/Minecraft.Client/net/minecraft/core/BlockPosBasics.cpp b/src/Minecraft.Client/net/minecraft/core/BlockPosBasics.cpp deleted file mode 100644 index 8694e020..00000000 --- a/src/Minecraft.Client/net/minecraft/core/BlockPosBasics.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "net/minecraft/core/BlockPos.h" -#include "net/minecraft/world/phys/Vec3.h" - -BlockPos::BlockPos(int x, int y, int z) : Vec3i(x, y, z) {} - -BlockPos::BlockPos(double x, double y, double z) : Vec3i(x, y, z) {} - -BlockPos::BlockPos() : Vec3i(0, 0, 0) {} - -BlockPos::BlockPos(Vec3* vec) : Vec3i(vec->m_x, vec->m_y, vec->m_z) {} - -BlockPos::BlockPos(const Vec3i& vec) : Vec3i(vec.getX(), vec.getY(), vec.getZ()) {} - -bool BlockPos::equals(const BlockPos& pos) const { - return getX() == pos.getX() && getY() == pos.getY() && getZ() == pos.getZ(); -} - -bool BlockPos::equals(const BlockPos* pos) const { - return equals(*pos); -} - -bool BlockPos::operator!=(const BlockPos& pos) const { - return !equals(pos); -} - -BlockPos BlockPos::offset(double x, double y, double z) const { - return BlockPos(getX() + x, getY() + y, getZ() + z); -} diff --git a/src/Minecraft.Client/net/minecraft/core/BlockPosPacking.cpp b/src/Minecraft.Client/net/minecraft/core/BlockPosPacking.cpp deleted file mode 100644 index 7511dec2..00000000 --- a/src/Minecraft.Client/net/minecraft/core/BlockPosPacking.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "net/minecraft/core/BlockPos.h" -#include - -// The original static initializers derive 26 X/Z bits from the 30,000,000 -// world border, leaving 12 Y bits. Positions are packed X:Y:Z, high to low. -long long BlockPos::compressBlockPos() const { - return (std::uint64_t(getX()) & 0x3ffffffULL) << 38 | (std::uint64_t(getY()) & 0xfffULL) << 26 - | (std::uint64_t(getZ()) & 0x3ffffffULL); -} - -BlockPos BlockPos::decompressBlockPos(long long value) { - const std::uint64_t bits = static_cast(value); - const int x = static_cast(bits) >> 38; - const int y = static_cast(bits << 26) >> 52; - const int z = static_cast(bits << 38) >> 38; - return BlockPos(x, y, z); -} diff --git a/src/Minecraft.Client/net/minecraft/core/Direction.cpp b/src/Minecraft.Client/net/minecraft/core/Direction.cpp index 9c0716c6..c8d01da7 100644 --- a/src/Minecraft.Client/net/minecraft/core/Direction.cpp +++ b/src/Minecraft.Client/net/minecraft/core/Direction.cpp @@ -1,5 +1,7 @@ #include "net/minecraft/core/Direction.h" +#include "net/minecraft/core/MutableBlockPos.h" + #include "net/minecraft/core/Vec3i.h" #include "net/minecraft/util/Mth.h" @@ -49,6 +51,7 @@ Direction::Direction(int dirX, int dirY, int dirZ, const std::wstring& name, m_z = pos->getZ(); } +// name guessed const Direction* Direction::from3DDataValue(int value) { return Direction::BY_3D_DATA[Mth::abs(value % 6)]; } @@ -65,6 +68,7 @@ unsigned int Direction::get3DDataValue() const { return m_dirX; } +// name guessed int Direction::get2DDataValue() const { return m_dirZ; } @@ -73,6 +77,7 @@ Direction::Axis* Direction::getAxis() const { return m_axis; } +// name guessed Direction::AxisDirection* Direction::getAxisDirection() const { return m_axisDirection; } @@ -88,3 +93,8 @@ int Direction::Axis::getId() { std::wstring Direction::getName() const { return m_name; } + +// name guessed +Vec3i Direction::getNormal() const { + return *m_pos; +} diff --git a/src/Minecraft.Client/net/minecraft/core/MutableBlockPos.cpp b/src/Minecraft.Client/net/minecraft/core/MutableBlockPos.cpp index 3c0702a3..d1f8d4a3 100644 --- a/src/Minecraft.Client/net/minecraft/core/MutableBlockPos.cpp +++ b/src/Minecraft.Client/net/minecraft/core/MutableBlockPos.cpp @@ -1,5 +1,21 @@ #include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/core/Direction.h" + +// name guessed MutableBlockPos::MutableBlockPos() : BlockPos(0, 0, 0) {} MutableBlockPos::MutableBlockPos(int x, int y, int z) : BlockPos(x, y, z) {} + +// name guessed +MutableBlockPos* MutableBlockPos::set(const Vec3i& pos) { + m_x = pos.getX(); + m_y = pos.getY(); + m_z = pos.getZ(); + return this; +} + +// name guessed +MutableBlockPos* MutableBlockPos::move(const Direction* direction, int amount) { + return set(static_cast(BlockPos(*this).offset(direction->getNormal().multiply(amount)))); +} diff --git a/src/Minecraft.Client/net/minecraft/core/NonNullList.h b/src/Minecraft.Client/net/minecraft/core/NonNullList.h index 88564e0b..13bca0bd 100644 --- a/src/Minecraft.Client/net/minecraft/core/NonNullList.h +++ b/src/Minecraft.Client/net/minecraft/core/NonNullList.h @@ -7,8 +7,9 @@ class NonNullList : arrayWithLength { public: NonNullList() = default; - // Copies are views of the same array. The owner must delete the backing data; - // destroying a view only releases its default value, as in the executable. + /** Copies are views of the same array. The owner must delete the backing data; + * destroying a view only releases its default value, as in the executable. + */ static NonNullList withSize(int size, const T& defaultValue) { NonNullList list; if (size > 0) { diff --git a/src/Minecraft.Client/net/minecraft/core/StringHash.cpp b/src/Minecraft.Client/net/minecraft/core/StringHash.cpp deleted file mode 100644 index bd3578f6..00000000 --- a/src/Minecraft.Client/net/minecraft/core/StringHash.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "net/minecraft/core/System.h" -#include - -// This is the original position-dependent LCE hash, including 32-bit wraparound. -size_t javaStringHashCode(const std::wstring& value) { - std::uint32_t length = static_cast(value.size()); - std::uint64_t last = length - 1; - std::uint64_t index = 0; - std::uint32_t remaining = last; - std::uint32_t result = 0; - if (length != 0) - do { - std::uint32_t character = static_cast(value[index]); - character = index >= last ? character : (character * 31u) ^ remaining; - result += character; - --remaining; - ++index; - } while (index != length); - return result; -} diff --git a/src/Minecraft.Client/net/minecraft/core/System.cpp b/src/Minecraft.Client/net/minecraft/core/System.cpp index a67976e3..45521939 100644 --- a/src/Minecraft.Client/net/minecraft/core/System.cpp +++ b/src/Minecraft.Client/net/minecraft/core/System.cpp @@ -1,5 +1,10 @@ #include "net/minecraft/core/System.h" +#include + +#include +#include + #include "nn/os/os_Mutex.h" void InitializeCriticalSection(nn::os::MutexType* mutex) { @@ -43,9 +48,7 @@ void System::ReverseULONG(unsigned int* v) { *(reinterpret_cast(v) + 3) = lb; } -// NON_MATCHING | Score 260 (lower is better) -// Not sure but this (along with the others) probably uses some compiler intrinsic -// I had to arrange this using odd then even +// NON_MATCHING | score: 260 (lower is better) void System::ReverseULONGLONG(unsigned long long* v) { const unsigned long long lb = *v; @@ -63,3 +66,65 @@ void System::ReverseCHAR16A(char16_t* str, int len) { for (int i = 0; i < len; i++) System::ReverseUSHORT(reinterpret_cast(str + i)); } + +/** The bundled SDK header aliases Tick to u64. Bind the ABI-compatible + * eight-byte argument to the real SDK import's value-class mangled name. + */ +extern nn::TimeSpan convertSystemTick(nn::os::Tick) asm("_ZN2nn2os17ConvertToTimeSpanENS0_4TickE"); + +long System::currentRealTimeMillis() { + nn::time::PosixTime t; + nn::time::StandardUserSystemClock::GetCurrentTime(&t); + return t.time; +} + +long System::currentUnixEpochTimeSeconds() { + return currentRealTimeMillis() / 1000; +} + +long System::processTime(ETimeGranularity granularity) { + const nn::os::Tick tick = nn::os::GetSystemTick(); + switch (granularity) { + case NANOSECONDS: + return convertSystemTick(tick).nanoseconds; + case MICROSECONDS: + return static_cast(convertSystemTick(tick).nanoseconds) / 1000; + case MILLISECONDS: + return static_cast(convertSystemTick(tick).nanoseconds) / 1000000; + default: + return 0; + } +} + +long System::processTimeInSeconds() { + return processTime(MILLISECONDS) / 1000; +} +long System::processTimeInMilliSecs() { + return processTime(MILLISECONDS); +} +long System::processTimeInMicroSecs() { + return processTime(MICROSECONDS); +} +long System::processTimeInNanoSecs() { + return processTime(NANOSECONDS); +} + +/** This is the original position-dependent LCE hash, including 32-bit wraparound. + */ +// NON_MATCHING | score: 605 (lower is better) +size_t javaStringHashCode(const std::wstring& value) { + std::uint32_t length = static_cast(value.size()); + std::uint64_t last = length - 1; + std::uint64_t index = 0; + std::uint32_t remaining = last; + std::uint32_t result = 0; + if (length != 0) + do { + std::uint32_t character = static_cast(value[index]); + character = index >= last ? character : (character * 31u) ^ remaining; + result += character; + --remaining; + ++index; + } while (index != length); + return result; +} diff --git a/src/Minecraft.Client/net/minecraft/core/System.h b/src/Minecraft.Client/net/minecraft/core/System.h index ef334a3e..295829af 100644 --- a/src/Minecraft.Client/net/minecraft/core/System.h +++ b/src/Minecraft.Client/net/minecraft/core/System.h @@ -1,6 +1,5 @@ #pragma once -#include "java/io/JavaLong.h" #include #include @@ -35,14 +34,14 @@ class System { public: enum ETimeGranularity { MILLISECONDS, MICROSECONDS, NANOSECONDS }; - static JavaLong currentRealTimeMillis(); - static JavaLong currentUnixEpochTimeSeconds(); + static long currentRealTimeMillis(); + static long currentUnixEpochTimeSeconds(); - static JavaLong processTimeInSeconds(); - static JavaLong processTimeInMilliSecs(); - static JavaLong processTimeInNanoSecs(); - static JavaLong processTimeInMicroSecs(); - static JavaLong processTime(System::ETimeGranularity); + static long processTimeInSeconds(); + static long processTimeInMilliSecs(); + static long processTimeInNanoSecs(); + static long processTimeInMicroSecs(); + static long processTime(System::ETimeGranularity); template static void arraycopy(arrayWithLength src, unsigned int srcOff, arrayWithLength* dest, diff --git a/src/Minecraft.Client/net/minecraft/core/SystemClock.cpp b/src/Minecraft.Client/net/minecraft/core/SystemClock.cpp deleted file mode 100644 index fc2dae11..00000000 --- a/src/Minecraft.Client/net/minecraft/core/SystemClock.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "net/minecraft/core/System.h" -#include -#include - -// The bundled SDK header aliases Tick to u64. Bind the ABI-compatible -// eight-byte argument to the real SDK import's value-class mangled name. -extern nn::TimeSpan convertSystemTick(nn::os::Tick) asm("_ZN2nn2os17ConvertToTimeSpanENS0_4TickE"); - -JavaLong System::currentRealTimeMillis() { - nn::time::PosixTime t; - nn::time::StandardUserSystemClock::GetCurrentTime(&t); - return t.time; -} - -JavaLong System::currentUnixEpochTimeSeconds() { - return currentRealTimeMillis() / 1000; -} - -JavaLong System::processTime(ETimeGranularity granularity) { - const nn::os::Tick tick = nn::os::GetSystemTick(); - switch (granularity) { - case NANOSECONDS: - return convertSystemTick(tick).nanoseconds; - case MICROSECONDS: - return static_cast(convertSystemTick(tick).nanoseconds) / 1000; - case MILLISECONDS: - return static_cast(convertSystemTick(tick).nanoseconds) / 1000000; - default: - return 0; - } -} - -JavaLong System::processTimeInSeconds() { - return processTime(MILLISECONDS) / 1000; -} -JavaLong System::processTimeInMilliSecs() { - return processTime(MILLISECONDS); -} -JavaLong System::processTimeInMicroSecs() { - return processTime(MICROSECONDS); -} -JavaLong System::processTimeInNanoSecs() { - return processTime(NANOSECONDS); -} diff --git a/src/Minecraft.Client/net/minecraft/core/TreePositionHelpers.cpp b/src/Minecraft.Client/net/minecraft/core/TreePositionHelpers.cpp deleted file mode 100644 index b3fb7a77..00000000 --- a/src/Minecraft.Client/net/minecraft/core/TreePositionHelpers.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "net/minecraft/core/Direction.h" -#include "net/minecraft/core/MutableBlockPos.h" - -BlockPos BlockPos::offset(const Vec3i& delta) const { - return offset(delta.getX(), delta.getY(), delta.getZ()); -} - -Vec3i Vec3i::multiply(int amount) const { - return Vec3i(getX() * amount, getY() * amount, getZ() * amount); -} - -Vec3i Direction::getNormal() const { - return *m_pos; -} - -MutableBlockPos* MutableBlockPos::set(const Vec3i& pos) { - m_x = pos.getX(); - m_y = pos.getY(); - m_z = pos.getZ(); - return this; -} - -MutableBlockPos* MutableBlockPos::move(const Direction* direction, int amount) { - return set(static_cast(BlockPos(*this).offset(direction->getNormal().multiply(amount)))); -} diff --git a/src/Minecraft.Client/net/minecraft/core/Vec3i.cpp b/src/Minecraft.Client/net/minecraft/core/Vec3i.cpp index eabcb6ca..fb57466c 100644 --- a/src/Minecraft.Client/net/minecraft/core/Vec3i.cpp +++ b/src/Minecraft.Client/net/minecraft/core/Vec3i.cpp @@ -1,5 +1,8 @@ #include "net/minecraft/core/Vec3i.h" +#include "net/minecraft/core/Direction.h" +#include "net/minecraft/core/MutableBlockPos.h" + #include "net/minecraft/util/Mth.h" Vec3i::Vec3i(int x, int y, int z) { @@ -26,6 +29,7 @@ int Vec3i::getZ() const { return m_z; } +// name guessed double Vec3i::distSqr(double x, double y, double z) const { double dx = getX() - x; double dy = getY() - y; @@ -33,6 +37,12 @@ double Vec3i::distSqr(double x, double y, double z) const { return dx * dx + dy * dy + dz * dz; } +// name guessed double Vec3i::distSqr(const Vec3i& other) const { return distSqr(other.getX(), other.getY(), other.getZ()); } + +// name guessed +Vec3i Vec3i::multiply(int amount) const { + return Vec3i(getX() * amount, getY() * amount, getZ() * amount); +} diff --git a/src/Minecraft.Client/net/minecraft/resources/ResourceLocation.h b/src/Minecraft.Client/net/minecraft/resources/ResourceLocation.h index 6e525283..b4f88f1a 100644 --- a/src/Minecraft.Client/net/minecraft/resources/ResourceLocation.h +++ b/src/Minecraft.Client/net/minecraft/resources/ResourceLocation.h @@ -35,13 +35,17 @@ class ResourceLocation { template <> struct std::equal_to { + // name guessed + // NON_MATCHING | score: 5 (lower is better) bool operator()(const ResourceLocation& lhs, const ResourceLocation& rhs) const { return lhs.operator==(&rhs); } }; -// Uses the original LCE resource-key hash. +/** Uses the original LCE resource-key hash. + */ template <> struct std::hash { + // NON_MATCHING | score: 5 (lower is better) std::size_t operator()(const ResourceLocation& rl) const { return rl.hashCode(); } }; diff --git a/src/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.cpp b/src/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.cpp index 262f34f7..4e81237e 100644 --- a/src/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.cpp +++ b/src/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.cpp @@ -118,7 +118,7 @@ LevelChunk* ServerChunkCache::getChunkIfGenerated(int chunkX, int chunkZ, bool u return loadedChunk; } -// NON_MATCHING: Regswap +// NON_MATCHING | score: 290 (lower is better) LevelChunk* ServerChunkCache::load(int chunkX, int chunkZ, LevelChunk* chunk) { LevelChunk* active = chunk; if (!m_chunkStorage) @@ -147,7 +147,7 @@ LevelChunk* ServerChunkCache::load(int chunkX, int chunkZ, LevelChunk* chunk) { return active; } -// NON_MATCHING: A couple instructions placed in the wrong positions +// NON_MATCHING | score: 860 (lower is better) LevelChunk* ServerChunkCache::updateCacheAndPostProcess(int chunkX, int chunkZ, LevelChunk* newChunk, LevelChunk* oldChunk, bool unk) { if (!inBounds(chunkX, chunkZ)) { diff --git a/src/Minecraft.World/java/io/ByteArrayInputStream.cpp b/src/Minecraft.World/java/io/ByteArrayInputStream.cpp index 42674434..d8b4c24a 100644 --- a/src/Minecraft.World/java/io/ByteArrayInputStream.cpp +++ b/src/Minecraft.World/java/io/ByteArrayInputStream.cpp @@ -48,6 +48,7 @@ int ByteArrayInputStream::read(arrayWithLength array, unsigned in void ByteArrayInputStream::close() {} +// name guessed void ByteArrayInputStream::reset() { arrayWithLength empty; m_buffer = empty; diff --git a/src/Minecraft.World/java/io/DataInput.cpp b/src/Minecraft.World/java/io/DataInput.cpp index e77ee3db..1910b371 100644 --- a/src/Minecraft.World/java/io/DataInput.cpp +++ b/src/Minecraft.World/java/io/DataInput.cpp @@ -1,3 +1,4 @@ #include "java/io/DataInput.h" +// NON_MATCHING | score: 805 (lower is better) DataInput::~DataInput() = default; diff --git a/src/Minecraft.World/java/io/DataInput.h b/src/Minecraft.World/java/io/DataInput.h index 8b2bd53b..0b50a95d 100644 --- a/src/Minecraft.World/java/io/DataInput.h +++ b/src/Minecraft.World/java/io/DataInput.h @@ -1,7 +1,5 @@ #pragma once -#include "java/io/JavaLong.h" - #include "net/minecraft/world/ArrayWithLength.h" #include "net/minecraft/world/PlayerUID.h" @@ -20,7 +18,7 @@ class DataInput { virtual double readDouble() = 0; virtual float readFloat() = 0; virtual int readInt() = 0; - virtual JavaLong readLong() = 0; + virtual long readLong() = 0; virtual short readShort() = 0; virtual std::wstring readUTF() = 0; virtual int readUTFChar() = 0; diff --git a/src/Minecraft.World/java/io/DataInputStream.cpp b/src/Minecraft.World/java/io/DataInputStream.cpp index d5e85ad2..769afa25 100644 --- a/src/Minecraft.World/java/io/DataInputStream.cpp +++ b/src/Minecraft.World/java/io/DataInputStream.cpp @@ -1,5 +1,12 @@ #include "java/io/DataInputStream.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/item/Item.h" +#include "net/minecraft/world/item/ItemInstance.h" + +#include "com/mojang/nbt/NbtIo.h" +#include "net/minecraft/client/Compression.h" + #include #include @@ -8,8 +15,9 @@ DataInputStream::DataInputStream(InputStream* stream) : m_inputStream(stream) {} DataInputStream::~DataInputStream() = default; -// Destruction of the wrapper does not destroy its child. The binary exposes -// this explicit operation for callers that transferred ownership. +/** Destruction of the wrapper does not destroy its child. The binary exposes + * this explicit operation for callers that transferred ownership. + */ void DataInputStream::deleteChildStream() { delete m_inputStream; } @@ -57,6 +65,7 @@ bool DataInputStream::readFully(arrayWithLength array) { } return true; } +// NON_MATCHING | score: 1615 (lower is better) bool DataInputStream::readFully(arrayWithLength array) { return readFully( arrayWithLength(reinterpret_cast(array.m_data), array.m_length)); @@ -78,7 +87,7 @@ int DataInputStream::readInt() { const std::uint32_t b3 = READ_PRIMITIVE_BYTE(); return (b0 << 24) | ((b1 & 0xff) << 16) | ((b2 & 0xff) << 8) | (b3 & 0xff); } -JavaLong DataInputStream::readLong() { +long DataInputStream::readLong() { const std::uint64_t b0 = READ_PRIMITIVE_BYTE(); const std::uint32_t b1 = READ_PRIMITIVE_BYTE(); const std::uint32_t b2 = READ_PRIMITIVE_BYTE(); @@ -101,12 +110,14 @@ int DataInputStream::readUnsignedShort() { const std::uint32_t low = READ_PRIMITIVE_BYTE(); return (high << 8) | (low & 0xff); } +// NON_MATCHING | score: 1210 (lower is better) double DataInputStream::readDouble() { - const JavaLong bits = readLong(); + const long bits = readLong(); double result; std::memcpy(&result, &bits, sizeof(result)); return result; } +// NON_MATCHING | score: 1210 (lower is better) float DataInputStream::readFloat() { const int bits = readInt(); float result; @@ -114,6 +125,7 @@ float DataInputStream::readFloat() { return result; } +// NON_MATCHING | score: 3810 (lower is better) std::wstring DataInputStream::readUTF() { std::wstring result; auto invalid = [&result]() -> std::wstring { return result; }; @@ -150,6 +162,7 @@ std::wstring DataInputStream::readUTF() { } return result; } +// NON_MATCHING | score: 470 (lower is better) int DataInputStream::readUTFChar() { const int first = m_inputStream->read(); if (first == -1 || (first & 0xc0) == 0x80 || (first & 0xf0) == 0xf0) @@ -181,6 +194,7 @@ PlayerUID DataInputStream::readPlayerUID() { bytes[i] = readByte(); return result; } +// NON_MATCHING | score: 585 (lower is better) int DataInputStream::readVarInt() { std::uint32_t result = 0; unsigned int shift = 0; @@ -195,10 +209,11 @@ int DataInputStream::readVarInt() { } while (byte & 0x80); return result; } -JavaLong DataInputStream::readVarLong() { +// NON_MATCHING | score: 585 (lower is better) +long DataInputStream::readVarLong() { std::uint64_t result = 0; unsigned int shift = 0; - JavaLong count = -1; + long count = -1; unsigned char byte; do { byte = readByte(); @@ -209,3 +224,58 @@ JavaLong DataInputStream::readVarLong() { } while (byte & 0x80); return result; } + +// NON_MATCHING | score: 5 (lower is better) +CompoundTag* DataInputStream::readCompressedNbt() { + const short length = readShort(); + if (length < 0) + return nullptr; + const short compressedLength = readShort(); + if (compressedLength < 0) + return nullptr; + arrayWithLength compressed(compressedLength, true); + readFully(compressed); + arrayWithLength bytes(length, true); + unsigned int actualLength = length; + Compression::getCompression()->Decompress(bytes.m_data, &actualLength, compressed.m_data, + compressed.m_length); + CompoundTag* result = NbtIo::decompress(bytes); + delete[] bytes.m_data; + delete[] compressed.m_data; + return result; +} + +// NON_MATCHING | score: 5 (lower is better) +CompoundTag* DataInputStream::readNbt() { + const short length = readShort(); + if (length < 0) + return nullptr; + arrayWithLength bytes(length, true); + readFully(bytes); + CompoundTag* result = NbtIo::decompress(bytes); + delete[] bytes.m_data; + return result; +} + +BlockPos DataInputStream::readBlockPos() { + return BlockPos::decompressBlockPos(readLong()); +} + +// NON_MATCHING | score: 3036 (lower is better) +BlockPos* DataInputStream::readBlockPosPointer() { + const BlockPos pos = BlockPos::decompressBlockPos(readLong()); + return new BlockPos(pos.getX(), pos.getY(), pos.getZ()); +} + +// NON_MATCHING | score: 810 (lower is better) +not_null_ptr DataInputStream::readItem() { + not_null_ptr result = ItemInstance::EMPTY; + const short id = readShort(); + if (id >= 0) { + const unsigned char count = readByte(); + const short auxiliary = readShort(); + result = not_null_ptr(new ItemInstance(Item::byId(id), count, auxiliary)); + result->setTag(readNbt()); + } + return result; +} diff --git a/src/Minecraft.World/java/io/DataInputStream.h b/src/Minecraft.World/java/io/DataInputStream.h index b076ca76..e0eccab2 100644 --- a/src/Minecraft.World/java/io/DataInputStream.h +++ b/src/Minecraft.World/java/io/DataInputStream.h @@ -31,7 +31,7 @@ class DataInputStream : public InputStream, public DataInput { double readDouble() override; float readFloat() override; int readInt() override; - JavaLong readLong() override; + long readLong() override; short readShort() override; std::wstring readUTF() override; int readUTFChar() override; @@ -39,7 +39,7 @@ class DataInputStream : public InputStream, public DataInput { void skipBytes(long long) override; int readVarInt(); - JavaLong readVarLong(); + long readVarLong(); BlockPos readBlockPos(); BlockPos* readBlockPosPointer(); not_null_ptr readItem(); diff --git a/src/Minecraft.World/java/io/DataInputStreamCompressedNbt.cpp b/src/Minecraft.World/java/io/DataInputStreamCompressedNbt.cpp deleted file mode 100644 index 371cf998..00000000 --- a/src/Minecraft.World/java/io/DataInputStreamCompressedNbt.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "com/mojang/nbt/NbtIo.h" -#include "java/io/DataInputStream.h" -#include "net/minecraft/client/Compression.h" - -CompoundTag* DataInputStream::readCompressedNbt() { - const short length = readShort(); - if (length < 0) - return nullptr; - const short compressedLength = readShort(); - if (compressedLength < 0) - return nullptr; - arrayWithLength compressed(compressedLength, true); - readFully(compressed); - arrayWithLength bytes(length, true); - unsigned int actualLength = length; - Compression::getCompression()->Decompress(bytes.m_data, &actualLength, compressed.m_data, - compressed.m_length); - CompoundTag* result = NbtIo::decompress(bytes); - delete[] bytes.m_data; - delete[] compressed.m_data; - return result; -} diff --git a/src/Minecraft.World/java/io/DataInputStreamNbt.cpp b/src/Minecraft.World/java/io/DataInputStreamNbt.cpp deleted file mode 100644 index 09d4840a..00000000 --- a/src/Minecraft.World/java/io/DataInputStreamNbt.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "com/mojang/nbt/NbtIo.h" -#include "java/io/DataInputStream.h" - -CompoundTag* DataInputStream::readNbt() { - const short length = readShort(); - if (length < 0) - return nullptr; - arrayWithLength bytes(length, true); - readFully(bytes); - CompoundTag* result = NbtIo::decompress(bytes); - delete[] bytes.m_data; - return result; -} diff --git a/src/Minecraft.World/java/io/DataInputStreamProtocol.cpp b/src/Minecraft.World/java/io/DataInputStreamProtocol.cpp deleted file mode 100644 index 7383b288..00000000 --- a/src/Minecraft.World/java/io/DataInputStreamProtocol.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "java/io/DataInputStream.h" -#include "net/minecraft/core/BlockPos.h" -#include "net/minecraft/world/item/Item.h" -#include "net/minecraft/world/item/ItemInstance.h" - -BlockPos DataInputStream::readBlockPos() { - return BlockPos::decompressBlockPos(readLong()); -} - -BlockPos* DataInputStream::readBlockPosPointer() { - const BlockPos pos = BlockPos::decompressBlockPos(readLong()); - return new BlockPos(pos.getX(), pos.getY(), pos.getZ()); -} - -not_null_ptr DataInputStream::readItem() { - not_null_ptr result = ItemInstance::EMPTY; - const short id = readShort(); - if (id >= 0) { - const unsigned char count = readByte(); - const short auxiliary = readShort(); - result = not_null_ptr(new ItemInstance(Item::byId(id), count, auxiliary)); - result->setTag(readNbt()); - } - return result; -} diff --git a/src/Minecraft.World/java/io/DataOutput.cpp b/src/Minecraft.World/java/io/DataOutput.cpp index 9a908650..575f2cd9 100644 --- a/src/Minecraft.World/java/io/DataOutput.cpp +++ b/src/Minecraft.World/java/io/DataOutput.cpp @@ -1,4 +1,6 @@ #include "java/io/DataOutput.h" +// name guessed DataOutput::DataOutput() = default; +// NON_MATCHING | score: 805 (lower is better) DataOutput::~DataOutput() = default; diff --git a/src/Minecraft.World/java/io/DataOutputStream.cpp b/src/Minecraft.World/java/io/DataOutputStream.cpp index 475d3067..c83084ca 100644 --- a/src/Minecraft.World/java/io/DataOutputStream.cpp +++ b/src/Minecraft.World/java/io/DataOutputStream.cpp @@ -1,3 +1,11 @@ +#include "java/io/DataOutputStream.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/item/Item.h" +#include "net/minecraft/world/item/ItemInstance.h" + +#include "com/mojang/nbt/NbtIo.h" + #include "DataOutputStream.h" #include "net/minecraft/world/PlayerUID.h" #include @@ -98,6 +106,7 @@ void DataOutputStream::writeChar(wchar_t value) { m_size += 2; } +// NON_MATCHING | score: 400 (lower is better) void DataOutputStream::writeVarInt(int value) { unsigned int bits; std::memcpy(&bits, &value, sizeof(bits)); @@ -108,7 +117,8 @@ void DataOutputStream::writeVarInt(int value) { writeByte(static_cast(bits)); } -void DataOutputStream::writeVarLong(JavaLong value) { +// NON_MATCHING | score: 400 (lower is better) +void DataOutputStream::writeVarLong(long value) { std::uint64_t bits; std::memcpy(&bits, &value, sizeof(bits)); while (bits > 0x7f) { @@ -151,3 +161,29 @@ void DataOutputStream::writeUTF(const std::wstring& value) { write(bytes, 0, length + 2); delete[] bytes.m_data; } + +void DataOutputStream::writeNbt(CompoundTag* tag) { + if (!tag) { + writeShort(-1); + return; + } + arrayWithLength bytes = NbtIo::compress(tag); + writeShort(bytes.m_length); + write(bytes); + delete[] bytes.m_data; +} + +void DataOutputStream::writeBlockPos(const BlockPos& pos) { + writeLong(pos.compressBlockPos()); +} + +void DataOutputStream::writeItem(not_null_ptr item) { + if (item->isEmpty()) { + writeShort(-1); + return; + } + writeShort(Item::VALIDgetId(item->getItem())); + writeByte(item->getCount()); + writeShort(item->getAuxValue()); + writeNbt(item->getTag()); +} diff --git a/src/Minecraft.World/java/io/DataOutputStream.h b/src/Minecraft.World/java/io/DataOutputStream.h index cb6c49a4..859ad7b8 100644 --- a/src/Minecraft.World/java/io/DataOutputStream.h +++ b/src/Minecraft.World/java/io/DataOutputStream.h @@ -3,7 +3,6 @@ #include #include "java/io/DataOutput.h" -#include "java/io/JavaLong.h" #include "java/io/OutputStream.h" #include "java/io/types/Double.h" #include "java/io/types/Float.h" @@ -39,7 +38,7 @@ class DataOutputStream : public OutputStream, public DataOutput { void writePlayerUID(PlayerUID) override; void writeVarInt(int); - void writeVarLong(JavaLong); + void writeVarLong(long); void writeBlockPos(const BlockPos&); void writeItem(not_null_ptr); void writeNbt(CompoundTag*); diff --git a/src/Minecraft.World/java/io/DataOutputStreamNbt.cpp b/src/Minecraft.World/java/io/DataOutputStreamNbt.cpp deleted file mode 100644 index 17ef3fae..00000000 --- a/src/Minecraft.World/java/io/DataOutputStreamNbt.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "com/mojang/nbt/NbtIo.h" -#include "java/io/DataOutputStream.h" - -void DataOutputStream::writeNbt(CompoundTag* tag) { - if (!tag) { - writeShort(-1); - return; - } - arrayWithLength bytes = NbtIo::compress(tag); - writeShort(bytes.m_length); - write(bytes); - delete[] bytes.m_data; -} diff --git a/src/Minecraft.World/java/io/DataOutputStreamProtocol.cpp b/src/Minecraft.World/java/io/DataOutputStreamProtocol.cpp deleted file mode 100644 index 683c185f..00000000 --- a/src/Minecraft.World/java/io/DataOutputStreamProtocol.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "java/io/DataOutputStream.h" -#include "net/minecraft/core/BlockPos.h" -#include "net/minecraft/world/item/Item.h" -#include "net/minecraft/world/item/ItemInstance.h" - -void DataOutputStream::writeBlockPos(const BlockPos& pos) { - writeLong(pos.compressBlockPos()); -} - -void DataOutputStream::writeItem(not_null_ptr item) { - if (item->isEmpty()) { - writeShort(-1); - return; - } - writeShort(Item::VALIDgetId(item->getItem())); - writeByte(item->getCount()); - writeShort(item->getAuxValue()); - writeNbt(item->getTag()); -} diff --git a/src/Minecraft.World/java/io/File.cpp b/src/Minecraft.World/java/io/File.cpp index a7c5e4b3..15ff467d 100644 --- a/src/Minecraft.World/java/io/File.cpp +++ b/src/Minecraft.World/java/io/File.cpp @@ -1,5 +1,8 @@ #include "java/io/File.h" +#include +#include + #include "fui/fuiFile.h" File::File() { @@ -14,8 +17,7 @@ File::File(const std::wstring& name) { } } -// NON_MATCHING | Score: 1075 (lower is better) -// Some std::wstring shenanigans +// NON_MATCHING | score: 1075 (lower is better) File::File(const File& rhs, const std::wstring& name) { this->m_name = rhs.getPath() + L"\\" + name; } @@ -23,8 +25,6 @@ File::File(const File& rhs, const std::wstring& name) { File::~File() = default; // NON_MATCHING | score: 805 (lower is better) -// Seems like I'm missing some kind of call -// Also, does it clear RHS' string? File& File::operator=(const File& rhs) { this->m_name.clear(); this->m_name = rhs.m_name; @@ -35,6 +35,7 @@ std::wstring File::getPath() const { return m_name; } +// NON_MATCHING | score: 1248 (lower is better) std::wstring File::getName() const { int separator = static_cast(m_name.rfind(L'\\')); if (separator == -1) @@ -42,6 +43,7 @@ std::wstring File::getName() const { return std::wstring(m_name, separator + 1, m_name.size()); } +// NON_MATCHING | score: 2980 (lower is better) std::wstring File::ext() const { const std::wstring name = getName(); const auto dot = name.find(std::wstring(L".")); @@ -53,6 +55,7 @@ std::wstring File::ext() const { int DeleteFileA(const char*); +// NON_MATCHING | score: 1020 (lower is better) bool File::_delete() { char buffer[256]; const bool result = DeleteFileA(wstringtofilename(getPath(), buffer)) != 0; @@ -79,6 +82,8 @@ bool isDirectory(const std::wstring& path) { return (GetFileAttributesA(wstringtofilename(file.getPath(), buffer)) & 0x10) != 0; } +// name guessed +// NON_MATCHING | score: 800 (lower is better) bool File::renameTo(File dest) { char buffer[256]; const std::string source(wstringtofilename(getPath(), buffer)); @@ -99,3 +104,45 @@ long File::length() { CloseHandle(handle); return size; } + +// NON_MATCHING | score: 515 (lower is better) +const char* wstringtofilename(const std::wstring& name, char (&buffer)[256]) { + for (unsigned int i = 0; i < name.size(); ++i) + buffer[i] = static_cast(name[i] == L'/' ? L'\\' : name[i]); + buffer[name.size()] = 0; + return buffer; +} + +// NON_MATCHING | score: 3213 (lower is better) +std::wstring filenametowstring(const char* name) { + const std::string encoded(name); + const auto length = encoded.size() + 1; + wchar_t* buffer = new wchar_t[length]; + std::mbstowcs(buffer, encoded.c_str(), length); + const std::wstring decoded(buffer); + delete[] buffer; + return decoded; +} + +std::wstring char16towstring(wchar_t* name) { + // FileEntry stores 16-bit characters even where wchar_t is 32 bits. + const unsigned short* units = reinterpret_cast(name); + std::wstring decoded; + while (*units) + decoded.push_back(*units++); + return decoded; +} + +/** These two legacy Windows adapters really are constant-return stubs in the + * Switch executable (0x71006081f0 and 0x7100608514). Do not use them on PC. + */ + +// name guessed +int DeleteFileA(const char*) { + return 0; +} + +// name guessed +bool WriteFile(nn::fs::FileHandle*, const void*, unsigned int, unsigned int*, _OVERLAPPED*) { + return true; +} diff --git a/src/Minecraft.World/java/io/FileInputStream.cpp b/src/Minecraft.World/java/io/FileInputStream.cpp index 0d32e9b5..f9c1e895 100644 --- a/src/Minecraft.World/java/io/FileInputStream.cpp +++ b/src/Minecraft.World/java/io/FileInputStream.cpp @@ -2,11 +2,13 @@ #include "java/io/File.h" -// The target supplies no usable app object at these call sites. Keep its -// argument registers and ABI symbol without constructing a host app singleton. +/** The target supplies no usable app object at these call sites. Keep its + * argument registers and ABI symbol without constructing a host app singleton. + */ [[noreturn]] void fileLoadError(nn::fs::FileHandle*, const wchar_t*, ...) asm("_ZN20CConsoleMinecraftApp14FatalLoadErrorEPKwz"); +// NON_MATCHING | score: 1554 (lower is better) FileInputStream::FileInputStream(const File& file) { m_eof = false; char buffer[256]; @@ -21,6 +23,8 @@ FileInputStream::~FileInputStream() { CloseHandle(m_file); } +// name guessed +// NON_MATCHING | score: 750 (lower is better) int FileInputStream::read() { if (m_eof) return -1; @@ -34,6 +38,7 @@ int FileInputStream::read() { return -1; } +// NON_MATCHING | score: 1145 (lower is better) int FileInputStream::read(arrayWithLength bytes) { if (m_eof) return -1; @@ -47,6 +52,8 @@ int FileInputStream::read(arrayWithLength bytes) { return -1; } +// name guessed +// NON_MATCHING | score: 1260 (lower is better) int FileInputStream::read(arrayWithLength bytes, unsigned int offset, unsigned int length) { if (m_eof) return -1; @@ -70,6 +77,7 @@ void FileInputStream::close() { } } +// name guessed long long FileInputStream::skip(long long amount) { return 0; } diff --git a/src/Minecraft.World/java/io/FileOutputStream.cpp b/src/Minecraft.World/java/io/FileOutputStream.cpp index 935d5872..005e3b8e 100644 --- a/src/Minecraft.World/java/io/FileOutputStream.cpp +++ b/src/Minecraft.World/java/io/FileOutputStream.cpp @@ -18,17 +18,21 @@ FileOutputStream::~FileOutputStream() { CloseHandle(m_file); } +// name guessed +// NON_MATCHING | score: 600 (lower is better) void FileOutputStream::write(unsigned int value) { const unsigned char byte = static_cast(value); unsigned int count; WriteFile(m_file, &byte, 1, &count, nullptr); } +// name guessed void FileOutputStream::write(arrayWithLength bytes) { unsigned int count; WriteFile(m_file, bytes.m_data, bytes.m_length, &count, nullptr); } +// name guessed void FileOutputStream::write(arrayWithLength bytes, unsigned int offset, unsigned int length) { unsigned int count; WriteFile(m_file, &bytes[offset], length, &count, nullptr); diff --git a/src/Minecraft.World/java/io/FilePaths.cpp b/src/Minecraft.World/java/io/FilePaths.cpp deleted file mode 100644 index 4aaabc83..00000000 --- a/src/Minecraft.World/java/io/FilePaths.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "java/io/File.h" -#include -#include - -const char* wstringtofilename(const std::wstring& name, char (&buffer)[256]) { - for (unsigned int i = 0; i < name.size(); ++i) - buffer[i] = static_cast(name[i] == L'/' ? L'\\' : name[i]); - buffer[name.size()] = 0; - return buffer; -} - -std::wstring filenametowstring(const char* name) { - const std::string encoded(name); - const auto length = encoded.size() + 1; - wchar_t* buffer = new wchar_t[length]; - std::mbstowcs(buffer, encoded.c_str(), length); - const std::wstring decoded(buffer); - delete[] buffer; - return decoded; -} - -std::wstring char16towstring(wchar_t* name) { - // FileEntry stores 16-bit characters even where wchar_t is 32 bits. - const unsigned short* units = reinterpret_cast(name); - std::wstring decoded; - while (*units) - decoded.push_back(*units++); - return decoded; -} diff --git a/src/Minecraft.World/java/io/IntCache.h b/src/Minecraft.World/java/io/IntCache.h index c690b044..fc2b489c 100644 --- a/src/Minecraft.World/java/io/IntCache.h +++ b/src/Minecraft.World/java/io/IntCache.h @@ -1,4 +1,5 @@ #pragma once -// Both historical include paths refer to the biome-layer cache. +/** Both historical include paths refer to the biome-layer cache. + */ #include "net/minecraft/world/level/newbiome/layer/IntCache.h" diff --git a/src/Minecraft.World/java/io/JavaLong.h b/src/Minecraft.World/java/io/JavaLong.h deleted file mode 100644 index 25327209..00000000 --- a/src/Minecraft.World/java/io/JavaLong.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -using JavaLong = long; diff --git a/src/Minecraft.World/java/io/SwitchFileStubs.cpp b/src/Minecraft.World/java/io/SwitchFileStubs.cpp deleted file mode 100644 index e4569653..00000000 --- a/src/Minecraft.World/java/io/SwitchFileStubs.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// These two legacy Windows adapters really are constant-return stubs in the -// Switch executable (0x71006081f0 and 0x7100608514). Do not use them on PC. -#include "java/io/File.h" - -int DeleteFileA(const char*) { - return 0; -} - -bool WriteFile(nn::fs::FileHandle*, const void*, unsigned int, unsigned int*, _OVERLAPPED*) { - return true; -} diff --git a/src/Minecraft.World/net/minecraft/util/Mth.cpp b/src/Minecraft.World/net/minecraft/util/Mth.cpp index b0d1f3b3..45ddc604 100644 --- a/src/Minecraft.World/net/minecraft/util/Mth.cpp +++ b/src/Minecraft.World/net/minecraft/util/Mth.cpp @@ -1,9 +1,11 @@ #include "net/minecraft/util/Mth.h" +#include + #include "cmath" #include "net/minecraft/world/Random.h" -float* Mth::SIN = nullptr; +float* Mth::SIN = nullptr; // name guessed float* Mth::ATAN = nullptr; int Mth::cached_atan_index(int x, int y) { @@ -81,8 +83,8 @@ double Mth::abs(double i) { return (i >= 0.0) ? i : -i; } -MthLong Mth::lfloor(double value) { - return static_cast(value) - (static_cast(value) > value); +long Mth::lfloor(double value) { + return static_cast(value) - (static_cast(value) > value); } double Mth::clampedLerp(double i, double j, double k) { @@ -181,23 +183,26 @@ int Mth::nextInt(Random* random, int i, int j) { return i; } +// name guessed float Mth::nextFloat(Random* random, float lower, float upper) { if (lower >= upper) return lower; return random->nextFloat() * (upper - lower) + lower; } +// name guessed double Mth::nextDouble(Random* random, double lower, double upper) { if (lower >= upper) return lower; return random->nextDouble() * (upper - lower) + lower; } +// NON_MATCHING | score: 35 (lower is better) std::wstring Mth::createInsecureUUID(Random* random) { wchar_t text[33]; text[32] = L'\0'; - MthLong high = (random->nextLong() & INT64_C(0xffffffffffff0fff)) | INT64_C(0x4000); - MthLong low = (random->nextLong() & INT64_C(0x3fffffffffffffff)) | INT64_MIN; + long high = (random->nextLong() & INT64_C(0xffffffffffff0fff)) | INT64_C(0x4000); + long low = (random->nextLong() & INT64_C(0x3fffffffffffffff)) | INT64_MIN; for (int i = 15; i != -1; --i) { unsigned int a = high & 15; unsigned int b = low & 15; @@ -210,3 +215,22 @@ std::wstring Mth::createInsecureUUID(Random* random) { } return std::wstring(text); } + +// name guessed +int Mth::ceil(float value) { + int truncated = static_cast(value); + return truncated + (truncated < value); +} + +int Mth::floor(double value) { + return (int)value - ((int)value > value); +} + +int Mth::floor(float value) { + return (int)value - ((int)value > value); +} + +// name guessed +long Mth::round(double value) { + return static_cast(std::floor(value + 0.5)); +} diff --git a/src/Minecraft.World/net/minecraft/util/Mth.h b/src/Minecraft.World/net/minecraft/util/Mth.h index fb1e6cb2..2d8c8959 100644 --- a/src/Minecraft.World/net/minecraft/util/Mth.h +++ b/src/Minecraft.World/net/minecraft/util/Mth.h @@ -5,8 +5,6 @@ class Random; -using MthLong = long; - // Meth class Mth { public: @@ -34,8 +32,8 @@ class Mth { static double wrapDegrees(double); static int cached_atan_index(int, int); static void init(); - static MthLong lfloor(double); - static MthLong round(double); + static long lfloor(double); + static long round(double); static double clampedLerp(double, double, double); static double frac(double); static int hsvToRgb(float, float, float); diff --git a/src/Minecraft.World/net/minecraft/util/MthCeil.cpp b/src/Minecraft.World/net/minecraft/util/MthCeil.cpp deleted file mode 100644 index a7ed71ae..00000000 --- a/src/Minecraft.World/net/minecraft/util/MthCeil.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "net/minecraft/util/Mth.h" - -int Mth::ceil(float value) { - int truncated = static_cast(value); - return truncated + (truncated < value); -} diff --git a/src/Minecraft.World/net/minecraft/util/MthFloor.cpp b/src/Minecraft.World/net/minecraft/util/MthFloor.cpp deleted file mode 100644 index 31f89d4f..00000000 --- a/src/Minecraft.World/net/minecraft/util/MthFloor.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "net/minecraft/util/Mth.h" - -int Mth::floor(double value) { - return (int)value - ((int)value > value); -} - -int Mth::floor(float value) { - return (int)value - ((int)value > value); -} diff --git a/src/Minecraft.World/net/minecraft/util/MthRound.cpp b/src/Minecraft.World/net/minecraft/util/MthRound.cpp deleted file mode 100644 index 5a9794ae..00000000 --- a/src/Minecraft.World/net/minecraft/util/MthRound.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "net/minecraft/util/Mth.h" -#include - -MthLong Mth::round(double value) { - return static_cast(std::floor(value + 0.5)); -} diff --git a/src/Minecraft.World/net/minecraft/util/StringUtils.cpp b/src/Minecraft.World/net/minecraft/util/StringUtils.cpp index b1ab7725..e8ef957e 100644 --- a/src/Minecraft.World/net/minecraft/util/StringUtils.cpp +++ b/src/Minecraft.World/net/minecraft/util/StringUtils.cpp @@ -1,5 +1,6 @@ #include "StringUtils.h" +// name guessed std::wstring replaceAll(const std::wstring& input, const std::wstring& from, const std::wstring& to) { std::wstring result(input); std::size_t pos = 0; @@ -10,6 +11,7 @@ std::wstring replaceAll(const std::wstring& input, const std::wstring& from, con return result; } +// name guessed std::vector& split(const std::wstring& text, wchar_t delimiter, std::vector& output) { std::wstringstream stream(text); @@ -19,6 +21,7 @@ std::vector& split(const std::wstring& text, wchar_t delimiter, return output; } +// name guessed std::vector split(const std::wstring& text, wchar_t delimiter) { std::vector output; return split(text, delimiter, output); diff --git a/src/Minecraft.World/net/minecraft/util/StringUtils.h b/src/Minecraft.World/net/minecraft/util/StringUtils.h index 3071a8ef..115da200 100644 --- a/src/Minecraft.World/net/minecraft/util/StringUtils.h +++ b/src/Minecraft.World/net/minecraft/util/StringUtils.h @@ -4,7 +4,8 @@ #include #include -// Additional formatting overload supplied by the Switch runtime. +/** Additional formatting overload supplied by the Switch runtime. + */ namespace std { inline namespace __1 { wstring to_wstring(bool); diff --git a/src/Minecraft.World/net/minecraft/util/datafix/DataFixLifecycle.cpp b/src/Minecraft.World/net/minecraft/util/datafix/DataFix.cpp similarity index 54% rename from src/Minecraft.World/net/minecraft/util/datafix/DataFixLifecycle.cpp rename to src/Minecraft.World/net/minecraft/util/datafix/DataFix.cpp index ece4fcce..0a335333 100644 --- a/src/Minecraft.World/net/minecraft/util/datafix/DataFixLifecycle.cpp +++ b/src/Minecraft.World/net/minecraft/util/datafix/DataFix.cpp @@ -1,4 +1,7 @@ #include "net/minecraft/util/datafix/DataFix.h" +// name guessed DataFix::DataFix() {} +// name guessed +// NON_MATCHING | score: 805 (lower is better) DataFix::~DataFix() {} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperRegistration.cpp b/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpper.cpp similarity index 53% rename from src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperRegistration.cpp rename to src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpper.cpp index ff99645e..8e86c647 100644 --- a/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperRegistration.cpp +++ b/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpper.cpp @@ -1,13 +1,18 @@ -#include "net/minecraft/util/datafix/DataFix.h" #include "net/minecraft/util/datafix/DataFixerUpper.h" + +#include "com/mojang/nbt/CompoundTag.h" + +#include "net/minecraft/util/datafix/DataFix.h" #include "net/minecraft/util/datafix/walker/DataWalker.h" +// name guessed DataFixer::DataFixer() {} DataFixerUpper::DataFixerUpper(int version) { m_version = version; } +// name guessed std::vector* DataFixerUpper::getOrCreateWalker(DataFixTypes::EDataFixTypes type) { auto* walkers = m_walkers[type]; // The original replaces even an existing empty vector without deleting it. @@ -18,6 +23,7 @@ std::vector* DataFixerUpper::getOrCreateWalker(DataFixTypes::EDataF return walkers; } +// name guessed std::vector* DataFixerUpper::getOrCreateFix(DataFixTypes::EDataFixTypes type) { auto* fixes = m_fixes[type]; if (!fixes || fixes->empty()) { @@ -27,11 +33,14 @@ std::vector* DataFixerUpper::getOrCreateFix(DataFixTypes::EDataFixType return fixes; } +// name guessed void DataFixerUpper::addWalker(DataFixTypes::EDataFixTypes type, DataWalker* walker) { auto* walkers = getOrCreateWalker(type); walkers->push_back(walker); } +// name guessed +// NON_MATCHING | score: 25 (lower is better) void DataFixerUpper::addFixer(DataFixTypes::EDataFixTypes type, DataFix* fix) { auto* fixes = getOrCreateFix(type); int version = fix->getVersion(); @@ -54,3 +63,47 @@ void DataFixerUpper::addFixer(DataFixTypes::EDataFixTypes type, DataFix* fix) { } fixes->push_back(fix); } + +const std::wstring DataFixerUpper::DATA_VERSION_KEY = L"DataVersion"; // name guessed + +// name guessed +CompoundTag* DataFixerUpper::updateData(DataFixTypes::EDataFixTypes type, CompoundTag* tag) { + int version = -1; + if (tag->contains(DATA_VERSION_KEY, 99)) { + version = tag->getInt(DATA_VERSION_KEY); + if (version > 921) + return tag; + } + return update(type, tag, version); +} + +// name guessed +CompoundTag* DataFixerUpper::update(DataFixTypes::EDataFixTypes type, CompoundTag* tag, int version) { + if (version < m_version) { + tag = applyFixes(type, tag, version); + tag = applyWalkers(type, tag, version); + } + return tag; +} + +// name guessed +CompoundTag* DataFixerUpper::applyFixes(DataFixTypes::EDataFixTypes type, CompoundTag* tag, int version) { + if (m_fixes.find(type) != m_fixes.end()) { + auto* fixes = m_fixes[type]; + for (auto it = fixes->begin(), end = fixes->end(); it != end; ++it) { + if (version < (*it)->getVersion()) + tag = (*it)->fix(tag); + } + } + return tag; +} + +// name guessed +CompoundTag* DataFixerUpper::applyWalkers(DataFixTypes::EDataFixTypes type, CompoundTag* tag, int version) { + auto found = m_walkers.find(type); + if (found != m_walkers.end()) { + for (auto* walker : *found->second) + tag = walker->walk(this, tag, version); + } + return tag; +} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperUpdate.cpp b/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperUpdate.cpp deleted file mode 100644 index 350734dd..00000000 --- a/src/Minecraft.World/net/minecraft/util/datafix/DataFixerUpperUpdate.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "com/mojang/nbt/CompoundTag.h" -#include "net/minecraft/util/datafix/DataFix.h" -#include "net/minecraft/util/datafix/DataFixerUpper.h" -#include "net/minecraft/util/datafix/walker/DataWalker.h" - -const std::wstring DataFixerUpper::DATA_VERSION_KEY = L"DataVersion"; - -CompoundTag* DataFixerUpper::updateData(DataFixTypes::EDataFixTypes type, CompoundTag* tag) { - int version = -1; - if (tag->contains(DATA_VERSION_KEY, 99)) { - version = tag->getInt(DATA_VERSION_KEY); - if (version > 921) - return tag; - } - return update(type, tag, version); -} - -CompoundTag* DataFixerUpper::update(DataFixTypes::EDataFixTypes type, CompoundTag* tag, int version) { - if (version < m_version) { - tag = applyFixes(type, tag, version); - tag = applyWalkers(type, tag, version); - } - return tag; -} - -CompoundTag* DataFixerUpper::applyFixes(DataFixTypes::EDataFixTypes type, CompoundTag* tag, int version) { - if (m_fixes.find(type) != m_fixes.end()) { - auto* fixes = m_fixes[type]; - for (auto it = fixes->begin(), end = fixes->end(); it != end; ++it) { - if (version < (*it)->getVersion()) - tag = (*it)->fix(tag); - } - } - return tag; -} - -CompoundTag* DataFixerUpper::applyWalkers(DataFixTypes::EDataFixTypes type, CompoundTag* tag, int version) { - auto found = m_walkers.find(type); - if (found != m_walkers.end()) { - for (auto* walker : *found->second) - tag = walker->walk(this, tag, version); - } - return tag; -} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/DataFixerItemTraversal.cpp b/src/Minecraft.World/net/minecraft/util/datafix/DataFixers.cpp similarity index 96% rename from src/Minecraft.World/net/minecraft/util/datafix/walker/DataFixerItemTraversal.cpp rename to src/Minecraft.World/net/minecraft/util/datafix/DataFixers.cpp index 1e283db3..0988347d 100644 --- a/src/Minecraft.World/net/minecraft/util/datafix/walker/DataFixerItemTraversal.cpp +++ b/src/Minecraft.World/net/minecraft/util/datafix/DataFixers.cpp @@ -1,8 +1,10 @@ +#include "net/minecraft/util/datafix/DataFixers.h" + #include "com/mojang/nbt/CompoundTag.h" #include "com/mojang/nbt/ListTag.h" #include "net/minecraft/util/datafix/DataFixer.h" -#include "net/minecraft/util/datafix/DataFixers.h" +// name guessed CompoundTag* DataFixers::updateItem(DataFixer* fixer, CompoundTag* tag, int version, const std::wstring& key) { if (tag->contains(key, Tag::TAG_Compound)) { @@ -11,6 +13,7 @@ CompoundTag* DataFixers::updateItem(DataFixer* fixer, CompoundTag* tag, int vers return tag; } +// name guessed CompoundTag* DataFixers::updateItems(DataFixer* fixer, CompoundTag* tag, int version, const std::wstring& key) { if (tag->contains(key, Tag::TAG_List)) { diff --git a/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemIdFix.cpp b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemIdFix.cpp index f047e1a5..73fc44b7 100644 --- a/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemIdFix.cpp +++ b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemIdFix.cpp @@ -1,6 +1,6 @@ #include "net/minecraft/util/datafix/fixes/ItemIdFix.h" -std::unordered_map ItemIdFix::ID_TO_NAME; +std::unordered_map ItemIdFix::ID_TO_NAME; // name guessed void ItemIdFix::staticCtor() { ID_TO_NAME[1] = L"minecraft:stone"; diff --git a/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTotemRenameFix.cpp b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTotemRenameFix.cpp new file mode 100644 index 00000000..73384284 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTotemRenameFix.cpp @@ -0,0 +1,19 @@ +#include "net/minecraft/util/datafix/fixes/ItemTotemRenameFix.h" + +#include "com/mojang/nbt/CompoundTag.h" +#include "net/minecraft/util/datafix/fixes/ItemWaterPotionFix.h" + +// name guessed +ItemTotemRenameFix::ItemTotemRenameFix() {} + +// name guessed +int ItemTotemRenameFix::getVersion() { + return 820; +} + +// name guessed +CompoundTag* ItemTotemRenameFix::fix(CompoundTag* tag) { + if (tag->getString(L"id") == L"minecraft:totem") + tag->putString(L"id", L"minecraft:totem_of_undying"); + return tag; +} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTagFixes.cpp b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemWaterPotionFix.cpp similarity index 74% rename from src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTagFixes.cpp rename to src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemWaterPotionFix.cpp index b1515b39..03889035 100644 --- a/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemTagFixes.cpp +++ b/src/Minecraft.World/net/minecraft/util/datafix/fixes/ItemWaterPotionFix.cpp @@ -1,23 +1,17 @@ +#include "net/minecraft/util/datafix/fixes/ItemWaterPotionFix.h" + #include "com/mojang/nbt/CompoundTag.h" #include "net/minecraft/util/datafix/fixes/ItemTotemRenameFix.h" -#include "net/minecraft/util/datafix/fixes/ItemWaterPotionFix.h" -ItemTotemRenameFix::ItemTotemRenameFix() {} +// name guessed ItemWaterPotionFix::ItemWaterPotionFix() {} -int ItemTotemRenameFix::getVersion() { - return 820; -} +// name guessed int ItemWaterPotionFix::getVersion() { return 806; } -CompoundTag* ItemTotemRenameFix::fix(CompoundTag* tag) { - if (tag->getString(L"id") == L"minecraft:totem") - tag->putString(L"id", L"minecraft:totem_of_undying"); - return tag; -} - +// name guessed CompoundTag* ItemWaterPotionFix::fix(CompoundTag* tag) { const std::wstring id = tag->getString(L"id"); if (id == L"minecraft:potion" || id == L"minecraft:splash_potion" || id == L"minecraft:lingering_potion" diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/DataWalkerLifecycle.cpp b/src/Minecraft.World/net/minecraft/util/datafix/walker/DataWalker.cpp similarity index 59% rename from src/Minecraft.World/net/minecraft/util/datafix/walker/DataWalkerLifecycle.cpp rename to src/Minecraft.World/net/minecraft/util/datafix/walker/DataWalker.cpp index 5f27c308..0d9f5610 100644 --- a/src/Minecraft.World/net/minecraft/util/datafix/walker/DataWalkerLifecycle.cpp +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/DataWalker.cpp @@ -1,4 +1,7 @@ #include "net/minecraft/util/datafix/walker/DataWalker.h" +// name guessed DataWalker::DataWalker() {} +// name guessed +// NON_MATCHING | score: 805 (lower is better) DataWalker::~DataWalker() {} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalker.cpp b/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalker.cpp new file mode 100644 index 00000000..43916b8c --- /dev/null +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalker.cpp @@ -0,0 +1,13 @@ +#include "net/minecraft/util/datafix/walker/ItemDataWalker.h" + +#include "net/minecraft/util/datafix/DataFixers.h" +#include "net/minecraft/util/datafix/walker/ItemListDataWalker.h" + +ItemDataWalker::~ItemDataWalker() {} + +// name guessed +CompoundTag* ItemDataWalker::doWalk(DataFixer* fixer, CompoundTag* tag, int version) { + for (auto it = m_keys.begin(); it != m_keys.end(); ++it) + tag = DataFixers::updateItem(fixer, tag, version, *it); + return tag; +} diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalker.h b/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalker.h index f3f4a2da..4f376de4 100644 --- a/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalker.h +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalker.h @@ -5,7 +5,8 @@ class ItemDataWalker : public KeyedDataWalker { public: - // Registry key selection in this constructor is not yet reconstructed. + /** Registry key selection in this constructor is not yet reconstructed. + */ ItemDataWalker(eINSTANCEOF, const std::wstring&); ~ItemDataWalker() override; CompoundTag* doWalk(DataFixer*, CompoundTag*, int version) override; diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalkers.cpp b/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemListDataWalker.cpp similarity index 63% rename from src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalkers.cpp rename to src/Minecraft.World/net/minecraft/util/datafix/walker/ItemListDataWalker.cpp index 0028d6e9..5e813e96 100644 --- a/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemDataWalkers.cpp +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemListDataWalker.cpp @@ -1,16 +1,11 @@ +#include "net/minecraft/util/datafix/walker/ItemListDataWalker.h" + #include "net/minecraft/util/datafix/DataFixers.h" #include "net/minecraft/util/datafix/walker/ItemDataWalker.h" -#include "net/minecraft/util/datafix/walker/ItemListDataWalker.h" -ItemDataWalker::~ItemDataWalker() {} ItemListDataWalker::~ItemListDataWalker() {} -CompoundTag* ItemDataWalker::doWalk(DataFixer* fixer, CompoundTag* tag, int version) { - for (auto it = m_keys.begin(); it != m_keys.end(); ++it) - tag = DataFixers::updateItem(fixer, tag, version, *it); - return tag; -} - +// name guessed CompoundTag* ItemListDataWalker::doWalk(DataFixer* fixer, CompoundTag* tag, int version) { for (auto it = m_keys.begin(); it != m_keys.end(); ++it) tag = DataFixers::updateItems(fixer, tag, version, *it); diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemListDataWalker.h b/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemListDataWalker.h index 648575ef..9f2f0ca2 100644 --- a/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemListDataWalker.h +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/ItemListDataWalker.h @@ -5,7 +5,8 @@ class ItemListDataWalker : public KeyedDataWalker { public: - // Registry key selection in these constructors is not yet reconstructed. + /** Registry key selection in these constructors is not yet reconstructed. + */ ItemListDataWalker(eINSTANCEOF, const std::wstring&); ItemListDataWalker(eINSTANCEOF, const std::vector&); ~ItemListDataWalker() override; diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.cpp b/src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.cpp index 37dee375..9fa50288 100644 --- a/src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.cpp +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.cpp @@ -2,8 +2,10 @@ #include "com/mojang/nbt/CompoundTag.h" +// name guessed KeyedDataWalker::~KeyedDataWalker() {} +// name guessed CompoundTag* KeyedDataWalker::walk(DataFixer* fixer, CompoundTag* tag, int version) { if (ResourceLocation(tag->getString(L"id")) == &m_key) return doWalk(fixer, tag, version); diff --git a/src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.h b/src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.h index 98df5886..f07bdb15 100644 --- a/src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.h +++ b/src/Minecraft.World/net/minecraft/util/datafix/walker/KeyedDataWalker.h @@ -5,7 +5,8 @@ class KeyedDataWalker : public DataWalker { public: - // Entity/block-entity registry key selection is not reconstructed here. + /** Entity/block-entity registry key selection is not reconstructed here. + */ explicit KeyedDataWalker(eINSTANCEOF); ~KeyedDataWalker() override; CompoundTag* walk(DataFixer*, CompoundTag*, int version) override; diff --git a/src/Minecraft.World/net/minecraft/world/ArrayWithLength.h b/src/Minecraft.World/net/minecraft/world/ArrayWithLength.h index aeb474c0..30d1c350 100644 --- a/src/Minecraft.World/net/minecraft/world/ArrayWithLength.h +++ b/src/Minecraft.World/net/minecraft/world/ArrayWithLength.h @@ -23,6 +23,7 @@ class arrayWithLength { this->m_data = initialData; this->m_length = N; } + // NON_MATCHING | score: 3114 (lower is better) arrayWithLength(unsigned int size, bool a3) { T* temp; if (a3) @@ -57,7 +58,7 @@ class arrayWithLength { m_length = newSize; } - // NON_MATCHING + // NON_MATCHING | score: 3195 (lower is better) static void copy(T* dest, T* src, unsigned int size) { if (size) { unsigned int i = 0; diff --git a/src/Minecraft.World/net/minecraft/world/PlayerUID.h b/src/Minecraft.World/net/minecraft/world/PlayerUID.h index 374ff3c1..171b92e2 100644 --- a/src/Minecraft.World/net/minecraft/world/PlayerUID.h +++ b/src/Minecraft.World/net/minecraft/world/PlayerUID.h @@ -1,6 +1,5 @@ #pragma once -#include "java/io/JavaLong.h" #include "types.h" #include #include @@ -18,8 +17,8 @@ class PlayerUID { const std::wstring UuidString() const; const std::wstring toString() const; - JavaLong m_gap0; - JavaLong m_mostSigBits; // grabbed from JDK, doubt those are correct but yeah, pure guess - JavaLong m_leastSigBits; + long m_gap0; + long m_mostSigBits; // name guessed: UUID high bits + long m_leastSigBits; // name guessed: UUID low bits char m_byte18; }; diff --git a/src/Minecraft.World/net/minecraft/world/Random.h b/src/Minecraft.World/net/minecraft/world/Random.h index 61c70544..3ed8670d 100644 --- a/src/Minecraft.World/net/minecraft/world/Random.h +++ b/src/Minecraft.World/net/minecraft/world/Random.h @@ -1,7 +1,5 @@ #pragma once -using RandomLong = long; - class Random { public: Random(); @@ -12,12 +10,12 @@ class Random { double nextDouble(); int nextInt(); void setSeed(long long seed); - RandomLong nextLong(); + long nextLong(); bool nextBoolean(); int next(int bits); double nextGaussian(); - RandomLong m_val; + long m_val; bool m_field8; double m_seed3; }; diff --git a/src/Minecraft.World/net/minecraft/world/entity/LivingEntity.h b/src/Minecraft.World/net/minecraft/world/entity/LivingEntity.h index a81721be..40919228 100644 --- a/src/Minecraft.World/net/minecraft/world/entity/LivingEntity.h +++ b/src/Minecraft.World/net/minecraft/world/entity/LivingEntity.h @@ -18,6 +18,7 @@ class CombatTracker; class ThermalAreaRuleDefinition; class HumanoidArm; +// NON_MATCHING | score: 4326 (lower is better) class LivingEntity : public Entity { public: LivingEntity(Level* level); diff --git a/src/Minecraft.World/net/minecraft/world/entity/player/Player.h b/src/Minecraft.World/net/minecraft/world/entity/player/Player.h index 513afb99..de34e457 100644 --- a/src/Minecraft.World/net/minecraft/world/entity/player/Player.h +++ b/src/Minecraft.World/net/minecraft/world/entity/player/Player.h @@ -195,7 +195,7 @@ class Player : public LivingEntity { bool hasInvisiblePrivilege(); bool isAllowedToFly(); bool hasInvulnerablePrivilege(); - // Inferred names for the unnamed entries at 0x71002d0d68 and 0x71002d0e10. + // name guessed: the unnamed entries at 0x71002d0d68 and 0x71002d0e10. bool usesLegacyFoodHealing(); bool isHurt(); void causeFoodExhaustion(float); diff --git a/src/Minecraft.World/net/minecraft/world/item/Item.cpp b/src/Minecraft.World/net/minecraft/world/item/Item.cpp index 4661b26f..4e7e075c 100644 --- a/src/Minecraft.World/net/minecraft/world/item/Item.cpp +++ b/src/Minecraft.World/net/minecraft/world/item/Item.cpp @@ -59,6 +59,7 @@ bool Item::canBeDepleted() { return this->m_maxDamage > 0 && (!this->m_stackedByData || this->m_maxStackSize == 1); } +// NON_MATCHING | score: 0 (lower is better) Item* Item::setIconName(const std::wstring& iconName) { this->m_iconName = iconName; return this; diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/Biome.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/Biome.cpp index ff573330..fb9a3221 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/Biome.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/biome/Biome.cpp @@ -269,16 +269,7 @@ void Biome::generateColoursDebugOutput() { return; } -// NON_MATCHING | Score: 5785 (lower is better) -// literally took me so many hours to get it finally partially completed (all registered, down to 99k score) -// but then I realized I had to make the last property of the BiomeProperties be set separately instead of -// chained -// ...or did I? Nope, just a waste of time... -// so then I figured out that I had to merge the BiomeProperties constructors directly into the Biome -// constructors... This got me down to like 70k iirc, which was closer but not close enough. then I saw that -// the wstring that gets assigned to the BiomeProperties constructor gets deleted after the var has been -// created but before the static Biome* has been set so that means I had to separate out the Biome's setters -// from the constructor init... and here I am, at 5785 score. -Dexrn +// NON_MATCHING | score: 5785 (lower is better) void Biome::staticCtor() { Biome::OCEAN = new OceanBiome(BiomeID_OCEAN, (new BiomeProperties(L"Ocean"))->depth(-1.0)->scale(0.1)); diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/BiomeSource.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/BiomeSource.cpp index d26ceb48..684cc31a 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/BiomeSource.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/biome/BiomeSource.cpp @@ -18,8 +18,7 @@ #include "net/minecraft/world/level/newbiome/layer/Layer.h" #include "net/minecraft/world/level/storage/LevelData.h" -// NON_MATCHING | Score: 535 (lower is better) -// Idk wtf is going on with this one - Azalea +// NON_MATCHING | score: 535 (lower is better) BiomeSource::LayerOverrideSettings::LayerOverrideSettings() { m_field38 = 0; m_genScale = static_cast(-1); diff --git a/src/Minecraft.World/net/minecraft/world/level/block/Block.cpp b/src/Minecraft.World/net/minecraft/world/level/block/Block.cpp index b0d28dcf..c10bb55d 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/Block.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/block/Block.cpp @@ -271,8 +271,7 @@ bool Block::ParticlesSurviveWithin() { return false; } -// NON_MATCHING: play with ifs in cases (so they are not optimised, the ifs) logic should be the same (unless -// I broke something while trying to match) +// NON_MATCHING | score: 3870 (lower is better) int Block::GetInteractTooltip(const BlockTooltipDataHolder& data) { int blockId = data.m_itemInstance->getItem()->getId(); // int returnValue = 0xFFFFFFFF; @@ -485,7 +484,6 @@ const AABB* Block::getShape(const BlockState* state, LevelSource* levelSource, c return Block::defaultBlockShape; } -// NON_MATCHING: i don't have a clue int Block::getLightColor(const BlockState* state, LevelSource* levelSource, const BlockPos& pos, int) { Block* blockFromLevel = levelSource->getBlockState(pos)->getBlock(); int color = levelSource->getLightColor(pos, blockFromLevel->getLightEmission(state), 0xFFFFFFFF); @@ -592,7 +590,7 @@ Item* Block::getResource(const BlockState* state, Random*, int) { return Item::byBlock(this); } -// NON_MATCHING: I don't have a clue +// NON_MATCHING | score: 650 (lower is better) float Block::getDestroyProgress(const BlockState* state, std::shared_ptr player, Level* level, const BlockPos& pos) { float destSpeed = state->getDestroySpeed(level, pos); @@ -737,6 +735,7 @@ int Block::getColor(LevelSource* levelSource, const BlockPos& pos, const BlockSt return 0xFFFFFF; } +// NON_MATCHING | score: 400 (lower is better) int Block::getSignal(const BlockState* state, LevelSource* levelSource, const BlockPos& pos, const Direction* direction) { return 0; @@ -888,8 +887,7 @@ int xOffsets[6] = {1, -1, 0, 0, 0, 0}; int yOffsets[6] = {0, 0, 1, -1, 0, 0}; int zOffsets[6] = {0, 0, 0, 0, 1, -1}; -// NON_MATCHING: too lazy to figure out this, wasLeaves is probably someshit generated by compiler and that's -// prob why it's not matching +// NON_MATCHING | score: 3310 (lower is better) TextureAtlasSprite* Block::getTexture(LevelSource* levelSource, const BlockPos& pos, const Direction* direction, const BlockState* state) { if (LeafBlock::isLeaves(state->getBlock())) @@ -981,10 +979,8 @@ bool Block::isExceptionBlockForAttachingPlusPiston(Block* block) { return Block::isExceptionBlockForAttaching(block); } -// NON_MATCHING: the registration phase now agrees with original ARM64 call -// traces, but the complete initializer still differs in its instructions. -// The original new sizes also cover fields absent from partial block headers; -// BlockBootstrapAllocation preserves those allocations without inventing layouts. +/** Allocates the full object sizes, including fields absent from partial class declarations. */ +// NON_MATCHING | score: 60165 (lower is better) void Block::staticCtor() { DEFAULT_FACING = DirectionProperty::create(L"facing"); HORIZONTAL_FACING = DirectionProperty::create(L"facing", Direction::Plane::HORIZONTAL); diff --git a/src/Minecraft.World/net/minecraft/world/level/block/BlockBootstrapAllocation.h b/src/Minecraft.World/net/minecraft/world/level/block/BlockBootstrapAllocation.h index 54f76312..13fbd582 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/BlockBootstrapAllocation.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/BlockBootstrapAllocation.h @@ -3,10 +3,7 @@ #include #include -// Several block declarations still expose only their reconstructed prefix. -// Keep the original initializer's allocation size without inventing fields or -// changing those partial class layouts. Placement-new retains allocation before -// constructor argument evaluation, as in the original new expression. +/** Custom allocation tag for partial block layouts; preserves allocation before argument evaluation. */ template struct BlockBootstrapAllocation {}; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/StoneSlabBlock.h b/src/Minecraft.World/net/minecraft/world/level/block/StoneSlabBlock.h index 8c800073..f9950ed8 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/StoneSlabBlock.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/StoneSlabBlock.h @@ -6,7 +6,8 @@ class StoneSlabBlock : public Block { public: - // Variant interface only; catalogue layout and construction remain unreconstructed. + /** Variant interface only; catalogue layout and construction remain unreconstructed. + */ class Variant : public StringRepresentable { public: static Variant* SANDSTONE; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/state/BlockStateDefinition.h b/src/Minecraft.World/net/minecraft/world/level/block/state/BlockStateDefinition.h index 1b910af0..cdbde1ca 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/state/BlockStateDefinition.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/state/BlockStateDefinition.h @@ -77,7 +77,8 @@ class BlockStateDefinition { const std::vector& getProperties() const; bool hasProperty(const Property*) const; Boxed* getPropertyValue(const Property*, unsigned short state) const; - // Property must belong to this definition's encoded state table. + /** Property must belong to this definition's encoded state table. + */ const BlockState* getNeighbour(const Property*, Boxed*, unsigned short state) const; const BlockState* any(); const arrayWithLength* getPossibleBlockStates() const; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/LevelGenerationOptions.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/LevelGenerationOptions.h index 1760daf3..850011b3 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/LevelGenerationOptions.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/LevelGenerationOptions.h @@ -10,6 +10,7 @@ class LevelGenerationOptions { LevelRuleset* getRequiredGameRules(); void loadBaseSaveData(); bool intersects(const BlockPos& lower, const BlockPos& upper); - // LegacyBlockData is the reconstruction's existing name for original BlockPair. + /** LegacyBlockData is the reconstruction's existing name for original BlockPair. + */ void getBiomeOverride(int biomeId, Biome::LegacyBlockData* filler, Biome::LegacyBlockData* surface); }; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherFlatLevelSource.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherFlatLevelSource.cpp index 28715550..184297bd 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherFlatLevelSource.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherFlatLevelSource.cpp @@ -41,7 +41,7 @@ void NetherFlatLevelSource::prepareHeights(int x, int z, ChunkPrimer* primer) { } } -// NON_MATCHING +// NON_MATCHING | score: 8474 (lower is better) void NetherFlatLevelSource::buildSurfaces(int x, int z, ChunkPrimer* primer) { const BlockState* bedrock = Blocks::BEDROCK->defaultBlockState(); @@ -115,7 +115,7 @@ LevelChunk* NetherFlatLevelSource::createChunk(int x, int z) { return chunk; } -// NON_MATCHING +// NON_MATCHING | score: 3523 (lower is better) void NetherFlatLevelSource::postProcess(int x, int z) { inPostProcessStep = true; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.cpp index 169a3542..fa86292c 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.cpp @@ -130,6 +130,7 @@ float OverworldLevelSource::getHeightFalloff(int chunkX, int chunkZ, int* distan return result; } +// NON_MATCHING | score: 0 (lower is better) int OverworldLevelSource::distanceToEdge(float a, int, int x, int z, int size) { int halfSize = size / 2; @@ -542,7 +543,7 @@ bool OverworldLevelSource::postProcessLoadedChunk(LevelChunk*, int, int) { return false; } -// NON_MATCHING | Score: 5336 (lower is better) +// NON_MATCHING | score: 346 (lower is better) void OverworldLevelSource::prepareHeights(int chunkX, int chunkZ, ChunkPrimer* primer) { // These variables are made into constants by the compiler int width = 4; // every 4th block is sampled in the chunk @@ -696,6 +697,7 @@ void OverworldLevelSource::recreateLogicStructuresForChunk(LevelChunk* chunk, in } } +// NON_MATCHING | score: 0 (lower is better) bool OverworldLevelSource::isPosInFeature(Level* level, const std::wstring& featureName, const BlockPos& pos) { if (!m_shouldGenerateStructures) { diff --git a/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/IntCache.h b/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/IntCache.h index b50a8e0e..48c15e78 100644 --- a/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/IntCache.h +++ b/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/IntCache.h @@ -20,7 +20,8 @@ class IntCache { ThreadStorage(); ~ThreadStorage(); - // Arrays remain owned here; returned arrayWithLength values are views. + /** Arrays remain owned here; returned arrayWithLength values are views. + */ int m_maxSize; std::vector> m_freeSmall; std::vector> m_activeSmall; diff --git a/src/Minecraft.World/net/minecraft/world/level/storage/light/SparseLightStorage.h b/src/Minecraft.World/net/minecraft/world/level/storage/light/SparseLightStorage.h index 741e8d3f..d3c9a890 100644 --- a/src/Minecraft.World/net/minecraft/world/level/storage/light/SparseLightStorage.h +++ b/src/Minecraft.World/net/minecraft/world/level/storage/light/SparseLightStorage.h @@ -42,7 +42,8 @@ class SparseLightStorage { static int sRetirementSlot; static XLockFreeStack sRetired[3]; - // Low 48 bits: buffer pointer; high 16 bits: number of explicit 128-byte slabs. + /** Low 48 bits: buffer pointer; high 16 bits: number of explicit 128-byte slabs. + */ unsigned long long m_packed; }; diff --git a/src/Minecraft.World/net/minecraft/world/phys/AABB.cpp b/src/Minecraft.World/net/minecraft/world/phys/AABB.cpp index ce1081a2..a5bd0db6 100644 --- a/src/Minecraft.World/net/minecraft/world/phys/AABB.cpp +++ b/src/Minecraft.World/net/minecraft/world/phys/AABB.cpp @@ -6,31 +6,67 @@ #include "net/minecraft/world/phys/Vec3.h" #include -// Keep the ray clip in the original matching translation unit. Host builds -// compile it separately so core subsystem linking needs no game dependencies. -#include "net/minecraft/world/phys/AABBClip.inl" +#include "net/minecraft/core/Direction.h" +#include "net/minecraft/world/phys/HitResult.h" + +HitResult* AABB::clip(Vec3* start, Vec3* end) const { + Vec3* closest = collideWithXPlane(m_inX, start, end); + const Direction* face = Direction::WEST; + Vec3* candidate = collideWithXPlane(m_axX, start, end); + if (candidate && isClosest(start, closest, candidate)) { + closest = candidate; + face = Direction::EAST; + } + candidate = collideWithYPlane(m_inY, start, end); + if (candidate && isClosest(start, closest, candidate)) { + closest = candidate; + face = Direction::DOWN; + } + candidate = collideWithYPlane(m_axY, start, end); + if (candidate && isClosest(start, closest, candidate)) { + closest = candidate; + face = Direction::UP; + } + candidate = collideWithZPlane(m_inZ, start, end); + if (candidate && isClosest(start, closest, candidate)) { + closest = candidate; + face = Direction::NORTH; + } + candidate = collideWithZPlane(m_axZ, start, end); + if (candidate && isClosest(start, closest, candidate)) { + closest = candidate; + face = Direction::SOUTH; + } + // Strict distance comparison preserves the earlier face at edges and corners. + return closest ? new HitResult(closest, face) : nullptr; +} DEFINE_THREAD_STORAGE(AABB, 1024) +// name guessed Vec3* AABB::collideWithXPlane(double x, Vec3* start, Vec3* end) const { Vec3* hit = start->getIntermediateWithXValue(end, x); return hit && containsYZ(hit) ? hit : nullptr; } +// name guessed Vec3* AABB::collideWithYPlane(double y, Vec3* start, Vec3* end) const { Vec3* hit = start->getIntermediateWithYValue(end, y); return hit && containsXZ(hit) ? hit : nullptr; } +// name guessed Vec3* AABB::collideWithZPlane(double z, Vec3* start, Vec3* end) const { Vec3* hit = start->getIntermediateWithZValue(end, z); return hit && containsXY(hit) ? hit : nullptr; } +// name guessed bool AABB::isClosest(Vec3* start, Vec3* closest, Vec3* candidate) const { return !closest || start->distanceToSqr(candidate) < start->distanceToSqr(closest); } +// name guessed bool AABB::containsYZ(Vec3* hit) const { // Ordered bounds checks reject NaNs, as do the original b.ge/b.ls branches. if (!hit || !(hit->m_y >= m_inY) || !(hit->m_y <= m_axY) || !(hit->m_z >= m_inZ)) @@ -38,20 +74,22 @@ bool AABB::containsYZ(Vec3* hit) const { return hit->m_z <= m_axZ; } +// name guessed bool AABB::containsXZ(Vec3* hit) const { if (!hit || !(hit->m_x >= m_inX) || !(hit->m_x <= m_axX) || !(hit->m_z >= m_inZ)) return false; return hit->m_z <= m_axZ; } +// name guessed bool AABB::containsXY(Vec3* hit) const { if (!hit || !(hit->m_x >= m_inX) || !(hit->m_x <= m_axX) || !(hit->m_y >= m_inY)) return false; return hit->m_y <= m_axY; } +// NON_MATCHING | score: 495 (lower is better) AABB* AABB::divideInternalsBy(double divisor) { - // NON_MATCHING: the reference schedules the divisions and stores differently. m_inX /= divisor; m_inY /= divisor; m_inZ /= divisor; @@ -78,6 +116,7 @@ AABB* AABB::newPermanent(const BlockPos& pos) { return newPermanent(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); } +// name guessed AABB* AABB::newPermanent(const BlockPos& first, const BlockPos& second) { return newPermanent(first.getX(), first.getY(), first.getZ(), second.getX(), second.getY(), second.getZ()); @@ -102,10 +141,12 @@ AABB* AABB::newTemp(const BlockPos& pos) { return newTemp(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); } +// name guessed AABB* AABB::newTemp(const BlockPos& first, const BlockPos& second) { return newTemp(first.getX(), first.getY(), first.getZ(), second.getX(), second.getY(), second.getZ()); } +// name guessed AABB* AABB::newTemp(const AABB* other) { return newTemp(other->m_inX, other->m_inY, other->m_inZ, other->m_axX, other->m_axY, other->m_axZ); } @@ -193,6 +234,7 @@ AABB* AABB::expand(double dx, double dy, double dz) const { return newTemp(tx1, ty1, tz1, tx2, ty2, tz2); } +// name guessed bool AABB::equals(const AABB* other) const { if (!other) return false; @@ -236,6 +278,7 @@ bool AABB::contains(const BlockPos& pos) const { return const_cast(this)->contains(Vec3::newTemp(pos.getX(), pos.getY(), pos.getZ())); } +// name guessed void AABB::correctMinMax() { // Copy all endpoints before writing through the references returned by minmax. const auto x = std::minmax(m_inX, m_axX); diff --git a/src/Minecraft.World/net/minecraft/world/phys/AABBClip.cpp b/src/Minecraft.World/net/minecraft/world/phys/AABBClip.cpp deleted file mode 100644 index 8b137891..00000000 --- a/src/Minecraft.World/net/minecraft/world/phys/AABBClip.cpp +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/Minecraft.World/net/minecraft/world/phys/AABBClip.inl b/src/Minecraft.World/net/minecraft/world/phys/AABBClip.inl deleted file mode 100644 index 9c611847..00000000 --- a/src/Minecraft.World/net/minecraft/world/phys/AABBClip.inl +++ /dev/null @@ -1,37 +0,0 @@ -#include "net/minecraft/world/phys/AABB.h" - -#include "net/minecraft/core/Direction.h" -#include "net/minecraft/world/phys/HitResult.h" -#include "net/minecraft/world/phys/Vec3.h" - -HitResult* AABB::clip(Vec3* start, Vec3* end) const { - Vec3* closest = collideWithXPlane(m_inX, start, end); - const Direction* face = Direction::WEST; - Vec3* candidate = collideWithXPlane(m_axX, start, end); - if (candidate && isClosest(start, closest, candidate)) { - closest = candidate; - face = Direction::EAST; - } - candidate = collideWithYPlane(m_inY, start, end); - if (candidate && isClosest(start, closest, candidate)) { - closest = candidate; - face = Direction::DOWN; - } - candidate = collideWithYPlane(m_axY, start, end); - if (candidate && isClosest(start, closest, candidate)) { - closest = candidate; - face = Direction::UP; - } - candidate = collideWithZPlane(m_inZ, start, end); - if (candidate && isClosest(start, closest, candidate)) { - closest = candidate; - face = Direction::NORTH; - } - candidate = collideWithZPlane(m_axZ, start, end); - if (candidate && isClosest(start, closest, candidate)) { - closest = candidate; - face = Direction::SOUTH; - } - // Strict distance comparison preserves the earlier face at edges and corners. - return closest ? new HitResult(closest, face) : nullptr; -} diff --git a/src/Minecraft.World/net/minecraft/world/phys/HitResult.cpp b/src/Minecraft.World/net/minecraft/world/phys/HitResult.cpp index 43e65a0d..16646477 100644 --- a/src/Minecraft.World/net/minecraft/world/phys/HitResult.cpp +++ b/src/Minecraft.World/net/minecraft/world/phys/HitResult.cpp @@ -4,6 +4,7 @@ #include "net/minecraft/world/entity/Entity.h" #include "net/minecraft/world/phys/Vec3.h" +// name guessed HitResult::HitResult(Vec3* hit, const Direction* direction) { m_type = 1; m_blockPos = BlockPos::zero; diff --git a/src/Minecraft.World/net/minecraft/world/phys/Vec3.cpp b/src/Minecraft.World/net/minecraft/world/phys/Vec3.cpp index da8ea896..379feeed 100644 --- a/src/Minecraft.World/net/minecraft/world/phys/Vec3.cpp +++ b/src/Minecraft.World/net/minecraft/world/phys/Vec3.cpp @@ -6,8 +6,9 @@ DEFINE_THREAD_STORAGE(Vec3, 1024) -Vec3* Vec3::ZERO; +Vec3* Vec3::ZERO; // name guessed +// name guessed void Vec3::staticCtor() { ZERO = new Vec3(0.0, 0.0, 0.0); } @@ -16,6 +17,7 @@ Vec3* Vec3::newPermanent(double x, double y, double z) { return new Vec3(x, y, z); } +// name guessed Vec3* Vec3::newPermanent(const Vec3* other) { return new Vec3(other->m_x, other->m_y, other->m_z); } @@ -28,10 +30,12 @@ Vec3* Vec3::newTemp(double x, double y, double z) { return temp; } +// name guessed Vec3* Vec3::newTemp(const Vec3* other) { return newTemp(other->m_x, other->m_y, other->m_z); } +// name guessed Vec3* Vec3::newTemp(const Vec3i& other) { return newTemp(other.getX(), other.getY(), other.getZ()); } @@ -43,24 +47,29 @@ Vec3* Vec3::normalize() { return newTemp(m_x / magnitude, m_y / magnitude, m_z / magnitude); } +// name guessed Vec3* Vec3::lerp(Vec3* other, double weight) { return newTemp(m_x + (other->m_x - m_x) * weight, m_y + (other->m_y - m_y) * weight, m_z + (other->m_z - m_z) * weight); } +// name guessed Vec3* Vec3::vectorTo(Vec3* other) { return newTemp(other->m_x - m_x, other->m_y - m_y, other->m_z - m_z); } +// name guessed Vec3* Vec3::cross(Vec3* other) { return newTemp(m_y * other->m_z - m_z * other->m_y, m_z * other->m_x - other->m_z * m_x, other->m_y * m_x - m_y * other->m_x); } +// name guessed Vec3* Vec3::add(Vec3* other) { return add(other->m_x, other->m_y, other->m_z); } +// name guessed double Vec3::distanceTo(Vec3* other) { double dx = other->m_x - m_x; double dy = other->m_y - m_y; @@ -68,14 +77,17 @@ double Vec3::distanceTo(Vec3* other) { return sqrt(dx * dx + dy * dy + dz * dz); } +// name guessed Vec3* Vec3::scale(double multiplier) { return newTemp(m_x * multiplier, m_y * multiplier, m_z * multiplier); } +// name guessed double Vec3::lengthSqr() { return m_x * m_x + m_y * m_y + m_z * m_z; } +// name guessed Vec3* Vec3::getIntermediateWithXValue(Vec3* other, double x) { double dx = other->m_x - m_x; double dy = other->m_y - m_y; @@ -89,6 +101,7 @@ Vec3* Vec3::getIntermediateWithXValue(Vec3* other, double x) { return newTemp(m_x + dx * weight, m_y + weight * dy, m_z + weight * dz); } +// name guessed Vec3* Vec3::getIntermediateWithYValue(Vec3* other, double y) { double dx = other->m_x - m_x; double dy = other->m_y - m_y; @@ -101,6 +114,7 @@ Vec3* Vec3::getIntermediateWithYValue(Vec3* other, double y) { return newTemp(m_x + dx * weight, m_y + dy * weight, m_z + weight * dz); } +// name guessed Vec3* Vec3::getIntermediateWithZValue(Vec3* other, double z) { double dx = other->m_x - m_x; double dy = other->m_y - m_y; @@ -113,6 +127,7 @@ Vec3* Vec3::getIntermediateWithZValue(Vec3* other, double z) { return newTemp(m_x + dx * weight, m_y + dy * weight, m_z + dz * weight); } +// name guessed bool Vec3::equals(Vec3* other) { if (other->m_x != m_x) return false; @@ -133,6 +148,7 @@ Vec3* Vec3::yRot(float angle) { return newTemp(cosine * m_x + sine * m_z, m_y, cosine * m_z - m_x * sine); } +// name guessed Vec3* Vec3::zRot(float angle) { double cosine = cosf(angle); double sine = sinf(angle); diff --git a/src/Minecraft.World/net/minecraft/world/phys/Vec3.h b/src/Minecraft.World/net/minecraft/world/phys/Vec3.h index 6962bf60..4bba961c 100644 --- a/src/Minecraft.World/net/minecraft/world/phys/Vec3.h +++ b/src/Minecraft.World/net/minecraft/world/phys/Vec3.h @@ -9,6 +9,7 @@ class Vec3 { public: DECLARE_THREAD_STORAGE(Vec3) + // name guessed Vec3(double x, double y, double z) { if (x == -0.0) x = 0.0;