diff --git a/data/data_symbols.csv b/data/data_symbols.csv index 0fe1d7e5..83c555d5 100644 --- a/data/data_symbols.csv +++ b/data/data_symbols.csv @@ -1,3 +1,78 @@ +0x000000710000fe44,_ZN11BlockEntity6isTypeE11eINSTANCEOF +0x000000710003da94,_ZN14BigTreeFeatureC1Eb +0x000000710005cbe0,_ZN16BlockBlobFeatureC1EP5Blocki +0x000000710005cc2c,_ZN16BlockBlobFeatureD2Ev +0x000000710005cc54,_ZN16BlockBlobFeature5placeEP5LevelR6RandomRK8BlockPos +0x00000071000f7004,_ZN15DeadBushFeatureC1EP5Block +0x00000071001086f0,_ZN16DoublePlantBlock7placeAtEP5LevelRK8BlockPosPNS_7VariantEi +0x00000071001094ec,_ZN18DoublePlantFeature16setNextPlantTypeEPN16DoublePlantBlock7VariantE +0x000000710011b754,_ZN12EnderCrystal13setBeamTargetEP8BlockPos +0x000000710011cca8,_ZN12EnderCrystalC1EP5Level +0x00000071001286d0,_ZN16EndPodiumFeatureC1Eb +0x00000071001575c0,_ZN8EntityIO6getKeyE11eINSTANCEOF +0x000000710019c4a0,_ZN17GroundBushFeatureC1EPK10BlockStateS2_ +0x00000071001aa8c4,_ZNK10BlockState8setValueIPN17HugeMushroomBlock7VariantEEEPKS_P8PropertyT_ +0x00000071001aab58,_ZN17HugeMushroomBlock7Variant6byDataEi +0x00000071001ace94,_ZN15IcePatchFeatureC1Ei +0x00000071002345c4,_ZN21MegaJungleTreeFeatureC1EbiiPK10BlockStateS2_ +0x0000007100234ebc,_ZN19MegaPineTreeFeatureC1Ebb +0x0000007100236940,_ZN12MelonFeatureC1Ev +0x0000007100236974,_ZN12MelonFeatureD1Ev +0x000000710023699c,_ZN12MelonFeature5placeEP5LevelR6RandomRK8BlockPos +0x000000710024a6c8,_ZN21MobSpawnerBlockEntity10getSpawnerEv +0x00000071002fcb40,_ZN15RoofTreeFeatureC1Eb +0x00000071002ff73c,_ZN11SandFeatureC1EP5Blocki +0x000000710030155c,_ZN18SavannaTreeFeatureC1Eb +0x000000710035fe18,_ZN12SpikeFeatureC1Ev +0x000000710038086c,_ZN16SwampTreeFeatureC1Ev +0x0000007100385e24,_ZN16TallgrassFeatureC1EPN14TallGrassBlock7VariantE +0x00000071003ba62c,_ZN12VinesFeatureC1Ev +0x00000071003ba660,_ZN12VinesFeature5placeEP5LevelR6RandomRK8BlockPos +0x000000710101aac0,_ZTV19AbstractTreeFeature +0x0000007101024d98,_ZTV14BigTreeFeature +0x00000071010250c8,_ZTV12BirchFeature +0x00000071010267a8,_ZTV16BlockBlobFeature +0x0000007101029dd8,_ZTV11BushFeature +0x000000710102f770,_ZTI11BlockEntity +0x0000007101030dd8,_ZTV13CactusFeature +0x0000007101032528,_ZTV13CanyonFeature +0x00000071010332f0,_ZTI16ChestBlockEntity +0x000000710103e400,_ZTV15DeadBushFeature +0x000000710103e8b8,_ZTV17DesertWellFeature +0x00000071010425e0,_ZTV18DoublePlantFeature +0x0000007101049ed8,_ZTV17EndGatewayFeature +0x0000007101049f10,_ZTV16EndPodiumFeature +0x00000071010501f8,_ZTV16EndIslandFeature +0x0000007101050a30,_ZTIPN14TallGrassBlock7VariantE +0x0000007101051738,_ZTVN10PredicatesIPN9SandBlock7VariantEE21EqualToValuePredicateE +0x00000071010517c8,_ZTVN19BlockStatePredicate19PredicateConversionIPN9SandBlock7VariantEEE +0x0000007101051828,_ZTV9PredicateIP5BoxedE +0x0000007101051880,_ZTIPN14StoneSlabBlock7VariantE +0x00000071010518a0,_ZTV10TypedBoxedIPN14StoneSlabBlock7VariantEE +0x0000007101062cb8,_ZTV17GroundBushFeature +0x0000007101068d48,_ZTV19HugeMushroomFeature +0x000000710106a080,_ZTV15IcePatchFeature +0x000000710106fa38,_ZTV17HellPortalFeature +0x0000007101070958,_ZTV15IceSpikeFeature +0x0000007101072cd8,_ZTV10TypedBoxedIPN14TallGrassBlock7VariantEE +0x0000007101073190,_ZTIPN17HugeMushroomBlock7VariantE +0x00000071010731b0,_ZTV10TypedBoxedIPN17HugeMushroomBlock7VariantEE +0x000000710107a918,_ZTV21MegaJungleTreeFeature +0x000000710107a978,_ZTV19MegaPineTreeFeature +0x000000710107a9d8,_ZTV15MegaTreeFeature +0x000000710107aee8,_ZTV12MelonFeature +0x00000071010901a8,_ZTV20LargeHellCaveFeature +0x000000710109bdd0,_ZTV11PineFeature +0x00000071010a77c8,_ZTV15RoofTreeFeature +0x00000071010a8718,_ZTV11SandFeature +0x00000071010a9140,_ZTV18SavannaTreeFeature +0x00000071010b4708,_ZTV12ReedsFeature +0x00000071010bfd08,_ZTV12SpikeFeature +0x00000071010c01a8,_ZTV13SpruceFeature +0x00000071010c70c0,_ZTV16SwampTreeFeature +0x00000071010c7aa8,_ZTV16TallgrassFeature +0x00000071010cd698,_ZTV11TreeFeature +0x00000071010d34e0,_ZTV12VinesFeature 0x0000007101781BBC,AABB__sThreadStorageCount 0x0000007101781BC0,AABB__sDefaultThreadStorage 0x0000007101781BE0,_ZN6Blocks8RegistryE @@ -132,6 +207,8 @@ 0x0000007101783610,_ZN6Blocks8DEADBUSHE 0x0000007101783618,_ZN6Blocks13FLOWING_WATERE 0x0000007101783620,_ZN6Blocks12FLOWING_LAVAE +0x0000007101783628,_ZN12BirchFeature5TRUNKE +0x0000007101783630,_ZN12BirchFeature6LEAVESE 0x00000071017836B8,sBlockStateMapper 0x00000071017836F8,_ZN6Blocks8CAULDRONE 0x0000007101783700,_ZN6Blocks6PISTONE @@ -355,18 +432,21 @@ 0x0000007101786150,_ZN8DyeColor4CYANE 0x0000007101786158,_ZN8DyeColor6PURPLEE 0x0000007101786160,_ZN8DyeColor7MAGENTAE +0x00000071017861d0,_ZN10CocoaBlock3AGEE 0x0000007101786238,_ZN9Direction5NORTHE 0x0000007101786240,_ZN8DyeColor5BROWNE 0x0000007101786280,_ZN12DamageSource13BYPASS_ARMOURE 0x0000007101786298,FACING 0x00000071017863D0,_ZN9Direction4DOWNE 0x00000071017863D8,_ZN9Direction2UPE -0x0000007101786580,_ZN9Direction10DIRECTIONSE +0x0000007101786580,_ZN9Direction6VALUESE 0x0000007101788EE8,_ZN9Direction4WESTE 0x0000007101788F50,sWeaponCategory 0x0000007101788F90,_ZN12DamageSource5DROWNE 0x0000007101788FC8,_ZN12DamageSource6WITHERE 0x0000007101789028,_ZN9Direction4Axis1YE +0x0000007101789030,_ZN17DesertWellFeature14SAND_PREDICATEE +0x0000007101789038,_ZN9Direction5Plane10HORIZONTALE 0x0000007101789050,_ZN10Difficulty8PEACEFULE 0x0000007101789058,_ZN10Difficulty4EASYE 0x0000007101789060,_ZN10Difficulty6NORMALE @@ -413,6 +493,7 @@ 0x0000007101789B08,_ZN12Enchantments5FLAMEE 0x0000007101789B10,_ZN12Enchantments8INFINITYE 0x0000007101789B18,_ZN12Enchantments7MENDINGE +0x0000007101789c78,_ZN15EndGatewayBlock16FJ_PORTAL_NUMBERE 0x000000710178A320,_ZN21EntityDataSerializers25sINT_EntityDataSerializerE 0x000000710178A328,_ZN21EntityDataSerializers28sSTRING_EntityDataSerializerE 0x000000710178A330,_ZN21EntityDataSerializers29sBOOLEAN_EntityDataSerializerE @@ -434,6 +515,7 @@ 0x000000710178A618,_ZN13EquipmentSlot4HEADE 0x000000710178A660,_ZN5Items9ENDER_EYEE 0x000000710178A668,_ZN14ChunkGenerator17inPostProcessStepE +0x000000710178a798,_ZN26HorizontalDirectionalBlock6FACINGE 0x000000710178A7B8,fire_0 0x000000710178A7D0,fire_1 0x000000710178A7E8,_ZN9FireBlock3AGEE @@ -558,6 +640,14 @@ 0x000000710178B410,sColorTagName 0x000000710178B440,_ZN5Items19LEATHER_HORSE_ARMORE 0x000000710178B448,_ZN5Items19DIAMOND_HORSE_ARMORE +0x000000710178b4b0,_ZN17HugeMushroomBlock7VARIANTE +0x000000710178b530,_ZN17HugeMushroomBlock7Variant10SOUTH_EASTE +0x000000710178b540,_ZN17HugeMushroomBlock7Variant10SOUTH_WESTE +0x000000710178b558,_ZN17HugeMushroomBlock7Variant10NORTH_EASTE +0x000000710178b568,_ZN17HugeMushroomBlock7Variant10NORTH_WESTE +0x000000710178b570,_ZN17HugeMushroomBlock7Variant6CENTERE +0x000000710178b578,_ZN17HugeMushroomBlock7Variant4STEME +0x000000710178b580,_ZN17HugeMushroomBlock7Variant10ALL_INSIDEE 0x000000710178B590,_ZN11HumanoidArm4LEFTE 0x000000710178B598,_ZN11HumanoidArm5RIGHTE 0x000000710178B6B8,_ZN5Items7LEATHERE @@ -803,6 +893,11 @@ 0x000000710178CAE8,_ZN13MaterialColor16TERRACOTTA_GREENE 0x000000710178CAF0,_ZN13MaterialColor14TERRACOTTA_REDE 0x000000710178CAF8,_ZN13MaterialColor16TERRACOTTA_BLACKE +0x000000710178cb70,_ZN19MegaPineTreeFeature5TRUNKE +0x000000710178cb78,_ZN19MegaPineTreeFeature6LEAVESE +0x000000710178cb80,_ZN19MegaPineTreeFeature6PODZOLE +0x000000710178CB88,_ZN11OldLogBlock7VARIANTE +0x000000710178cb90,_ZN12OldLeafBlock7VARIANTE 0x000000710178CD28,_ZN13ParticleTypes5SMOKEE 0x000000710178CD68,_ZN11MobCategory7MONSTERE 0x000000710178CD70,_ZN11MobCategory8CREATUREE @@ -824,9 +919,12 @@ 0x000000710178CEC0,_ZN15MonsterEggBlock7Variant11MOSSY_BRICKE 0x000000710178CEC8,_ZN15MonsterEggBlock7Variant13CRACKED_BRICKE 0x000000710178CED0,_ZN15MonsterEggBlock7Variant14CHISELED_BRICKE +0x000000710178cfc0,_ZN12NewLeafBlock7VARIANTE 0x000000710178CFC8,_ZN11NewLogBlock7VARIANTE 0x00000071017A1140,_ZN6Packet11sPacketsMapE 0x00000071017A16D8,_ZN15RangedAttribute13ATTACK_DAMAGEE +0x00000071017a16e0,_ZN11PineFeature5TRUNKE +0x00000071017a16e8,_ZN11PineFeature6LEAVESE 0x00000071017A16F0,_ZN11PlanksBlock7Variant6SPRUCEE 0x00000071017A1898,_ZN11PlanksBlock19variantTextureNamesE 0x00000071017A1928,_ZN11PlanksBlock7VARIANTE @@ -838,6 +936,7 @@ 0x00000071017A1958,_ZN11PlanksBlock7Variant8VARIANTSE 0x00000071017A1988,_ZN11PlanksBlock9PREDICATEE 0x00000071017A1A30,_ZN15RangedAttribute12ATTACK_SPEEDE +0x00000071017a1a40,_ZN14DataFixerUpper16DATA_VERSION_KEYE 0x00000071017A1BB0,_ZN9Direction4Axis9PREDICATEE 0x00000071017A1E70,_ZN15PrismarineBlock7VARIANTE 0x00000071017A1E78,_ZN15PrismarineBlock7Variant8VARIANTSE @@ -870,6 +969,8 @@ 0x00000071017A2218,_ZN17RedSandStoneBlock7Variant8CHISELEDE 0x00000071017A2220,_ZN17RedSandStoneBlock7Variant6SMOOTHE 0x00000071017A2390,_ZN10ReedsBlock12sAgePropertyE +0x00000071017a2438,_ZN15RoofTreeFeature5TRUNKE +0x00000071017a2440,_ZN15RoofTreeFeature6LEAVESE 0x00000071017A2448,_ZN18RotatedPillarBlock4AXISE 0x00000071017A2490,_ZN9SandBlock7VARIANTE 0x00000071017A2498,_ZN9SandBlock7Variant7DEFAULTE @@ -881,6 +982,8 @@ 0x00000071017A2558,_ZN14SandStoneBlock7Variant7DEFAULTE 0x00000071017A2560,_ZN14SandStoneBlock7Variant8CHISELEDE 0x00000071017A2568,_ZN14SandStoneBlock7Variant6SMOOTHE +0x00000071017a2618,_ZN18SavannaTreeFeature5TRUNKE +0x00000071017a2620,_ZN18SavannaTreeFeature6LEAVESE 0x00000071017A2750,_ZN15SharedConstants14sVersionStringE 0x00000071017A2768,_ZN15SharedConstants18sAcceptableLettersE 0x00000071017A2780,_ZN15SharedConstants15sIsHalloweenDayE @@ -901,6 +1004,9 @@ 0x00000071017A42E8,SoundType::GRASS 0x00000071017A42F0,SoundType::STONE 0x00000071017A4318,SoundType::SNOW +0x00000071017a4558,_ZN13SpruceFeature5TRUNKE +0x00000071017a4560,_ZN13SpruceFeature6LEAVESE +0x00000071017a4a78,_ZN10TorchBlock6FACINGE 0x00000071017A4AC0,_ZN10StoneBlock7VARIANTE 0x00000071017A4AC8,_ZN10StoneBlock7Variant5STONEE 0x00000071017A4AD0,_ZN10StoneBlock7Variant7GRANITEE @@ -919,7 +1025,19 @@ 0x00000071017A4BD8,_ZN15StoneBrickBlock7Variant5MOSSYE 0x00000071017A4BE0,_ZN15StoneBrickBlock7Variant7CRACKEDE 0x00000071017A4BE8,_ZN15StoneBrickBlock7Variant8CHISELEDE +0x00000071017a4bf8,_ZN14StoneSlabBlock7VARIANTE +0x00000071017a4c08,_ZN14StoneSlabBlock7Variant9SANDSTONEE +0x00000071017a53a0,_ZN16SwampTreeFeature5TRUNKE +0x00000071017a53a8,_ZN16SwampTreeFeature6LEAVESE +0x00000071017a53b0,_ZN9VineBlock4EASTE +0x00000071017a53b8,_ZN9VineBlock4WESTE +0x00000071017a53c0,_ZN9VineBlock5SOUTHE +0x00000071017a53c8,_ZN9VineBlock5NORTHE 0x00000071017A53F8,SynchedEntityData__sIdMap +0x00000071017a5458,_ZN14TallGrassBlock4TYPEE +0x00000071017a57e8,_ZN11TreeFeature5TRUNKE +0x00000071017a57f0,_ZN11TreeFeature6LEAVESE +0x00000071017A58E8,_ZN4Vec34ZEROE 0x00000071017A5ED8,_ZZN10StoneBlock26createBlockStateDefinitionEvE10properties 0x00000071017A8380,_ZN3fui9sInstanceE 0x00000071017AA788,CGameNetworkManager__sInstance diff --git a/data/mcswitch_functions.csv b/data/mcswitch_functions.csv index 186c2e38..b0594e02 100644 --- a/data/mcswitch_functions.csv +++ b/data/mcswitch_functions.csv @@ -665,16 +665,16 @@ Address,Quality,Size,Name 0x0000007100015734,U,000008, 0x000000710001573c,U,000032, 0x000000710001575c,U,000012, -0x0000007100015768,U,000096,_ZN19AbstractTreeFeatureC_gen -0x00000071000157c8,U,000036,_ZN19AbstractTreeFeatureD0Ev -0x00000071000157ec,U,000216, -0x00000071000158c4,U,000004, -0x00000071000158c8,U,000136, -0x0000007100015950,U,000116, +0x0000007100015768,O,000096,_ZN19AbstractTreeFeatureC2EbiPK10BlockStateS2_b +0x00000071000157c8,O,000036,_ZN19AbstractTreeFeatureD0Ev +0x00000071000157ec,O,000216,_ZN19AbstractTreeFeature6isFreeEP5Block +0x00000071000158c4,O,000004,_ZN19AbstractTreeFeature13postPlaceTreeEP5LevelR6RandomRK8BlockPos +0x00000071000158c8,O,000136,_ZN19AbstractTreeFeature9setDirtAtEP5LevelRK8BlockPos +0x0000007100015950,O,000116,_ZN19AbstractTreeFeature7addVineEP5LevelRK8BlockPosPK15BooleanProperty 0x00000071000159c4,O,000100,_ZNK10BlockState8setValueIbEEPKS_P8PropertyT_ -0x0000007100015a28,U,000984, +0x0000007100015a28,M,000984,_ZN19AbstractTreeFeature10placeTrunkEP5LevelRK8BlockPosR6Randomi 0x0000007100015e00,O,000040,_ZNK10BlockState8getValueIPN11PlanksBlock7VariantEEET_P8Property -0x0000007100015e28,U,000820, +0x0000007100015e28,M,000820,_ZN19AbstractTreeFeature16placeFallenTrunkEP5LevelRK8BlockPosR6Randomi 0x000000710001615c,O,000044,_ZNK8BlockPos5aboveEi 0x0000007100016188,O,000112,_ZNK8BlockPos6offsetEiii 0x00000071000161f8,U,000124, @@ -780,7 +780,7 @@ Address,Quality,Size,Name 0x000000710001c08c,U,000172,_ZN10AnvilBlockC_gen 0x000000710001c138,O,000008,_ZN5Block20registerDefaultStateEPK10BlockState 0x000000710001c140,U,000032,_ZN20BlockStateDefinition3anyEv -0x000000710001c160,U,000096, +0x000000710001c160,O,000096,_ZNK10BlockState8setValueIPK9DirectionEEPKS_P8PropertyT_ 0x000000710001c1c0,O,000096,_ZNK10BlockState8setValueIiEEPKS_P8PropertyT_ 0x000000710001c220,U,000008,_ZN10AnvilBlock12isCubeShapedEPK10BlockState 0x000000710001c228,U,000008,_ZN10AnvilBlock17getBlockFaceShapeEP11LevelSourcePK10BlockStateRK8BlockPosPK9Direction @@ -1378,7 +1378,7 @@ Address,Quality,Size,Name 0x0000007100034b64,U,000028, 0x0000007100034b80,U,000128, 0x0000007100034c00,U,000152, -0x0000007100034c98,U,000012, +0x0000007100034c98,O,000012,_ZN15arrayWithLengthIPK9DirectionEixEj 0x0000007100034ca4,U,000060, 0x0000007100034ce0,U,000764, 0x0000007100034fdc,U,000096, @@ -1658,31 +1658,31 @@ Address,Quality,Size,Name 0x000000710003d96c,U,000024, 0x000000710003d984,U,000092, 0x000000710003d9e0,U,000060, -0x000000710003da1c,U,000108, +0x000000710003da1c,O,000108,_ZN14BigTreeFeature13FoliageCoordsC1ERK8BlockPosi 0x000000710003da88,O,000004,_ZN8BlockPosC1Eiii -0x000000710003da8c,U,000008, -0x000000710003da94,U,000236,_ZN14BigTreeFeatureC_gen -0x000000710003db80,U,000052,_ZN14BigTreeFeatureD2Ev +0x000000710003da8c,O,000008,_ZN14BigTreeFeature13FoliageCoords13getBranchBaseEv +0x000000710003da94,M,000236,_ZN14BigTreeFeatureC1Eb +0x000000710003db80,O,000052,_ZN14BigTreeFeatureD2Ev 0x000000710003dbb4,U,000056, -0x000000710003dbec,U,000036,_ZN14BigTreeFeatureD0Ev -0x000000710003dc10,U,000876, -0x000000710003df7c,U,000180, +0x000000710003dbec,O,000036,_ZN14BigTreeFeatureD0Ev +0x000000710003dc10,M,000876,_ZN14BigTreeFeature7prepareEv +0x000000710003df7c,O,000180,_ZN14BigTreeFeature9treeShapeEi 0x000000710003e030,U,000132, -0x000000710003e0b4,U,000356, -0x000000710003e218,U,000360, -0x000000710003e380,U,000052, -0x000000710003e3b4,U,000188, -0x000000710003e470,U,000388, -0x000000710003e5f4,U,000100, -0x000000710003e658,U,000164, -0x000000710003e6fc,U,000064, -0x000000710003e73c,U,000040, -0x000000710003e764,U,000300, -0x000000710003e890,U,000204, +0x000000710003e0b4,O,000356,_ZN14BigTreeFeature9checkLineERK8BlockPosS2_ +0x000000710003e218,O,000360,_ZN14BigTreeFeature11crossectionERK8BlockPosfPK10BlockState +0x000000710003e380,M,000052,_ZN14BigTreeFeature12foliageShapeEi +0x000000710003e3b4,O,000188,_ZN14BigTreeFeature14foliageClusterERK8BlockPos +0x000000710003e470,O,000388,_ZN14BigTreeFeature4limbERK8BlockPosS2_P5Block +0x000000710003e5f4,O,000100,_ZN14BigTreeFeature8getStepsERK8BlockPos +0x000000710003e658,O,000164,_ZN14BigTreeFeature10getLogAxisERK8BlockPosS2_ +0x000000710003e6fc,O,000064,_ZN14BigTreeFeature11makeFoliageEv +0x000000710003e73c,O,000040,_ZN14BigTreeFeature12trimBranchesEi +0x000000710003e764,O,000300,_ZN14BigTreeFeature9makeTrunkEv +0x000000710003e890,O,000204,_ZN14BigTreeFeature12makeBranchesEv 0x000000710003e95c,U,000028, -0x000000710003e978,U,000012, -0x000000710003e984,U,000228, -0x000000710003ea68,U,000224, +0x000000710003e978,O,000012,_ZN14BigTreeFeature4initEv +0x000000710003e984,O,000228,_ZN14BigTreeFeature5placeEP5LevelR6RandomRK8BlockPos +0x000000710003ea68,O,000224,_ZN14BigTreeFeature13checkLocationEv 0x000000710003eb48,U,000072, 0x000000710003eb90,U,000068, 0x000000710003ebd4,U,000036, @@ -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, @@ -1904,10 +1904,10 @@ Address,Quality,Size,Name 0x000000710004a1ac,U,000604, 0x000000710004a408,O,000248,_ZN11BiomeSource12fjCouldSpawnEPK26FjFeatureBiomeRequirementsii 0x000000710004a500,U,000004, -0x000000710004a504,U,000148,_ZN12BirchFeature10staticCtorEv +0x000000710004a504,O,000148,_ZN12BirchFeature10staticCtorEv 0x000000710004a598,O,000096,_ZNK10BlockState8setValueIPN11PlanksBlock7VariantEEEPKS_P8PropertyT_ -0x000000710004a5f8,U,000092,_ZN12BirchFeatureC_gen -0x000000710004a654,U,001588, +0x000000710004a5f8,O,000092,_ZN12BirchFeatureC2Ebb +0x000000710004a654,O,001588,_ZN12BirchFeature5placeEP5LevelR6RandomRK8BlockPos 0x000000710004ac88,U,000056,_ZN5Blaze10staticCtorEv 0x000000710004acc0,U,000224,_ZN5BlazeC_gen 0x000000710004ada0,U,000012,_ZN5Blaze14addDataWalkersEP14DataFixerUpper @@ -2113,10 +2113,10 @@ Address,Quality,Size,Name 0x000000710005cb88,U,000008, 0x000000710005cb90,U,000064, 0x000000710005cbd0,U,000016, -0x000000710005cbe0,U,000076,_ZN16BlockBlobFeatureC_gen -0x000000710005cc2c,U,000004, -0x000000710005cc30,U,000036,_ZN16BlockBlobFeatureD0Ev -0x000000710005cc54,U,000744, +0x000000710005cbe0,O,000076,_ZN16BlockBlobFeatureC1EP5Blocki +0x000000710005cc2c,O,000004,_ZN16BlockBlobFeatureD2Ev +0x000000710005cc30,O,000036,_ZN16BlockBlobFeatureD0Ev +0x000000710005cc54,O,000744,_ZN16BlockBlobFeature5placeEP5LevelR6RandomRK8BlockPos 0x000000710005cf3c,U,000068,_ZN8BlockPos7betweenERKS_S1_ 0x000000710005cf80,U,000076, 0x000000710005cfcc,U,000016, @@ -2501,8 +2501,8 @@ Address,Quality,Size,Name 0x000000710006cf90,U,000008,_ZN9BoneBlock14getRenderShapeEPK10BlockState 0x000000710006cf98,U,000024, 0x000000710006cfb0,O,000040,_ZNK10BlockState8getValueIPN9Direction4AxisEEET_P8Property -0x000000710006cfd8,U,000008, -0x000000710006cfe0,U,001444,_ZN17BonusChestFeature5placeEP5LevelR6RandomRK8BlockPosb +0x000000710006cfd8,O,000008,_ZN17BonusChestFeature5placeEP5LevelR6RandomRK8BlockPos +0x000000710006cfe0,O,001444,_ZN17BonusChestFeature5placeEP5LevelR6RandomRK8BlockPosb 0x000000710006d584,U,000016, 0x000000710006d594,U,000048,_ZN17BookCloningRecipeC_gen 0x000000710006d5c4,U,000036,_ZN6RecipeC_gen @@ -2899,10 +2899,10 @@ Address,Quality,Size,Name 0x000000710009a40c,O,000008,_ZN4Bush14getRenderLayerEv 0x000000710009a414,O,000008,_ZN4Bush17getBlockFaceShapeEP11LevelSourcePK10BlockStateRK8BlockPosPK9Direction 0x000000710009a41c,O,000008,_ZN4Bush14getRenderShapeEPK10BlockState -0x000000710009a424,U,000060,_ZN11BushFeatureC1EP4Bush -0x000000710009a460,U,000004,_ZN11BushFeatureD2Ev -0x000000710009a464,U,000036,_ZN11BushFeatureD0Ev -0x000000710009a488,U,000344, +0x000000710009a424,O,000060,_ZN11BushFeatureC1EP4Bush +0x000000710009a460,O,000004,_ZN11BushFeatureD2Ev +0x000000710009a464,O,000036,_ZN11BushFeatureD0Ev +0x000000710009a488,O,000344,_ZN11BushFeature5placeEP5LevelR6RandomRK8BlockPos 0x000000710009a5e0,U,000096,_ZN15WoodButtonBlock11DerivedInitEv 0x000000710009a640,U,000080,_ZN11ButtonBlockC_gen 0x000000710009a690,U,000008,_ZN15WoodButtonBlock11getClipAABBEPK10BlockStateP11LevelSourceRK8BlockPos @@ -3016,7 +3016,7 @@ Address,Quality,Size,Name 0x000000710009c668,U,000076,_ZN11CactusBlock10getTextureEPK9DirectionPK10BlockState 0x000000710009c6b4,U,000264,_ZN11CactusBlock13registerIconsEP12IconRegister 0x000000710009c7bc,U,000008,_ZN11CactusBlock14getRenderShapeEPK10BlockState -0x000000710009c7c4,U,000376, +0x000000710009c7c4,O,000376,_ZN13CactusFeature5placeEP5LevelR6RandomRK8BlockPos 0x000000710009c93c,U,000124,_ZN9CakeBlockC_gen 0x000000710009c9b8,U,000052,_ZN9CakeBlock8getShapeEPK10BlockStateP11LevelSourceRK8BlockPos 0x000000710009c9ec,U,000008,_ZN9CakeBlock12isCubeShapedEPK10BlockState @@ -3043,9 +3043,9 @@ Address,Quality,Size,Name 0x000000710009d070,U,000176,_ZN8Calendar15GetCalenderTimeEv 0x000000710009d120,O,000024,_ZN8Calendar13GetDayOfMonthEv 0x000000710009d138,O,000024,_ZN8Calendar8GetMonthEv -0x000000710009d150,U,002676, +0x000000710009d150,M,002676,_ZN13CanyonFeature9addTunnelExiiP11ChunkPrimerdddfffiid 0x000000710009dbc4,O,000060,_ZN11ChunkPrimer8getStateEiii -0x000000710009dc00,U,000416, +0x000000710009dc00,O,000416,_ZN13CanyonFeature10addFeatureEP5LeveliiiiP11ChunkPrimer 0x000000710009dda0,U,000016, 0x000000710009ddb0,U,000016, 0x000000710009ddc0,U,000064,_ZN11CarrotBlock8getShapeEPK10BlockStateP11LevelSourceRK8BlockPos @@ -3914,9 +3914,9 @@ Address,Quality,Size,Name 0x00000071000b21b0,O,000036,_ZN23BindingCurseEnchantmentD0Ev 0x00000071000b21d4,O,000008,_ZN5Biome7isFoggyEv 0x00000071000b21dc,O,000008,_ZN5Biome9isNaturalEv -0x00000071000b21e4,U,000036,_ZN13CactusFeatureD0Ev +0x00000071000b21e4,O,000036,_ZN13CactusFeatureD0Ev 0x00000071000b2208,U,000004, -0x00000071000b220c,U,000036,_ZN12BirchFeatureD0Ev +0x00000071000b220c,O,000036,_ZN12BirchFeatureD0Ev 0x00000071000b2230,U,000036,_ZN5BlazeD0Ev 0x00000071000b2254,U,000012, 0x00000071000b2260,U,000036,_ZN5Blaze15BlazeAttackGoalD0Ev @@ -3943,7 +3943,7 @@ Address,Quality,Size,Name 0x00000071000b25bc,U,000012, 0x00000071000b25c8,U,000036,_ZN8BoatItemD0Ev 0x00000071000b25ec,U,000036,_ZN9BoneBlockD0Ev -0x00000071000b2610,U,000036,_ZN17BonusChestFeatureD0Ev +0x00000071000b2610,O,000036,_ZN17BonusChestFeatureD0Ev 0x00000071000b2634,U,000036,_ZN8BookItemD0Ev 0x00000071000b2658,U,000036,_ZN14BookshelfBlockD0Ev 0x00000071000b267c,U,000012, @@ -4201,7 +4201,7 @@ Address,Quality,Size,Name 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_ 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, @@ -6846,8 +6846,8 @@ Address,Quality,Size,Name 0x00000071000f6e7c,U,000008,_ZN13DeadBushBlock19mayReplaceWithPlaceEP11LevelSourceRK8BlockPos 0x00000071000f6e84,U,000016,_ZN13DeadBushBlock11getResourceEPK10BlockStateP6Randomi 0x00000071000f6e94,U,000368,_ZN13DeadBushBlock13playerDestroyEP5LevelSt10shared_ptrI6PlayerERK8BlockPosPK10BlockStateNSt3__110shared_ptrI11BlockEntityE12not_null_ptrI12ItemInstanceE -0x00000071000f7004,U,000052,__ct__15DeadBushFeatureFP5Block -0x00000071000f7038,U,000488, +0x00000071000f7004,O,000052,_ZN15DeadBushFeatureC1EP5Block +0x00000071000f7038,O,000488,_ZN15DeadBushFeature5placeEP5LevelR6RandomRK8BlockPos 0x00000071000f7220,O,000200,_ZN14DebugFourjItem13interactEnemyE12not_null_ptrI12ItemInstanceENSt3__110shared_ptrI6PlayerEENS4_I12LivingEntityEEN15InteractionHand16EInteractionHandE 0x00000071000f72e8,O,000040,_ZN18DebugOptionsPacketD2Ev 0x00000071000f7310,O,000036,_ZN18DebugOptionsPacketD0Ev @@ -6930,13 +6930,13 @@ Address,Quality,Size,Name 0x00000071000f83ec,U,000016, 0x00000071000f83fc,U,000832,_ZN11DesertBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE 0x00000071000f873c,U,000252,vtbl_710103E7F0_func_11 -0x00000071000f8838,U,001908, +0x00000071000f8838,O,001908,_ZN17DesertWellFeature5placeEP5LevelR6RandomRK8BlockPos 0x00000071000f8fac,U,000052,_ZN13FossilFeatureC_gen -0x00000071000f8fe0,U,000100,_ZN17DesertWellFeature10staticCtorEv -0x00000071000f9044,U,000076, -0x00000071000f9090,U,000052, -0x00000071000f90c4,U,000168,_ZN17DesertWellFeatureC_gen -0x00000071000f916c,U,000096, +0x00000071000f8fe0,O,000100,_ZN17DesertWellFeature10staticCtorEv +0x00000071000f9044,O,000076,_ZN19BlockStatePredicate5whereIPN9SandBlock7VariantEEEPS_P8PropertyP9PredicateIT_E +0x00000071000f9090,O,000052,_ZN10PredicatesIPN9SandBlock7VariantEE7equalToES2_ +0x00000071000f90c4,O,000168,_ZN17DesertWellFeatureC1Ev +0x00000071000f916c,O,000096,_ZNK10BlockState8setValueIPN14StoneSlabBlock7VariantEEEPKS_P8PropertyT_ 0x00000071000f91cc,O,000096,_ZNK10BlockState8setValueIPN13HalfSlabBlock4HalfEEEPKS_P8PropertyT_ 0x00000071000f922c,U,000004,_ZN9Direction5Plane8iteratorEv 0x00000071000f9230,U,000128,_ZN17DetectorRailBlock15blockStaticCtorEv @@ -7448,11 +7448,11 @@ Address,Quality,Size,Name 0x0000007100109278,U,000056, 0x00000071001092b0,U,000072,_ZN16DoublePlantBlock10getTextureEPK9DirectionPK10BlockState 0x00000071001092f8,U,000408,_ZN16DoublePlantBlock13registerIconsEP12IconRegister -0x0000007100109490,U,000052,_ZN18DoublePlantFeatureC_gen -0x00000071001094c4,U,000004,_ZN18DoublePlantFeatureD2Ev -0x00000071001094c8,U,000036,_ZN18DoublePlantFeatureD0Ev -0x00000071001094ec,U,000008, -0x00000071001094f4,U,000336, +0x0000007100109490,O,000052,_ZN18DoublePlantFeatureC1Ev +0x00000071001094c4,O,000004,_ZN18DoublePlantFeatureD2Ev +0x00000071001094c8,O,000036,_ZN18DoublePlantFeatureD0Ev +0x00000071001094ec,O,000008,_ZN18DoublePlantFeature16setNextPlantTypeEPN16DoublePlantBlock7VariantE +0x00000071001094f4,O,000336,_ZN18DoublePlantFeature5placeEP5LevelR6RandomRK8BlockPos 0x0000007100109644,M,000048,_ZN9DoubleTagC2Ev 0x0000007100109674,O,000064,_ZN9DoubleTagC2Ed 0x00000071001096b4,O,000020,_ZN9DoubleTag5writeEP10DataOutput @@ -7879,8 +7879,8 @@ Address,Quality,Size,Name 0x000000710011a098,U,000328, 0x000000710011a1e0,U,000088, 0x000000710011a238,U,000116, -0x000000710011a2ac,U,000612, -0x000000710011a510,U,000968, +0x000000710011a2ac,M,000612,_ZN17EndGatewayFeature5placeEP5LevelR6RandomRK8BlockPos +0x000000710011a510,M,000968,_ZN16EndPodiumFeature5placeEP5LevelR6RandomRK8BlockPos 0x000000710011a8d8,U,000216,_ZNSt3__120__shared_ptr_pointerIP11EnderDragonNS_14default_deleteIS1_EENS_9allocatorIS1_EEEC_gen 0x000000710011a9b0,U,002780, 0x000000710011b48c,U,000324, @@ -8118,9 +8118,9 @@ Address,Quality,Size,Name 0x000000710012843c,U,000116,_ZN15EndGatewayBlock26createBlockStateDefinitionEv 0x00000071001284b0,U,000048,_ZN15EndGatewayBlock13getBlockStateEi 0x00000071001284e0,U,000024,_ZN15EndGatewayBlock29convertBlockStateToLegacyDataEPK10BlockState -0x00000071001284f8,U,000060,_ZN17EndGatewayFeatureC_gen -0x0000007100128534,U,000412, -0x00000071001286d0,U,000060,_ZN16EndPodiumFeatureC_gen +0x00000071001284f8,O,000060,_ZN17EndGatewayFeatureC1Ei +0x0000007100128534,O,000412,_ZN16EndIslandFeature5placeEP5LevelR6RandomRK8BlockPos +0x00000071001286d0,O,000060,_ZN16EndPodiumFeatureC1Eb 0x000000710012870c,U,000080,_ZN14EndPortalBlockC_gen 0x000000710012875c,U,000136, 0x00000071001287e4,U,000216,_ZNSt3__120__shared_ptr_pointerIP23TheEndPortalBlockEntityNS_14default_deleteIS1_EENS_9allocatorIS1_EEEC_gen @@ -8359,7 +8359,7 @@ Address,Quality,Size,Name 0x000000710012ad40,U,000012, 0x000000710012ad4c,U,000036,_ZN27DaylightDetectorBlockEntityD0Ev 0x000000710012ad70,U,000036,_ZN13DeadBushBlockD0Ev -0x000000710012ad94,U,000036,_ZN15DeadBushFeatureD0Ev +0x000000710012ad94,O,000036,_ZN15DeadBushFeatureD0Ev 0x000000710012adb8,O,000036,_ZN14DebugFourjItemD0Ev 0x000000710012addc,O,000008,_ZN18DebugOptionsPacket11getPacketIdEv 0x000000710012ade4,O,000004,_ZN7CommandD1Ev @@ -8370,7 +8370,7 @@ Address,Quality,Size,Name 0x000000710012ae84,U,000036,_ZN16DerivedLevelDataD0Ev 0x000000710012aea8,U,000036,_ZN11DesertBiomeD0Ev 0x000000710012aecc,U,000008,vtbl_710103E7F0_func_18 -0x000000710012aed4,U,000036,_ZN17DesertWellFeatureD0Ev +0x000000710012aed4,O,000036,_ZN17DesertWellFeatureD0Ev 0x000000710012aef8,U,000036,_ZN17DetectorRailBlockD0Ev 0x000000710012af1c,O,000036,_ZN24DigDurabilityEnchantmentD0Ev 0x000000710012af40,O,000036,_ZN10DiggerItemD0Ev @@ -8453,8 +8453,8 @@ Address,Quality,Size,Name 0x000000710012b730,U,000008, 0x000000710012b738,U,000036,_ZN13EndCityPieces12EndCityPieceD0Ev 0x000000710012b75c,U,000036,_ZN14EndCrystalItemD0Ev -0x000000710012b780,U,000036,_ZN17EndGatewayFeatureD0Ev -0x000000710012b7a4,U,000036,_ZN16EndPodiumFeatureD0Ev +0x000000710012b780,O,000036,_ZN17EndGatewayFeatureD0Ev +0x000000710012b7a4,O,000036,_ZN16EndPodiumFeatureD0Ev 0x000000710012b7c8,U,000036,_ZN15EnderChestBlockD0Ev 0x000000710012b7ec,U,000008, 0x000000710012b7f4,U,000008, @@ -8480,7 +8480,7 @@ Address,Quality,Size,Name 0x000000710012baa4,U,000036,_ZN15EndGatewayBlockD0Ev 0x000000710012bac8,U,000008, 0x000000710012bad0,U,000008, -0x000000710012bad8,U,000036,_ZN16EndIslandFeatureD0Ev +0x000000710012bad8,O,000036,_ZN16EndIslandFeatureD0Ev 0x000000710012bafc,U,000036,_ZN14EndPortalBlockD0Ev 0x000000710012bb20,U,000008, 0x000000710012bb28,U,000008, @@ -8993,24 +8993,24 @@ Address,Quality,Size,Name 0x00000071001381dc,U,000028,_ZNKSt3__120__shared_ptr_pointerIP16PlayerInfoPacketNS_14default_deleteIS1_EENS_9allocatorIS1_EEE13__get_deleterERKSt9type_info 0x00000071001381f8,U,000004,_ZNSt3__120__shared_ptr_pointerIP16PlayerInfoPacketNS_14default_deleteIS1_EENS_9allocatorIS1_EEE21__on_zero_shared_weakEv 0x00000071001381fc,U,000016,_ZNSt3__18weak_ptrI16PlayerInfoPacketED2Ev -0x000000710013820c,U,000052,_ZN10PredicatesIPN9SandBlock7VariantEE21EqualToValuePredicateC_gen +0x000000710013820c,O,000052,_ZN10PredicatesIPN9SandBlock7VariantEE21EqualToValuePredicateC2ES2_ 0x0000007100138240,O,000020,_ZN9PredicateIPN9SandBlock7VariantEEC2Ev -0x0000007100138254,U,000016, +0x0000007100138254,O,000016,_ZNK10PredicatesIPN9SandBlock7VariantEE21EqualToValuePredicate5applyES2_ 0x0000007100138264,O,000008,_ZNK9PredicateIPN9SandBlock7VariantEE4copyEv -0x000000710013826c,U,000036,_ZN10PredicatesIPN9SandBlock7VariantEE21EqualToValuePredicateD0Ev +0x000000710013826c,O,000036,_ZN10PredicatesIPN9SandBlock7VariantEE21EqualToValuePredicateD0Ev 0x0000007100138290,O,000004,_ZN9PredicateIPN9SandBlock7VariantEED2Ev 0x0000007100138294,O,000036,_ZN9PredicateIPN9SandBlock7VariantEED0Ev -0x00000071001382b8,U,000052,_ZN19BlockStatePredicate19PredicateConversionIPN9SandBlock7VariantEEC_gen -0x00000071001382ec,U,000020,_ZN9PredicateIP5BoxedEC2Ev -0x0000007100138300,U,000064, -0x0000007100138340,U,000008, -0x0000007100138348,U,000004, -0x000000710013834c,U,000036,_ZN19BlockStatePredicate19PredicateConversionIPN9SandBlock7VariantEED0Ev -0x0000007100138370,U,000036, +0x00000071001382b8,O,000052,_ZN19BlockStatePredicate19PredicateConversionIPN9SandBlock7VariantEEC2EPK9PredicateIS3_E +0x00000071001382ec,O,000020,_ZN9PredicateIP5BoxedEC2Ev +0x0000007100138300,O,000064,_ZNK19BlockStatePredicate19PredicateConversionIPN9SandBlock7VariantEE5applyEP5Boxed +0x0000007100138340,O,000008,_ZNK9PredicateIP5BoxedE4copyEv +0x0000007100138348,O,000004,_ZN9PredicateIP5BoxedED2Ev +0x000000710013834c,O,000036,_ZN19BlockStatePredicate19PredicateConversionIPN9SandBlock7VariantEED0Ev +0x0000007100138370,O,000036,_ZN9PredicateIP5BoxedED0Ev 0x0000007100138394,U,000056, 0x00000071001383cc,O,000008,_ZN10TypedBoxedIPN9SandBlock7VariantEE8getValueEv -0x00000071001383d4,U,000068,_ZN10TypedBoxedIPN14StoneSlabBlock7VariantEEC_gen -0x0000007100138418,U,000036,_ZN10TypedBoxedIPN14StoneSlabBlock7VariantEED0Ev +0x00000071001383d4,O,000068,_ZN10TypedBoxedIPN14StoneSlabBlock7VariantEEC2EPS2_ +0x0000007100138418,O,000036,_ZN10TypedBoxedIPN14StoneSlabBlock7VariantEED0Ev 0x000000710013843c,U,000048, 0x000000710013846c,U,000088, 0x00000071001384c4,U,000048, @@ -11066,7 +11066,7 @@ Address,Quality,Size,Name 0x00000071001816a8,U,000008, 0x00000071001816b0,U,000520,_ZN15FlatLevelSource11createChunkEii 0x00000071001818b8,U,000968,_ZN15FlatLevelSource11postProcessEii -0x0000007100181c80,U,000052,_ZN18MonsterRoomFeatureC_gen +0x0000007100181c80,O,000052,_ZN18MonsterRoomFeatureC1Ev 0x0000007100181cb4,U,000008,_ZN15FlatLevelSource22postProcessLoadedChunkEP10LevelChunkii 0x0000007100181cbc,U,000140,_ZN15FlatLevelSource9getMobsAtEP11MobCategoryRK8BlockPos 0x0000007100181d48,U,001044,_ZN15FlatLevelSource21findNearestMapFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPosb @@ -11136,7 +11136,7 @@ Address,Quality,Size,Name 0x0000007100183608,U,000064, 0x0000007100183648,U,000008, 0x0000007100183650,U,000148,_ZN11FlowerBlock11DerivedInitEv -0x00000071001836e4,U,000096, +0x00000071001836e4,O,000096,_ZNK10BlockState8setValueIPN11FlowerBlock6FlowerEEEPKS_P8PropertyT_ 0x0000007100183744,U,000064,_ZN11FlowerBlockC_gen 0x0000007100183784,U,000084,_ZN11FlowerBlock8getShapeEPK10BlockStateP11LevelSourceRK8BlockPos 0x00000071001837d8,U,000052,_ZN11FlowerBlock25getSpawnResourcesAuxValueEPK10BlockState @@ -11171,9 +11171,9 @@ Address,Quality,Size,Name 0x00000071001841a0,U,000008, 0x00000071001841a8,U,000324, 0x00000071001842ec,U,000112,_ZN11FlowerBlock18GetInteractTooltipERK22BlockTooltipDataHolder -0x000000710018435c,U,000080,_ZN13FlowerFeatureC1EP11FlowerBlockPNS0_6FlowerE -0x00000071001843ac,U,000096, -0x000000710018440c,U,000452,_ZN13FlowerFeature5placeEP5LevelR6RandomRK8BlockPos +0x000000710018435c,O,000080,_ZN13FlowerFeatureC1EP11FlowerBlockPNS0_6FlowerE +0x00000071001843ac,O,000096,_ZN13FlowerFeature9setFlowerEP11FlowerBlockPNS0_6FlowerE +0x000000710018440c,O,000452,_ZN13FlowerFeature5placeEP5LevelR6RandomRK8BlockPos 0x00000071001845d0,U,000124,_ZN14FlowerPotBlock15blockStaticCtorEv 0x000000710018464c,U,000664, 0x00000071001848e4,U,000160,_ZN14FlowerPotBlockC_gen @@ -12062,7 +12062,7 @@ Address,Quality,Size,Name 0x000000710019b60c,U,000008, 0x000000710019b614,U,000008, 0x000000710019b61c,U,000664, -0x000000710019b8b4,U,000096, +0x000000710019b8b4,O,000096,_ZNK10BlockState8setValueIPN14TallGrassBlock7VariantEEEPKS_P8PropertyT_ 0x000000710019b914,U,000004, 0x000000710019b918,U,000008,_ZN10GrassBlock14getRenderLayerEv 0x000000710019b920,U,000008,_ZN10GrassBlock29convertBlockStateToLegacyDataEPK10BlockState @@ -12095,8 +12095,8 @@ Address,Quality,Size,Name 0x000000710019c40c,U,000120,_ZN11GravelBlock11getResourceEPK10BlockStateP6Randomi 0x000000710019c484,U,000016,_ZN11GravelBlock11getMapColorEPK10BlockStateP11LevelSourceRK8BlockPos 0x000000710019c494,U,000012, -0x000000710019c4a0,U,000072,_ZN17GroundBushFeatureC_gen -0x000000710019c4e8,U,000796, +0x000000710019c4a0,O,000072,_ZN17GroundBushFeatureC1EPK10BlockStateS2_ +0x000000710019c4e8,O,000796,_ZN17GroundBushFeature5placeEP5LevelR6RandomRK8BlockPos 0x000000710019c804,U,000088,_ZN20GroundPathNavigationC_gen 0x000000710019c85c,U,000064, 0x000000710019c89c,U,000124, @@ -12255,7 +12255,7 @@ Address,Quality,Size,Name 0x00000071001a2560,U,000008, 0x00000071001a2568,U,000004, 0x00000071001a256c,O,000352,_ZN15HellFireFeature5placeEP5LevelR6RandomRK8BlockPos -0x00000071001a26cc,U,000568, +0x00000071001a26cc,O,000568,_ZN17HellPortalFeature5placeEP5LevelR6RandomRK8BlockPos 0x00000071001a2904,O,000076,_ZN17HellSpringFeatureC1EP5Blockb 0x00000071001a2950,O,000916,_ZN17HellSpringFeature5placeEP5LevelR6RandomRK8BlockPos 0x00000071001a2ce4,U,000212,_ZN9HitResultC1EP4Vec3PK9DirectionRK8BlockPos @@ -12474,7 +12474,7 @@ Address,Quality,Size,Name 0x00000071001aa528,U,000124,_ZN17HugeMushroomBlock15blockStaticCtorEv 0x00000071001aa5a4,U,000664, 0x00000071001aa83c,U,000136,_ZN17HugeMushroomBlockC_gen -0x00000071001aa8c4,U,000096, +0x00000071001aa8c4,O,000096,_ZNK10BlockState8setValueIPN17HugeMushroomBlock7VariantEEEPKS_P8PropertyT_ 0x00000071001aa924,U,000040,_ZN17HugeMushroomBlock16getResourceCountEP6Random 0x00000071001aa94c,U,000148,_ZN17HugeMushroomBlock11getMapColorEPK10BlockStateP11LevelSourceRK8BlockPos 0x00000071001aa9e0,U,000040, @@ -12494,9 +12494,9 @@ Address,Quality,Size,Name 0x00000071001ab060,U,000012, 0x00000071001ab06c,U,000336,_ZN17HugeMushroomBlock10getTextureEPK9DirectionPK10BlockState 0x00000071001ab1bc,U,000804,_ZN17HugeMushroomBlock13registerIconsEP12IconRegister -0x00000071001ab4e0,U,000060,_ZN19HugeMushroomFeatureC_gen -0x00000071001ab51c,U,000056,_ZN19HugeMushroomFeatureC1Ev -0x00000071001ab554,U,002048, +0x00000071001ab4e0,O,000060,_ZN19HugeMushroomFeatureC1EP5Block +0x00000071001ab51c,O,000056,_ZN19HugeMushroomFeatureC1Ev +0x00000071001ab554,O,002048,_ZN19HugeMushroomFeature5placeEP5LevelR6RandomRK8BlockPos 0x00000071001abd54,O,000036,_ZNK11HumanoidArm11getOppositeEv 0x00000071001abd78,U,000116,_ZN16HurtByTargetGoalC_gen 0x00000071001abdec,U,000060,_ZN16HurtByTargetGoalC_gen2 @@ -12528,11 +12528,11 @@ Address,Quality,Size,Name 0x00000071001acdb4,U,000132, 0x00000071001ace38,U,000008,_ZN15FrostedIceBlock21getPistonPushReactionEPK10BlockState 0x00000071001ace40,U,000084, -0x00000071001ace94,U,000076,_ZN15IcePatchFeatureC_gen -0x00000071001acee0,U,000004,_ZN15IcePatchFeatureD2Ev -0x00000071001acee4,U,000036,_ZN15IcePatchFeatureD0Ev -0x00000071001acf08,U,000624, -0x00000071001ad178,U,001648, +0x00000071001ace94,O,000076,_ZN15IcePatchFeatureC1Ei +0x00000071001acee0,O,000004,_ZN15IcePatchFeatureD2Ev +0x00000071001acee4,O,000036,_ZN15IcePatchFeatureD0Ev +0x00000071001acf08,O,000624,_ZN15IcePatchFeature5placeEP5LevelR6RandomRK8BlockPos +0x00000071001ad178,O,001648,_ZN15IceSpikeFeature5placeEP5LevelR6RandomRK8BlockPos 0x00000071001ad7e8,U,000284,_ZN15IllusionIllagerC_gen 0x00000071001ad904,U,000692, 0x00000071001adbb8,U,000164, @@ -13185,7 +13185,7 @@ Address,Quality,Size,Name 0x00000071001d0694,U,000004, 0x00000071001d0698,U,000036,_ZN11FlowerBlock23FlowerCategoryPredicateD0Ev 0x00000071001d06bc,U,000036,_ZN11FlowerBlockD0Ev -0x00000071001d06e0,U,000036,_ZN13FlowerFeatureD0Ev +0x00000071001d06e0,O,000036,_ZN13FlowerFeatureD0Ev 0x00000071001d0704,U,000036,_ZN14FlowerPotBlockD0Ev 0x00000071001d0728,U,000008, 0x00000071001d0730,U,000008, @@ -13210,7 +13210,7 @@ Address,Quality,Size,Name 0x00000071001d09d4,U,000064, 0x00000071001d0a14,U,000036,_ZN11ForestBiomeD0Ev 0x00000071001d0a38,U,000008, -0x00000071001d0a40,U,000036,_ZN19HugeMushroomFeatureD0Ev +0x00000071001d0a40,O,000036,_ZN19HugeMushroomFeatureD0Ev 0x00000071001d0a64,U,000036,_ZN13FossilFeatureD0Ev 0x00000071001d0a88,O,000036,_ZN20HalfTransparentBlockD0Ev 0x00000071001d0aac,U,000036,_ZN8IceBlockD0Ev @@ -13280,7 +13280,7 @@ Address,Quality,Size,Name 0x00000071001d133c,U,000036,_ZN10GrassBlockD0Ev 0x00000071001d1360,U,000036,_ZN14GrassPathBlockD0Ev 0x00000071001d1384,U,000036,_ZN11GravelBlockD0Ev -0x00000071001d13a8,U,000036,_ZN17GroundBushFeatureD0Ev +0x00000071001d13a8,O,000036,_ZN17GroundBushFeatureD0Ev 0x00000071001d13cc,U,000052,_ZN20GroundPathNavigationC_gen2 0x00000071001d1400,U,000036,_ZN20GroundPathNavigationD0Ev 0x00000071001d1424,U,000008, @@ -13306,7 +13306,7 @@ Address,Quality,Size,Name 0x00000071001d16dc,U,000036,_ZN9HellBiomeD0Ev 0x00000071001d1700,U,000008, 0x00000071001d1708,O,000036,_ZN15HellFireFeatureD0Ev -0x00000071001d172c,U,000036,_ZN17HellPortalFeatureD0Ev +0x00000071001d172c,O,000036,_ZN17HellPortalFeatureD0Ev 0x00000071001d1750,O,000036,_ZN17HellSpringFeatureD0Ev 0x00000071001d1774,U,000036,_ZN7HoeItemD0Ev 0x00000071001d1798,U,000036,_ZN11HopperBlockD0Ev @@ -13328,7 +13328,7 @@ Address,Quality,Size,Name 0x00000071001d199c,U,000064, 0x00000071001d19dc,U,000036,_ZN4HuskD0Ev 0x00000071001d1a00,U,000012, -0x00000071001d1a0c,U,000036,_ZN15IceSpikeFeatureD0Ev +0x00000071001d1a0c,O,000036,_ZN15IceSpikeFeatureD0Ev 0x00000071001d1a30,U,000036,_ZN8IceBiomeD0Ev 0x00000071001d1a54,U,000008, 0x00000071001d1a5c,U,000040, @@ -13792,7 +13792,7 @@ Address,Quality,Size,Name 0x00000071001e13d4,U,000052, 0x00000071001e1408,U,000008, 0x00000071001e1410,U,000068,_ZN10TypedBoxedIPN11FlowerBlock6FlowerEEC_gen -0x00000071001e1454,U,000036,_ZN10TypedBoxedIPN11FlowerBlock6FlowerEED0Ev +0x00000071001e1454,O,000036,_ZN10TypedBoxedIPN11FlowerBlock6FlowerEED0Ev 0x00000071001e1478,U,000048, 0x00000071001e14a8,U,000088, 0x00000071001e1500,U,000048, @@ -13943,8 +13943,8 @@ Address,Quality,Size,Name 0x00000071001e63ac,U,000052, 0x00000071001e63e0,U,000008, 0x00000071001e63e8,U,000184, -0x00000071001e64a0,U,000068,_ZN10TypedBoxedIPN14TallGrassBlock7VariantEEC_gen -0x00000071001e64e4,U,000036,_ZN10TypedBoxedIPN14TallGrassBlock7VariantEED0Ev +0x00000071001e64a0,O,000068,_ZN10TypedBoxedIPN14TallGrassBlock7VariantEEC2EPS2_ +0x00000071001e64e4,O,000036,_ZN10TypedBoxedIPN14TallGrassBlock7VariantEED0Ev 0x00000071001e6508,U,000048, 0x00000071001e6538,U,000088, 0x00000071001e6590,U,000048, @@ -14022,7 +14022,7 @@ Address,Quality,Size,Name 0x00000071001e8a90,U,000268,_ZN12EnumPropertyIPN17HugeMushroomBlock7VariantEEC_gen 0x00000071001e8b9c,U,000076,_ZN16AbstractPropertyIPN17HugeMushroomBlock7VariantEEC_gen 0x00000071001e8be8,U,000752, -0x00000071001e8ed8,U,000068,_ZN10TypedBoxedIPN17HugeMushroomBlock7VariantEEC_gen +0x00000071001e8ed8,O,000068,_ZN10TypedBoxedIPN17HugeMushroomBlock7VariantEEC2EPS2_ 0x00000071001e8f1c,U,000012, 0x00000071001e8f28,U,000008, 0x00000071001e8f30,U,000008, @@ -14044,7 +14044,7 @@ Address,Quality,Size,Name 0x00000071001e9568,U,000108, 0x00000071001e95d4,U,001012, 0x00000071001e99c8,U,000004, -0x00000071001e99cc,U,000036,_ZN10TypedBoxedIPN17HugeMushroomBlock7VariantEED0Ev +0x00000071001e99cc,O,000036,_ZN10TypedBoxedIPN17HugeMushroomBlock7VariantEED0Ev 0x00000071001e99f0,U,000048, 0x00000071001e9a20,U,000088, 0x00000071001e9a78,U,000048, @@ -14307,7 +14307,7 @@ Address,Quality,Size,Name 0x00000071001f15d0,U,000008,_ZN11LadderBlock17getBlockFaceShapeEP11LevelSourcePK10BlockStateRK8BlockPosPK9Direction 0x00000071001f15d8,U,000008,_ZN11LadderBlock14getRenderShapeEPK10BlockState 0x00000071001f15e0,O,000060,_ZN11LakeFeatureC1EP5Block -0x00000071001f161c,U,003008,_ZN11LakeFeature5placeEP5LevelR6RandomRK8BlockPos +0x00000071001f161c,M,003008,_ZN11LakeFeature5placeEP5LevelR6RandomRK8BlockPos 0x00000071001f21dc,U,000008,shouldFreezeIgnoreNeighbors__5LevelFRC8BlockPos 0x00000071001f21e4,U,000060,_ZN24LandOnOwnersShoulderGoalC_gen 0x00000071001f2220,U,000332, @@ -14316,16 +14316,16 @@ Address,Quality,Size,Name 0x00000071001f2424,U,000212, 0x00000071001f24f8,U,000016,_ZN8Language11getInstanceEv 0x00000071001f2508,U,000100,_ZN8Language10getElementERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEEz -0x00000071001f256c,U,000164,_ZN16LargeCaveFeature7addRoomExiiP11ChunkPrimerddd -0x00000071001f2610,U,002584,_ZN16LargeCaveFeature9addTunnelExiiP11ChunkPrimerdddfffiid +0x00000071001f256c,O,000164,_ZN16LargeCaveFeature7addRoomExiiP11ChunkPrimerddd +0x00000071001f2610,M,002584,_ZN16LargeCaveFeature9addTunnelExiiP11ChunkPrimerdddfffiid 0x00000071001f3028,O,000084,_ZN3Mth3sinEf 0x00000071001f307c,O,000096,_ZN3Mth3cosEf 0x00000071001f30dc,O,000024,_ZN3Mth5floorEd -0x00000071001f30f4,U,000180, -0x00000071001f31a8,U,000656,_ZN16LargeCaveFeature10addFeatureEP5LeveliiiiP11ChunkPrimer -0x00000071001f3438,U,000100,_ZN12LargeFeatureC1Ev -0x00000071001f349c,U,000004,_ZN12LargeFeatureD0Ev -0x00000071001f34a0,U,000388,_ZN12LargeFeature5applyEP5LeveliiP11ChunkPrimer +0x00000071001f30f4,M,000180,_ZN16LargeCaveFeature15canReplaceBlockEii +0x00000071001f31a8,O,000656,_ZN16LargeCaveFeature10addFeatureEP5LeveliiiiP11ChunkPrimer +0x00000071001f3438,O,000100,_ZN12LargeFeatureC1Ev +0x00000071001f349c,O,000004,_ZN12LargeFeatureD0Ev +0x00000071001f34a0,O,000388,_ZN12LargeFeature5applyEP5LeveliiP11ChunkPrimer 0x00000071001f3624,O,000016,_ZN5Level7getSeedEv 0x00000071001f3634,U,000064,_ZN13LargeFireballC_gen 0x00000071001f3674,U,000064,_ZN13LargeFireballC_gen2 @@ -14336,9 +14336,9 @@ Address,Quality,Size,Name 0x00000071001f38c4,U,000008,_ZN13LargeFireball14addDataWalkersEP14DataFixerUpper 0x00000071001f38cc,U,000116, 0x00000071001f3940,U,000188, -0x00000071001f39fc,U,000164, -0x00000071001f3aa0,U,002420, -0x00000071001f4414,U,000548, +0x00000071001f39fc,O,000164,_ZN20LargeHellCaveFeature7addRoomExiiP11ChunkPrimerddd +0x00000071001f3aa0,M,002420,_ZN20LargeHellCaveFeature9addTunnelExiiP11ChunkPrimerdddfffiid +0x00000071001f4414,M,000548,_ZN20LargeHellCaveFeature10addFeatureEP5LeveliiiiP11ChunkPrimer 0x00000071001f4638,M,005332,_ZN5Layer16getDefaultLayersExP9LevelTypeP15SuperflatConfigP9LevelDataPN11BiomeSource21LayerOverrideSettingsE 0x00000071001f5b0c,O,000068,_ZNSt3__110shared_ptrI5LayerEC2I11IslandLayerEEPT_NS_9enable_ifIXsr14is_convertibleIS6_PS1_EE5valueENS2_5__natEE4typeE 0x00000071001f5b50,O,000068,_ZNSt3__110shared_ptrI5LayerEC2I14AddIslandLayerEEPT_NS_9enable_ifIXsr14is_convertibleIS6_PS1_EE5valueENS2_5__natEE4typeE @@ -14494,7 +14494,7 @@ Address,Quality,Size,Name 0x00000071001f9fac,O,000268,_ZN5Level23updateObservingBlocksAtERK8BlockPosP5Block 0x00000071001fa0b8,O,000144,_ZN5Level7setDataERK8BlockPosiib 0x00000071001fa148,U,000500,_ZN5Level7setDataEiiiiib -0x00000071001fa33c,U,000496,setBlockAndData__5LevelFiN51 +0x00000071001fa33c,U,000496,_ZN5Level15setBlockAndDataEiiiiii 0x00000071001fa52c,U,000080,_ZN10LevelChunk10getBlockIdEiii 0x00000071001fa57c,O,000092,_ZN5Level11removeBlockERK8BlockPos 0x00000071001fa5d8,U,000260,_ZN5Level12destroyBlockERK8BlockPosb @@ -15782,28 +15782,28 @@ Address,Quality,Size,Name 0x00000071002344fc,U,000096, 0x000000710023455c,U,000096, 0x00000071002345bc,U,000008, -0x00000071002345c4,U,000052,_ZN21MegaJungleTreeFeatureC_gen -0x00000071002345f8,U,000072,_ZN15MegaTreeFeatureC_gen -0x0000007100234640,U,000004,_ZN21MegaJungleTreeFeatureD2Ev -0x0000007100234644,U,000036,_ZN21MegaJungleTreeFeatureD0Ev -0x0000007100234668,U,001556, -0x0000007100234c7c,U,000212, -0x0000007100234d50,U,000180, -0x0000007100234e04,U,000184,_ZN19MegaPineTreeFeature10staticCtorEv -0x0000007100234ebc,U,000092,_ZN19MegaPineTreeFeatureC_gen -0x0000007100234f18,U,000004,_ZN19MegaPineTreeFeatureD2Ev -0x0000007100234f1c,U,000036,_ZN19MegaPineTreeFeatureD0Ev -0x0000007100234f40,U,000884, -0x00000071002352b4,U,000280, -0x00000071002353cc,U,000424, -0x0000007100235574,U,000460, -0x0000007100235740,U,000264, -0x0000007100235848,U,000088, -0x00000071002358a0,U,000348, -0x00000071002359fc,U,000292, -0x0000007100235b20,U,000092, -0x0000007100235b7c,U,000320, -0x0000007100235cbc,U,000272, +0x00000071002345c4,O,000052,_ZN21MegaJungleTreeFeatureC1EbiiPK10BlockStateS2_ +0x00000071002345f8,O,000072,_ZN15MegaTreeFeatureC2EbiiPK10BlockStateS2_ +0x0000007100234640,O,000004,_ZN21MegaJungleTreeFeatureD2Ev +0x0000007100234644,O,000036,_ZN21MegaJungleTreeFeatureD0Ev +0x0000007100234668,O,001556,_ZN21MegaJungleTreeFeature5placeEP5LevelR6RandomRK8BlockPos +0x0000007100234c7c,O,000212,_ZN21MegaJungleTreeFeature11createCrownEP5LevelRK8BlockPosi +0x0000007100234d50,O,000180,_ZN21MegaJungleTreeFeature9placeVineEP5LevelR6RandomRK8BlockPosPK15BooleanProperty +0x0000007100234e04,O,000184,_ZN19MegaPineTreeFeature10staticCtorEv +0x0000007100234ebc,O,000092,_ZN19MegaPineTreeFeatureC1Ebb +0x0000007100234f18,O,000004,_ZN19MegaPineTreeFeatureD2Ev +0x0000007100234f1c,O,000036,_ZN19MegaPineTreeFeatureD0Ev +0x0000007100234f40,O,000884,_ZN19MegaPineTreeFeature5placeEP5LevelR6RandomRK8BlockPos +0x00000071002352b4,O,000280,_ZN19MegaPineTreeFeature11createCrownEP5LeveliiiiR6Random +0x00000071002353cc,O,000424,_ZN19MegaPineTreeFeature13postPlaceTreeEP5LevelR6RandomRK8BlockPos +0x0000007100235574,O,000460,_ZN19MegaPineTreeFeature17placePodzolCircleEP5LevelRK8BlockPos +0x0000007100235740,O,000264,_ZN19MegaPineTreeFeature13placePodzolAtEP5LevelRK8BlockPos +0x0000007100235848,O,000088,_ZN15MegaTreeFeature14calcTreeHeigthER6Random +0x00000071002358a0,M,000348,_ZN15MegaTreeFeature11checkIsFreeEP5LevelRK8BlockPosi +0x00000071002359fc,O,000292,_ZN15MegaTreeFeature13makeDirtFloorERK8BlockPosP5Level +0x0000007100235b20,O,000092,_ZN15MegaTreeFeature11prepareTreeEP5LevelR6RandomRK8BlockPosi +0x0000007100235b7c,M,000320,_ZN15MegaTreeFeature22placeDoubleTrunkLeavesEP5LevelRK8BlockPosi +0x0000007100235cbc,O,000272,_ZN15MegaTreeFeature22placeSingleTrunkLeavesEP5LevelRK8BlockPosi 0x0000007100235dcc,U,000088, 0x0000007100235e24,U,000100,_ZN15MeleeAttackGoalC_gen 0x0000007100235e88,U,000072,_ZN15MeleeAttackGoalC_gen2 @@ -15821,10 +15821,10 @@ Address,Quality,Size,Name 0x00000071002367b0,U,000088,_ZN10MelonBlock28getResourceCountForLootBonusEiP6Random 0x0000007100236808,U,000052,_ZN10MelonBlock10getTextureEPK9DirectionPK10BlockState 0x000000710023683c,U,000260,_ZN10MelonBlock13registerIconsEP12IconRegister -0x0000007100236940,U,000052,_ZN12MelonFeatureC_gen -0x0000007100236974,U,000004, -0x0000007100236978,U,000036,_ZN12MelonFeatureD0Ev -0x000000710023699c,U,000356, +0x0000007100236940,O,000052,_ZN12MelonFeatureC1Ev +0x0000007100236974,O,000004,_ZN12MelonFeatureD2Ev +0x0000007100236978,O,000036,_ZN12MelonFeatureD0Ev +0x000000710023699c,O,000356,_ZN12MelonFeature5placeEP5LevelR6RandomRK8BlockPos 0x0000007100236b00,O,000088,_ZN18MendingEnchantmentC1EPK6Rarity15arrayWithLengthIPK13EquipmentSlotE 0x0000007100236b58,O,000012,_ZN18MendingEnchantment10getMinCostEi 0x0000007100236b64,O,000032,_ZN18MendingEnchantment10getMaxCostEi @@ -16581,8 +16581,8 @@ Address,Quality,Size,Name 0x0000007100257070,U,000008, 0x0000007100257078,U,000280, 0x0000007100257190,U,000184, -0x0000007100257248,U,002000,_ZN18MonsterRoomFeature5placeEP5LevelR6RandomRK8BlockPos -0x0000007100257a18,U,000284, +0x0000007100257248,M,002000,_ZN18MonsterRoomFeature5placeEP5LevelR6RandomRK8BlockPos +0x0000007100257a18,M,000284,_ZN18MonsterRoomFeature14randomEntityIdER6Random 0x0000007100257b34,O,000036,_ZN11MoveControlC1EP3Mob 0x0000007100257b58,U,000016, 0x0000007100257b68,U,000008, @@ -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 @@ -17342,11 +17342,11 @@ Address,Quality,Size,Name 0x0000007100285770,O,000312,_ZN8OreBlock14spawnResourcesEP5LevelRK8BlockPosPK10BlockStatefi 0x00000071002858a8,O,000068,_ZN8OreBlock20getCloneItemInstanceEP5LevelRK8BlockPosPK10BlockState 0x00000071002858ec,O,000044,_ZN8OreBlock25getSpawnResourcesAuxValueEPK10BlockState -0x0000007100285918,U,000144, -0x00000071002859a8,U,000176,_ZN10OreFeatureC1EPK10BlockStatei -0x0000007100285a58,U,000104,_ZN10OreFeatureC1EPK10BlockStateiPK9PredicateIRKN5Biome9BlockPairEE -0x0000007100285ac0,U,002012,_ZN10OreFeature5placeEP5LevelR6RandomRK8BlockPos -0x000000710028629c,U,000132, +0x0000007100285918,O,000144,_ZN10OreFeature4initEPK10BlockStateiPK9PredicateIRKN5Biome15LegacyBlockDataEE +0x00000071002859a8,M,000176,_ZN10OreFeatureC1EPK10BlockStatei +0x0000007100285a58,O,000104,_ZN10OreFeatureC1EPK10BlockStateiPK9PredicateIRKN5Biome15LegacyBlockDataEE +0x0000007100285ac0,M,002012,_ZN10OreFeature5placeEP5LevelR6RandomRK8BlockPos +0x000000710028629c,M,000132,_ZNK10OreFeature21NaturalStonePredicate5applyERKN5Biome15LegacyBlockDataE 0x0000007100286320,U,001728, 0x00000071002869e0,U,000020, 0x00000071002869f4,U,000020, @@ -17819,16 +17819,16 @@ Address,Quality,Size,Name 0x0000007100294a30,O,000004,_ZN8MaterialD2Ev 0x0000007100294a34,O,000036,_ZN8MaterialD0Ev 0x0000007100294a58,U,000036,_ZN11LadderBlockD0Ev -0x0000007100294a7c,U,000036,_ZN11LakeFeatureD0Ev +0x0000007100294a7c,O,000036,_ZN11LakeFeatureD0Ev 0x0000007100294aa0,U,000052,_ZN24LandOnOwnersShoulderGoalD2Ev 0x0000007100294ad4,U,000036,_ZN24LandOnOwnersShoulderGoalD0Ev 0x0000007100294af8,U,000064, -0x0000007100294b38,U,000004,_ZN12LargeFeatureD2Ev +0x0000007100294b38,O,000004,_ZN12LargeFeatureD2Ev 0x0000007100294b3c,M,000004,_ZN16LargeCaveFeatureD0Ev -0x0000007100294b40,U,000004,_ZN12LargeFeature10addFeatureEP5LeveliiiiP11ChunkPrimer +0x0000007100294b40,O,000004,_ZN12LargeFeature10addFeatureEP5LeveliiiiP11ChunkPrimer 0x0000007100294b44,U,000036,_ZN13LargeFireballD0Ev 0x0000007100294b68,U,000012, -0x0000007100294b74,U,000004,_ZN20LargeHellCaveFeatureD0Ev +0x0000007100294b74,M,000004,_ZN20LargeHellCaveFeatureD0Ev 0x0000007100294b78,O,000036,_ZN5LayerD0Ev 0x0000007100294b9c,U,000036,_ZN8LeadItemD0Ev 0x0000007100294bc0,U,000036,_ZN13LeafBlockItemD0Ev @@ -17895,7 +17895,7 @@ Address,Quality,Size,Name 0x0000007100295464,O,000036,_ZN7MapItemD0Ev 0x0000007100295488,U,000008,_ZN19MapSelectInfoPacket11getPacketIdEv 0x0000007100295490,U,000036,_ZN26McRegionLevelStorageSourceD0Ev -0x00000071002954b4,U,000036,_ZN15MegaTreeFeatureD0Ev +0x00000071002954b4,O,000036,_ZN15MegaTreeFeatureD0Ev 0x00000071002954d8,U,000036,_ZN10MelonBlockD0Ev 0x00000071002954fc,O,000036,_ZN18MendingEnchantmentD0Ev 0x0000007100295520,U,000068,_ZN12MerchantMenuD2Ev @@ -17968,7 +17968,7 @@ Address,Quality,Size,Name 0x0000007100295c68,O,000080,_ZN13PathfinderMobD2Ev 0x0000007100295cb8,U,000036,_ZN7MonsterD0Ev 0x0000007100295cdc,O,000036,_ZN15MonsterEggBlockD0Ev -0x0000007100295d00,U,000036,_ZN18MonsterRoomFeatureD0Ev +0x0000007100295d00,O,000036,_ZN18MonsterRoomFeatureD0Ev 0x0000007100295d24,U,000036,_ZN21MoveEntityPacketSmallD0Ev 0x0000007100295d48,U,000008,_ZN21MoveEntityPacketSmall11getPacketIdEv 0x0000007100295d50,U,000008, @@ -18114,8 +18114,8 @@ Address,Quality,Size,Name 0x0000007100296df0,U,000036,_ZN27OptionsLowerCaseLanguageFixD0Ev 0x0000007100296e14,O,000036,_ZN8OreBlockD0Ev 0x0000007100296e38,U,000008, -0x0000007100296e40,U,000036,_ZN10OreFeature21NaturalStonePredicateD0Ev -0x0000007100296e64,U,000036,_ZN10OreFeatureD0Ev +0x0000007100296e40,M,000036,_ZN10OreFeature21NaturalStonePredicateD0Ev +0x0000007100296e64,O,000036,_ZN10OreFeatureD0Ev 0x0000007100296e88,U,000052,_ZN21OwnerHurtByTargetGoalD2Ev 0x0000007100296ebc,U,000036,_ZN21OwnerHurtByTargetGoalD0Ev 0x0000007100296ee0,U,000064, @@ -19878,9 +19878,9 @@ Address,Quality,Size,Name 0x00000071002c0088,U,000084,_ZN9PigZombie24PigZombieHurtByOtherGoalC_gen 0x00000071002c00dc,U,000280, 0x00000071002c01f4,U,000004, -0x00000071002c01f8,U,000148,_ZN11PineFeature10staticCtorEv -0x00000071002c028c,U,000084,_ZN11PineFeatureC_gen -0x00000071002c02e0,U,001688, +0x00000071002c01f8,O,000148,_ZN11PineFeature10staticCtorEv +0x00000071002c028c,O,000084,_ZN11PineFeatureC2Ev +0x00000071002c02e0,O,001688,_ZN11PineFeature5placeEP5LevelR6RandomRK8BlockPos 0x00000071002c0978,U,000028,_ZN15PistonBaseBlock15blockStaticCtorEv 0x00000071002c0994,U,000188,_ZN15PistonBaseBlockC_gen 0x00000071002c0a50,U,000048,_ZN15PistonBaseBlock14isViewBlockingEPK10BlockState @@ -21052,7 +21052,7 @@ Address,Quality,Size,Name 0x00000071002f617c,U,000416, 0x00000071002f631c,U,000004, 0x00000071002f6320,U,000148,_ZN10ReedsBlock18GetInteractTooltipERK22BlockTooltipDataHolder -0x00000071002f63b4,U,000656, +0x00000071002f63b4,O,000656,_ZN12ReedsFeature5placeEP5LevelR6RandomRK8BlockPos 0x00000071002f6644,U,000156,_ZN6RegionD1Ev 0x00000071002f66e0,U,000012,_ZN17array2DWithLengthIP10LevelChunkE3getEi 0x00000071002f66ec,U,000036,_ZN6RegionD0Ev @@ -21211,14 +21211,14 @@ Address,Quality,Size,Name 0x00000071002fc764,O,000232,_ZN15RiverMixerLayerC1ExNSt3__110shared_ptrI5LayerEES3_ 0x00000071002fc84c,O,000076,_ZN15RiverMixerLayer4initEx 0x00000071002fc898,O,000532,_ZN15RiverMixerLayer7getAreaEiiii -0x00000071002fcaac,U,000148,_ZN15RoofTreeFeature10staticCtorEv -0x00000071002fcb40,U,000084,_ZN15RoofTreeFeatureC_gen -0x00000071002fcb94,U,000004,_ZN15RoofTreeFeatureD2Ev -0x00000071002fcb98,U,000036,_ZN15RoofTreeFeatureD0Ev -0x00000071002fcbbc,U,004384, -0x00000071002fdcdc,U,000356, -0x00000071002fde40,U,000132, -0x00000071002fdec4,U,000140, +0x00000071002fcaac,O,000148,_ZN15RoofTreeFeature10staticCtorEv +0x00000071002fcb40,O,000084,_ZN15RoofTreeFeatureC1Eb +0x00000071002fcb94,O,000004,_ZN15RoofTreeFeatureD2Ev +0x00000071002fcb98,O,000036,_ZN15RoofTreeFeatureD0Ev +0x00000071002fcbbc,M,004384,_ZN15RoofTreeFeature5placeEP5LevelR6RandomRK8BlockPos +0x00000071002fdcdc,O,000356,_ZN15RoofTreeFeature20canPlaceTreeOfHeightEP5LevelRK8BlockPosi +0x00000071002fde40,O,000132,_ZN15RoofTreeFeature10placeLogAtEP5LevelRK8BlockPos +0x00000071002fdec4,O,000140,_ZN15RoofTreeFeature11placeLeafAtEP5Leveliii 0x00000071002fdf50,O,000124,_ZN18RotatedPillarBlock15blockStaticCtorEv 0x00000071002fdfcc,O,000664,_ZN12EnumPropertyIPN9Direction4AxisEE6createILi3EEEPS3_RKNSt3__112basic_stringIwNS6_11char_traitsIwEENS6_9allocatorIwEEEERKSt9type_infoRAT__S2_P9PredicateIS2_E 0x00000071002fe264,O,000072,_ZN18RotatedPillarBlockC2EP8Material @@ -21276,8 +21276,8 @@ Address,Quality,Size,Name 0x00000071002ff668,U,000008, 0x00000071002ff670,O,000060,_ZN9SandBlock10getTextureEPK9DirectionPK10BlockState 0x00000071002ff6ac,O,000144,_ZN9SandBlock13registerIconsEP12IconRegister -0x00000071002ff73c,U,000076,__ct__11SandFeatureFP5Blocki -0x00000071002ff788,U,000692, +0x00000071002ff73c,O,000076,_ZN11SandFeatureC1EP5Blocki +0x00000071002ff788,O,000692,_ZN11SandFeature5placeEP5LevelR6RandomRK8BlockPos 0x00000071002ffa3c,O,000124,_ZN14SandStoneBlock15blockStaticCtorEv 0x00000071002ffab8,O,000664,_ZN12EnumPropertyIPN14SandStoneBlock7VariantEE6createILi3EEEPS3_RKNSt3__112basic_stringIwNS6_11char_traitsIwEENS6_9allocatorIwEEEERKSt9type_infoRAT__S2_P9PredicateIS2_E 0x00000071002ffd50,O,000128,_ZN14SandStoneBlockC1Ev @@ -21320,13 +21320,13 @@ Address,Quality,Size,Name 0x00000071003011c8,U,000380,_ZN12SavannaBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE 0x0000007100301344,U,000088, 0x000000710030139c,U,000300, -0x00000071003014c8,U,000148,_ZN18SavannaTreeFeature10staticCtorEv -0x000000710030155c,U,000084,_ZN18SavannaTreeFeatureC_gen -0x00000071003015b0,U,000004,_ZN18SavannaTreeFeatureD2Ev -0x00000071003015b4,U,000036,_ZN18SavannaTreeFeatureD0Ev -0x00000071003015d8,U,003408, -0x0000007100302328,U,000016, -0x0000007100302338,U,000152, +0x00000071003014c8,O,000148,_ZN18SavannaTreeFeature10staticCtorEv +0x000000710030155c,O,000084,_ZN18SavannaTreeFeatureC1Eb +0x00000071003015b0,O,000004,_ZN18SavannaTreeFeatureD2Ev +0x00000071003015b4,O,000036,_ZN18SavannaTreeFeatureD0Ev +0x00000071003015d8,O,003408,_ZN18SavannaTreeFeature5placeEP5LevelR6RandomRK8BlockPos +0x0000007100302328,O,000016,_ZN18SavannaTreeFeature10placeLogAtEP5LevelRK8BlockPos +0x0000007100302338,O,000152,_ZN18SavannaTreeFeature11placeLeafAtEP5LevelRK8BlockPos 0x00000071003023d0,O,000064,_ZN9SavedDataC2ERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEE 0x0000007100302410,O,000008,_ZN9SavedData8setDirtyEv 0x0000007100302418,O,000012,_ZN9SavedData8setDirtyEb @@ -22293,7 +22293,7 @@ Address,Quality,Size,Name 0x00000071003253e0,U,000036,_ZN9PigZombieD0Ev 0x0000007100325404,U,000012, 0x0000007100325410,U,000036,_ZN9PigZombie24PigZombieHurtByOtherGoalD0Ev -0x0000007100325434,U,000036,_ZN11PineFeatureD0Ev +0x0000007100325434,O,000036,_ZN11PineFeatureD0Ev 0x0000007100325458,U,000036,_ZN15PistonBaseBlockD0Ev 0x000000710032547c,U,000036,_ZN15PistonBlockItemD0Ev 0x00000071003254a0,U,000036,_ZN15PistonHeadBlockD0Ev @@ -22409,7 +22409,7 @@ Address,Quality,Size,Name 0x0000007100326144,U,000052,_ZN17RedStoneWireBlockD2Ev 0x0000007100326178,U,000036,_ZN17RedStoneWireBlockD0Ev 0x000000710032619c,U,000036,_ZN10ReedsBlockD0Ev -0x00000071003261c0,U,000036,_ZN12ReedsFeatureD0Ev +0x00000071003261c0,O,000036,_ZN12ReedsFeatureD0Ev 0x00000071003261e4,O,000052,_ZN16RegionHillsLayerD2Ev 0x0000007100326218,O,000036,_ZN16RegionHillsLayerD0Ev 0x000000710032623c,U,000052,_ZN15RepairContainerD2Ev @@ -22434,7 +22434,7 @@ Address,Quality,Size,Name 0x0000007100326530,U,000064, 0x0000007100326570,U,000036,_ZN10SaddleItemD0Ev 0x0000007100326594,O,000036,_ZN9SandBlockD0Ev -0x00000071003265b8,U,000036,_ZN11SandFeatureD0Ev +0x00000071003265b8,O,000036,_ZN11SandFeatureD0Ev 0x00000071003265dc,O,000036,_ZN14SandStoneBlockD0Ev 0x0000007100326600,U,000036,_ZN12SaplingBlockD0Ev 0x0000007100326624,U,000036,_ZN12SavannaBiomeD0Ev @@ -24116,22 +24116,22 @@ Address,Quality,Size,Name 0x000000710035fccc,U,000076, 0x000000710035fd18,U,000016, 0x000000710035fd28,U,000080, -0x000000710035fd78,U,000096, -0x000000710035fdd8,U,000016, -0x000000710035fde8,U,000008, -0x000000710035fdf0,U,000008, -0x000000710035fdf8,U,000008, -0x000000710035fe00,U,000008, -0x000000710035fe08,U,000008, -0x000000710035fe10,U,000008, -0x000000710035fe18,U,000060,_ZN12SpikeFeatureC_gen -0x000000710035fe54,U,000060,_ZN12SpikeFeatureC_gen2 -0x000000710035fe90,U,000036,_ZN12SpikeFeatureD0Ev -0x000000710035feb4,U,000008, -0x000000710035febc,U,000012, -0x000000710035fec8,U,001344, +0x000000710035fd78,O,000096,_ZN12SpikeFeature8EndSpikeC1Eiiiib +0x000000710035fdd8,O,000016,_ZN12SpikeFeature8EndSpikeD1Ev +0x000000710035fde8,O,000008,_ZN12SpikeFeature8EndSpike10getCenterXEv +0x000000710035fdf0,O,000008,_ZN12SpikeFeature8EndSpike10getCenterZEv +0x000000710035fdf8,O,000008,_ZN12SpikeFeature8EndSpike9getRadiusEv +0x000000710035fe00,O,000008,_ZN12SpikeFeature8EndSpike9getHeightEv +0x000000710035fe08,O,000008,_ZN12SpikeFeature8EndSpike9isGuardedEv +0x000000710035fe10,O,000008,_ZN12SpikeFeature8EndSpike17getTopBoundingBoxEv +0x000000710035fe18,O,000060,_ZN12SpikeFeatureC1Ev +0x000000710035fe54,O,000060,_ZN12SpikeFeatureD1Ev +0x000000710035fe90,O,000036,_ZN12SpikeFeatureD0Ev +0x000000710035feb4,O,000008,_ZN12SpikeFeature8setSpikeEPNS_8EndSpikeE +0x000000710035febc,O,000012,_ZN12SpikeFeature22setCrystalInvulnerableEb +0x000000710035fec8,O,001344,_ZN12SpikeFeature5placeEP5LevelR6RandomRK8BlockPos 0x0000007100360408,U,000120, -0x0000007100360480,U,000128, +0x0000007100360480,O,000128,_ZN12SpikeFeature20setCrystalBeamTargetERK8BlockPos 0x0000007100360500,U,000008, 0x0000007100360508,U,000072, 0x0000007100360550,U,000108, @@ -24155,11 +24155,11 @@ Address,Quality,Size,Name 0x0000007100360ef4,U,000512,_ZN11SpongeBlock11animateTickEPK10BlockStateP5LevelRK8BlockPosP6Random 0x00000071003610f4,U,000192,_ZN11SpongeBlock13registerIconsEP12IconRegister 0x00000071003611b4,U,000068,_ZN11SpongeBlock10getTextureEPK9DirectionPK10BlockState -0x00000071003611f8,U,000060,_ZN13SpringFeatureC1EP5Blockb -0x0000007100361234,U,000552,_ZN13SpringFeature5placeEP5LevelR6RandomRK8BlockPos -0x000000710036145c,U,000148,_ZN13SpruceFeature10staticCtorEv -0x00000071003614f0,U,000084,_ZN13SpruceFeatureC_gen -0x0000007100361544,U,001520, +0x00000071003611f8,O,000060,_ZN13SpringFeatureC1EP5Block +0x0000007100361234,O,000552,_ZN13SpringFeature5placeEP5LevelR6RandomRK8BlockPos +0x000000710036145c,O,000148,_ZN13SpruceFeature10staticCtorEv +0x00000071003614f0,O,000084,_ZN13SpruceFeatureC2Eb +0x0000007100361544,O,001520,_ZN13SpruceFeature5placeEP5LevelR6RandomRK8BlockPos 0x0000007100361b34,U,000032, 0x0000007100361b54,U,000156,_ZN5SquidC_gen 0x0000007100361bf0,U,000056,_ZN11WaterAnimalC_gen @@ -24823,10 +24823,10 @@ Address,Quality,Size,Name 0x00000071003805c8,U,000016, 0x00000071003805d8,U,000400, 0x0000007100380768,U,000112, -0x00000071003807d8,U,000148,_ZN16SwampTreeFeature10staticCtorEv -0x000000710038086c,U,000084,_ZN16SwampTreeFeatureC_gen -0x00000071003808c0,U,002660, -0x0000007100381324,U,000320, +0x00000071003807d8,O,000148,_ZN16SwampTreeFeature10staticCtorEv +0x000000710038086c,O,000084,_ZN16SwampTreeFeatureC1Ev +0x00000071003808c0,M,002660,_ZN16SwampTreeFeature5placeEP5LevelR6RandomRK8BlockPos +0x0000007100381324,O,000320,_ZN16SwampTreeFeature7addVineEP5LevelRK8BlockPosPK15BooleanProperty 0x0000007100381464,U,000120,_ZN9SwellGoalC_gen 0x00000071003814dc,U,000160, 0x000000710038157c,U,000148, @@ -24982,8 +24982,8 @@ Address,Quality,Size,Name 0x0000007100385d68,U,000008,_ZN14TallGrassBlock13getOffsetTypeEv 0x0000007100385d70,U,000060,_ZN14TallGrassBlock10getTextureEPK9DirectionPK10BlockState 0x0000007100385dac,U,000120,_ZN14TallGrassBlock13registerIconsEP12IconRegister -0x0000007100385e24,U,000096,_ZN16TallgrassFeatureC_gen -0x0000007100385e84,U,000472, +0x0000007100385e24,O,000096,_ZN16TallgrassFeatureC1EPN14TallGrassBlock7VariantE +0x0000007100385e84,O,000472,_ZN16TallgrassFeature5placeEP5LevelR6RandomRK8BlockPos 0x000000710038605c,U,000104,_ZN13TamableAnimal10staticCtorEv 0x00000071003860c4,U,000068,_ZN13TamableAnimalC_gen 0x0000007100386108,U,000008, @@ -25136,7 +25136,7 @@ Address,Quality,Size,Name 0x000000710038bc64,U,000836, 0x000000710038bfa8,U,000060, 0x000000710038bfe4,U,000540, -0x000000710038c200,U,000052,_ZN16EndIslandFeatureC_gen +0x000000710038c200,O,000052,_ZN16EndIslandFeatureC1Ev 0x000000710038c234,U,000308, 0x000000710038c368,U,000136, 0x000000710038c3f0,U,000136, @@ -25404,14 +25404,14 @@ Address,Quality,Size,Name 0x000000710039827c,U,000888,_ZN8TrapMenuC_gen 0x00000071003985f4,U,000096, 0x0000007100398654,U,000552, -0x000000710039887c,U,000148,_ZN11TreeFeature10staticCtorEv -0x0000007100398910,U,000084,_ZN11TreeFeatureC_gen -0x0000007100398964,U,000056,_ZN11TreeFeatureC_gen2 -0x000000710039899c,U,000876, -0x0000007100398d08,U,000168, -0x0000007100398db0,U,002012, -0x000000710039958c,U,000260, -0x0000007100399690,U,000148, +0x000000710039887c,O,000148,_ZN11TreeFeature10staticCtorEv +0x0000007100398910,O,000084,_ZN11TreeFeatureC2Eb +0x0000007100398964,O,000056,_ZN11TreeFeatureC2EbiPK10BlockStateS2_b +0x000000710039899c,O,000876,_ZN11TreeFeature12prepareSpawnEP5LevelRK8BlockPosi +0x0000007100398d08,O,000168,_ZN11TreeFeature9placeLeafEP5LevelRK15MutableBlockPos +0x0000007100398db0,O,002012,_ZN11TreeFeature5placeEP5LevelR6RandomRK8BlockPos +0x000000710039958c,O,000260,_ZN11TreeFeature14addHangingVineEP5LevelRK8BlockPosPK15BooleanProperty +0x0000007100399690,O,000148,_ZN11TreeFeature10placeCocoaEP5LeveliRK8BlockPosPK9Direction 0x0000007100399724,U,000244,_ZN13TripWireBlockC_gen 0x0000007100399818,U,000068,_ZN13TripWireBlock8getShapeEPK10BlockStateP11LevelSourceRK8BlockPos 0x000000710039985c,U,000260,_ZN13TripWireBlock31fillVirtualBlockStatePropertiesEPK10BlockStateP11LevelSourceRK8BlockPos @@ -25991,8 +25991,8 @@ Address,Quality,Size,Name 0x00000071003ba5f8,U,000008,_ZN9VineBlock17getBlockFaceShapeEP11LevelSourcePK10BlockStateRK8BlockPosPK9Direction 0x00000071003ba600,U,000008,_ZN9VineBlock14getRenderShapeEPK10BlockState 0x00000071003ba608,U,000036,_ZN9VineBlock15shouldBlockTickEP5LevelRK8BlockPosPK10BlockState -0x00000071003ba62c,U,000052,_ZN12VinesFeatureC_gen -0x00000071003ba660,U,000544, +0x00000071003ba62c,O,000052,_ZN12VinesFeatureC1Ev +0x00000071003ba660,O,000544,_ZN12VinesFeature5placeEP5LevelR6RandomRK8BlockPos 0x00000071003ba880,U,000320,_ZN9VoidBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE 0x00000071003ba9c0,U,000048,_ZN18VoidBiomeDecoratorC_gen 0x00000071003ba9f0,U,000008, @@ -26723,8 +26723,8 @@ Address,Quality,Size,Name 0x00000071003d870c,U,000036,_ZN6Spider16SpiderTargetGoalD0Ev 0x00000071003d8730,U,000036,_ZN16SplashPotionItemD0Ev 0x00000071003d8754,U,000036,_ZN11SpongeBlockD0Ev -0x00000071003d8778,U,000036,_ZN13SpringFeatureD0Ev -0x00000071003d879c,U,000036,_ZN13SpruceFeatureD0Ev +0x00000071003d8778,O,000036,_ZN13SpringFeatureD0Ev +0x00000071003d879c,O,000036,_ZN13SpruceFeatureD0Ev 0x00000071003d87c0,U,000036,_ZN11WaterAnimalD0Ev 0x00000071003d87e4,U,000036,_ZN5SquidD0Ev 0x00000071003d8808,U,000012, @@ -26791,7 +26791,7 @@ Address,Quality,Size,Name 0x00000071003d8e88,U,000036,_ZN18StructureVoidBlockD0Ev 0x00000071003d8eac,U,000036,_ZN10SwampBiomeD0Ev 0x00000071003d8ed0,U,000008, -0x00000071003d8ed8,U,000036,_ZN16SwampTreeFeatureD0Ev +0x00000071003d8ed8,O,000036,_ZN16SwampTreeFeatureD0Ev 0x00000071003d8efc,U,000052,_ZN9SwellGoalD2Ev 0x00000071003d8f30,U,000036,_ZN9SwellGoalD0Ev 0x00000071003d8f54,U,000064, @@ -26802,7 +26802,7 @@ Address,Quality,Size,Name 0x00000071003d9018,U,000036,_ZN14TakeFlowerGoalD0Ev 0x00000071003d903c,U,000064, 0x00000071003d907c,U,000036,_ZN14TallGrassBlockD0Ev -0x00000071003d90a0,U,000036,_ZN16TallgrassFeatureD0Ev +0x00000071003d90a0,O,000036,_ZN16TallgrassFeatureD0Ev 0x00000071003d90c4,U,000052,_ZN9TemptGoalD2Ev 0x00000071003d90f8,U,000036,_ZN9TemptGoalD0Ev 0x00000071003d911c,U,000064, @@ -26865,7 +26865,7 @@ Address,Quality,Size,Name 0x00000071003d9748,U,000036,_ZN13TrapDoorBlockD0Ev 0x00000071003d976c,U,000052,_ZN8TrapMenuD2Ev 0x00000071003d97a0,U,000036,_ZN8TrapMenuD0Ev -0x00000071003d97c4,U,000036,_ZN11TreeFeatureD0Ev +0x00000071003d97c4,O,000036,_ZN11TreeFeatureD0Ev 0x00000071003d97e8,U,000036,_ZN13TripWireBlockD0Ev 0x00000071003d980c,U,000036,_ZN17TripWireHookBlockD0Ev 0x00000071003d9830,O,000036,_ZN21UntouchingEnchantmentD0Ev @@ -26925,7 +26925,7 @@ Address,Quality,Size,Name 0x00000071003d9ea8,U,000036,_ZN18VindicationIllager22LIVING_ENTITY_SELECTORD0Ev 0x00000071003d9ecc,U,000036,_ZN18VindicationIllager26VindicatorJohnnyAttackGoalD0Ev 0x00000071003d9ef0,U,000036,_ZN9VineBlockD0Ev -0x00000071003d9f14,U,000036,_ZN12VinesFeatureD0Ev +0x00000071003d9f14,O,000036,_ZN12VinesFeatureD0Ev 0x00000071003d9f38,U,000036,_ZN18VoidBiomeDecoratorD0Ev 0x00000071003d9f5c,U,000036,_ZN9VoidBiomeD0Ev 0x00000071003d9f80,U,000008, @@ -34344,7 +34344,7 @@ Address,Quality,Size,Name 0x000000710050e620,U,000044, 0x000000710050e64c,U,000044, 0x000000710050e678,U,000044, -0x000000710050e6a4,U,000320, +0x000000710050e6a4,U,000320,_ZN22LevelGenerationOptions10intersectsERK8BlockPosS2_ 0x000000710050e7e4,U,000008, 0x000000710050e7ec,U,000016, 0x000000710050e7fc,U,000752, @@ -39372,7 +39372,7 @@ Address,Quality,Size,Name 0x0000007100603f30,U,000044, 0x0000007100603f5c,U,000020, 0x0000007100603f70,U,000004, -0x0000007100603f74,U,000240, +0x0000007100603f74,U,000240,_ZN13CMinecraftApp19addGeneratedFeatureEiii 0x0000007100604064,U,000144, 0x00000071006040f4,U,000228, 0x00000071006041d8,U,001224, @@ -44573,7 +44573,7 @@ Address,Quality,Size,Name 0x000000710072b304,U,000604,_ZN11ServerLevel15setInitialSpawnEP13LevelSettings 0x000000710072b560,U,000012, 0x000000710072b56c,U,000632, -0x000000710072b7e4,U,000052,_ZN17BonusChestFeatureC_gen +0x000000710072b7e4,O,000052,_ZN17BonusChestFeatureC1Ev 0x000000710072b818,U,000180, 0x000000710072b8cc,U,000084,_ZN21TexturePackRepository11getSelectedEv 0x000000710072b920,U,000172, diff --git a/src/4JLibraries_Source/NX/Render/C4JRender.h b/src/4JLibraries_Source/NX/Render/C4JRender.h index 46ba7dc4..f40622f1 100644 --- a/src/4JLibraries_Source/NX/Render/C4JRender.h +++ b/src/4JLibraries_Source/NX/Render/C4JRender.h @@ -1,6 +1,6 @@ #pragma once -#include "arm_neon.h" +#include class _XSOCIAL_PREVIEWIMAGE; class ImageFileBuffer; @@ -41,7 +41,7 @@ class C4JRender { virtual void MatrixPop() = 0; virtual void MatrixPush() = 0; virtual float32x4_t MatrixMult(float*) = 0; - virtual void MatrixGet(int) = 0; + virtual float* MatrixGet(int) = 0; virtual void Set_matrixDirty() = 0; virtual void Initialise() = 0; virtual void InitialiseContext() = 0; diff --git a/src/4JLibraries_Source/NX/Render/RendererCore.cpp b/src/4JLibraries_Source/NX/Render/RendererCore.cpp index 44bcdeea..29b8a290 100644 --- a/src/4JLibraries_Source/NX/Render/RendererCore.cpp +++ b/src/4JLibraries_Source/NX/Render/RendererCore.cpp @@ -15,12 +15,66 @@ #include __thread Renderer::Context* sContext; +static __thread MatrixStruct sMatrixResult; + +extern "C" Renderer::Context* Renderer__getContext() { + return sContext; +} + +static const MatrixStruct identityMatrix = { + {{1.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}}; unsigned int textureWidths[6] = {1920, 1280, 512, 256, 128, 64}; unsigned int textureHeights[6] = {1080, 720, 512, 256, 128, 64}; nn::os::MutexType someRendererMutex; -Renderer::Context::Context(Renderer*, bool a2) { - this->m_filler[0] = a2; +// NON_MATCHING | score: 5575 (lower is better) +Renderer::Context::Context(Renderer*, bool creationFlag) { + m_ptr1DE0 = nullptr; + m_ptr1DE8 = nullptr; + m_ptr1DF0 = nullptr; + m_creationFlag = creationFlag; + // Only the base entries are initialized; stack storage and matrix-dirty flags are preserved. + m_matrixDepth[0] = 0; + m_matrixStacks[0][0] = identityMatrix; + m_matrixDepth[1] = 0; + m_matrixDepth[2] = 0; + m_matrixDepth[3] = 0; + m_matrixMode = 0; + m_matrixStacks[1][0] = identityMatrix; + m_matrixStacks[2][0] = identityMatrix; + m_matrixStacks[3][0] = identityMatrix; + m_byte1040 = false; + m_float1044 = 1.0f; + m_lightingEnabled = false; + for (int i = 0; i < 4; i++) { + m_textureBindings[i] = 0; + m_textureBindingDirty[i] = false; + m_textureFlags[i] = false; + } + m_fogEnabled = false; + m_byte1DD8 = false; + m_commandBuffer = nullptr; + m_dword1CE0 = -1; + memset(m_data1CE8, 0, sizeof(m_data1CE8)); + m_byte1CDC = false; + m_byte1D38 = false; + m_fogDirty = false; + m_byte1CE4 = false; + m_textureScaleUI[0] = 1.0f; + m_textureScaleUI[1] = 1.0f; + m_textureScaleUI[2] = 0.0f; + m_textureScaleUI[3] = 0.0f; + nvnBlendStateSetDefaults(&m_blendState); + nvnDepthStencilStateSetDefaults(&m_depthStencilState); + nvnDepthStencilStateSetDepthTestEnable(&m_depthStencilState, true); + nvnDepthStencilStateSetDepthFunc(&m_depthStencilState, NVN_DEPTH_FUNC_LEQUAL); + nvnColorStateSetDefaults(&m_colorState); + nvnPolygonStateSetDefaults(&m_polygonState); + nvnChannelMaskStateSetDefaults(&m_channelMaskState); + m_depthFunc = NVN_DEPTH_FUNC_LEQUAL; + for (int i = 0; i < 6; i++) + m_stateDirty[i] = true; + m_dword1CC0 = 0; } Renderer::Renderer() : C4JRender() { @@ -31,7 +85,7 @@ Renderer::Renderer() : C4JRender() { Renderer::sInstance = this; } -// NON_MATCHING: inline the tls offset getter, could be some compiler flag +// NON_MATCHING | score: 800 (lower is better) void Renderer::InitialiseContext(bool idk) { sContext = new Renderer::Context(this, idk); } @@ -429,3 +483,115 @@ float32x4_t Renderer::MatrixMult(float* matrix) { void Renderer::UpdateGamma(unsigned short gamma) { this->m_gammaIntensity = gamma; } + +void Renderer::MatrixMode(int mode) { + Renderer__getContext()->m_matrixMode = mode; +} + +void Renderer::MatrixSetIdentity() { + Context* context = Renderer__getContext(); + int mode = context->m_matrixMode; + MatrixStruct& top = context->m_matrixStacks[mode][context->m_matrixDepth[mode]]; + top.m__[0] = identityMatrix.m__[0]; + top.m__[1] = identityMatrix.m__[1]; + top.m__[2] = identityMatrix.m__[2]; + top.m__[3] = identityMatrix.m__[3]; + context->m_matrixDirty[context->m_matrixMode] = true; +} + +float32x4_t Renderer::MultWithStack(MatrixStruct input) { + Context* context = Renderer__getContext(); + int mode = context->m_matrixMode; + MatrixStruct& top = context->m_matrixStacks[mode][context->m_matrixDepth[mode]]; + float32x4_t a = top.m__[0]; + float32x4_t b = top.m__[1]; + float32x4_t c = top.m__[2]; + float32x4_t d = top.m__[3]; + float32x4_t result; + for (int i = 0; i < 4; i++) { + float32x4_t column = vmulq_laneq_f32(a, input.m__[i], 0); + column = vfmaq_laneq_f32(column, b, input.m__[i], 1); + column = vfmaq_laneq_f32(column, c, input.m__[i], 2); + result = vfmaq_laneq_f32(column, d, input.m__[i], 3); + top.m__[i] = result; + } + context->m_matrixDirty[context->m_matrixMode] = true; + return result; +} + +void Renderer::MatrixTranslate(float x, float y, float z) { + MatrixStruct matrix = identityMatrix; + matrix.m__[3] = (float32x4_t){x, y, z, 1.0f}; + MultWithStack(matrix); +} + +void Renderer::MatrixScale(float x, float y, float z) { + MatrixStruct matrix + = {{{x, 0.0f, 0.0f, 0.0f}, {0.0f, y, 0.0f, 0.0f}, {0.0f, 0.0f, z, 0.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}}; + MultWithStack(matrix); +} + +void Renderer::MatrixOrthogonal(float left, float right, float bottom, float top, float near, float far) { + float x = 1.0f / (right - left); + float y = 1.0f / (top - bottom); + float z = -1.0f / (far - near); + MatrixStruct matrix = {{{x + x, 0.0f, 0.0f, 0.0f}, + {0.0f, y + y, 0.0f, 0.0f}, + {0.0f, 0.0f, z, 0.0f}, + {-(left + right) * x, -(bottom + top) * y, z * near, 1.0f}}}; + MultWithStack(matrix); +} + +void Renderer::MatrixPush() { + Context* context = Renderer__getContext(); + int mode = context->m_matrixMode; + MatrixStruct* top = &context->m_matrixStacks[mode][context->m_matrixDepth[mode]]; + memcpy(top + 1, top, sizeof(MatrixStruct)); + context->m_matrixDepth[context->m_matrixMode]++; +} + +void Renderer::MatrixPop() { + Context* context = Renderer__getContext(); + context->m_matrixDepth[context->m_matrixMode]--; + context->m_matrixDirty[context->m_matrixMode] = true; +} + +float* Renderer::MatrixGet(int mode) { + Context* context = Renderer__getContext(); + MatrixStruct& top = context->m_matrixStacks[mode][context->m_matrixDepth[mode]]; + float32x4_t a = top.m__[0]; + float32x4_t b = top.m__[1]; + float32x4_t c = top.m__[2]; + float32x4_t d = top.m__[3]; + sMatrixResult.m__[0] = a; + sMatrixResult.m__[1] = b; + sMatrixResult.m__[2] = c; + sMatrixResult.m__[3] = d; + return reinterpret_cast(&sMatrixResult); +} + +void Renderer::Set_matrixDirty() { + Context* context = Renderer__getContext(); + context->m_matrixStacks[0][0].m__[0] = identityMatrix.m__[0]; + context->m_matrixStacks[0][0].m__[1] = identityMatrix.m__[1]; + context->m_matrixStacks[0][0].m__[2] = identityMatrix.m__[2]; + context->m_matrixStacks[0][0].m__[3] = identityMatrix.m__[3]; + context->m_matrixStacks[1][0].m__[0] = identityMatrix.m__[0]; + context->m_matrixStacks[1][0].m__[1] = identityMatrix.m__[1]; + context->m_matrixStacks[1][0].m__[2] = identityMatrix.m__[2]; + context->m_matrixStacks[1][0].m__[3] = identityMatrix.m__[3]; + context->m_matrixStacks[3][0].m__[0] = identityMatrix.m__[0]; + context->m_matrixStacks[3][0].m__[1] = identityMatrix.m__[1]; + context->m_matrixStacks[3][0].m__[2] = identityMatrix.m__[2]; + context->m_matrixStacks[3][0].m__[3] = identityMatrix.m__[3]; + context->m_matrixStacks[2][0].m__[0] = identityMatrix.m__[0]; + context->m_matrixStacks[2][0].m__[1] = identityMatrix.m__[1]; + context->m_matrixStacks[2][0].m__[2] = identityMatrix.m__[2]; + context->m_matrixStacks[2][0].m__[3] = identityMatrix.m__[3]; + context->m_matrixDirty[0] = true; + context->m_matrixDirty[1] = true; + context->m_matrixDirty[3] = true; + context->m_matrixDirty[2] = true; + m_dword29C0 = -1; + m_dword29C4 = -1; +} diff --git a/src/4JLibraries_Source/NX/Render/RendererCore.h b/src/4JLibraries_Source/NX/Render/RendererCore.h index c69dea81..c90bbf18 100644 --- a/src/4JLibraries_Source/NX/Render/RendererCore.h +++ b/src/4JLibraries_Source/NX/Render/RendererCore.h @@ -34,7 +34,49 @@ class Renderer : public C4JRender { public: Context(Renderer*, bool); - char m_filler[0x1F30]; + char m_gap0[0x10]; + MatrixStruct m_matrixStacks[4][16]; + bool m_matrixDirty[4]; + int m_matrixDepth[4]; + int m_matrixMode; + int m_textureBindings[4]; + bool m_textureBindingDirty[4]; + bool m_textureFlags[4]; + bool m_byte1040; + float m_float1044; + NVNblendState m_blendState; + NVNdepthStencilState m_depthStencilState; + NVNcolorState m_colorState; + NVNpolygonState m_polygonState; + NVNchannelMaskState m_channelMaskState; + int m_depthFunc; + bool m_stateDirty[6]; + char m_gap106E[0xC52]; + int m_dword1CC0; + bool m_fogEnabled; + char m_gap1CC5[0x13]; + bool m_fogDirty; + bool m_lightingEnabled; + char m_gap1CDA[2]; + bool m_byte1CDC; + char m_gap1CDD[3]; + int m_dword1CE0; + bool m_byte1CE4; + bool m_creationFlag; + char m_gap1CE6[2]; + char m_data1CE8[0x50]; + bool m_byte1D38; + char m_gap1D39[0x87]; + void* m_commandBuffer; + char m_gap1DC8[0x10]; + bool m_byte1DD8; + char m_gap1DD9[7]; + void* m_ptr1DE0; + void* m_ptr1DE8; + void* m_ptr1DF0; + char m_gap1DF8[0x28]; + float m_textureScaleUI[4]; + char m_gap1E30[0x100]; }; Renderer(); @@ -58,8 +100,8 @@ class Renderer : public C4JRender { virtual void Tick(); virtual void UpdateGamma(unsigned short gamma); - // see OpenGL for more info (modes starts from 0 and ends in 2, they are in the same order as they are in - // OpenGL) + /** NX maintains four independently selected matrix stacks, each with sixteen entries. + */ virtual void MatrixMode(int); virtual void MatrixSetIdentity(); virtual void MatrixTranslate(float, float, float); @@ -70,7 +112,7 @@ class Renderer : public C4JRender { virtual void MatrixPop(); virtual void MatrixPush(); virtual float32x4_t MatrixMult(float* matrix); - virtual void MatrixGet(int); + virtual float* MatrixGet(int); virtual void Set_matrixDirty(); // unused params were probably used in Xbox One virtual void Initialise(); @@ -343,3 +385,13 @@ class Renderer : public C4JRender { int m_elo; int m_elo22; }; + +static_assert(sizeof(MatrixStruct) == 0x40, "Matrix size"); +static_assert(alignof(MatrixStruct) == 0x10, "Matrix alignment"); +static_assert(sizeof(Renderer::Context) == 0x1F30, "Renderer context size"); +static_assert(offsetof(Renderer::Context, m_matrixStacks) == 0x10, "Matrix stack offset"); +static_assert(offsetof(Renderer::Context, m_matrixDirty) == 0x1010, "Matrix dirty offset"); +static_assert(offsetof(Renderer::Context, m_matrixMode) == 0x1024, "Matrix mode offset"); +static_assert(offsetof(Renderer::Context, m_blendState) == 0x1048, "Blend state offset"); +static_assert(offsetof(Renderer::Context, m_creationFlag) == 0x1CE5, "Context flag offset"); +static_assert(offsetof(Renderer::Context, m_textureScaleUI) == 0x1E20, "UI texture scale offset"); diff --git a/src/4JLibraries_Source/fui/fui.cpp b/src/4JLibraries_Source/fui/fui.cpp index 703cd822..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,8 +96,9 @@ 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_data.m_fuiSymbol->m_stage; // ??? + FJ_FuiNode* node = file->m_renderNodeStage->m_fuiNodeStage; if (FJ_FuiNode* focus = static_cast(node)->getFocus()) node = focus; @@ -105,8 +107,9 @@ 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_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..cb8dbbcb 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 @@ -36,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); @@ -46,47 +48,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 +159,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 +184,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 +193,11 @@ 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 +221,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/Minecraft.Client/com/mojang/nbt/CompoundTag.h b/src/Minecraft.Client/com/mojang/nbt/CompoundTag.h index 096796a5..68dcebc8 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,10 @@ 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 +71,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 +103,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/Tag.h b/src/Minecraft.Client/com/mojang/nbt/Tag.h index 0abd8c0f..be5c7732 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,18 @@ 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..d9653c43 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); + // 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); 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.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/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.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..13bca0bd 100644 --- a/src/Minecraft.Client/net/minecraft/core/NonNullList.h +++ b/src/Minecraft.Client/net/minecraft/core/NonNullList.h @@ -5,7 +5,38 @@ 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/System.h b/src/Minecraft.Client/net/minecraft/core/System.h index fca8e4c7..295829af 100644 --- a/src/Minecraft.Client/net/minecraft/core/System.h +++ b/src/Minecraft.Client/net/minecraft/core/System.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + #include "net/minecraft/world/ArrayWithLength.h" #include "net/minecraft/world/level/biome/Biome.h" #include "nn/os/os_MutexTypes.h" @@ -12,7 +15,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; 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..b4f88f1a 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,19 @@ 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 { + // 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. + */ +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 8e44a8e8..4e81237e 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) { @@ -116,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) @@ -145,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)) { @@ -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/DataInput.h b/src/Minecraft.World/java/io/DataInput.h index eb87b6a9..0b50a95d 100644 --- a/src/Minecraft.World/java/io/DataInput.h +++ b/src/Minecraft.World/java/io/DataInput.h @@ -12,9 +12,9 @@ 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; diff --git a/src/Minecraft.World/java/io/DataInputStream.h b/src/Minecraft.World/java/io/DataInputStream.h index c4dcf4e5..e0eccab2 100644 --- a/src/Minecraft.World/java/io/DataInputStream.h +++ b/src/Minecraft.World/java/io/DataInputStream.h @@ -25,9 +25,9 @@ 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; @@ -44,6 +44,8 @@ class DataInputStream : public InputStream, public DataInput { BlockPos* readBlockPosPointer(); not_null_ptr readItem(); CompoundTag* readNbt(); + CompoundTag* readCompressedNbt(); + void deleteChildStream(); InputStream* m_inputStream; }; diff --git a/src/Minecraft.World/java/io/DataOutputStream.h b/src/Minecraft.World/java/io/DataOutputStream.h index 9ca985d5..859ad7b8 100644 --- a/src/Minecraft.World/java/io/DataOutputStream.h +++ b/src/Minecraft.World/java/io/DataOutputStream.h @@ -39,7 +39,7 @@ class DataOutputStream : public OutputStream, public DataOutput { void writeVarInt(int); void writeVarLong(long); - void writeBlockPos(const BlockPos&) const; + void writeBlockPos(const BlockPos&); void writeItem(not_null_ptr); void writeNbt(CompoundTag*); diff --git a/src/Minecraft.World/net/minecraft/util/Mth.h b/src/Minecraft.World/net/minecraft/util/Mth.h index 97227879..2d8c8959 100644 --- a/src/Minecraft.World/net/minecraft/util/Mth.h +++ b/src/Minecraft.World/net/minecraft/util/Mth.h @@ -1,5 +1,6 @@ #pragma once +#include #include class Random; @@ -10,11 +11,13 @@ class Mth { 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 +29,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 long 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/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/world/ArrayWithLength.h b/src/Minecraft.World/net/minecraft/world/ArrayWithLength.h index 7bb6b677..38c26cf4 100644 --- a/src/Minecraft.World/net/minecraft/world/ArrayWithLength.h +++ b/src/Minecraft.World/net/minecraft/world/ArrayWithLength.h @@ -18,6 +18,12 @@ class arrayWithLength { this->m_data = initialData; this->m_length = length; } + template + arrayWithLength(T (&initialData)[N]) { + 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) @@ -28,7 +34,9 @@ class arrayWithLength { this->m_length = size; } + // name guessed 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) { @@ -51,7 +59,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/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..171b92e2 100644 --- a/src/Minecraft.World/net/minecraft/world/PlayerUID.h +++ b/src/Minecraft.World/net/minecraft/world/PlayerUID.h @@ -2,6 +2,7 @@ #include "types.h" #include +#include class PlayerUID { public: @@ -17,7 +18,7 @@ class PlayerUID { 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; + 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/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/EntityIO.h b/src/Minecraft.World/net/minecraft/world/entity/EntityIO.h index c4be2406..100931e8 100644 --- a/src/Minecraft.World/net/minecraft/world/entity/EntityIO.h +++ b/src/Minecraft.World/net/minecraft/world/entity/EntityIO.h @@ -1,6 +1,48 @@ #pragma once +#include "net/minecraft/resources/ResourceLocation.h" +#include +#include +#include +#include + +class Entity; +class Level; + class EntityIO { public: + struct SpawnEggInfo { + SpawnEggInfo(std::uint32_t, const ResourceLocation&, int, int); + SpawnEggInfo(const SpawnEggInfo&); + ~SpawnEggInfo(); + + std::uint32_t hash; + ResourceLocation key; + union { + std::uint64_t colors; + struct { + int primaryColor; + int secondaryColor; + }; + }; + std::uint64_t unknown96; + std::uint64_t unknown104; + }; + static void bootStrap(); + static ResourceLocation getKey(eINSTANCEOF); + static void registerEntity(Entity* (*)(Level*), int, const std::wstring&, eINSTANCEOF, + const std::wstring&); + static SpawnEggInfo registerEgg(std::uint32_t, const std::wstring, int, int); + + static std::unordered_map SPAWN_EGGS; + static ResourceLocation DEFAULT_TYPE; + static std::unordered_set KNOWN_TYPES; }; + +#ifdef SAFETY_CHECKS +static_assert(sizeof(EntityIO::SpawnEggInfo) == 112, "Spawn egg metadata layout"); +static_assert(offsetof(EntityIO::SpawnEggInfo, key) == 8, "Spawn egg resource key"); +static_assert(offsetof(EntityIO::SpawnEggInfo, colors) == 88, "Spawn egg colors"); +static_assert(offsetof(EntityIO::SpawnEggInfo, unknown104) == 104, "Spawn egg tail"); +#endif diff --git a/src/Minecraft.World/net/minecraft/world/entity/LivingEntity.h b/src/Minecraft.World/net/minecraft/world/entity/LivingEntity.h index 8d0cc489..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); @@ -93,7 +94,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 +120,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/item/EnderCrystal.h b/src/Minecraft.World/net/minecraft/world/entity/item/EnderCrystal.h index d9a8da0f..800b4d88 100644 --- a/src/Minecraft.World/net/minecraft/world/entity/item/EnderCrystal.h +++ b/src/Minecraft.World/net/minecraft/world/entity/item/EnderCrystal.h @@ -4,9 +4,11 @@ class EnderCrystal : public Entity { public: + EnderCrystal(Level* level); EnderCrystal(Level* level, double x, double y, double z); void setShowBottom(bool show); + void setBeamTarget(BlockPos*); eINSTANCEOF GetType() override; void defineSynchedData() override; 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..de34e457 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(); + // name guessed: 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..4e7e075c 100644 --- a/src/Minecraft.World/net/minecraft/world/item/Item.cpp +++ b/src/Minecraft.World/net/minecraft/world/item/Item.cpp @@ -59,8 +59,10 @@ bool Item::canBeDepleted() { return this->m_maxDamage > 0 && (!this->m_stackedByData || this->m_maxStackSize == 1); } -void Item::setIconName(const std::wstring& iconName) { +// NON_MATCHING | score: 0 (lower is better) +Item* Item::setIconName(const std::wstring& iconName) { this->m_iconName = iconName; + return this; } not_null_ptr Item::getDefaultInstance() { @@ -102,6 +104,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/BaseMobSpawner.h b/src/Minecraft.World/net/minecraft/world/level/BaseMobSpawner.h new file mode 100644 index 00000000..fa925feb --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/BaseMobSpawner.h @@ -0,0 +1,10 @@ +#pragma once + +class ResourceLocation; + +class BaseMobSpawner { +public: + virtual ~BaseMobSpawner(); + virtual ResourceLocation getEntityId(); + virtual void setEntityId(const ResourceLocation&); +}; 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..fb9a3221 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) { @@ -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/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..684cc31a 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" @@ -16,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); @@ -113,7 +114,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 +199,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 +295,7 @@ bool BiomeSource::fjCouldSpawn(const FjFeatureBiomeRequirements* biomeRequiremen } BiomeSource::~BiomeSource() { - nn::os::FinalizeMutex(&m_mutexType); + DeleteCriticalSection(&m_mutexType); delete m_biomeCache; } @@ -322,7 +323,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 +363,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..c10bb55d 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" @@ -269,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; @@ -483,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); @@ -590,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); @@ -735,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; @@ -886,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())) @@ -944,7 +944,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 +979,8 @@ 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. +/** 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); @@ -1080,7 +1068,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 +1107,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 +1129,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 +1140,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 +1151,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 +1163,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 +1232,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 +1241,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 +1282,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 +1304,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 +1315,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 +1326,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 +1338,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 +1351,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 +1371,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 +1390,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 +1399,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 +1415,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 +1482,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 +1493,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 +1514,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 +1581,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 +1589,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 +1613,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 +1645,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 +1656,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 +1664,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 +1676,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 +1687,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 +1698,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 +1708,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 +1730,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 +1742,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 +1751,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 +1772,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 +1796,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 +1899,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 +1929,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 +1941,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 +1951,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 +2000,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 +2012,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 +2049,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 +2093,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 +2104,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 +2115,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 +2126,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 +2135,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 +2144,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 +2154,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 +2174,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 +2209,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 +2240,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 +2251,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 +2259,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 +2269,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 +2279,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 +2291,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 +2300,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 +2383,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 +2392,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 +2415,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 +2455,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 +2506,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 +2516,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 +2524,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 +2543,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 +2552,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 +2564,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 +2573,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 +2594,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 +2605,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 +2617,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 +2646,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 +2664,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 +2685,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 +2694,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 +2706,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 +2716,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 +2731,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 +2853,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 +2871,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 +2881,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 +2898,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 +2920,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 +2931,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 +2943,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 +2970,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 +2983,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 +2997,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 +3008,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 +3019,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 +3030,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 +3041,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 +3051,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 +3062,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 +3073,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 +3084,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 +3095,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 +3127,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 +3147,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 +3159,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 +3198,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 +3206,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 +3217,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 +3227,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 +3280,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 +3297,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 +3307,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 +3317,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 +3327,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 +3338,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 +3348,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 +3358,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 +3367,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 +3378,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 +3387,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 +3398,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 +3407,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 +3417,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 +3428,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 +3438,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 +3569,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 +3577,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 +3601,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..13fbd582 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/block/BlockBootstrapAllocation.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include + +/** Custom allocation tag for partial block layouts; preserves allocation before argument evaluation. */ +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..f9950ed8 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,18 @@ #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/entity/BlockEntity.h b/src/Minecraft.World/net/minecraft/world/level/block/entity/BlockEntity.h index 83ceb7e6..1e8da66c 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/entity/BlockEntity.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/entity/BlockEntity.h @@ -57,6 +57,7 @@ class BlockEntity : public std::enable_shared_from_this { virtual void mirror(Mirror*); CompoundTag* saveMetadata(CompoundTag*); + bool isType(eINSTANCEOF); void setRenderRemoveStage(unsigned char); bool shouldRemoveForRender() const { return m_renderFlag == 2; } diff --git a/src/Minecraft.World/net/minecraft/world/level/block/entity/ChestBlockEntity.h b/src/Minecraft.World/net/minecraft/world/level/block/entity/ChestBlockEntity.h new file mode 100644 index 00000000..9e59420d --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/block/entity/ChestBlockEntity.h @@ -0,0 +1,11 @@ +#pragma once + +#include "net/minecraft/world/level/block/entity/RandomizableLockableContainerBlockEntity.h" + +class ChestBlockEntity : public RandomizableLockableContainerBlockEntity { +public: + char m_unknown68[0x30]; + bool m_isBonusChest; +}; + +ASSERT_SIZEOF(ChestBlockEntity, 0xA0) diff --git a/src/Minecraft.World/net/minecraft/world/level/block/entity/MobSpawnerBlockEntity.h b/src/Minecraft.World/net/minecraft/world/level/block/entity/MobSpawnerBlockEntity.h new file mode 100644 index 00000000..2819d0da --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/block/entity/MobSpawnerBlockEntity.h @@ -0,0 +1,13 @@ +#pragma once + +#include "net/minecraft/world/level/block/entity/BlockEntity.h" + +class BaseMobSpawner; + +class MobSpawnerBlockEntity : public BlockEntity { +public: + BaseMobSpawner* getSpawner(); + +private: + BaseMobSpawner* m_spawner; +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/block/entity/RandomizableLockableContainerBlockEntity.h b/src/Minecraft.World/net/minecraft/world/level/block/entity/RandomizableLockableContainerBlockEntity.h new file mode 100644 index 00000000..e279cd6f --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/block/entity/RandomizableLockableContainerBlockEntity.h @@ -0,0 +1,17 @@ +#pragma once + +#include "net/minecraft/world/level/block/entity/LockableContainerBlockEntity.h" + +class ResourceLocation; + +class RandomizableLockableContainerBlockEntity : public LockableContainerBlockEntity { +public: + void setLootTable(ResourceLocation*, long long seed); + +private: + char m_unknown50[8]; + ResourceLocation* m_lootTable; + long long m_lootTableSeed; +}; + +ASSERT_SIZEOF(RandomizableLockableContainerBlockEntity, 0x68) 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..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 @@ -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,20 @@ 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/BlockStatePredicate.h b/src/Minecraft.World/net/minecraft/world/level/block/state/BlockStatePredicate.h new file mode 100644 index 00000000..9d78b88b --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/block/state/BlockStatePredicate.h @@ -0,0 +1,49 @@ +#pragma once + +#include "net/minecraft/world/level/block/state/properties/AbstractProperty.h" +#include "types.h" +#include + +class Block; +class BlockState; +class BlockStateDefinition; + +/** Property predicates are borrowed; destroying this object releases only the map storage. + */ +class BlockStatePredicate : public Predicate { +public: + BlockStatePredicate(BlockStateDefinition*); + ~BlockStatePredicate() override; + + static BlockStatePredicate* forBlock(Block*); + bool apply(const BlockState*) const override; + BlockStatePredicate* where(Property*, const Predicate*); + + template + class PredicateConversion : public Predicate { + public: + // name guessed + PredicateConversion(const Predicate* predicate) : m_predicate(predicate) {} + + // name guessed + bool apply(Boxed* value) const override { + return m_predicate->apply(*const_cast*>(value->tryGetType())->getValue()); + } + + private: + const Predicate* m_predicate; + }; + + template + // name guessed + BlockStatePredicate* where(Property* property, Predicate* predicate) { + const Predicate* conversion = new PredicateConversion(predicate); + return where(property, conversion); + } + +private: + BlockStateDefinition* m_definition; + std::unordered_map*> m_predicates; +}; + +ASSERT_SIZEOF(BlockStatePredicate, 0x38); diff --git a/src/Minecraft.World/net/minecraft/world/level/block/state/BooleanProperty.h b/src/Minecraft.World/net/minecraft/world/level/block/state/BooleanProperty.h index cfbbc354..4ae8a105 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/state/BooleanProperty.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/state/BooleanProperty.h @@ -1,6 +1,7 @@ #pragma once #include "net/minecraft/world/level/block/state/properties/AbstractProperty.h" +#include class BooleanProperty : public AbstractProperty { public: @@ -15,4 +16,7 @@ class BooleanProperty : public AbstractProperty { bool getUnboxedValue(const std::wstring&) const override; std::wstring getName(const bool&) const override; ~BooleanProperty(); + + std::vector m_allowedValues; + std::unordered_map m_values; }; 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..0488f8d5 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 @@ -13,13 +13,17 @@ class Predicate { Predicate() {} virtual bool apply(T) const = 0; + // name guessed virtual Predicate* copy() const { return nullptr; } + // name guessed virtual ~Predicate() {} }; template class Predicates { public: + // name guessed + 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 +50,15 @@ 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: + // name guessed + EqualToValuePredicate(T value) : m_value(value) {} + + // name guessed + bool apply(T value) const override { return m_value == value; } + + private: + T m_value; }; }; @@ -110,7 +122,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..850011b3 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,16 @@ #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..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; @@ -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..fa86292c 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,7 @@ float OverworldLevelSource::getHeightFalloff(int chunkX, int chunkZ, int* distan return result; } -// NON_MATCHING | Score: 1630 (lower is better) +// NON_MATCHING | score: 0 (lower is better) int OverworldLevelSource::distanceToEdge(float a, int, int x, int z, int size) { int halfSize = size / 2; @@ -150,18 +152,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 +187,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 +325,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); @@ -540,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 @@ -563,19 +566,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 +600,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 +652,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 +697,30 @@ void OverworldLevelSource::recreateLogicStructuresForChunk(LevelChunk* chunk, in } } -// NON_MATCHING | Score: 860- (lower is better) +// NON_MATCHING | score: 0 (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/AbstractTreeFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.cpp new file mode 100644 index 00000000..18508abf --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.cpp @@ -0,0 +1,113 @@ +#include "net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h" + +#include "net/minecraft/core/Direction.h" +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/LogBlock.h" +#include "net/minecraft/world/level/block/OldLogBlock.h" +#include "net/minecraft/world/level/block/VineBlock.h" +#include "net/minecraft/world/level/block/state/BooleanProperty.h" +#include "net/minecraft/world/level/material/Material.h" + +// name guessed +AbstractTreeFeature::AbstractTreeFeature(bool update, int minHeight, const BlockState* trunk, + const BlockState* leaves, bool vines) + : Feature(update), m_minHeight(minHeight), m_vines(vines), m_trunk(trunk), m_leaves(leaves) {} + +// name guessed +void AbstractTreeFeature::postPlaceTree(Level*, Random&, const BlockPos&) {} + +// name guessed +bool AbstractTreeFeature::isFree(Block* block) { + Material* material = block->defaultBlockState()->getMaterial(); + return material == Material::AIR || material == Material::LEAVES || block == Blocks::GRASS + || block == Blocks::DIRT || block == Blocks::LOG || block == Blocks::LOG2 + || block == Blocks::SAPLING || block == Blocks::VINE; +} + +// name guessed +void AbstractTreeFeature::setDirtAt(Level* level, const BlockPos& pos) { + if (level->getBlockState(pos)->getBlock() != Blocks::DIRT) + Feature::setBlock(level, pos, Blocks::DIRT->defaultBlockState()); +} + +// name guessed +void AbstractTreeFeature::addVine(Level* level, const BlockPos& pos, const BooleanProperty* property) { + setBlock(level, pos, + Blocks::VINE->defaultBlockState()->setValue(const_cast(property), true)); +} + +/** A fallen-tree attempt still leaves the one-block stump when its horizontal trunk is rejected. + */ +// name guessed +// NON_MATCHING | score: 575 (lower is better) +bool AbstractTreeFeature::placeTrunk(Level* level, const BlockPos& pos, Random& random, int height) { + int fallen = random.nextInt(80); + auto variant = m_trunk->getValue(OldLogBlock::VARIANT); + float vineChance = variant == PlanksBlock::Variant::BIRCH ? 0.0f : 0.75f; + if (fallen != 0 && variant != PlanksBlock::Variant::BIRCH) { + if (!m_vines) + vineChance = random.nextInt(12) == 0 ? 1.0f : 0.0f; + else + vineChance = 1.0f / 3.0f; + } + if (fallen == 0) { + placeFallenTrunk(level, pos, random, height); + height = 1; + } + for (int y = 0; y < height; ++y) { + Material* material = level->getBlockState(pos.above(y))->getMaterial(); + if (material != Material::AIR && material != Material::LEAVES && material != Material::MOSS + && material != Material::DIRT && material != Material::GRASS) + continue; + setBlock(level, pos.above(y), m_trunk); + if (vineChance != 0.0f) { + if (random.nextFloat() < vineChance && level->isEmptyBlock(pos.offset(-1, y, 0))) + addVine(level, pos.offset(-1, y, 0), VineBlock::EAST); + if (random.nextFloat() < vineChance && level->isEmptyBlock(pos.offset(1, y, 0))) + addVine(level, pos.offset(1, y, 0), VineBlock::WEST); + if (random.nextFloat() < vineChance && level->isEmptyBlock(pos.offset(0, y, -1))) + addVine(level, pos.offset(0, y, -1), VineBlock::SOUTH); + if (random.nextFloat() < vineChance && level->isEmptyBlock(pos.offset(0, y, 1))) + addVine(level, pos.offset(0, y, 1), VineBlock::NORTH); + } + } + return fallen != 0; +} + +// name guessed +// NON_MATCHING | score: 300 (lower is better) +void AbstractTreeFeature::placeFallenTrunk(Level* level, const BlockPos& pos, Random& random, int height) { + MutableBlockPos start(pos.getX(), pos.getY(), pos.getZ()); + const Direction* direction = Direction::Plane::HORIZONTAL->getRandomDirection(random); + start.move(direction, random.nextInt(2) + 2); + MutableBlockPos base = start; + base.set(base.getX(), level->getHeightmap(base.getX(), base.getZ()), base.getZ()); + if (base.getY() > pos.getY() + 1) + return; + MutableBlockPos current = base; + int unsupported = 0; + for (int i = 0; i < height - 2; ++i) { + current.move(direction, 1); + if (level->getBlockState(current)->getMaterial() != Material::AIR) + return; + if (level->isSolidBlockingBlockInLoadedChunk(current.below(), false)) + unsupported = 0; + else if (++unsupported > 2) + return; + } + current = base; + for (int i = 0; i < height - 2; ++i) { + current.move(direction, 1); + auto axis = direction->getAxis()->getId() == 0 ? LogBlock::LogAxis::X : LogBlock::LogAxis::Z; + setBlock(level, current, m_trunk->setValue(LogBlock::LOG_AXIS, axis)); + if (random.nextInt(10) == 0 + && level->getBlockState(current.above())->getMaterial() == Material::AIR) { + setBlock(level, current.above(), + (random.nextFloat() < 0.5f ? Blocks::BROWN_MUSHROOM : Blocks::RED_MUSHROOM) + ->defaultBlockState()); + } + } +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h index bda6cd78..b888abbf 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h @@ -1,6 +1,28 @@ #pragma once #include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" -// STUB -class AbstractTreeFeature : public Feature {}; +class Block; +class BooleanProperty; + +class AbstractTreeFeature : public Feature { +public: + AbstractTreeFeature(bool update, int minHeight, const BlockState* trunk, const BlockState* leaves, + bool vines); + virtual void postPlaceTree(Level*, Random&, const BlockPos&); + + bool isFree(Block*); + void setDirtAt(Level*, const BlockPos&); + void addVine(Level*, const BlockPos&, const BooleanProperty*); + bool placeTrunk(Level*, const BlockPos&, Random&, int height); + void placeFallenTrunk(Level*, const BlockPos&, Random&, int height); + +protected: + int m_minHeight; + bool m_vines; + const BlockState* m_trunk; + const BlockState* m_leaves; +}; + +ASSERT_SIZEOF(AbstractTreeFeature, 0x28) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BigTreeFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BigTreeFeature.cpp new file mode 100644 index 00000000..0d826b26 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BigTreeFeature.cpp @@ -0,0 +1,270 @@ +#include "net/minecraft/world/level/levelgen/feature/BigTreeFeature.h" + +#include "NX/Platform.h" +#include "net/minecraft/util/Mth.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/LeafBlock.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/material/Material.h" +#include +#include + +// name guessed +BigTreeFeature::FoliageCoords::FoliageCoords(const BlockPos& pos, int branchBase) + : BlockPos(pos.getX(), pos.getY(), pos.getZ()), m_branchBase(branchBase) {} + +// name guessed +int BigTreeFeature::FoliageCoords::getBranchBase() { + return m_branchBase; +} + +// name guessed +// NON_MATCHING | score: 260 (lower is better) +BigTreeFeature::BigTreeFeature(bool update) + : AbstractTreeFeature(update, 5, Blocks::LOG->defaultBlockState(), Blocks::LEAVES->defaultBlockState(), + false), + m_height(0), m_trunkHeight(0) { + m_origin = BlockPos::zero; + m_heightAttenuation = 0.618; + m_branchSlope = 0.381; + m_scaleWidth = 1.0; + m_leafDensity = 1.0; + m_trunkWidth = 1; + m_heightLimit = 12; + m_foliageHeight = 4; +} + +BigTreeFeature::~BigTreeFeature() = default; + +// name guessed +void BigTreeFeature::init() { + m_foliageHeight = 5; +} + +// name guessed +// NON_MATCHING | score: 1120 (lower is better) +void BigTreeFeature::prepare() { + m_trunkHeight = static_cast(m_height * m_heightAttenuation); + if (m_trunkHeight >= m_height) + m_trunkHeight = m_height - 1; + int count = static_cast(1.382 + pow(m_leafDensity * m_height / 13.0, 2.0)); + if (count < 1) + count = 1; + int trunkTop = m_origin.getY() + m_trunkHeight; + int layer = m_height - m_foliageHeight; + m_foliage.clear(); + m_foliage.push_back(FoliageCoords(m_origin.above(layer), trunkTop)); + for (; layer >= 0; --layer) { + float shape = treeShape(layer); + if (shape < 0.0f) + continue; + for (int i = 0; i < count; ++i) { + double radius = m_scaleWidth * static_cast(shape) + * (static_cast(m_random.nextFloat()) + 0.328); + float angle = (m_random.nextFloat() * 2.0f) * Mth::PI; + BlockPos foliage + = m_origin.offset(radius * Mth::sin(angle) + 0.5, static_cast(layer) - 1.0, + radius * Mth::cos(angle) + 0.5); + BlockPos clearanceTop = foliage.above(m_foliageHeight); + if (checkLine(foliage, clearanceTop) != -1) + continue; + int dx = m_origin.getX() - foliage.getX(); + int dz = m_origin.getZ() - foliage.getZ(); + int foliageY = foliage.getY(); + float squared = static_cast(dx * dx + dz * dz); + float distance = sqrtf(squared); + double branchY = foliageY - static_cast(distance) * m_branchSlope; + int baseY = branchY > trunkTop ? trunkTop : static_cast(branchY); + BlockPos branch(m_origin.getX(), baseY, m_origin.getZ()); + if (checkLine(branch, foliage) == -1) + m_foliage.push_back(FoliageCoords(foliage, branch.getY())); + } + } +} + +// name guessed +float BigTreeFeature::treeShape(int height) { + if (height < m_height * 0.3f) + return -1.0f; + float half = m_height * 0.5f; + float relative = half - height; + float squared = half * half - relative * relative; + float radius = sqrtf(squared); + if (relative == 0.0f) + radius = half; + else if (fabsf(relative) >= half) + return 0.0f; + return radius * 0.5f; +} + +// name guessed +int BigTreeFeature::checkLine(const BlockPos& start, const BlockPos& end) { + BlockPos delta = end.offset(-start.getX(), -start.getY(), -start.getZ()); + int steps = getSteps(delta); + int dx = delta.getX(); + int dy = delta.getY(); + int dz = delta.getZ(); + if (steps > 0) { + float stepX = static_cast(dx) / steps; + float stepY = static_cast(dy) / steps; + float stepZ = static_cast(dz) / steps; + for (int i = 0; i <= steps; ++i) { + BlockPos pos = start.offset(stepX * i + 0.5f, stepY * i + 0.5f, stepZ * i + 0.5f); + Block* block = m_level->getBlockState(pos)->getBlock(); + if (!reinterpret_cast(block)->isFree(block)) + return i; + } + } + return -1; +} + +// name guessed +void BigTreeFeature::crossection(const BlockPos& center, float radius, const BlockState* state) { + int extent = static_cast(radius + 0.618); + for (int x = -extent; x <= extent; ++x) { + for (int z = -extent; z <= extent; ++z) { + if (pow(static_cast(std::abs(x)) + 0.5, 2.0) + + pow(static_cast(std::abs(z)) + 0.5, 2.0) + <= static_cast(radius * radius)) { + BlockPos pos = center.offset(x, 0, z); + Material* material = m_level->getBlockState(pos)->getMaterial(); + if (material == Material::AIR || material == Material::LEAVES) + setBlock(m_level, pos, state); + } + } + } +} + +// name guessed +// NON_MATCHING | score: 185 (lower is better) +float BigTreeFeature::foliageShape(int height) { + if (height >= 0 && height < m_foliageHeight) { + float radius = 2.0f; + if (height != m_foliageHeight - 1 && height != 0) + radius = 3.0f; + return radius; + } + return -1.0f; +} + +// name guessed +void BigTreeFeature::foliageCluster(const BlockPos& base) { + for (int y = 0; y < m_foliageHeight; ++y) { + BlockPos pos = base.above(y); + float radius = foliageShape(y); + const BlockState* state + = Blocks::LEAVES->defaultBlockState()->setValue(LeafBlock::CHECK_DECAY, false); + crossection(pos, radius, state); + } +} + +// name guessed +void BigTreeFeature::limb(const BlockPos& start, const BlockPos& end, Block* block) { + BlockPos delta = end.offset(-start.getX(), -start.getY(), -start.getZ()); + int steps = getSteps(delta); + int dx = delta.getX(); + int dy = delta.getY(); + int dz = delta.getZ(); + if (steps >= 0) { + float stepX = static_cast(dx) / steps; + float stepY = static_cast(dy) / steps; + float stepZ = static_cast(dz) / steps; + for (int i = 0; i <= steps; ++i) { + BlockPos pos = start.offset(stepX * i + 0.5f, stepY * i + 0.5f, stepZ * i + 0.5f); + LogBlock::LogAxis* axis = getLogAxis(start, pos); + setBlock(m_level, pos, block->defaultBlockState()->setValue(LogBlock::LOG_AXIS, axis)); + } + } +} + +// name guessed +int BigTreeFeature::getSteps(const BlockPos& delta) { + int x = std::abs(delta.getX()); + int y = std::abs(delta.getY()); + int z = std::abs(delta.getZ()); + int maximum = y > x ? y : x; + return z > x && z > y ? z : maximum; +} + +// name guessed +LogBlock::LogAxis* BigTreeFeature::getLogAxis(const BlockPos& start, const BlockPos& end) { + LogBlock::LogAxis* axis = LogBlock::LogAxis::Y; + int x = std::abs(end.getX() - start.getX()); + int z = std::abs(end.getZ() - start.getZ()); + if (std::max(x, z) > 0) { + if (x < z) + axis = LogBlock::LogAxis::Z; + else + axis = LogBlock::LogAxis::X; + } + return axis; +} + +// name guessed +void BigTreeFeature::makeFoliage() { + for (auto it = m_foliage.begin(); it != m_foliage.end(); ++it) + foliageCluster(*it); +} + +// name guessed +bool BigTreeFeature::trimBranches(int height) { + return height >= m_height * 0.2; +} + +// name guessed +void BigTreeFeature::makeTrunk() { + BlockPos top = m_origin.above(m_trunkHeight); + Block* log = Blocks::LOG; + limb(m_origin, top, log); + if (m_trunkWidth == 2) { + limb(m_origin.east(), top.east(), log); + limb(m_origin.east().south(), top.east().south(), log); + limb(m_origin.south(), top.south(), log); + } +} + +// name guessed +void BigTreeFeature::makeBranches() { + for (auto it = m_foliage.begin(); it != m_foliage.end(); ++it) { + FoliageCoords& foliage = *it; + int baseY = foliage.getBranchBase(); + BlockPos start(m_origin.getX(), baseY, m_origin.getZ()); + if (start != foliage && trimBranches(baseY - m_origin.getY())) + limb(start, foliage, Blocks::LOG); + } +} + +// name guessed +bool BigTreeFeature::checkLocation() { + Block* ground = m_level->getBlockState(m_origin.below())->getBlock(); + if (ground != Blocks::DIRT && ground != Blocks::GRASS && ground != Blocks::FARMLAND) + return false; + int obstruction = checkLine(m_origin, m_origin.above(m_height - 1)); + if (obstruction == -1) + return true; + if (obstruction < 6) + return false; + m_height = obstruction; + return true; +} + +// name guessed +bool BigTreeFeature::place(Level* level, Random& random, const BlockPos& pos) { + PIXBeginNamedEvent(0, "BigTreeFeature::place"); + m_level = level; + m_origin = pos; + m_random = Random(random.nextLong()); + if (m_height == 0) + m_height = 5 + random.nextInt(m_heightLimit); + if (!checkLocation()) { + PIXEndNamedEvent(); + return false; + } + prepare(); + makeFoliage(); + makeTrunk(); + makeBranches(); + PIXEndNamedEvent(); + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BigTreeFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BigTreeFeature.h new file mode 100644 index 00000000..4d86b51f --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BigTreeFeature.h @@ -0,0 +1,57 @@ +#pragma once + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/block/LogBlock.h" +#include "net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h" +#include + +class BigTreeFeature : public AbstractTreeFeature { +public: + class FoliageCoords : public BlockPos { + public: + FoliageCoords(const BlockPos&, int branchBase); + int getBranchBase(); + + private: + int m_branchBase; + }; + + BigTreeFeature(bool update); + ~BigTreeFeature() override; + bool place(Level*, Random&, const BlockPos&) override; + void init() override; + + void prepare(); + float treeShape(int height); + int checkLine(const BlockPos&, const BlockPos&); + void crossection(const BlockPos&, float radius, const BlockState*); + float foliageShape(int height); + void foliageCluster(const BlockPos&); + void limb(const BlockPos&, const BlockPos&, Block*); + int getSteps(const BlockPos&); + LogBlock::LogAxis* getLogAxis(const BlockPos&, const BlockPos&); + void makeFoliage(); + bool trimBranches(int height); + void makeTrunk(); + void makeBranches(); + bool checkLocation(); + +private: + Random m_random; // 0x28 + Level* m_level; // 0x40 + BlockPos m_origin; // 0x48 + int m_height; // 0x54 + int m_trunkHeight; // 0x58 + double m_heightAttenuation; // 0x60 + double m_branchSlope; // 0x68 + double m_scaleWidth; // 0x70 + double m_leafDensity; // 0x78 + int m_trunkWidth; // 0x80 + int m_heightLimit; // 0x84 + int m_foliageHeight; // 0x88 + std::vector m_foliage; // 0x90 +}; + +ASSERT_SIZEOF(BigTreeFeature::FoliageCoords, 0x10) +ASSERT_SIZEOF(BigTreeFeature, 0xa8) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BirchFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BirchFeature.cpp new file mode 100644 index 00000000..6ff25ddd --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BirchFeature.cpp @@ -0,0 +1,96 @@ +#include "net/minecraft/world/level/levelgen/feature/BirchFeature.h" + +#include "NX/Platform.h" +#include "net/minecraft/client/CMinecraftApp.h" +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/OldLeafBlock.h" +#include "net/minecraft/world/level/block/OldLogBlock.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/material/Material.h" +#include + +const BlockState* BirchFeature::TRUNK; // name guessed +const BlockState* BirchFeature::LEAVES; + +void BirchFeature::staticCtor() { + TRUNK = Blocks::LOG->defaultBlockState()->setValue(OldLogBlock::VARIANT, PlanksBlock::Variant::BIRCH); + LEAVES = Blocks::LEAVES->defaultBlockState() + ->setValue(OldLeafBlock::VARIANT, PlanksBlock::Variant::BIRCH) + ->setValue(LeafBlock::CHECK_DECAY, false); +} + +// name guessed +BirchFeature::BirchFeature(bool update, bool superBirch) + : AbstractTreeFeature(update, 5, TRUNK, LEAVES, false), m_superBirch(superBirch) {} + +// name guessed +bool BirchFeature::place(Level* level, Random& random, const BlockPos& pos) { + PIXBeginNamedEvent(0, "BirchFeature::place"); + int height = random.nextInt(3) + m_minHeight; + if (m_superBirch) + height += random.nextInt(7); + if (pos.getY() <= 0 || pos.getY() + height >= 256) { + PIXEndNamedEvent(); + return false; + } + MutableBlockPos cursor(0, 0, 0); + bool free = true; + for (int y = pos.getY(); y <= pos.getY() + height + 1; ++y) { + int radius = y == pos.getY() ? 0 : 1; + if (y >= pos.getY() + height - 1) + radius = 2; + for (int x = pos.getX() - radius; x <= pos.getX() + radius && free; ++x) { + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius && free; ++z) { + if (y >= 0 && y < 256) { + cursor.set(x, y, z); + Block* block = level->getBlockState(cursor)->getBlock(); + // The original call passes the block as the unused receiver as well. + free = reinterpret_cast(block)->isFree(block); + } else { + free = false; + } + } + } + } + if (!free) { + PIXEndNamedEvent(); + return false; + } + Block* ground = level->getBlockState(pos.below())->getBlock(); + if ((ground != Blocks::GRASS && ground != Blocks::DIRT && ground != Blocks::FARMLAND) + || pos.getY() >= 255 - height) { + PIXEndNamedEvent(); + return false; + } + if (CConsoleMinecraftApp::sInstance.getLevelGenerationOptions() + && CConsoleMinecraftApp::sInstance.getLevelGenerationOptions()->intersects( + pos.offset(-3, -1, -3), pos.offset(3, height, 3))) { + PIXEndNamedEvent(); + return false; + } + setDirtAt(level, pos.below()); + if (placeTrunk(level, pos, random, height)) { + MutableBlockPos leaves(0, 0, 0); + for (int y = pos.getY() + height - 3; y <= pos.getY() + height; ++y) { + int relative = y - (pos.getY() + height); + int radius = 1 - relative / 2; + for (int x = pos.getX() - radius; x <= pos.getX() + radius; ++x) { + int dx = x - pos.getX(); + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius; ++z) { + int dz = z - pos.getZ(); + if (std::abs(dx) != radius || std::abs(dz) != radius + || (random.nextInt(2) != 0 && relative != 0)) { + leaves.set(x, y, z); + Material* material = level->getBlockState(leaves)->getMaterial(); + if (material == Material::AIR || material == Material::LEAVES) + setBlock(level, leaves, m_leaves); + } + } + } + } + PIXEndNamedEvent(); + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BirchFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BirchFeature.h index 523cdaf5..98289ef3 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BirchFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BirchFeature.h @@ -2,8 +2,17 @@ #include "net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h" -// STUB class BirchFeature : public AbstractTreeFeature { public: + BirchFeature(bool update, bool superBirch); static void staticCtor(); + bool place(Level*, Random&, const BlockPos&) override; + + static const BlockState* TRUNK; + static const BlockState* LEAVES; + +private: + bool m_superBirch; }; + +ASSERT_SIZEOF(BirchFeature, 0x30) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BlockBlobFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BlockBlobFeature.cpp new file mode 100644 index 00000000..2e45bf17 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BlockBlobFeature.cpp @@ -0,0 +1,49 @@ +#include "net/minecraft/world/level/levelgen/feature/BlockBlobFeature.h" + +#include "net/minecraft/core/BlockPosIterator.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/state/BlockState.h" + +// name guessed +BlockBlobFeature::BlockBlobFeature(Block* block, int radius) + : Feature(false), m_block(block), m_radius(radius) {} + +// name guessed +BlockBlobFeature::~BlockBlobFeature() = default; + +/** Settle on natural ground, then overlap three independently sized stone blobs. + */ +// name guessed +bool BlockBlobFeature::place(Level* level, Random& random, const BlockPos& origin) { + BlockPos pos = origin; + while (pos.getY() > 3) { + if (!level->isEmptyBlock(pos.below())) { + Block* ground = level->getBlockState(pos.below())->getBlock(); + if (ground == Blocks::GRASS || ground == Blocks::DIRT || ground == Blocks::STONE) + break; + } + pos = pos.below(); + } + if (pos.getY() <= 3) + return false; + + int size = m_radius; + for (int attempt = 0; size >= 0 && attempt < 3; ++attempt) { + int x = size + random.nextInt(2); + int y = size + random.nextInt(2); + int z = size + random.nextInt(2); + float radius = (x + y + z) * 0.333f + 0.5f; + BlockPosIterator* positions = BlockPos::between(pos.offset(-x, -y, -z), pos.offset(x, y, z)); + while (positions->hasNext()) { + BlockPos candidate = *positions->next(); + if (candidate.distSqr(pos) <= radius * radius) + level->setBlock(candidate, m_block->defaultBlockState(), 4, false); + } + delete positions; + pos = pos.offset(-(size + 1) + random.nextInt(2 + size * 2), -random.nextInt(2), + -(size + 1) + random.nextInt(2 + size * 2)); + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BlockBlobFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BlockBlobFeature.h new file mode 100644 index 00000000..f70d6ee3 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BlockBlobFeature.h @@ -0,0 +1,19 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" + +class Block; + +class BlockBlobFeature : public Feature { +public: + BlockBlobFeature(Block*, int); + ~BlockBlobFeature() override; + bool place(Level*, Random&, const BlockPos&) override; + +private: + Block* m_block; + int m_radius; +}; + +ASSERT_SIZEOF(BlockBlobFeature, 0x20) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BonusChestFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BonusChestFeature.cpp new file mode 100644 index 00000000..cb7ef8c3 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BonusChestFeature.cpp @@ -0,0 +1,68 @@ +#include "net/minecraft/world/level/levelgen/feature/BonusChestFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Block.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/entity/ChestBlockEntity.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/material/Material.h" +#include "net/minecraft/world/level/storage/loot/BuiltInLootTables.h" + +// name guessed +BonusChestFeature::BonusChestFeature() : Feature(false) {} + +// name guessed +bool BonusChestFeature::place(Level* level, Random& random, const BlockPos& pos) { + return place(level, random, pos, false); +} + +bool BonusChestFeature::place(Level* level, Random& random, const BlockPos& pos, bool fixedPosition) { + BlockPos origin = pos; + if (!fixedPosition) { + const BlockState* state = level->getBlockState(origin); + while ((state->getMaterial() == Material::AIR || state->getMaterial() == Material::LEAVES) + && origin.getY() > 1) { + origin = origin.below(); + state = level->getBlockState(origin); + } + if (origin.getY() < 1) + return false; + origin = origin.above(); + } + for (int attempt = 0; attempt < 4; ++attempt) { + BlockPos candidate(0, 0, 0); + if (fixedPosition) + candidate = origin.offset(0, -1, 0); + else + candidate + = origin.offset(random.nextInt(4) - random.nextInt(4), random.nextInt(3) - random.nextInt(3), + random.nextInt(4) - random.nextInt(4)); + if (!level->isEmptyBlock(candidate) || !level->getBlockState(candidate.below())->isTopSolidBlocking()) + continue; + level->setBlock(candidate, Blocks::CHEST->defaultBlockState(), 2, false); + std::shared_ptr entity = level->getBlockEntity(candidate); + if (entity->isType(eChestBlockEntity)) { + auto chest = std::dynamic_pointer_cast(entity); + if (chest) { + chest->setLootTable(&BuiltInLootTables::SPAWN_BONUS_CHEST, random.nextLong()); + chest->m_isBonusChest = true; + } + } + BlockPos east = candidate.east(); + BlockPos west = candidate.west(); + BlockPos north = candidate.north(); + BlockPos south = candidate.south(); + if (level->isEmptyBlock(west) && level->getBlockState(west.below())->isTopSolidBlocking()) + level->setBlock(west, Blocks::TORCH->defaultBlockState(), 2, false); + if (level->isEmptyBlock(east) && level->getBlockState(east.below())->isTopSolidBlocking()) + level->setBlock(east, Blocks::TORCH->defaultBlockState(), 2, false); + if (level->isEmptyBlock(north) && level->getBlockState(north.below())->isTopSolidBlocking()) + level->setBlock(north, Blocks::TORCH->defaultBlockState(), 2, false); + if (level->isEmptyBlock(south) && level->getBlockState(south.below())->isTopSolidBlocking()) + level->setBlock(south, Blocks::TORCH->defaultBlockState(), 2, false); + return true; + } + return false; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BonusChestFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BonusChestFeature.h new file mode 100644 index 00000000..ccc4d0f6 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BonusChestFeature.h @@ -0,0 +1,10 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" + +class BonusChestFeature : public Feature { +public: + BonusChestFeature(); + bool place(Level*, Random&, const BlockPos&) override; + bool place(Level*, Random&, const BlockPos&, bool fixedPosition); +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BushFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BushFeature.cpp new file mode 100644 index 00000000..cb383360 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BushFeature.cpp @@ -0,0 +1,25 @@ +#include "net/minecraft/world/level/levelgen/feature/BushFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Bush.h" +#include "net/minecraft/world/level/dimension/Dimension.h" + +BushFeature::BushFeature(Bush* bush) : Feature(false), m_bush(bush) {} + +BushFeature::~BushFeature() {} + +// name guessed +bool BushFeature::place(Level* level, Random& random, const BlockPos& pos) { + for (int attempt = 0; attempt < 64; ++attempt) { + BlockPos candidate + = pos.offset(random.nextInt(8) - random.nextInt(8), random.nextInt(4) - random.nextInt(4), + random.nextInt(8) - random.nextInt(8)); + if (level->isEmptyBlock(candidate) && (!level->m_dimension->isHasCeiling() || candidate.getY() < 127) + && m_bush->canSurvive(level, candidate, m_bush->defaultBlockState())) { + level->setBlock(candidate, m_bush->defaultBlockState(), 2, false); + } + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BushFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BushFeature.h new file mode 100644 index 00000000..f4ec63cf --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/BushFeature.h @@ -0,0 +1,18 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" + +class Bush; + +class BushFeature : public Feature { +public: + BushFeature(Bush*); + ~BushFeature() override; + bool place(Level*, Random&, const BlockPos&) override; + +private: + Bush* m_bush; +}; + +ASSERT_SIZEOF(BushFeature, 0x18) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CactusFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CactusFeature.cpp new file mode 100644 index 00000000..234a23da --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CactusFeature.cpp @@ -0,0 +1,24 @@ +#include "net/minecraft/world/level/levelgen/feature/CactusFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/CactusBlock.h" + +// name guessed +bool CactusFeature::place(Level* level, Random& random, const BlockPos& pos) { + for (int attempt = 0; attempt < 10; ++attempt) { + BlockPos candidate + = pos.offset(random.nextInt(8) - random.nextInt(8), random.nextInt(4) - random.nextInt(4), + random.nextInt(8) - random.nextInt(8)); + if (level->isEmptyBlock(candidate)) { + int height = 1 + random.nextInt(random.nextInt(3) + 1); + for (int y = 0; y < height; ++y) { + if (static_cast(Blocks::CACTUS)->canSurvive(level, candidate)) + level->setBlock(candidate.above(y), Blocks::CACTUS->defaultBlockState(), 2, false); + } + } + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CactusFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CactusFeature.h new file mode 100644 index 00000000..c25c514c --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CactusFeature.h @@ -0,0 +1,13 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" + +class CactusFeature : public Feature { +public: + CactusFeature() = default; + ~CactusFeature() override = default; + bool place(Level*, Random&, const BlockPos&) override; +}; + +ASSERT_SIZEOF(CactusFeature, 0x10) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CanyonFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CanyonFeature.cpp new file mode 100644 index 00000000..40d20f69 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CanyonFeature.cpp @@ -0,0 +1,182 @@ +#include "net/minecraft/world/level/levelgen/feature/CanyonFeature.h" + +#include "NX/Platform.h" +#include "net/minecraft/client/CMinecraftApp.h" +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/util/Mth.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/biome/Biome.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/levelgen/ChunkPrimer.h" + +// name guessed +// NON_MATCHING | score: 31717 (lower is better) +void CanyonFeature::addTunnel(long long seed, int chunkX, int chunkZ, ChunkPrimer* primer, double x, double y, + double z, float width, float yaw, float pitch, int startStep, int endStep, + double verticalScale) { + MemSect(49); + Random random(seed); + MemSect(0); + if (endStep <= 0) { + int range = m_radius * 16 - 16; + endStep = range - random.nextInt(range / 4); + } + + float heightWidth = 1.0f; + for (int i = 0; i < 128; i++) { + if (i == 0 || random.nextInt(3) == 0) { + float first = random.nextFloat(); + heightWidth = first * random.nextFloat() + 1.0f; + } + m_widths[i] = heightWidth * heightWidth; + } + + bool room = startStep == -1; + int step = room ? endStep / 2 : startStep; + float pitchVelocity = 0.0f; + float yawVelocity = 0.0f; + double centerX = chunkX * 16 + 8; + double centerZ = chunkZ * 16 + 8; + double reach = width + 2.0f + 16.0f; + + for (; step < endStep; step++) { + double radius = 1.5 + Mth::sin(step * Mth::PI / endStep) * width; + double radiusY = radius * verticalScale; + radius *= double(random.nextFloat()) * 0.25 + 0.75; + radiusY *= double(random.nextFloat()) * 0.25 + 0.75; + float cosPitch = Mth::cos(pitch); + float sinPitch = Mth::sin(pitch); + x += cosPitch * Mth::cos(yaw); + y += sinPitch; + z += cosPitch * Mth::sin(yaw); + + float pitchRandom1 = random.nextFloat(); + float pitchRandom2 = random.nextFloat(); + float pitchRandom3 = random.nextFloat(); + float yawRandom1 = random.nextFloat(); + float yawRandom2 = random.nextFloat(); + float yawRandom3 = random.nextFloat(); + + if (room || random.nextInt(4) != 0) { + double dx = x - centerX; + double dz = z - centerZ; + double remaining = endStep - step; + if (dx * dx + dz * dz - remaining * remaining > reach * reach) + return; + + if (x >= centerX - 16.0 - radius * 2.0 && z >= centerZ - 16.0 - radius * 2.0 + && x <= centerX + 16.0 + radius * 2.0 && z <= centerZ + 16.0 + radius * 2.0) { + int minX = Mth::floor(x - radius) - chunkX * 16 - 1; + int maxX = Mth::floor(x + radius) - chunkX * 16 + 1; + int minY = Mth::floor(y - radiusY) - 1; + int maxY = Mth::floor(y + radiusY) + 1; + int minZ = Mth::floor(z - radius) - chunkZ * 16 - 1; + int maxZ = Mth::floor(z + radius) - chunkZ * 16 + 1; + if (minX < 0) + minX = 0; + if (maxX > 16) + maxX = 16; + if (minY < 1) + minY = 1; + if (maxY > 120) + maxY = 120; + if (minZ < 0) + minZ = 0; + if (maxZ > 16) + maxZ = 16; + + bool water = false; + for (int ix = minX; ix < maxX && !water; ix++) { + for (int iz = minZ; iz < maxZ && !water; iz++) { + for (int iy = maxY + 1; iy >= minY - 1; iy--) { + if (iy >= 0 && iy < 128) { + const BlockState* state = primer->getState(ix, iy, iz); + if (state->getBlock() == Blocks::FLOWING_WATER + || state->getBlock() == Blocks::WATER) { + water = true; + break; + } + if (iy != minY - 1 && ix != minX && ix != maxX - 1 && iz != minZ + && iz != maxZ - 1) + iy = minY; + } + } + } + } + + if (!water) { + MutableBlockPos pos; + Biome::LegacyBlockData lava(10, Blocks::FLOWING_LAVA->convertBlockStateToLegacyData( + Blocks::FLOWING_LAVA->defaultBlockState())); + Biome::LegacyBlockData air(0, 0); + for (int ix = minX; ix < maxX; ix++) { + double localX = (ix + chunkX * 16 + 0.5 - x) / radius; + for (int iz = minZ; iz < maxZ; iz++) { + double localZ = (iz + chunkZ * 16 + 0.5 - z) / radius; + double horizontal = localX * localX + localZ * localZ; + if (horizontal >= 1.0) + continue; + + bool surface = false; + for (int iy = maxY - 1; iy >= minY; iy--) { + double localY = (iy + 0.5 - y) / radiusY; + if (horizontal * m_widths[iy] + localY * localY / 6.0 >= 1.0) + continue; + + const BlockState* state = primer->getState(ix, iy, iz); + surface = surface || state->getBlock() == Blocks::GRASS; + if (state->getBlock() != Blocks::STONE && state->getBlock() != Blocks::DIRT + && state->getBlock() != Blocks::GRASS) + continue; + + int packed = (ix << 11) | (iz << 7) | iy; + if (iy - 1 < 10) { + primer->setBlockAndData(packed, lava.m_id, lava.m_data); + } else { + primer->setBlockAndData(packed, air.m_id, air.m_data); + if (surface) { + if (primer->getState(ix, iy - 1, iz)->getBlock() == Blocks::DIRT) { + pos.set(ix + chunkX * 16, 0, iz + chunkZ * 16); + Biome* biome = m_level->getBiome(pos); + primer->setBlockAndData(packed - 1, biome->m_grass.m_id, + biome->m_grass.m_data); + } + } + } + } + } + } + if (room) + return; + } + } + } + + pitch = pitch * 0.7f + pitchVelocity * 0.05f; + yaw += yawVelocity * 0.05f; + float pitchChange = (pitchRandom1 - pitchRandom2) * pitchRandom3; + pitchVelocity = pitchVelocity * 0.8f + pitchChange + pitchChange; + yawVelocity = yawVelocity * 0.5f + (yawRandom1 - yawRandom2) * yawRandom3 * 4.0f; + } +} + +// name guessed +void CanyonFeature::addFeature(Level*, int sourceX, int sourceZ, int chunkX, int chunkZ, + ChunkPrimer* primer) { + if (m_random.nextInt(50) != 0) + return; + + double x = sourceX * 16 + m_random.nextInt(16); + double y = m_random.nextInt(m_random.nextInt(40) + 8) + 20; + double z = sourceZ * 16 + m_random.nextInt(16); + int markerX = int(x * 0.0625); + int markerZ = int(y * 0.0625); + float yaw = m_random.nextFloat() * Mth::PI * 2.0f; + float pitch = (m_random.nextFloat() - 0.5f) * 2.0f * 0.125f; + float firstWidth = m_random.nextFloat() * 2.0f; + float width = (firstWidth + m_random.nextFloat()) * 2.0f; + addTunnel(m_random.nextLong(), chunkX, chunkZ, primer, x, y, z, width, yaw, pitch, 0, 0, 3.0); + // The reference registers X/Y here, although the marker service accepts X/Z. + CConsoleMinecraftApp::sInstance.addGeneratedFeature(4, markerX, markerZ); +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CanyonFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CanyonFeature.h index 1c5bf9ac..17173fbc 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CanyonFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CanyonFeature.h @@ -1,10 +1,17 @@ #pragma once #include "net/minecraft/world/level/levelgen/feature/LargeFeature.h" +#include "types.h" class CanyonFeature : public LargeFeature { public: - char m_filler[0x1000]; + CanyonFeature() = default; + void addFeature(Level*, int, int, int, int, ChunkPrimer*) override; + void addTunnel(long long, int, int, ChunkPrimer*, double, double, double, float, float, float, int, int, + double); + + float m_widths[128]; + char m_padding[0xe00]; }; ASSERT_SIZEOF(CanyonFeature, 0x1030) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DeadBushFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DeadBushFeature.cpp new file mode 100644 index 00000000..4ec22be6 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DeadBushFeature.cpp @@ -0,0 +1,35 @@ +#include "net/minecraft/world/level/levelgen/feature/DeadBushFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/Bush.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/material/Material.h" + +// name guessed +DeadBushFeature::DeadBushFeature(Block*) : Feature(false) {} + +// name guessed +bool DeadBushFeature::place(Level* level, Random& random, const BlockPos& origin) { + BlockPos pos = origin; + const BlockState* state = level->getBlockState(pos); + while ((state->getMaterial() == Material::AIR || state->getMaterial() == Material::LEAVES) + && pos.getY() > 0) { + pos = pos.below(); + state = level->getBlockState(pos); + } + + for (int attempt = 0; attempt < 4; ++attempt) { + BlockPos candidate + = pos.offset(random.nextInt(8) - random.nextInt(8), random.nextInt(4) - random.nextInt(4), + random.nextInt(8) - random.nextInt(8)); + if (level->isEmptyBlock(candidate) + && static_cast(Blocks::DEADBUSH) + ->canSurvive(level, candidate, Blocks::DEADBUSH->defaultBlockState())) { + level->setBlock(candidate, Blocks::DEADBUSH->defaultBlockState(), 2, false); + } + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DeadBushFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DeadBushFeature.h new file mode 100644 index 00000000..df4ede08 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DeadBushFeature.h @@ -0,0 +1,15 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" + +class Block; + +class DeadBushFeature : public Feature { +public: + DeadBushFeature(Block*); + ~DeadBushFeature() override = default; + bool place(Level*, Random&, const BlockPos&) override; +}; + +ASSERT_SIZEOF(DeadBushFeature, 0x10) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DesertWellFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DesertWellFeature.cpp new file mode 100644 index 00000000..7880a580 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DesertWellFeature.cpp @@ -0,0 +1,86 @@ +#include "net/minecraft/world/level/levelgen/feature/DesertWellFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/core/Direction.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/HalfSlabBlock.h" +#include "net/minecraft/world/level/block/SandBlock.h" +#include "net/minecraft/world/level/block/StoneSlabBlock.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/block/state/BlockStatePredicate.h" + +Predicate* DesertWellFeature::SAND_PREDICATE; // name guessed + +void DesertWellFeature::staticCtor() { + BlockStatePredicate* predicate = BlockStatePredicate::forBlock(Blocks::SAND); + SAND_PREDICATE = predicate->where(SandBlock::VARIANT, + Predicates::equalTo(SandBlock::Variant::DEFAULT)); +} + +// name guessed +DesertWellFeature::DesertWellFeature() : Feature(false) { + m_slab = Blocks::STONE_SLAB->defaultBlockState() + ->setValue(StoneSlabBlock::VARIANT, StoneSlabBlock::Variant::SANDSTONE) + ->setValue(HalfSlabBlock::VARIANT, HalfSlabBlock::Half::BOTTOM); + m_sandstone = Blocks::SANDSTONE->defaultBlockState(); + m_water = Blocks::FLOWING_WATER->defaultBlockState(); +} + +/** Places the well, including the intermediate blocks later overwritten by slabs. */ +// name guessed +bool DesertWellFeature::place(Level* level, Random&, const BlockPos& origin) { + BlockPos pos = origin; + while (level->isEmptyBlock(pos) && pos.getY() > 2) + pos = pos.below(); + + if (!SAND_PREDICATE->apply(level->getBlockState(pos))) + return false; + + for (int x = -2; x <= 2; x++) { + for (int z = -2; z <= 2; z++) { + if (level->isEmptyBlock(pos.offset(x, -1, z)) && level->isEmptyBlock(pos.offset(x, -2, z))) + return false; + } + } + + for (int y = -1; y <= 0; y++) { + for (int x = -2; x <= 2; x++) { + for (int z = -2; z <= 2; z++) + level->setBlock(pos.offset(x, y, z), m_sandstone, 2, false); + } + } + level->setBlock(pos, m_water, 2, false); + auto directions = Direction::Plane::HORIZONTAL->iterator(); + for (unsigned int i = 0; i < directions.m_length; i++) { + const Direction* direction = directions[i]; + level->setBlock(pos.relative(direction), m_water, 2, false); + } + + for (int x = -2; x <= 2; x++) { + for (int z = -2; z <= 2; z++) { + if (x == -2 || x == 2 || z == -2 || z == 2) + level->setBlock(pos.offset(x, 1, z), m_sandstone, 2, false); + } + } + level->setBlock(pos.offset(2, 1, 0), m_slab, 2, false); + level->setBlock(pos.offset(-2, 1, 0), m_slab, 2, false); + level->setBlock(pos.offset(0, 1, 2), m_slab, 2, false); + level->setBlock(pos.offset(0, 1, -2), m_slab, 2, false); + + for (int x = -1; x <= 1; x++) { + for (int z = -1; z <= 1; z++) { + if (x == 0 && z == 0) + level->setBlock(pos.offset(x, 4, z), m_sandstone, 2, false); + else + level->setBlock(pos.offset(x, 4, z), m_slab, 2, false); + } + } + for (int y = 1; y <= 3; y++) { + level->setBlock(pos.offset(-1, y, -1), m_sandstone, 2, false); + level->setBlock(pos.offset(-1, y, 1), m_sandstone, 2, false); + level->setBlock(pos.offset(1, y, -1), m_sandstone, 2, false); + level->setBlock(pos.offset(1, y, 1), m_sandstone, 2, false); + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DesertWellFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DesertWellFeature.h index fdf3a459..41a68b0a 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DesertWellFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DesertWellFeature.h @@ -1,7 +1,19 @@ #pragma once -// STUB -class DesertWellFeature { +#include "net/minecraft/world/level/block/state/properties/AbstractProperty.h" +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" + +class DesertWellFeature : public Feature { public: + DesertWellFeature(); static void staticCtor(); + bool place(Level*, Random&, const BlockPos&) override; + + static Predicate* SAND_PREDICATE; + const BlockState* m_slab; + const BlockState* m_sandstone; + const BlockState* m_water; }; + +ASSERT_SIZEOF(DesertWellFeature, 0x28) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DoublePlantFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DoublePlantFeature.cpp new file mode 100644 index 00000000..37d80e05 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DoublePlantFeature.cpp @@ -0,0 +1,33 @@ +#include "net/minecraft/world/level/levelgen/feature/DoublePlantFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/dimension/Dimension.h" + +// name guessed +DoublePlantFeature::DoublePlantFeature() : Feature(false) {} + +DoublePlantFeature::~DoublePlantFeature() = default; + +// name guessed +void DoublePlantFeature::setNextPlantType(DoublePlantBlock::Variant* type) { + m_type = type; +} + +// name guessed +bool DoublePlantFeature::place(Level* level, Random& random, const BlockPos& origin) { + bool placed = false; + for (int attempt = 0; attempt < 64; ++attempt) { + BlockPos candidate + = origin.offset(random.nextInt(8) - random.nextInt(8), random.nextInt(4) - random.nextInt(4), + random.nextInt(8) - random.nextInt(8)); + if (level->isEmptyBlock(candidate) && (!level->m_dimension->isHasCeiling() || candidate.getY() < 126) + && Blocks::DOUBLE_PLANT->mayPlace(level, candidate)) { + static_cast(Blocks::DOUBLE_PLANT)->placeAt(level, candidate, m_type, 2); + placed = true; + } + } + return placed; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DoublePlantFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DoublePlantFeature.h new file mode 100644 index 00000000..623cc9f2 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/DoublePlantFeature.h @@ -0,0 +1,17 @@ +#pragma once + +#include "net/minecraft/world/level/block/DoublePlantBlock.h" +#include "net/minecraft/world/level/levelgen/feature/Feature.h" + +class DoublePlantFeature : public Feature { +public: + DoublePlantFeature(); + ~DoublePlantFeature() override; + void setNextPlantType(DoublePlantBlock::Variant*); + bool place(Level*, Random&, const BlockPos&) override; + +private: + DoublePlantBlock::Variant* m_type; +}; + +ASSERT_SIZEOF(DoublePlantFeature, 0x18) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndGatewayFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndGatewayFeature.cpp new file mode 100644 index 00000000..d13fad16 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndGatewayFeature.cpp @@ -0,0 +1,40 @@ +#include "net/minecraft/world/level/levelgen/feature/EndGatewayFeature.h" + +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/EndGatewayBlock.h" +#include + +// name guessed +EndGatewayFeature::EndGatewayFeature(int portalNumber) : Feature(false), m_portalNumber(portalNumber) {} + +// name guessed +// NON_MATCHING | score: 1145 (lower is better) +bool EndGatewayFeature::place(Level* level, Random&, const BlockPos& pos) { + MutableBlockPos current(0, 0, 0); + for (int x = pos.getX() - 1; x <= pos.getX() + 1; ++x) { + for (int z = pos.getZ() - 1; z <= pos.getZ() + 1; ++z) { + for (int y = pos.getY() - 2; y <= pos.getY() + 2; ++y) { + current.set(x, y, z); + bool sameX = x == pos.getX(); + bool sameY = y == pos.getY(); + bool sameZ = z == pos.getZ(); + bool cap = std::abs(y - pos.getY()) == 2; + if (sameX && sameY && sameZ) { + const BlockState* state = Blocks::END_GATEWAY->defaultBlockState()->setValue( + EndGatewayBlock::FJ_PORTAL_NUMBER, m_portalNumber); + setBlock(level, BlockPos(current), state); + } else if (sameY) { + setBlock(level, current, Blocks::AIR->defaultBlockState()); + } else if (sameX && cap && sameZ) { + setBlock(level, current, Blocks::BEDROCK->defaultBlockState()); + } else if (cap || (!sameX && !sameZ)) { + setBlock(level, current, Blocks::AIR->defaultBlockState()); + } else { + setBlock(level, current, Blocks::BEDROCK->defaultBlockState()); + } + } + } + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndGatewayFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndGatewayFeature.h new file mode 100644 index 00000000..29a12e7b --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndGatewayFeature.h @@ -0,0 +1,15 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" + +class EndGatewayFeature : public Feature { +public: + explicit EndGatewayFeature(int portalNumber); + bool place(Level*, Random&, const BlockPos&) override; + +private: + int m_portalNumber; +}; + +ASSERT_SIZEOF(EndGatewayFeature, 0x10) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndIslandFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndIslandFeature.cpp new file mode 100644 index 00000000..cb2fd812 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndIslandFeature.cpp @@ -0,0 +1,27 @@ +#include "net/minecraft/world/level/levelgen/feature/EndIslandFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/block/Block.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include + +// name guessed +EndIslandFeature::EndIslandFeature() : Feature(false) {} + +/** Shrink each successive disk; preserve the original random calls and block-write order. + */ +// name guessed +bool EndIslandFeature::place(Level* level, Random& random, const BlockPos& origin) { + float radius = (float)random.nextInt(3) + 4.0f; + for (int y = 0; radius > 0.5f; --y) { + for (int x = (int)std::floor(-radius); x <= (int)std::ceil(radius); ++x) { + for (int z = (int)std::floor(-radius); z <= (int)std::ceil(radius); ++z) { + if ((float)(x * x + z * z) <= (radius + 1.0f) * (radius + 1.0f)) + setBlock(level, origin.offset(x, y, z), Blocks::END_STONE->defaultBlockState()); + } + } + radius -= (float)random.nextInt(2) + 0.5f; + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndIslandFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndIslandFeature.h new file mode 100644 index 00000000..3a3e0bf9 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndIslandFeature.h @@ -0,0 +1,10 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" + +class EndIslandFeature : public Feature { +public: + EndIslandFeature(); + ~EndIslandFeature() override = default; + bool place(Level*, Random&, const BlockPos&) override; +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndPodiumFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndPodiumFeature.cpp new file mode 100644 index 00000000..15e0d1ff --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndPodiumFeature.cpp @@ -0,0 +1,51 @@ +#include "net/minecraft/world/level/levelgen/feature/EndPodiumFeature.h" + +#include "net/minecraft/core/BlockPosIterator.h" +#include "net/minecraft/core/Direction.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/TorchBlock.h" + +extern double endDistanceToSpawn(const Vec3i*, int, int, int); + +// name guessed +EndPodiumFeature::EndPodiumFeature(bool active) : Feature(false), m_active(active) {} + +// name guessed +// NON_MATCHING | score: 2441 (lower is better) +bool EndPodiumFeature::place(Level* level, Random&, const BlockPos& pos) { + BlockPos lower(pos.getX() - 4, pos.getY() - 1, pos.getZ() - 4); + BlockPos upper(pos.getX() + 4, pos.getY() + 32, pos.getZ() + 4); + BlockPosIterator* iterator = BlockPos::between(lower, upper); + while (iterator->hasNext()) { + BlockPos* candidate = iterator->next(); + double distance = endDistanceToSpawn(candidate, pos.getX(), candidate->getY(), pos.getZ()); + if (distance <= 3.5) { + if (candidate->getY() < pos.getY()) { + if (distance <= 2.5) + setBlock(level, *candidate, Blocks::BEDROCK->defaultBlockState()); + else if (candidate->getY() < pos.getY()) + setBlock(level, *candidate, Blocks::END_STONE->defaultBlockState()); + } else if (candidate->getY() > pos.getY()) { + setBlock(level, *candidate, Blocks::AIR->defaultBlockState()); + } else if (distance > 2.5) { + setBlock(level, *candidate, Blocks::BEDROCK->defaultBlockState()); + } else { + setBlock(level, *candidate, + (m_active ? Blocks::END_PORTAL : Blocks::AIR)->defaultBlockState()); + } + } + } + // The original placement does not delete this iterator. + setBlock(level, pos.above(0), Blocks::BEDROCK->defaultBlockState()); + setBlock(level, pos.above(1), Blocks::BEDROCK->defaultBlockState()); + setBlock(level, pos.above(2), Blocks::BEDROCK->defaultBlockState()); + setBlock(level, pos.above(3), Blocks::BEDROCK->defaultBlockState()); + BlockPos torchLevel = pos.above(2); + auto directions = Direction::Plane::HORIZONTAL->iterator(); + for (unsigned int i = 0; i < directions.m_length; ++i) { + const Direction* direction = directions[i]; + setBlock(level, torchLevel.relative(direction), + Blocks::TORCH->defaultBlockState()->setValue(TorchBlock::FACING, direction)); + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndPodiumFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndPodiumFeature.h new file mode 100644 index 00000000..a7cc12ea --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndPodiumFeature.h @@ -0,0 +1,15 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" + +class EndPodiumFeature : public Feature { +public: + explicit EndPodiumFeature(bool active); + bool place(Level*, Random&, const BlockPos&) override; + +private: + bool m_active; +}; + +ASSERT_SIZEOF(EndPodiumFeature, 0x10) 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.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/FlowerFeature.cpp new file mode 100644 index 00000000..d4bc1a18 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/FlowerFeature.cpp @@ -0,0 +1,42 @@ +#include "net/minecraft/world/level/levelgen/feature/FlowerFeature.h" + +#include "net/minecraft/client/CMinecraftApp.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/dimension/Dimension.h" + +FlowerFeature::FlowerFeature(FlowerBlock* block, FlowerBlock::Flower* flower) : Feature(false) { + setFlower(block, flower); +} + +// name guessed: the setup routine at 0x71001843ac. +void FlowerFeature::setFlower(FlowerBlock* block, FlowerBlock::Flower* flower) { + m_flower = block; + const BlockState* state = block->defaultBlockState(); + m_state = state->setValue(block->getFlowerProperty(), flower); +} + +bool FlowerFeature::place(Level* level, Random& random, const BlockPos& pos) { + if (CConsoleMinecraftApp::sInstance.getLevelGenerationOptions()) { + LevelGenerationOptions* options = CConsoleMinecraftApp::sInstance.getLevelGenerationOptions(); + BlockPos lower; + BlockPos upper; + lower = pos.offset(-8, -4, -8); + upper = pos.offset(8, 4, 8); + if (options->intersects(lower, upper)) + return false; + } + for (int i = 0; i < 64; ++i) { + int dx = random.nextInt(8) - random.nextInt(8); + int dy = random.nextInt(4) - random.nextInt(4); + int dz = random.nextInt(8) - random.nextInt(8); + BlockPos candidate = pos.offset(dx, dy, dz); + if (level->isEmptyBlock(candidate) && (!level->m_dimension->isHasCeiling() || candidate.getY() < 127) + && m_flower->canSurvive(level, candidate, m_state)) { + level->setBlock(candidate, m_state, 2, false); + } + } + return true; +} 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/GroundBushFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/GroundBushFeature.cpp new file mode 100644 index 00000000..231c74dc --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/GroundBushFeature.cpp @@ -0,0 +1,49 @@ +#include "net/minecraft/world/level/levelgen/feature/GroundBushFeature.h" + +#include "NX/Platform.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/material/Material.h" +#include + +// name guessed +GroundBushFeature::GroundBushFeature(const BlockState* trunk, const BlockState* leaves) + : TreeFeature(false), m_bushLeaves(leaves), m_bushTrunk(trunk) {} + +// name guessed +bool GroundBushFeature::place(Level* level, Random& random, const BlockPos& origin) { + PIXBeginNamedEvent(0.0f, "Placing GroundBushFeature"); + BlockPos pos = origin; + for (;;) { + const BlockState* state = level->getBlockState(pos); + if ((state->getMaterial() != Material::AIR && state->getMaterial() != Material::LEAVES) + || pos.getY() <= 0) + break; + pos = pos.below(); + } + Block* ground = level->getBlockState(pos)->getBlock(); + if (ground == Blocks::DIRT || ground == Blocks::GRASS) { + pos = pos.above(); + setBlock(level, pos, m_bushTrunk); + for (int y = pos.getY(); y <= pos.getY() + 2; ++y) { + int radius = 2 - (y - pos.getY()); + for (int x = pos.getX() - radius; x <= pos.getX() + radius; ++x) { + int dx = x - pos.getX(); + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius; ++z) { + int dz = z - pos.getZ(); + if (std::abs(dx) != radius || std::abs(dz) != radius || random.nextInt(2) != 0) { + BlockPos candidate(x, y, z); + const BlockState* state = level->getBlockState(candidate); + Material* material = state->getMaterial(); + if (material == Material::AIR || material == Material::LEAVES) + setBlock(level, candidate, m_bushLeaves); + } + } + } + } + } + PIXEndNamedEvent(); + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/GroundBushFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/GroundBushFeature.h new file mode 100644 index 00000000..57cf12b8 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/GroundBushFeature.h @@ -0,0 +1,13 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/TreeFeature.h" + +class GroundBushFeature : public TreeFeature { +public: + GroundBushFeature(const BlockState* trunk, const BlockState* leaves); + bool place(Level*, Random&, const BlockPos&) override; + +private: + const BlockState* m_bushLeaves; + const BlockState* m_bushTrunk; +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HellPortalFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HellPortalFeature.cpp new file mode 100644 index 00000000..9c82dcfd --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HellPortalFeature.cpp @@ -0,0 +1,43 @@ +#include "net/minecraft/world/level/levelgen/feature/HellPortalFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/core/Direction.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/material/Material.h" + +// name guessed +bool HellPortalFeature::place(Level* level, Random& random, const BlockPos& pos) { + if (!level->isEmptyBlock(pos)) { + return false; + } + if (level->getBlockState(pos.above())->getBlock() != Blocks::NETHERRACK) { + return false; + } + level->setBlock(pos, Blocks::GLOWSTONE->defaultBlockState(), 2, false); + + for (int i = 0; i < 1500; i++) { + BlockPos randomPos = pos.offset(random.nextInt(8) - random.nextInt(8), -random.nextInt(12), + random.nextInt(8) - random.nextInt(8)); + + if (level->getBlockState(randomPos)->getBlock()->getMaterial() == (Material*)Material::AIR) { + int glowstoneCount = 0; + + for (auto it = Direction::VALUES.begin(); it != Direction::VALUES.end(); ++it) { + const Direction* direction = *it; + if (level->getBlockState(randomPos.relative(direction))->getBlock() == Blocks::GLOWSTONE) + glowstoneCount++; + + if (glowstoneCount > 1) { + break; + } + } + if (glowstoneCount == 1) { + level->setBlock(randomPos, Blocks::GLOWSTONE->defaultBlockState(), 2, false); + } + } + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HellPortalFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HellPortalFeature.h new file mode 100644 index 00000000..0e0b9c6b --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HellPortalFeature.h @@ -0,0 +1,9 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" + +class HellPortalFeature : public Feature { +public: + HellPortalFeature() = default; + bool place(Level*, Random&, const BlockPos&) override; +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HugeMushroomFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HugeMushroomFeature.cpp new file mode 100644 index 00000000..704e8935 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HugeMushroomFeature.cpp @@ -0,0 +1,120 @@ +#include "net/minecraft/world/level/levelgen/feature/HugeMushroomFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/HugeMushroomBlock.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/material/Material.h" + +// name guessed +HugeMushroomFeature::HugeMushroomFeature(Block* type) : Feature(true), m_type(type) {} + +HugeMushroomFeature::HugeMushroomFeature() : Feature(false), m_type(nullptr) {} + +// name guessed +bool HugeMushroomFeature::place(Level* level, Random& random, const BlockPos& pos) { + Block* type = m_type; + if (!type) + type = random.nextBoolean() ? Blocks::BROWN_MUSHROOM_BLOCK : Blocks::RED_MUSHROOM_BLOCK; + + int height = random.nextInt(3) + 4; + if (random.nextInt(12) == 0) + height *= 2; + if (pos.getY() < 1 || pos.getY() + height >= 255) + return false; + + bool clear = true; + for (int y = pos.getY(); y <= pos.getY() + height + 1; ++y) { + int radius = 3; + if (y <= pos.getY() + 3) + radius = 0; + BlockPos candidate; + for (int x = pos.getX() - radius; x <= pos.getX() + radius && clear; ++x) { + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius && clear; ++z) { + if (y >= 0 && y < 256) { + candidate = BlockPos(x, y, z); + const BlockState* state = level->getBlockState(candidate); + Material* material = state->getMaterial(); + if (material != Material::AIR && material != Material::LEAVES) + clear = false; + } else { + clear = false; + } + } + } + } + if (!clear) + return false; + + Block* ground = level->getBlockState(pos.below())->getBlock(); + if (ground != Blocks::DIRT && ground != Blocks::GRASS && ground != Blocks::MYCELIUM) + return false; + + int capStart = pos.getY() + height; + if (type == Blocks::RED_MUSHROOM_BLOCK) + capStart = pos.getY() + height - 3; + for (int y = capStart; y <= pos.getY() + height; ++y) { + int radius = 1; + if (y < pos.getY() + height) + radius = 2; + if (type == Blocks::BROWN_MUSHROOM_BLOCK) + radius = 3; + int minX = pos.getX() - radius; + int maxX = pos.getX() + radius; + int minZ = pos.getZ() - radius; + int maxZ = pos.getZ() + radius; + for (int x = minX; x <= maxX; ++x) { + for (int z = minZ; z <= maxZ; ++z) { + int data = 5; + if (x == minX) + --data; + if (x == maxX) + ++data; + if (z == minZ) + data -= 3; + if (z == maxZ) + data += 3; + HugeMushroomBlock::Variant* variant = HugeMushroomBlock::Variant::byData(data); + if (type == Blocks::BROWN_MUSHROOM_BLOCK || y < pos.getY() + height) { + if ((x == minX || x == maxX) && (z == minZ || z == maxZ)) + continue; + if (x == pos.getX() - (radius - 1) && z == pos.getZ() - radius) + variant = HugeMushroomBlock::Variant::NORTH_WEST; + if (x == minX && z == pos.getZ() - (radius - 1)) + variant = HugeMushroomBlock::Variant::NORTH_WEST; + if (x == pos.getX() + (radius - 1) && z == minZ) + variant = HugeMushroomBlock::Variant::NORTH_EAST; + if (x == maxX && z == pos.getZ() - (radius - 1)) + variant = HugeMushroomBlock::Variant::NORTH_EAST; + if (x == pos.getX() - (radius - 1) && z == maxZ) + variant = HugeMushroomBlock::Variant::SOUTH_WEST; + if (x == minX && z == pos.getZ() + (radius - 1)) + variant = HugeMushroomBlock::Variant::SOUTH_WEST; + if (x == pos.getX() + (radius - 1) && z == maxZ) + variant = HugeMushroomBlock::Variant::SOUTH_EAST; + if (x == maxX && z == pos.getZ() + (radius - 1)) + variant = HugeMushroomBlock::Variant::SOUTH_EAST; + } + if (variant == HugeMushroomBlock::Variant::CENTER && y < pos.getY() + height) + variant = HugeMushroomBlock::Variant::ALL_INSIDE; + // The shipped Switch check reads the origin Y on both sides. + if (variant == HugeMushroomBlock::Variant::ALL_INSIDE && pos.getY() < pos.getY() + height - 1) + continue; + BlockPos candidate(x, y, z); + if (!level->getBlockState(candidate)->isSolid()) + setBlock(level, candidate, + type->defaultBlockState()->setValue(HugeMushroomBlock::VARIANT, variant)); + } + } + } + + for (int y = 0; y < height; ++y) { + if (!level->getBlockState(pos.above(y))->isSolid()) + setBlock(level, pos.above(y), + type->defaultBlockState()->setValue(HugeMushroomBlock::VARIANT, + HugeMushroomBlock::Variant::STEM)); + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HugeMushroomFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HugeMushroomFeature.h new file mode 100644 index 00000000..2614f689 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HugeMushroomFeature.h @@ -0,0 +1,19 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" + +class Block; + +class HugeMushroomFeature : public Feature { +public: + HugeMushroomFeature(); + HugeMushroomFeature(Block*); + ~HugeMushroomFeature() override = default; + bool place(Level*, Random&, const BlockPos&) override; + +private: + Block* m_type; +}; + +ASSERT_SIZEOF(HugeMushroomFeature, 0x18) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/IcePatchFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/IcePatchFeature.cpp new file mode 100644 index 00000000..df550700 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/IcePatchFeature.cpp @@ -0,0 +1,37 @@ +#include "net/minecraft/world/level/levelgen/feature/IcePatchFeature.h" + +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" + +// name guessed +IcePatchFeature::IcePatchFeature(int radius) + : Feature(false), m_block(Blocks::PACKED_ICE), m_radius(radius) {} +IcePatchFeature::~IcePatchFeature() = default; + +// name guessed +bool IcePatchFeature::place(Level* level, Random& random, const BlockPos& origin) { + BlockPos pos = origin; + while (level->isEmptyBlock(pos) && pos.getY() > 2) + pos = pos.below(); + if (level->getBlockState(pos)->getBlock() != Blocks::SNOW) + return false; + int radius = random.nextInt(m_radius - 2) + 2; + MutableBlockPos candidate(0, 0, 0); + for (int x = pos.getX() - radius; x <= pos.getX() + radius; ++x) { + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius; ++z) { + int dx = x - pos.getX(); + int dz = z - pos.getZ(); + if (dx * dx + dz * dz > radius * radius) + continue; + for (int y = pos.getY() - 1; y <= pos.getY() + 1; ++y) { + candidate.set(x, y, z); + Block* block = level->getBlockState(candidate)->getBlock(); + if (block == Blocks::DIRT || block == Blocks::SNOW || block == Blocks::ICE) + level->setBlock(candidate, m_block->defaultBlockState(), 2, false); + } + } + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/IcePatchFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/IcePatchFeature.h new file mode 100644 index 00000000..a3eb0bd6 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/IcePatchFeature.h @@ -0,0 +1,15 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" + +class Block; +class IcePatchFeature : public Feature { +public: + IcePatchFeature(int radius); + ~IcePatchFeature() override; + bool place(Level*, Random&, const BlockPos&) override; + +private: + Block* m_block; + int m_radius; +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/IceSpikeFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/IceSpikeFeature.cpp new file mode 100644 index 00000000..0a9b4ce3 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/IceSpikeFeature.cpp @@ -0,0 +1,78 @@ +#include "net/minecraft/world/level/levelgen/feature/IceSpikeFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/util/Mth.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/material/Material.h" +#include + +// name guessed +bool IceSpikeFeature::place(Level* level, Random& random, const BlockPos& origin) { + BlockPos pos = origin; + while (level->isEmptyBlock(pos) && pos.getY() > 2) + pos = pos.below(); + if (level->getBlockState(pos)->getBlock() != Blocks::SNOW) + return false; + pos = pos.above(random.nextInt(4)); + int height = random.nextInt(4) + 7; + int radius = height / 4 + random.nextInt(2); + if (radius > 1 && random.nextInt(60) == 0) + pos = pos.above(random.nextInt(30) + 10); + for (int y = 0; y < height; ++y) { + float width = (1.0f - static_cast(y) / height) * static_cast(radius); + int extent = Mth::ceil(width); + for (int x = -extent; x <= extent; ++x) { + float dx = static_cast(Mth::abs(x)) - 0.25f; + for (int z = -extent; z <= extent; ++z) { + float dz = static_cast(Mth::abs(z)) - 0.25f; + if ((x == 0 && z == 0) || !(dx * dx + dz * dz > width * width)) { + if ((x != -extent && x != extent && z != -extent && z != extent) + || !(random.nextFloat() > 0.75f)) { + const BlockState* state = level->getBlockState(pos.offset(x, y, z)); + Block* block = state->getBlock(); + if (state->getMaterial() == Material::AIR || block == Blocks::DIRT + || block == Blocks::SNOW || block == Blocks::ICE) + setBlock(level, pos.offset(x, y, z), Blocks::PACKED_ICE->defaultBlockState()); + if (y != 0 && extent > 1) { + state = level->getBlockState(pos.offset(x, -y, z)); + block = state->getBlock(); + if (state->getMaterial() == Material::AIR || block == Blocks::DIRT + || block == Blocks::SNOW || block == Blocks::ICE) + setBlock(level, pos.offset(x, -y, z), + Blocks::PACKED_ICE->defaultBlockState()); + } + } + } + } + } + } + int rootRadius = radius - 1; + if (rootRadius < 0) + rootRadius = 0; + else if (rootRadius > 1) + rootRadius = 1; + for (int x = -rootRadius; x <= rootRadius; ++x) { + for (int z = -rootRadius; z <= rootRadius; ++z) { + BlockPos root = pos.offset(x, -1, z); + int remaining = 50; + if (std::abs(x) == 1 && std::abs(z) == 1) + remaining = random.nextInt(5); + while (root.getY() > 50) { + const BlockState* state = level->getBlockState(root); + Block* block = state->getBlock(); + if (state->getMaterial() != Material::AIR && block != Blocks::DIRT && block != Blocks::SNOW + && block != Blocks::ICE && block != Blocks::PACKED_ICE) + break; + setBlock(level, root, Blocks::PACKED_ICE->defaultBlockState()); + root = root.below(); + if (--remaining <= 0) { + root = root.below(random.nextInt(5) + 1); + remaining = random.nextInt(5); + } + } + } + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/IceSpikeFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/IceSpikeFeature.h new file mode 100644 index 00000000..27f41e89 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/IceSpikeFeature.h @@ -0,0 +1,9 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" + +class IceSpikeFeature : public Feature { +public: + IceSpikeFeature() = default; + bool place(Level*, Random&, const BlockPos&) override; +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LakeFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LakeFeature.cpp index 36e5e743..02584740 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LakeFeature.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LakeFeature.cpp @@ -1,5 +1,131 @@ #include "net/minecraft/world/level/levelgen/feature/LakeFeature.h" +#include "net/minecraft/client/CMinecraftApp.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/biome/Biome.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/material/Material.h" +#include + LakeFeature::LakeFeature(Block* block) : Feature(false), m_block(block) {} -// bool LakeFeature::place(Level* level, Random& random, const BlockPos& pos); +// NON_MATCHING | score: 5010 (lower is better) +bool LakeFeature::place(Level* level, Random& random, const BlockPos& pos) { + BlockPos origin = pos.offset(-8, 0, -8); + while (origin.getY() >= 6 && level->isEmptyBlock(origin)) + origin = origin.below(); + if (origin.getY() < 5) + return false; + origin = origin.below(4); + + bool cavity[16 * 16 * 8]; + std::memset(cavity, 0, sizeof(cavity)); + if (CConsoleMinecraftApp::sInstance.getLevelGenerationOptions()) { + LevelGenerationOptions* options = CConsoleMinecraftApp::sInstance.getLevelGenerationOptions(); + BlockPos lower(origin.getX(), origin.getY(), origin.getZ()); + BlockPos upper(origin.getX() + 16, origin.getY() + 8, origin.getZ() + 16); + if (options->intersects(lower, upper)) + return false; + } + + int ellipsoids = random.nextInt(4) + 4; + for (int i = 0; i < ellipsoids; ++i) { + double sizeX = random.nextDouble() * 6.0 + 3.0; + double sizeY = random.nextDouble() * 4.0 + 2.0; + double sizeZ = random.nextDouble() * 6.0 + 3.0; + double centerX = sizeX * 0.5 + random.nextDouble() * (16.0 - sizeX - 2.0) + 1.0; + double centerY = sizeY * 0.5 + random.nextDouble() * (8.0 - sizeY - 4.0) + 2.0; + double centerZ = sizeZ * 0.5 + random.nextDouble() * (16.0 - sizeZ - 2.0) + 1.0; + for (int x = 1; x < 15; ++x) { + double dx = (x - centerX) / (sizeX * 0.5); + for (int z = 1; z < 15; ++z) { + double dz = (z - centerZ) / (sizeZ * 0.5); + for (int y = 1; y < 7; ++y) { + double dy = (y - centerY) / (sizeY * 0.5); + if (dz * dz + dx * dx + dy * dy < 1.0) + cavity[(x * 16 + z) * 8 + y] = true; + } + } + } + } + + // Validate the complete boundary before the first world write. + for (int x = 0; x < 16; ++x) { + for (int z = 0; z < 16; ++z) { + for (int y = 0; y < 8; ++y) { + int index = (x * 16 + z) * 8 + y; + bool boundary = !cavity[index] + && ((x < 15 && cavity[index + 128]) || (x > 0 && cavity[index - 128]) + || (z < 15 && cavity[index + 8]) || (z > 0 && cavity[index - 8]) + || (y < 7 && cavity[index + 1]) || (y > 0 && cavity[index - 1])); + if (boundary) { + Material* material = level->getBlockState(origin.offset(x, y, z))->getMaterial(); + if (y >= 4) { + if (material->isLiquid()) + return false; + } else if (!material->isSolid() + && level->getBlockState(origin.offset(x, y, z))->getBlock() != m_block) { + return false; + } + } + } + } + } + + for (int x = 0; x < 16; ++x) { + for (int z = 0; z < 16; ++z) { + for (int y = 0; y < 8; ++y) { + if (cavity[(x * 16 + z) * 8 + y]) + level->setBlock(origin.offset(x, y, z), + (y >= 4 ? Blocks::AIR : m_block)->defaultBlockState(), 2, false); + } + } + } + + for (int x = 0; x < 16; ++x) { + for (int z = 0; z < 16; ++z) { + for (int y = 4; y < 8; ++y) { + if (cavity[(x * 16 + z) * 8 + y]) { + BlockPos below = origin.offset(x, y - 1, z); + if (level->getBlockState(below)->getBlock() == Blocks::DIRT + && level->getBrightness(LightLayer::SKY, origin.offset(x, y, z)) > 0) { + // The field at 0x58 is the biome's top-block ID, not its biome ID. + Block* top + = level->getBiome(below)->m_grass.m_id == 110 ? Blocks::MYCELIUM : Blocks::GRASS; + level->setBlock(below, top->defaultBlockState(), 2, false); + } + } + } + } + } + + if (m_block->defaultBlockState()->getMaterial() == Material::LAVA) { + for (int x = 0; x < 16; ++x) { + for (int z = 0; z < 16; ++z) { + for (int y = 0; y < 8; ++y) { + int index = (x * 16 + z) * 8 + y; + bool boundary = !cavity[index] + && ((x < 15 && cavity[index + 128]) || (x > 0 && cavity[index - 128]) + || (z < 15 && cavity[index + 8]) || (z > 0 && cavity[index - 8]) + || (y < 7 && cavity[index + 1]) || (y > 0 && cavity[index - 1])); + if (boundary && (y < 4 || random.nextInt(2) != 0) + && level->getBlockState(origin.offset(x, y, z))->getMaterial()->isSolid()) { + level->setBlock(origin.offset(x, y, z), Blocks::STONE->defaultBlockState(), 2, false); + } + } + } + } + } + if (m_block->defaultBlockState()->getMaterial() == Material::WATER) { + for (int x = 0; x < 16; ++x) { + for (int z = 0; z < 16; ++z) { + if (level->shouldFreezeIgnoreNeighbors(origin.offset(x, 4, z))) + level->setBlock(origin.offset(x, 4, z), Blocks::ICE->defaultBlockState(), 2, false); + } + } + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeCaveFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeCaveFeature.cpp new file mode 100644 index 00000000..3ab9606b --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeCaveFeature.cpp @@ -0,0 +1,219 @@ +#include "net/minecraft/world/level/levelgen/feature/LargeCaveFeature.h" + +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/util/Mth.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/biome/Biome.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/LiquidBlock.h" +#include "net/minecraft/world/level/levelgen/ChunkPrimer.h" +#include "net/minecraft/world/level/material/LiquidMaterial.h" + +// NON_MATCHING | score: 26811 (lower is better) +void LargeCaveFeature::addTunnel(long long seed, int chunkX, int chunkZ, ChunkPrimer* primer, double x, + double y, double z, float width, float yaw, float pitch, int startStep, + int endStep, double verticalScale) { + Random random(seed); + if (endStep <= 0) { + int range = m_radius * 16 - 16; + endStep = range - random.nextInt(range / 4); + } + + bool room = startStep == -1; + int step = room ? endStep / 2 : startStep; + int branchStep = random.nextInt(endStep / 2) + endStep / 4; + bool steep = random.nextInt(6) == 0; + float pitchVelocity = 0.0f; + float yawVelocity = 0.0f; + double centerX = chunkX * 16 + 8; + double centerZ = chunkZ * 16 + 8; + double reach = width + 2.0f + 16.0f; + + for (; step < endStep; step++) { + double radius = 1.5 + Mth::sin(step * Mth::PI / endStep) * width; + double radiusY = radius * verticalScale; + float cosPitch = Mth::cos(pitch); + float sinPitch = Mth::sin(pitch); + x += cosPitch * Mth::cos(yaw); + y += sinPitch; + z += cosPitch * Mth::sin(yaw); + + pitch = (steep ? 0.92f : 0.7f) * pitch + pitchVelocity * 0.1f; + yaw += yawVelocity * 0.1f; + float pitchRandom1 = random.nextFloat(); + float pitchRandom2 = random.nextFloat(); + float pitchRandom3 = random.nextFloat(); + float yawRandom1 = random.nextFloat(); + float yawRandom2 = random.nextFloat(); + float yawRandom3 = random.nextFloat(); + + if (!room && endStep > 0 && step == branchStep && width > 1.0f) { + long long leftSeed = random.nextLong(); + float leftWidth = random.nextFloat() * 0.5f + 0.5f; + addTunnel(leftSeed, chunkX, chunkZ, primer, x, y, z, leftWidth, yaw - Mth::PI / 2.0f, + pitch / 3.0f, step, endStep, 1.0); + long long rightSeed = random.nextLong(); + float rightWidth = random.nextFloat() * 0.5f + 0.5f; + addTunnel(rightSeed, chunkX, chunkZ, primer, x, y, z, rightWidth, yaw + Mth::PI / 2.0f, + pitch / 3.0f, step, endStep, 1.0); + return; + } + + if (room || random.nextInt(4) != 0) { + double dx = x - centerX; + double dz = z - centerZ; + double remaining = endStep - step; + if (dx * dx + dz * dz - remaining * remaining > reach * reach) + return; + + if (x >= centerX - 16.0 - radius * 2.0 && z >= centerZ - 16.0 - radius * 2.0 + && x <= centerX + 16.0 + radius * 2.0 && z <= centerZ + 16.0 + radius * 2.0) { + int minX = Mth::floor(x - radius) - chunkX * 16 - 1; + int maxX = Mth::floor(x + radius) - chunkX * 16 + 1; + int minY = Mth::floor(y - radiusY) - 1; + int maxY = Mth::floor(y + radiusY) + 1; + int minZ = Mth::floor(z - radius) - chunkZ * 16 - 1; + int maxZ = Mth::floor(z + radius) - chunkZ * 16 + 1; + if (minX < 0) + minX = 0; + if (maxX > 16) + maxX = 16; + if (minY < 1) + minY = 1; + if (maxY > 120) + maxY = 120; + if (minZ < 0) + minZ = 0; + if (maxZ > 16) + maxZ = 16; + + bool water = false; + for (int ix = minX; ix < maxX && !water; ix++) { + for (int iz = minZ; iz < maxZ && !water; iz++) { + for (int iy = maxY + 1; iy >= minY - 1; iy--) { + if (iy >= 0 && iy < 128) { + int id = primer->getBlockId((ix << 11) | (iz << 7) | iy); + if (id == 8 || id == 9) { + water = true; + break; + } + if (iy != minY - 1 && ix != minX && ix != maxX - 1 && iz != minZ + && iz != maxZ - 1) + iy = minY; + } + } + } + } + + if (!water) { + MutableBlockPos pos(0, 0, 0); + Biome::LegacyBlockData lava( + 11, Blocks::LAVA->convertBlockStateToLegacyData(Blocks::LAVA->defaultBlockState())); + Biome::LegacyBlockData air(0, 0); + for (int ix = minX; ix < maxX; ix++) { + double localX = (ix + chunkX * 16 + 0.5 - x) / radius; + for (int iz = minZ; iz < maxZ; iz++) { + double localZ = (iz + chunkZ * 16 + 0.5 - z) / radius; + if (localX * localX + localZ * localZ >= 1.0) + continue; + + bool surface = false; + for (int iy = maxY - 1; iy >= minY; iy--) { + double localY = (iy + 0.5 - y) / radiusY; + if (localY <= -0.7 + || localZ * localZ + localX * localX + localY * localY >= 1.0) + continue; + + int packed = (ix << 11) | (iz << 7) | iy; + int id = primer->getBlockId(packed); + int above = primer->getBlockId(packed + 1); + if (id == 2 || id == 110) + surface = true; + if (!canReplaceBlock(id, above)) + continue; + + if (iy - 1 < 10) { + primer->setBlockAndData(packed, lava.m_id, lava.m_data); + } else { + primer->setBlockAndData(packed, air.m_id, air.m_data); + if (surface && primer->getBlockId(packed - 1) == 3) { + pos.set(ix + chunkX * 16, 0, iz + chunkZ * 16); + Biome* biome = m_level->getBiome(pos); + Block* block = Block::byId(biome->m_grass.m_id); + int data = block->convertBlockStateToLegacyData( + block->defaultBlockState()); + primer->setBlockAndData(packed - 1, biome->m_grass.m_id, data); + } + } + } + } + } + if (room) + return; + } + } + } + + float pitchChange = (pitchRandom1 - pitchRandom2) * pitchRandom3; + pitchVelocity = pitchVelocity * 0.9f + pitchChange + pitchChange; + yawVelocity = yawVelocity * 0.75f + (yawRandom1 - yawRandom2) * yawRandom3 * 4.0f; + } +} + +// name guessed +// NON_MATCHING | score: 325 (lower is better) +bool LargeCaveFeature::canReplaceBlock(int id, int above) { + switch (id) { + case 1: // Stone + case 2: // Grass + case 3: // Dirt + case 24: // Sandstone + case 78: // Snow layer + case 110: // Mycelium + case 159: // Stained hardened clay + case 172: // Hardened clay + case 179: // Red sandstone + return true; + default: + if (id == 12 || id == 13) { + Block* block = Block::byId(above); + return block && block->getMaterial() != Material::WATER; + } + return false; + } +} + +void LargeCaveFeature::addRoom(long long seed, int chunkX, int chunkZ, ChunkPrimer* primer, double x, + double y, double z) { + float width = 1.0f + m_random.nextFloat() * 6.0f; + addTunnel(seed, chunkX, chunkZ, primer, x, y, z, width, 0.0f, 0.0f, -1, -1, 0.5); +} + +void LargeCaveFeature::addFeature(Level*, int sourceX, int sourceZ, int chunkX, int chunkZ, + ChunkPrimer* primer) { + int count = m_random.nextInt(m_random.nextInt(m_random.nextInt(40) + 1) + 1); + if (m_random.nextInt(15) != 0) + count = 0; + + for (int i = 0; i < count; i++) { + double x = sourceX * 16 + m_random.nextInt(16); + double y = m_random.nextInt(m_random.nextInt(120) + 8); + double z = sourceZ * 16 + m_random.nextInt(16); + int tunnels = 1; + + if (m_random.nextInt(4) == 0) { + addRoom(m_random.nextLong(), chunkX, chunkZ, primer, x, y, z); + tunnels += m_random.nextInt(4); + } + + for (int j = 0; j < tunnels; j++) { + float yaw = m_random.nextFloat() * Mth::PI * 2.0f; + float pitch = (m_random.nextFloat() - 0.5f) * 2.0f / 8.0f; + float width = m_random.nextFloat() * 2.0f + m_random.nextFloat(); + if (m_random.nextInt(10) == 0) + width *= m_random.nextFloat() * m_random.nextFloat() * 3.0f + 1.0f; + + addTunnel(m_random.nextLong(), chunkX, chunkZ, primer, x, y, z, width, yaw, pitch, 0, 0, 1.0); + } + } +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeCaveFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeCaveFeature.h index 0be48def..b086c1d9 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeCaveFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeCaveFeature.h @@ -2,4 +2,13 @@ #include "net/minecraft/world/level/levelgen/feature/LargeFeature.h" -class LargeCaveFeature : public LargeFeature {}; +// NON_MATCHING | score: 805 (lower is better) +class LargeCaveFeature : public LargeFeature { +public: + LargeCaveFeature() = default; + void addFeature(Level*, int, int, int, int, ChunkPrimer*) override; + void addRoom(long long, int, int, ChunkPrimer*, double, double, double); + void addTunnel(long long, int, int, ChunkPrimer*, double, double, double, float, float, float, int, int, + double); + bool canReplaceBlock(int, int); +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeFeature.cpp new file mode 100644 index 00000000..54e0f886 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeFeature.cpp @@ -0,0 +1,29 @@ +#include "net/minecraft/world/level/levelgen/feature/LargeFeature.h" + +#include "net/minecraft/world/level/Level.h" + +LargeFeature::LargeFeature() { + m_radius = 8; + m_random = Random(); +} + +LargeFeature::~LargeFeature() = default; + +void LargeFeature::apply(Level* level, int chunkX, int chunkZ, ChunkPrimer* primer) { + int radius = m_radius; + m_level = level; + m_random.setSeed(level->getSeed()); + long long seedX = m_random.nextLong(); + long long seedZ = m_random.nextLong(); + + for (int sourceX = chunkX - radius; sourceX <= chunkX + radius; sourceX++) { + for (int sourceZ = chunkZ - radius; sourceZ <= chunkZ + radius; sourceZ++) { + long long mixedX = sourceX * seedX; + long long mixedZ = sourceZ * seedZ; + m_random.setSeed(mixedX ^ mixedZ ^ level->getSeed()); + addFeature(level, sourceX, sourceZ, chunkX, chunkZ, primer); + } + } +} + +void LargeFeature::addFeature(Level*, int, int, int, int, ChunkPrimer*) {} 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/LargeHellCaveFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeHellCaveFeature.cpp new file mode 100644 index 00000000..a1652a96 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeHellCaveFeature.cpp @@ -0,0 +1,160 @@ +#include "net/minecraft/world/level/levelgen/feature/LargeHellCaveFeature.h" + +#include "net/minecraft/util/Mth.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/levelgen/ChunkPrimer.h" + +// name guessed +void LargeHellCaveFeature::addRoom(long long seed, int chunkX, int chunkZ, ChunkPrimer* primer, double x, + double y, double z) { + addTunnel(seed, chunkX, chunkZ, primer, x, y, z, m_random.nextFloat() * 6.0f + 1.0f, 0.0f, 0.0f, -1, -1, + 0.5); +} + +// name guessed +// NON_MATCHING | score: 20926 (lower is better) +void LargeHellCaveFeature::addTunnel(long long seed, int chunkX, int chunkZ, ChunkPrimer* primer, double x, + double y, double z, float width, float yaw, float pitch, int startStep, + int endStep, double verticalScale) { + Random random(seed); + if (endStep <= 0) { + int range = m_radius * 16 - 16; + endStep = range - random.nextInt(range / 4); + } + bool room = startStep == -1; + int step = room ? endStep / 2 : startStep; + int branchStep = random.nextInt(endStep / 2) + endStep / 4; + bool steep = random.nextInt(6) == 0; + float pitchVelocity = 0.0f; + float yawVelocity = 0.0f; + double centerX = chunkX * 16 + 8; + double centerZ = chunkZ * 16 + 8; + double reach = width + 2.0f + 16.0f; + + for (; step < endStep; ++step) { + double radius = 1.5 + Mth::sin(step * Mth::PI / endStep) * width; + double radiusY = radius * verticalScale; + float cosPitch = Mth::cos(pitch); + float sinPitch = Mth::sin(pitch); + x += cosPitch * Mth::cos(yaw); + y += sinPitch; + z += cosPitch * Mth::sin(yaw); + pitch = (steep ? 0.92f : 0.7f) * pitch + pitchVelocity * 0.1f; + yaw += yawVelocity * 0.1f; + float pitchRandom1 = random.nextFloat(); + float pitchRandom2 = random.nextFloat(); + float pitchRandom3 = random.nextFloat(); + float yawRandom1 = random.nextFloat(); + float yawRandom2 = random.nextFloat(); + float yawRandom3 = random.nextFloat(); + + if (!room && width > 1.0f && step == branchStep) { + long long leftSeed = random.nextLong(); + float leftWidth = random.nextFloat() * 0.5f + 0.5f; + addTunnel(leftSeed, chunkX, chunkZ, primer, x, y, z, leftWidth, yaw - Mth::PI / 2.0f, + pitch / 3.0f, step, endStep, 1.0); + long long rightSeed = random.nextLong(); + float rightWidth = random.nextFloat() * 0.5f + 0.5f; + addTunnel(rightSeed, chunkX, chunkZ, primer, x, y, z, rightWidth, yaw + Mth::PI / 2.0f, + pitch / 3.0f, step, endStep, 1.0); + return; + } + if (room || random.nextInt(4) != 0) { + double dx = x - centerX; + double dz = z - centerZ; + double remaining = endStep - step; + if (dx * dx + dz * dz - remaining * remaining > reach * reach) + return; + if (x >= centerX - 16.0 - radius * 2.0 && z >= centerZ - 16.0 - radius * 2.0 + && x <= centerX + 16.0 + radius * 2.0 && z <= centerZ + 16.0 + radius * 2.0) { + int minX = Mth::floor(x - radius) - chunkX * 16 - 1; + int maxX = Mth::floor(x + radius) - chunkX * 16 + 1; + int minY = Mth::floor(y - radiusY) - 1; + int maxY = Mth::floor(y + radiusY) + 1; + int minZ = Mth::floor(z - radius) - chunkZ * 16 - 1; + int maxZ = Mth::floor(z + radius) - chunkZ * 16 + 1; + if (minX < 0) + minX = 0; + if (maxX > 16) + maxX = 16; + if (minY < 1) + minY = 1; + if (maxY > 120) + maxY = 120; + if (minZ < 0) + minZ = 0; + if (maxZ > 16) + maxZ = 16; + + bool lava = false; + for (int ix = minX; ix < maxX && !lava; ++ix) { + for (int iz = minZ; iz < maxZ && !lava; ++iz) { + for (int iy = maxY + 1; iy >= minY - 1; --iy) { + if (iy >= 0 && iy < 128) { + const BlockState* state = primer->getState(ix, iy, iz); + if (state->getBlock() == Blocks::FLOWING_LAVA + || state->getBlock() == Blocks::LAVA) { + lava = true; + break; + } + if (iy != minY - 1 && ix != minX && ix != maxX - 1 && iz != minZ + && iz != maxZ - 1) + iy = minY; + } + } + } + } + if (!lava) { + for (int ix = minX; ix < maxX; ++ix) { + double localX = (ix + chunkX * 16 + 0.5 - x) / radius; + for (int iz = minZ; iz < maxZ; ++iz) { + double localZ = (iz + chunkZ * 16 + 0.5 - z) / radius; + for (int iy = maxY - 1; iy >= minY; --iy) { + double localY = (iy + 0.5 - y) / radiusY; + if (localY > -0.7 + && localZ * localZ + localX * localX + localY * localY < 1.0) { + const BlockState* state = primer->getState(ix, iy, iz); + if (state->getBlock() == Blocks::NETHERRACK + || state->getBlock() == Blocks::DIRT + || state->getBlock() == Blocks::GRASS) + primer->setState(ix, iy, iz, Blocks::AIR->defaultBlockState()); + } + } + } + } + if (room) + return; + } + } + } + float pitchChange = (pitchRandom1 - pitchRandom2) * pitchRandom3; + pitchVelocity = pitchVelocity * 0.9f + pitchChange + pitchChange; + yawVelocity = yawVelocity * 0.75f + (yawRandom1 - yawRandom2) * yawRandom3 * 4.0f; + } +} + +// name guessed +// NON_MATCHING | score: 1810 (lower is better) +void LargeHellCaveFeature::addFeature(Level*, int sourceX, int sourceZ, int chunkX, int chunkZ, + ChunkPrimer* primer) { + int count = m_random.nextInt(m_random.nextInt(m_random.nextInt(10) + 1) + 1); + if (m_random.nextInt(5) != 0) + count = 0; + for (int i = 0; i < count; ++i) { + double x = sourceX * 16 + m_random.nextInt(16); + double y = m_random.nextInt(128); + double z = sourceZ * 16 + m_random.nextInt(16); + int tunnels = 1; + if (m_random.nextInt(4) == 0) { + addRoom(m_random.nextLong(), chunkX, chunkZ, primer, x, y, z); + tunnels += m_random.nextInt(4); + } + for (int j = 0; j < tunnels; ++j) { + float yaw = m_random.nextFloat() * Mth::PI * 2.0f; + float pitch = (m_random.nextFloat() - 0.5f) * 2.0f * 0.125f; + float width = (m_random.nextFloat() * 2.0f + m_random.nextFloat()) * 2.0f; + addTunnel(m_random.nextLong(), chunkX, chunkZ, primer, x, y, z, width, yaw, pitch, 0, 0, 0.5); + } + } +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeHellCaveFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeHellCaveFeature.h new file mode 100644 index 00000000..54516542 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeHellCaveFeature.h @@ -0,0 +1,13 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/LargeFeature.h" + +// NON_MATCHING | score: 805 (lower is better) +class LargeHellCaveFeature : public LargeFeature { +public: + LargeHellCaveFeature() = default; + void addRoom(long long, int, int, ChunkPrimer*, double, double, double); + void addTunnel(long long, int, int, ChunkPrimer*, double, double, double, float, float, float, int, int, + double); + void addFeature(Level*, int, int, int, int, ChunkPrimer*) override; +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaJungleTreeFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaJungleTreeFeature.cpp new file mode 100644 index 00000000..492cdcc9 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaJungleTreeFeature.cpp @@ -0,0 +1,102 @@ +#include "net/minecraft/world/level/levelgen/feature/MegaJungleTreeFeature.h" + +#include "NX/Platform.h" +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/util/Mth.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/VineBlock.h" + +// name guessed +MegaJungleTreeFeature::MegaJungleTreeFeature(bool update, int minHeight, int heightRange, + const BlockState* trunk, const BlockState* leaves) + : MegaTreeFeature(update, minHeight, heightRange, trunk, leaves) {} +MegaJungleTreeFeature::~MegaJungleTreeFeature() = default; + +// name guessed +void MegaJungleTreeFeature::createCrown(Level* level, const BlockPos& pos, int radius) { + for (int y = 0; y >= -2; --y) + placeDoubleTrunkLeaves(level, pos.above(y), radius + 1 - y); +} + +// name guessed +void MegaJungleTreeFeature::placeVine(Level* level, Random& random, const BlockPos& pos, + const BooleanProperty* property) { + if (random.nextInt(3) > 0 && level->isEmptyBlock(pos)) + setBlock(level, pos, + Blocks::VINE->defaultBlockState()->setValue(const_cast(property), true)); +} + +// name guessed +bool MegaJungleTreeFeature::place(Level* level, Random& random, const BlockPos& pos) { + PIXBeginNamedEvent(0, "MegaJungleTreeFeature::place"); + int height = calcTreeHeigth(random); + if (!prepareTree(level, random, pos, height)) { + PIXEndNamedEvent(); + return false; + } + PIXBeginNamedEvent(0, "Create crown"); + createCrown(level, pos.above(height), 2); + PIXEndNamedEvent(); + int branchY = pos.getY() + height - 2 - random.nextInt(4); + PIXBeginNamedEvent(0, "Place leaves"); + MutableBlockPos branch(0, 0, 0); + for (; branchY > pos.getY() + height / 2; branchY -= random.nextInt(4) + 2) { + float angle = random.nextFloat() * (Mth::PI * 2.0f); + int x = pos.getX() + static_cast(0.5f + Mth::cos(angle) * 4.0f); + int z = pos.getZ() + static_cast(0.5f + Mth::sin(angle) * 4.0f); + for (int segment = 0; segment < 5; ++segment) { + x = pos.getX() + static_cast(Mth::cos(angle) * segment + 1.5f); + z = pos.getZ() + static_cast(Mth::sin(angle) * segment + 1.5f); + branch.set(x, branchY - 3 + segment / 2, z); + setBlock(level, branch, m_trunk); + } + int depth = 1 + random.nextInt(2); + for (int y = branchY - depth; y <= branchY; ++y) { + branch.set(x, y, z); + placeSingleTrunkLeaves(level, branch, 1 - (y - branchY)); + } + } + PIXEndNamedEvent(); + PIXBeginNamedEvent(0, "Place trunk"); + for (int y = 0; y < height; ++y) { + BlockPos northWest = pos.above(y); + if (isFree(level->getBlockState(northWest)->getBlock())) { + setBlock(level, northWest, m_trunk); + if (y > 0) { + placeVine(level, random, northWest.west(), VineBlock::EAST); + placeVine(level, random, northWest.north(), VineBlock::SOUTH); + } + } + if (y < height - 1) { + BlockPos northEast = northWest.east(); + if (isFree(level->getBlockState(northEast)->getBlock())) { + setBlock(level, northEast, m_trunk); + if (y > 0) { + placeVine(level, random, northEast.east(), VineBlock::WEST); + placeVine(level, random, northEast.north(), VineBlock::SOUTH); + } + } + BlockPos southEast = northWest.south().east(); + if (isFree(level->getBlockState(southEast)->getBlock())) { + setBlock(level, southEast, m_trunk); + if (y > 0) { + placeVine(level, random, southEast.east(), VineBlock::WEST); + placeVine(level, random, southEast.south(), VineBlock::NORTH); + } + } + BlockPos southWest = northWest.south(); + if (isFree(level->getBlockState(southWest)->getBlock())) { + setBlock(level, southWest, m_trunk); + if (y > 0) { + placeVine(level, random, southWest.west(), VineBlock::EAST); + placeVine(level, random, southWest.south(), VineBlock::NORTH); + } + } + } + } + PIXEndNamedEvent(); + PIXEndNamedEvent(); + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaJungleTreeFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaJungleTreeFeature.h new file mode 100644 index 00000000..37489778 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaJungleTreeFeature.h @@ -0,0 +1,13 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/MegaTreeFeature.h" + +class MegaJungleTreeFeature : public MegaTreeFeature { +public: + MegaJungleTreeFeature(bool update, int minHeight, int heightRange, const BlockState* trunk, + const BlockState* leaves); + ~MegaJungleTreeFeature() override; + bool place(Level*, Random&, const BlockPos&) override; + void createCrown(Level*, const BlockPos&, int); + void placeVine(Level*, Random&, const BlockPos&, const BooleanProperty*); +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaPineTreeFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaPineTreeFeature.cpp new file mode 100644 index 00000000..70898ae8 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaPineTreeFeature.cpp @@ -0,0 +1,108 @@ +#include "net/minecraft/world/level/levelgen/feature/MegaPineTreeFeature.h" + +#include "NX/Platform.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/util/Mth.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/DirtBlock.h" +#include "net/minecraft/world/level/block/OldLeafBlock.h" +#include "net/minecraft/world/level/block/OldLogBlock.h" +#include "net/minecraft/world/level/material/Material.h" +#include + +const BlockState* MegaPineTreeFeature::TRUNK; // name guessed +const BlockState* MegaPineTreeFeature::LEAVES; +const BlockState* MegaPineTreeFeature::PODZOL; + +void MegaPineTreeFeature::staticCtor() { + TRUNK = Blocks::LOG->defaultBlockState()->setValue(OldLogBlock::VARIANT, PlanksBlock::Variant::SPRUCE); + LEAVES + = Blocks::LEAVES->defaultBlockState()->setValue(OldLeafBlock::VARIANT, PlanksBlock::Variant::SPRUCE); + PODZOL = Blocks::DIRT->defaultBlockState()->setValue(DirtBlock::VARIANT, DirtBlock::Variant::PODZOL); +} + +// name guessed +MegaPineTreeFeature::MegaPineTreeFeature(bool update, bool useBaseHeight) + : MegaTreeFeature(update, 13, 15, TRUNK, LEAVES), m_useBaseHeight(useBaseHeight) {} +MegaPineTreeFeature::~MegaPineTreeFeature() = default; + +// name guessed +void MegaPineTreeFeature::createCrown(Level* level, int x, int z, int y, int radius, Random& random) { + int depth = random.nextInt(5) + (m_useBaseHeight ? m_minHeight : 3); + int previousRadius = 0; + for (int currentY = y - depth; currentY <= y; ++currentY) { + int distance = y - currentY; + int width = radius + Mth::floor(static_cast(distance) / depth * 3.5f); + placeDoubleTrunkLeaves( + level, BlockPos(x, currentY, z), + width + (distance > 0 && width == previousRadius && (currentY & 1) == 0 ? 1 : 0)); + previousRadius = width; + } +} + +// name guessed +bool MegaPineTreeFeature::place(Level* level, Random& random, const BlockPos& pos) { + int height = calcTreeHeigth(random); + if (!prepareTree(level, random, pos, height)) + return false; + createCrown(level, pos.getX(), pos.getZ(), pos.getY() + height, 0, random); + for (int y = 0; y < height; ++y) { + const BlockState* state = level->getBlockState(pos.above(y)); + if (state->getMaterial() == Material::AIR || state->getMaterial() == Material::LEAVES) + setBlock(level, pos.above(y), m_trunk); + if (y < height - 1) { + state = level->getBlockState(pos.offset(1, y, 0)); + if (state->getMaterial() == Material::AIR || state->getMaterial() == Material::LEAVES) + setBlock(level, pos.offset(1, y, 0), m_trunk); + state = level->getBlockState(pos.offset(1, y, 1)); + if (state->getMaterial() == Material::AIR || state->getMaterial() == Material::LEAVES) + setBlock(level, pos.offset(1, y, 1), m_trunk); + state = level->getBlockState(pos.offset(0, y, 1)); + if (state->getMaterial() == Material::AIR || state->getMaterial() == Material::LEAVES) + setBlock(level, pos.offset(0, y, 1), m_trunk); + } + } + return true; +} + +// name guessed +void MegaPineTreeFeature::placePodzolAt(Level* level, const BlockPos& pos) { + for (int y = 2; y >= -3; --y) { + BlockPos candidate = pos.above(y); + const BlockState* state = level->getBlockState(candidate); + Block* block = state->getBlock(); + if (block == Blocks::GRASS || block == Blocks::DIRT) { + setBlock(level, candidate, PODZOL); + return; + } + if (state->getMaterial() != Material::AIR && y < 0) + break; + } +} + +// name guessed +void MegaPineTreeFeature::placePodzolCircle(Level* level, const BlockPos& pos) { + for (int x = -2; x <= 2; ++x) + for (int z = -2; z <= 2; ++z) + if (std::abs(x) != 2 || std::abs(z) != 2) + placePodzolAt(level, pos.offset(x, 0, z)); +} + +// name guessed +void MegaPineTreeFeature::postPlaceTree(Level* level, Random& random, const BlockPos& pos) { + PIXBeginNamedEvent(0, "MegaPineTreeFeature::postPlaceTree"); + placePodzolCircle(level, pos.west().north()); + placePodzolCircle(level, pos.east(2).north()); + placePodzolCircle(level, pos.west().south(2)); + placePodzolCircle(level, pos.east(2).south(2)); + for (int i = 0; i < 5; ++i) { + int value = random.nextInt(64); + int x = value % 8; + int z = value / 8; + if (x == 0 || x == 7 || z == 0 || z == 7) + placePodzolCircle(level, pos.offset(x - 3, 0, z - 3)); + } + PIXEndNamedEvent(); +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaPineTreeFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaPineTreeFeature.h index c43fb308..efa5cce3 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaPineTreeFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaPineTreeFeature.h @@ -2,8 +2,22 @@ #include "net/minecraft/world/level/levelgen/feature/MegaTreeFeature.h" -// STUB class MegaPineTreeFeature : public MegaTreeFeature { public: + static const BlockState* TRUNK; + static const BlockState* LEAVES; + static const BlockState* PODZOL; + MegaPineTreeFeature(bool update, bool useBaseHeight); + ~MegaPineTreeFeature() override; static void staticCtor(); + bool place(Level*, Random&, const BlockPos&) override; + void postPlaceTree(Level*, Random&, const BlockPos&) override; + void createCrown(Level*, int x, int z, int y, int radius, Random&); + void placePodzolAt(Level*, const BlockPos&); + void placePodzolCircle(Level*, const BlockPos&); + +private: + bool m_useBaseHeight; }; + +ASSERT_SIZEOF(MegaPineTreeFeature, 0x30) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp new file mode 100644 index 00000000..ea1ef8e2 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp @@ -0,0 +1,93 @@ +#include "net/minecraft/world/level/levelgen/feature/MegaTreeFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/material/Material.h" + +// name guessed +MegaTreeFeature::MegaTreeFeature(bool update, int minHeight, int heightRange, const BlockState* trunk, + const BlockState* leaves) + : AbstractTreeFeature(update, minHeight, trunk, leaves, false), m_heightRange(heightRange) {} + +// name guessed +int MegaTreeFeature::calcTreeHeigth(Random& random) { + int height = random.nextInt(3) + m_minHeight; + if (m_heightRange > 1) + height += random.nextInt(m_heightRange); + return height; +} + +// name guessed +// NON_MATCHING | score: 1640 (lower is better) +bool MegaTreeFeature::checkIsFree(Level* level, const BlockPos& pos, int height) { + if (pos.getY() < 1 || pos.getY() + height > 255) + return false; + bool free = true; + for (int y = 0; y <= height + 1; ++y) { + int radius = y == 0 ? 1 : 2; + for (int x = -radius; x <= radius && free; ++x) { + for (int z = -radius; z <= radius && free; ++z) { + if (pos.getY() + y < 0 || pos.getY() + y > 255) + free = false; + else + free = isFree(level->getBlockState(pos.offset(x, y, z))->getBlock()); + } + } + } + return free; +} + +// name guessed +bool MegaTreeFeature::makeDirtFloor(const BlockPos& pos, Level* level) { + BlockPos below = pos.below(); + Block* ground = level->getBlockState(below)->getBlock(); + if ((ground != Blocks::GRASS && ground != Blocks::DIRT) || pos.getY() <= 1) + return false; + setDirtAt(level, below); + setDirtAt(level, below.east()); + setDirtAt(level, below.south()); + setDirtAt(level, below.south().east()); + return true; +} + +// name guessed +bool MegaTreeFeature::prepareTree(Level* level, Random&, const BlockPos& pos, int height) { + if (checkIsFree(level, pos, height)) + return makeDirtFloor(pos, level); + return false; +} + +// name guessed +// NON_MATCHING | score: 70 (lower is better) +void MegaTreeFeature::placeDoubleTrunkLeaves(Level* level, const BlockPos& pos, int radius) { + int squared = radius * radius; + for (int x = -radius; x <= radius + 1; ++x) { + for (int z = -radius; z <= radius + 1; ++z) { + int dx = x - 1; + int dz = z - 1; + if (x * x + z * z <= squared || dx * dx + z * z <= squared || dx * dx + dz * dz <= squared + || x * x + dz * dz <= squared) { + BlockPos candidate = pos.offset(x, 0, z); + Material* material = level->getBlockState(candidate)->getMaterial(); + if (material == Material::AIR || material == Material::LEAVES) + setBlock(level, candidate, m_leaves); + } + } + } +} + +// name guessed +void MegaTreeFeature::placeSingleTrunkLeaves(Level* level, const BlockPos& pos, int radius) { + for (int x = -radius; x <= radius; ++x) { + for (int z = -radius; z <= radius; ++z) { + if (x * x + z * z <= radius * radius) { + BlockPos candidate = pos.offset(x, 0, z); + Material* material = level->getBlockState(candidate)->getMaterial(); + if (material == Material::AIR || material == Material::LEAVES) + setBlock(level, candidate, m_leaves); + } + } + } +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaTreeFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaTreeFeature.h index 54d66836..932f6934 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaTreeFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaTreeFeature.h @@ -2,5 +2,18 @@ #include "net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h" -// STUB -class MegaTreeFeature : public AbstractTreeFeature {}; +class MegaTreeFeature : public AbstractTreeFeature { +public: + MegaTreeFeature(bool update, int minHeight, int heightRange, const BlockState*, const BlockState*); + virtual int calcTreeHeigth(Random&); + virtual bool prepareTree(Level*, Random&, const BlockPos&, int); + virtual void placeDoubleTrunkLeaves(Level*, const BlockPos&, int); + virtual void placeSingleTrunkLeaves(Level*, const BlockPos&, int); + bool checkIsFree(Level*, const BlockPos&, int); + bool makeDirtFloor(const BlockPos&, Level*); + +protected: + int m_heightRange; +}; + +ASSERT_SIZEOF(MegaTreeFeature, 0x30) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MelonFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MelonFeature.cpp new file mode 100644 index 00000000..85972940 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MelonFeature.cpp @@ -0,0 +1,25 @@ +#include "net/minecraft/world/level/levelgen/feature/MelonFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" + +// name guessed +MelonFeature::MelonFeature() : Feature(false) {} +// name guessed +MelonFeature::~MelonFeature() = default; + +// name guessed +bool MelonFeature::place(Level* level, Random& random, const BlockPos& origin) { + for (int i = 0; i < 64; ++i) { + int x = random.nextInt(8) - random.nextInt(8); + int y = random.nextInt(4) - random.nextInt(4); + int z = random.nextInt(8) - random.nextInt(8); + BlockPos candidate = origin.offset(x, y, z); + if (Blocks::MELON_BLOCK->mayPlace(level, candidate) + && level->getBlockState(candidate.below())->getBlock() == Blocks::GRASS) + level->setBlock(candidate, Blocks::MELON_BLOCK->defaultBlockState(), 2, false); + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MelonFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MelonFeature.h new file mode 100644 index 00000000..59368284 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MelonFeature.h @@ -0,0 +1,10 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" + +class MelonFeature : public Feature { +public: + MelonFeature(); + ~MelonFeature() override; + bool place(Level*, Random&, const BlockPos&) override; +}; 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.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.cpp new file mode 100644 index 00000000..bbfb3691 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.cpp @@ -0,0 +1,109 @@ +#include "net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/core/Direction.h" +#include "net/minecraft/resources/ResourceLocation.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/entity/EntityIO.h" +#include "net/minecraft/world/level/BaseMobSpawner.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/ChestBlock.h" +#include "net/minecraft/world/level/block/entity/MobSpawnerBlockEntity.h" +#include "net/minecraft/world/level/block/entity/RandomizableLockableContainerBlockEntity.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/material/Material.h" +#include "net/minecraft/world/level/storage/loot/BuiltInLootTables.h" + +// name guessed +MonsterRoomFeature::MonsterRoomFeature() : Feature(false) {} + +// NON_MATCHING | score: 8414 (lower is better) +bool MonsterRoomFeature::place(Level* level, Random& random, const BlockPos& pos) { + int radiusX = random.nextInt(2) + 2; + int radiusZ = random.nextInt(2) + 2; + int openings = 0; + for (int x = -radiusX - 1; x <= radiusX + 1; ++x) { + for (int y = -1; y <= 4; ++y) { + for (int z = -radiusZ - 1; z <= radiusZ + 1; ++z) { + BlockPos candidate = pos.offset(x, y, z); + bool solid = level->getBlockState(candidate)->getMaterial()->isSolid(); + if (y == -1 && !solid) + return false; + if (y == 4 && !solid) + return false; + if ((x == -radiusX - 1 || x == radiusX + 1 || z == -radiusZ - 1 || z == radiusZ + 1) && y == 0 + && level->isEmptyBlock(candidate) && level->isEmptyBlock(candidate.above())) + ++openings; + } + } + } + if (openings < 1 || openings > 5) + return false; + for (int x = -radiusX - 1; x <= radiusX + 1; ++x) { + for (int y = 3; y >= -1; --y) { + for (int z = -radiusZ - 1; z <= radiusZ + 1; ++z) { + BlockPos candidate = pos.offset(x, y, z); + if (x == -radiusX - 1 || y == -1 || z == -radiusZ - 1 || x == radiusX + 1 + || z == radiusZ + 1) { + if (candidate.getY() >= 0 + && !level->getBlockState(candidate.below())->getMaterial()->isSolid()) { + level->removeBlock(candidate); + } else if (level->getBlockState(candidate)->getMaterial()->isSolid() + && level->getBlockState(candidate)->getBlock() != Blocks::CHEST) { + if (y == -1 && random.nextInt(4) != 0) + level->setBlock(candidate, Blocks::MOSSY_COBBLESTONE->defaultBlockState(), 2, + false); + else + level->setBlock(candidate, Blocks::COBBLESTONE->defaultBlockState(), 2, false); + } + } else if (level->getBlockState(candidate)->getBlock() != Blocks::CHEST) { + level->removeBlock(candidate); + } + } + } + } + for (int chest = 0; chest < 2; ++chest) { + for (int attempt = 0; attempt < 3; ++attempt) { + BlockPos candidate(pos.getX() + random.nextInt(radiusX * 2 + 1) - radiusX, pos.getY(), + pos.getZ() + random.nextInt(radiusZ * 2 + 1) - radiusZ); + if (!level->isEmptyBlock(candidate)) + continue; + int walls = 0; + arrayWithLength directions = Direction::Plane::HORIZONTAL->iterator(); + for (unsigned int i = 0; i < directions.m_length; ++i) { + if (level->getBlockState(candidate.relative(directions.get(i)))->getMaterial()->isSolid()) + ++walls; + } + if (walls == 1) { + ChestBlock* chestBlock = static_cast(Blocks::CHEST); + level->setBlock(candidate, + chestBlock->reorient(level, candidate, chestBlock->defaultBlockState()), 2, + false); + std::shared_ptr entity = level->getBlockEntity(candidate); + if (entity->isType(eChestBlockEntity)) { + auto container + = std::static_pointer_cast(entity); + container->setLootTable(&BuiltInLootTables::SIMPLE_DUNGEON, random.nextLong()); + } + break; + } + } + } + level->setBlock(pos, Blocks::MOB_SPAWNER->defaultBlockState(), 2, false); + std::shared_ptr entity = level->getBlockEntity(pos); + if (entity->isType(eMobSpawnerBlockEntity)) { + auto spawner = std::static_pointer_cast(entity); + spawner->getSpawner()->setEntityId(ResourceLocation(randomEntityId(random))); + } + return true; +} + +// name guessed +// NON_MATCHING | score: 1142 (lower is better) +std::wstring MonsterRoomFeature::randomEntityId(Random& random) { + static std::wstring types[] + = {EntityIO::getKey(eSkeleton).toString(), EntityIO::getKey(eZombie).toString(), + EntityIO::getKey(eZombie).toString(), EntityIO::getKey(eSpider).toString()}; + return types[random.nextInt(4)]; +} 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/OreFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/OreFeature.cpp new file mode 100644 index 00000000..d441717b --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/OreFeature.cpp @@ -0,0 +1,158 @@ +#include "net/minecraft/world/level/levelgen/feature/OreFeature.h" + +#include "NX/Platform.h" +#include "net/minecraft/client/CMinecraftApp.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/util/Mth.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/StoneBlock.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include +#include + +// NON_MATCHING | score: 1679 (lower is better) +OreFeature::OreFeature(const BlockState* state, int size) : Feature(false), m_ore(0, 0) { + static const NaturalStonePredicate predicate; + init(state, size, &predicate); +} + +// name guessed +OreFeature::OreFeature(const BlockState* state, int size, + const Predicate* predicate) + : Feature(false), m_ore(0, 0) { + init(state, size, predicate); +} + +// NON_MATCHING | score: 5 (lower is better) +OreFeature::NaturalStonePredicate::~NaturalStonePredicate() {} + +// name guessed +void OreFeature::init(const BlockState* state, int size, + const Predicate* predicate) { + int id = Block::getId(state->getBlock()); + int data = state->getBlock()->convertBlockStateToLegacyData(state); + m_ore = Biome::LegacyBlockData(id, data); + m_size = size; + m_predicate = predicate; +} + +// name guessed +// NON_MATCHING | score: 340 (lower is better) +bool OreFeature::NaturalStonePredicate::apply(const Biome::LegacyBlockData& block) const { + static int stoneId = Block::getId(Blocks::STONE); + if (block.m_id == stoneId) + return StoneBlock::Variant::VARIANTS[block.m_data]->isNatural(); + return false; +} + +// NON_MATCHING | score: 14928 (lower is better) +bool OreFeature::place(Level* level, Random& random, const BlockPos& pos) { + PIXBeginNamedEvent(0.0f, "Place Ore Feature"); + PIXBeginNamedEvent(0.0f, "Prep"); + float angle = random.nextFloat() * Mth::PI; + double startX = float(pos.getX() + 8) + Mth::sin(angle) * float(m_size) * 0.125f; + double endX = float(pos.getX() + 8) - Mth::sin(angle) * float(m_size) * 0.125f; + double startZ = float(pos.getZ() + 8) + Mth::cos(angle) * float(m_size) * 0.125f; + double endZ = float(pos.getZ() + 8) - Mth::cos(angle) * float(m_size) * 0.125f; + double startY = pos.getY() + random.nextInt(3) - 2; + double endY = pos.getY() + random.nextInt(3) - 2; + PIXEndNamedEvent(); + + PIXBeginNamedEvent(0.0f, "Level generation options"); + double maximumRadius = (double(m_size) * 0.0625 + double(m_size) * 0.0625 + 1.0) * 0.5; + int lowerX = Mth::floor(std::min(startX, endX) - maximumRadius); + int lowerY = Mth::floor(std::min(startY, endY) - maximumRadius); + int lowerZ = Mth::floor(std::min(startZ, endZ) - maximumRadius); + int upperX = Mth::floor(std::max(startX, endX) + maximumRadius); + int upperY = Mth::floor(std::max(startY, endY) + maximumRadius); + int upperZ = Mth::floor(std::max(startZ, endZ) + maximumRadius); + int height = upperY - lowerY + 1; + int depth = upperZ - lowerZ + 1; + unsigned char visited[2048]; + std::memset(visited, 0, ((upperX - lowerX + 1) * height * depth + 7) / 8); + LevelGenerationOptions* options = nullptr; + bool checkExclusions = false; + if (CConsoleMinecraftApp::sInstance.getLevelGenerationOptions()) { + options = CConsoleMinecraftApp::sInstance.getLevelGenerationOptions(); + BlockPos lower(lowerX, lowerY, lowerZ); + BlockPos upper(upperX, upperY, upperZ); + checkExclusions = options->intersects(lower, upper); + } + PIXEndNamedEvent(); + + int seaLevel = level->getSeaLevel(); + PIXBeginNamedEvent(0.0f, "Attempting %d placements", m_size); + for (int step = 0; step <= m_size; step++) { + float fraction = float(step) / float(m_size); + double x = startX + (endX - startX) * double(fraction); + double y = startY + (endY - startY) * double(fraction); + double z = startZ + (endZ - startZ) * double(fraction); + double size = random.nextDouble() * double(m_size) * 0.0625; + double radius = (double(Mth::sin(fraction * Mth::PI) + 1.0f) * size + 1.0) * 0.5; + int minX = Mth::floor(x - radius); + int minY = Mth::floor(y - radius); + int minZ = Mth::floor(z - radius); + int maxX = Mth::floor(x + radius); + int maxY = Mth::floor(y + radius); + int maxZ = Mth::floor(z + radius); + + if (checkExclusions) { + PIXBeginNamedEvent(0.0f, "Check intersects"); + BlockPos lower(minX, minY, minZ); + BlockPos upper(maxX, maxY, maxZ); + bool excluded = options->intersects(lower, upper); + PIXEndNamedEvent(); + if (excluded) + continue; + } + if (double(seaLevel) < startY) { + PIXBeginNamedEvent(0.0f, "Early reject tests"); + bool aboveSurface + = level->getHeightmap(minX, minZ) < minY && level->getHeightmap(maxX, minZ) < minY + && level->getHeightmap(minX, maxZ) < minY && level->getHeightmap(maxX, maxZ) < minY; + PIXEndNamedEvent(); + if (aboveSurface) + continue; + } + + PIXBeginNamedEvent(0.0f, "Setting blocks"); + int radiusSquared = int(radius * radius * 65536.0); + int dx = int((double(minX) + 0.5 - x) * 256.0); + for (int ix = minX; ix <= maxX; ix++, dx += 256) { + if (dx * dx >= radiusSquared) + continue; + int dy = int((double(minY) + 0.5 - y) * 256.0); + for (int iy = minY; iy <= maxY; iy++, dy += 256) { + int distanceXY = dx * dx + dy * dy; + if (distanceXY >= radiusSquared) + continue; + int index = ((ix - lowerX) * height + iy - lowerY) * depth + minZ - lowerZ; + int dz = int((double(minZ) + 0.5 - z) * 256.0); + for (int iz = minZ; iz <= maxZ; iz++, dz += 256) { + if (distanceXY + dz * dz < radiusSquared) { + unsigned char mask = 1 << (index & 7); + // The original skips advancing the bit index when it is already visited. + if (visited[index >> 3] & mask) + continue; + visited[index >> 3] |= mask; + PIXBeginNamedEvent(0.0f, "Applying"); + int id = level->getBlockId(ix, iy, iz); + if (id != 0) { + Biome::LegacyBlockData block(id, level->getBlockData(ix, iy, iz)); + if (m_predicate->apply(block)) + level->setBlockAndData(ix, iy, iz, m_ore.m_id, m_ore.m_data, 0x34); + } + PIXEndNamedEvent(); + } + index++; + } + } + } + PIXEndNamedEvent(); + } + PIXEndNamedEvent(); + PIXEndNamedEvent(); + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/OreFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/OreFeature.h index 69050713..ab8d73b5 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/OreFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/OreFeature.h @@ -1,5 +1,7 @@ #pragma once +#include "net/minecraft/world/level/biome/Biome.h" +#include "net/minecraft/world/level/block/state/properties/AbstractProperty.h" #include "net/minecraft/world/level/levelgen/feature/Feature.h" class Block; @@ -7,10 +9,23 @@ class Block; class OreFeature : public Feature { public: OreFeature(const BlockState* state, int unk); + OreFeature(const BlockState* state, int size, const Predicate* predicate); + + class NaturalStonePredicate : public Predicate { + public: + bool apply(const Biome::LegacyBlockData&) const override; + ~NaturalStonePredicate() override; + }; + + using Feature::init; + void init(const BlockState*, int, const Predicate*); bool place(Level* level, Random& random, const BlockPos& pos) override; private: - const BlockState* mBlockState; - int field_18; + Biome::LegacyBlockData m_ore; + int m_size; + const Predicate* m_predicate; }; + +static_assert(sizeof(OreFeature) == 0x20, "OreFeature layout must match the Switch object"); diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/PineFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/PineFeature.cpp new file mode 100644 index 00000000..91ba7c8a --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/PineFeature.cpp @@ -0,0 +1,92 @@ +#include "net/minecraft/world/level/levelgen/feature/PineFeature.h" + +#include "NX/Platform.h" +#include "net/minecraft/client/CMinecraftApp.h" +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/OldLeafBlock.h" +#include "net/minecraft/world/level/block/OldLogBlock.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/material/Material.h" +#include + +const BlockState* PineFeature::TRUNK; // name guessed +const BlockState* PineFeature::LEAVES; + +void PineFeature::staticCtor() { + TRUNK = Blocks::LOG->defaultBlockState()->setValue(OldLogBlock::VARIANT, PlanksBlock::Variant::SPRUCE); + LEAVES = Blocks::LEAVES->defaultBlockState() + ->setValue(OldLeafBlock::VARIANT, PlanksBlock::Variant::SPRUCE) + ->setValue(LeafBlock::CHECK_DECAY, false); +} + +// name guessed +PineFeature::PineFeature() : AbstractTreeFeature(false, 7, TRUNK, LEAVES, false) {} + +// name guessed +bool PineFeature::place(Level* level, Random& random, const BlockPos& pos) { + PIXBeginNamedEvent(0, "PineFeature::place"); + int height = random.nextInt(5) + m_minHeight; + int foliageStart = height - random.nextInt(2) - 3; + int maxRadius = random.nextInt(height - foliageStart + 1) + 1; + if (pos.getY() <= 0 || pos.getY() + height >= 128) { + PIXEndNamedEvent(); + return false; + } + if (CConsoleMinecraftApp::sInstance.getLevelGenerationOptions() + && CConsoleMinecraftApp::sInstance.getLevelGenerationOptions()->intersects( + BlockPos(pos.getX() - maxRadius, pos.getY() - 1, pos.getZ() - maxRadius), + BlockPos(pos.getX() + maxRadius, pos.getY() + height, pos.getZ() + maxRadius))) { + PIXEndNamedEvent(); + return false; + } + bool free = true; + for (int y = pos.getY(); y <= pos.getY() + height + 1 && free; ++y) { + int radius = y - pos.getY() < foliageStart ? 0 : maxRadius; + for (int x = pos.getX() - radius; x <= pos.getX() + radius && free; ++x) { + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius && free; ++z) { + if (y >= 0 && y < 128) + free = isFree(level->getBlockState(BlockPos(x, y, z))->getBlock()); + else + free = false; + } + } + } + if (!free) { + PIXEndNamedEvent(); + return false; + } + Block* ground = level->getBlockState(pos.below())->getBlock(); + if ((ground != Blocks::GRASS && ground != Blocks::DIRT) || pos.getY() >= 127 - height) { + PIXEndNamedEvent(); + return false; + } + setDirtAt(level, pos.below()); + MutableBlockPos leaves(0, 0, 0); + int radius = 0; + for (int y = pos.getY() + height; y >= pos.getY() + foliageStart; --y) { + for (int x = pos.getX() - radius; x <= pos.getX() + radius; ++x) { + int dx = x - pos.getX(); + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius; ++z) { + int dz = z - pos.getZ(); + if (std::abs(dx) == radius && std::abs(dz) == radius && radius > 0) + continue; + leaves.set(x, y, z); + if (!level->getBlockState(leaves)->isSolid()) + setBlock(level, leaves, m_leaves); + } + } + if (radius >= 1 && y == pos.getY() + foliageStart + 1) + --radius; + else if (radius < maxRadius) + ++radius; + } + for (int y = 0; y < height - 1; ++y) { + Material* material = level->getBlockState(pos.above(y))->getMaterial(); + if (material == Material::AIR || material == Material::LEAVES) + setBlock(level, pos.above(y), m_trunk); + } + PIXEndNamedEvent(); + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/PineFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/PineFeature.h index 1cf1d8ae..41c1fd99 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/PineFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/PineFeature.h @@ -2,8 +2,14 @@ #include "net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h" -// STUB class PineFeature : public AbstractTreeFeature { public: + PineFeature(); static void staticCtor(); + bool place(Level*, Random&, const BlockPos&) override; + + static const BlockState* TRUNK; + static const BlockState* LEAVES; }; + +ASSERT_SIZEOF(PineFeature, 0x28) 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/ReedsFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/ReedsFeature.cpp new file mode 100644 index 00000000..24f92be7 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/ReedsFeature.cpp @@ -0,0 +1,36 @@ +#include "net/minecraft/world/level/levelgen/feature/ReedsFeature.h" + +#include "net/minecraft/client/CMinecraftApp.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/ReedsBlock.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/material/Material.h" + +// name guessed +bool ReedsFeature::place(Level* level, Random& random, const BlockPos& pos) { + for (int attempt = 0; attempt < 20; ++attempt) { + BlockPos candidate + = pos.offset(random.nextInt(4) - random.nextInt(4), 0, random.nextInt(4) - random.nextInt(4)); + if (CConsoleMinecraftApp::sInstance.getLevelGenerationOptions() + && CConsoleMinecraftApp::sInstance.getLevelGenerationOptions()->intersects(candidate, candidate)) + continue; + + if (level->isEmptyBlock(candidate)) { + BlockPos below = candidate.below(); + if (level->getBlockState(below.west())->getMaterial() == Material::WATER + || level->getBlockState(below.east())->getMaterial() == Material::WATER + || level->getBlockState(below.north())->getMaterial() == Material::WATER + || level->getBlockState(below.south())->getMaterial() == Material::WATER) { + int height = 2 + random.nextInt(random.nextInt(3) + 1); + for (int y = 0; y < height; ++y) { + if (static_cast(Blocks::REEDS)->canSurvive(level, candidate)) + level->setBlock(candidate.above(y), Blocks::REEDS->defaultBlockState(), 2, false); + } + } + } + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/ReedsFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/ReedsFeature.h new file mode 100644 index 00000000..e4a3bf27 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/ReedsFeature.h @@ -0,0 +1,13 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" + +class ReedsFeature : public Feature { +public: + ReedsFeature() = default; + ~ReedsFeature() override = default; + bool place(Level*, Random&, const BlockPos&) override; +}; + +ASSERT_SIZEOF(ReedsFeature, 0x10) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/RoofTreeFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/RoofTreeFeature.cpp new file mode 100644 index 00000000..3b1e71c7 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/RoofTreeFeature.cpp @@ -0,0 +1,156 @@ +#include "net/minecraft/world/level/levelgen/feature/RoofTreeFeature.h" + +#include "NX/Platform.h" +#include "net/minecraft/core/Direction.h" +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/NewLeafBlock.h" +#include "net/minecraft/world/level/block/NewLogBlock.h" +#include "net/minecraft/world/level/material/Material.h" +#include + +const BlockState* RoofTreeFeature::TRUNK; // name guessed +const BlockState* RoofTreeFeature::LEAVES; + +void RoofTreeFeature::staticCtor() { + TRUNK = Blocks::LOG2->defaultBlockState()->setValue(NewLogBlock::VARIANT, PlanksBlock::Variant::DARK_OAK); + LEAVES = Blocks::LEAVES2->defaultBlockState() + ->setValue(NewLeafBlock::VARIANT, PlanksBlock::Variant::DARK_OAK) + ->setValue(LeafBlock::CHECK_DECAY, false); +} + +// name guessed +RoofTreeFeature::RoofTreeFeature(bool update) : AbstractTreeFeature(update, 6, TRUNK, LEAVES, false) {} +RoofTreeFeature::~RoofTreeFeature() = default; + +// name guessed +bool RoofTreeFeature::canPlaceTreeOfHeight(Level* level, const BlockPos& pos, int height) { + int x = pos.getX(); + int y = pos.getY(); + int z = pos.getZ(); + BlockPos candidate; + for (int dy = 0; dy <= height + 1; ++dy) { + int radius = dy == 0 ? 0 : 1; + if (dy >= height - 1) + radius = 2; + for (int dx = -radius; dx <= radius; ++dx) { + for (int dz = -radius; dz <= radius; ++dz) { + candidate = BlockPos(x + dx, y + dy, z + dz); + if (!isFree(level->getBlockState(candidate)->getBlock())) + return false; + } + } + } + return true; +} + +// name guessed +void RoofTreeFeature::placeLogAt(Level* level, const BlockPos& pos) { + if (isFree(level->getBlockState(pos)->getBlock())) + setBlock(level, pos, m_trunk); +} + +// name guessed +void RoofTreeFeature::placeLeafAt(Level* level, int x, int y, int z) { + BlockPos pos(x, y, z); + if (level->getBlockState(pos)->getMaterial() == Material::AIR) + setBlock(level, pos, m_leaves); +} + +// name guessed +// NON_MATCHING | score: 18451 (lower is better) +bool RoofTreeFeature::place(Level* level, Random& random, const BlockPos& pos) { + PIXBeginNamedEvent(0, "RoofTreeFeature::place"); + int height = random.nextInt(3) + random.nextInt(2) + m_minHeight; + int originX = pos.getX(); + int originY = pos.getY(); + int originZ = pos.getZ(); + if (originY <= 0 || originY + height >= 256) { + PIXEndNamedEvent(); + return false; + } + BlockPos below = pos.below(); + Block* ground = level->getBlockState(below)->getBlock(); + if ((ground != Blocks::GRASS && ground != Blocks::DIRT) || pos.getY() >= 255 - height + || !canPlaceTreeOfHeight(level, pos, height)) { + PIXEndNamedEvent(); + return false; + } + setDirtAt(level, below); + setDirtAt(level, below.east()); + setDirtAt(level, below.south()); + setDirtAt(level, below.south().east()); + const Direction* direction = Direction::Plane::HORIZONTAL->getRandomDirection(random); + int bendStart = height - random.nextInt(4); + int bendLength = 2 - random.nextInt(3); + int trunkX = originX; + int trunkZ = originZ; + int top = originY + height - 1; + MutableBlockPos candidate(0, 0, 0); + for (int y = 0; y < height; ++y) { + if (y >= bendStart && bendLength > 0) { + trunkX += direction->getX(); + trunkZ += direction->getZ(); + --bendLength; + } + int worldY = pos.getY() + y; + candidate.set(trunkX, worldY, trunkZ); + Material* material = level->getBlockState(candidate)->getMaterial(); + if (material == Material::AIR || material == Material::LEAVES) { + placeLogAt(level, candidate); + placeLogAt(level, candidate.east()); + placeLogAt(level, candidate.south()); + placeLogAt(level, candidate.east().south()); + top = worldY; + } + } + for (int dx = -2; dx <= 0; ++dx) { + for (int dz = -2; dz <= 0; ++dz) { + placeLeafAt(level, trunkX + dx, top - 1, trunkZ + dz); + placeLeafAt(level, trunkX + 1 - dx, top - 1, trunkZ + dz); + placeLeafAt(level, trunkX + dx, top - 1, trunkZ + 1 - dz); + placeLeafAt(level, trunkX + 1 - dx, top - 1, trunkZ + 1 - dz); + if ((dx > -2 || dz > -1) && (dx != -1 || dz != -2)) { + placeLeafAt(level, trunkX + dx, top + 1, trunkZ + dz); + placeLeafAt(level, trunkX + 1 - dx, top + 1, trunkZ + dz); + placeLeafAt(level, trunkX + dx, top + 1, trunkZ + 1 - dz); + placeLeafAt(level, trunkX + 1 - dx, top + 1, trunkZ + 1 - dz); + } + } + } + if (random.nextBoolean()) { + placeLeafAt(level, trunkX, top + 2, trunkZ); + placeLeafAt(level, trunkX + 1, top + 2, trunkZ); + placeLeafAt(level, trunkX + 1, top + 2, trunkZ + 1); + placeLeafAt(level, trunkX, top + 2, trunkZ + 1); + } + for (int dx = -3; dx <= 4; ++dx) { + for (int dz = -3; dz <= 4; ++dz) { + if ((dx != -3 || dz != -3) && (dx != -3 || dz != 4) && (dx != 4 || dz != -3) + && (dx != 4 || dz != 4) && (std::abs(dx) < 3 || std::abs(dz) < 3)) + placeLeafAt(level, trunkX + dx, top, trunkZ + dz); + } + } + for (int dx = -1; dx <= 2; ++dx) { + for (int dz = -1; dz <= 2; ++dz) { + if ((dx < 0 || dx > 1 || dz < 0 || dz > 1) && random.nextInt(3) == 0) { + int length = random.nextInt(3) + 2; + for (int dy = 0; dy < length; ++dy) { + BlockPos branch(originX + dx, top - 1 - dy, originZ + dz); + placeLogAt(level, branch); + } + for (int x = -1; x <= 1; ++x) + for (int z = -1; z <= 1; ++z) + placeLeafAt(level, trunkX + dx + x, top, trunkZ + dz + z); + for (int x = -2; x <= 2; ++x) + for (int z = -2; z <= 2; ++z) + if (std::abs(x) != 2 || std::abs(z) != 2) + placeLeafAt(level, trunkX + dx + x, top - 1, trunkZ + dz + z); + } + } + } + PIXEndNamedEvent(); + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/RoofTreeFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/RoofTreeFeature.h index d68c4791..4661a3a4 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/RoofTreeFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/RoofTreeFeature.h @@ -2,8 +2,17 @@ #include "net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h" -// STUB class RoofTreeFeature : public AbstractTreeFeature { public: + static const BlockState* TRUNK; + static const BlockState* LEAVES; + RoofTreeFeature(bool); + ~RoofTreeFeature() override; static void staticCtor(); + bool place(Level*, Random&, const BlockPos&) override; + bool canPlaceTreeOfHeight(Level*, const BlockPos&, int); + void placeLogAt(Level*, const BlockPos&); + void placeLeafAt(Level*, int, int, int); }; + +ASSERT_SIZEOF(RoofTreeFeature, 0x28) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SandFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SandFeature.cpp new file mode 100644 index 00000000..cab8db24 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SandFeature.cpp @@ -0,0 +1,46 @@ +#include "net/minecraft/world/level/levelgen/feature/SandFeature.h" + +#include "net/minecraft/client/CMinecraftApp.h" +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/material/Material.h" + +// name guessed +SandFeature::SandFeature(Block* block, int radius) : Feature(false), m_block(block), m_radius(radius) {} + +// name guessed +bool SandFeature::place(Level* level, Random& random, const BlockPos& pos) { + if (level->getBlockState(pos)->getMaterial() != Material::WATER) + return false; + + Level::setInstaTick(true); + int radius = random.nextInt(m_radius - 2) + 2; + if (CConsoleMinecraftApp::sInstance.getLevelGenerationOptions() + && CConsoleMinecraftApp::sInstance.getLevelGenerationOptions()->intersects( + pos.offset(-radius, -2, -radius), pos.offset(radius, 2, radius))) { + Level::setInstaTick(false); + return false; + } + + MutableBlockPos candidate(0, 0, 0); + for (int x = pos.getX() - radius; x <= pos.getX() + radius; ++x) { + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius; ++z) { + int dx = x - pos.getX(); + int dz = z - pos.getZ(); + if (static_cast(dx * dx + dz * dz) <= static_cast(radius * radius)) { + int y = pos.getY(); + for (int currentY = y - 2; currentY <= pos.getY() + 2; ++currentY) { + candidate.set(x, currentY, z); + Block* block = level->getBlockState(candidate)->getBlock(); + if (block == Blocks::DIRT || block == Blocks::GRASS) + level->setBlock(candidate, m_block->defaultBlockState(), 2, false); + } + } + } + } + Level::setInstaTick(false); + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SandFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SandFeature.h new file mode 100644 index 00000000..e7eed19f --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SandFeature.h @@ -0,0 +1,19 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" + +class Block; + +class SandFeature : public Feature { +public: + SandFeature(Block*, int); + ~SandFeature() override = default; + bool place(Level*, Random&, const BlockPos&) override; + +private: + Block* m_block; + int m_radius; +}; + +ASSERT_SIZEOF(SandFeature, 0x20) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SavannaTreeFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SavannaTreeFeature.cpp new file mode 100644 index 00000000..19e99e75 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SavannaTreeFeature.cpp @@ -0,0 +1,146 @@ +#include "net/minecraft/world/level/levelgen/feature/SavannaTreeFeature.h" + +#include "NX/Platform.h" +#include "net/minecraft/core/Direction.h" +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/NewLeafBlock.h" +#include "net/minecraft/world/level/block/NewLogBlock.h" +#include "net/minecraft/world/level/material/Material.h" +#include + +const BlockState* SavannaTreeFeature::TRUNK; // name guessed +const BlockState* SavannaTreeFeature::LEAVES; + +void SavannaTreeFeature::staticCtor() { + TRUNK = Blocks::LOG2->defaultBlockState()->setValue(NewLogBlock::VARIANT, PlanksBlock::Variant::ACACIA); + LEAVES = Blocks::LEAVES2->defaultBlockState() + ->setValue(NewLeafBlock::VARIANT, PlanksBlock::Variant::ACACIA) + ->setValue(LeafBlock::CHECK_DECAY, false); +} + +// name guessed +SavannaTreeFeature::SavannaTreeFeature(bool update) : AbstractTreeFeature(update, 5, TRUNK, LEAVES, false) {} +SavannaTreeFeature::~SavannaTreeFeature() = default; + +// name guessed +void SavannaTreeFeature::placeLogAt(Level* level, const BlockPos& pos) { + setBlock(level, pos, m_trunk); +} + +// name guessed +void SavannaTreeFeature::placeLeafAt(Level* level, const BlockPos& pos) { + Material* material = level->getBlockState(pos)->getMaterial(); + if (material == Material::AIR || material == Material::LEAVES) + setBlock(level, pos, m_leaves); +} + +// name guessed +bool SavannaTreeFeature::place(Level* level, Random& random, const BlockPos& pos) { + PIXBeginNamedEvent(0, "SavannaTreeFeature::place"); + int height = random.nextInt(3) + random.nextInt(3) + m_minHeight; + if (pos.getY() <= 0 || pos.getY() + height >= 256) { + PIXEndNamedEvent(); + return false; + } + bool free = true; + for (int y = pos.getY(); y <= pos.getY() + height + 1; ++y) { + int radius = y == pos.getY() ? 0 : 1; + if (y >= pos.getY() + height - 1) + radius = 2; + for (int x = pos.getX() - radius; x <= pos.getX() + radius && free; ++x) { + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius && free; ++z) { + if (static_cast(y) < 256) { + free = isFree(level->getBlockState(BlockPos(x, y, z))->getBlock()); + } else { + free = false; + } + } + } + } + if (!free) { + PIXEndNamedEvent(); + return false; + } + Block* ground = level->getBlockState(pos.below())->getBlock(); + if ((ground != Blocks::GRASS && ground != Blocks::DIRT) || pos.getY() >= 255 - height) { + PIXEndNamedEvent(); + return false; + } + setDirtAt(level, pos.below()); + const Direction* direction = Direction::Plane::HORIZONTAL->getRandomDirection(random); + int bendStart = height - random.nextInt(4) - 1; + int bendLength = 3 - random.nextInt(3); + int trunkX = pos.getX(); + int trunkZ = pos.getZ(); + int top = 0; + MutableBlockPos candidate(0, 0, 0); + for (int y = 0; y < height; ++y) { + int worldY = pos.getY() + y; + if (y >= bendStart && bendLength > 0) { + trunkX += direction->getX(); + trunkZ += direction->getZ(); + --bendLength; + } + candidate.set(trunkX, worldY, trunkZ); + Material* material = level->getBlockState(candidate)->getMaterial(); + if (material == Material::AIR || material == Material::LEAVES) { + placeLogAt(level, candidate); + top = worldY; + } + } + { + BlockPos crown(trunkX, top, trunkZ); + for (int x = -3; x <= 3; ++x) { + for (int z = -3; z <= 3; ++z) { + if (std::abs(x) != 3 || std::abs(z) != 3) + placeLeafAt(level, crown.offset(x, 0, z)); + } + } + crown = crown.above(); + for (int x = -1; x <= 1; ++x) + for (int z = -1; z <= 1; ++z) + placeLeafAt(level, crown.offset(x, 0, z)); + placeLeafAt(level, crown.east(2)); + placeLeafAt(level, crown.west(2)); + placeLeafAt(level, crown.south(2)); + placeLeafAt(level, crown.north(2)); + } + + trunkX = pos.getX(); + trunkZ = pos.getZ(); + const Direction* branchDirection = Direction::Plane::HORIZONTAL->getRandomDirection(random); + if (branchDirection != direction) { + int branchStart = bendStart - random.nextInt(2) - 1; + int branchLength = 1 + random.nextInt(3); + int branchTop = 0; + for (int y = branchStart; y < height && branchLength > 0; ++y, --branchLength) { + if (y < 1) + continue; + int worldY = pos.getY() + y; + trunkX += branchDirection->getX(); + trunkZ += branchDirection->getZ(); + BlockPos branch(trunkX, worldY, trunkZ); + Material* material = level->getBlockState(branch)->getMaterial(); + if (material == Material::AIR || material == Material::LEAVES) { + placeLogAt(level, branch); + branchTop = worldY; + } + } + if (branchTop > 0) { + BlockPos crown(trunkX, branchTop, trunkZ); + for (int x = -2; x <= 2; ++x) + for (int z = -2; z <= 2; ++z) + if (std::abs(x) != 2 || std::abs(z) != 2) + placeLeafAt(level, crown.offset(x, 0, z)); + crown = crown.above(); + for (int x = -1; x <= 1; ++x) + for (int z = -1; z <= 1; ++z) + placeLeafAt(level, crown.offset(x, 0, z)); + } + } + PIXEndNamedEvent(); + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SavannaTreeFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SavannaTreeFeature.h index a4e9609f..870b3bd7 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SavannaTreeFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SavannaTreeFeature.h @@ -2,8 +2,16 @@ #include "net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h" -// STUB class SavannaTreeFeature : public AbstractTreeFeature { public: + static const BlockState* TRUNK; + static const BlockState* LEAVES; + SavannaTreeFeature(bool update); + ~SavannaTreeFeature() override; + bool place(Level*, Random&, const BlockPos&) override; static void staticCtor(); + void placeLogAt(Level*, const BlockPos&); + void placeLeafAt(Level*, const BlockPos&); }; + +ASSERT_SIZEOF(SavannaTreeFeature, 0x28) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpikeFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpikeFeature.cpp new file mode 100644 index 00000000..7a6606c4 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpikeFeature.cpp @@ -0,0 +1,122 @@ +#include "net/minecraft/world/level/levelgen/feature/SpikeFeature.h" + +#include "net/minecraft/core/BlockPosIterator.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/entity/item/EnderCrystal.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Block.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/phys/AABB.h" +#include + +// name guessed +SpikeFeature::EndSpike::EndSpike(int centerX, int centerZ, int radius, int height, bool guarded) + : m_centerX(centerX), m_centerZ(centerZ), m_radius(radius), m_height(height), m_guarded(guarded) { + m_bounds + = AABB::newPermanent(centerX - radius, 0, centerZ - radius, centerX + radius, 256, centerZ + radius); +} + +// name guessed +void SpikeFeature::setSpike(EndSpike* spike) { + m_spike = spike; +} + +// name guessed +SpikeFeature::EndSpike::~EndSpike() { + delete m_bounds; +} + +// name guessed +int SpikeFeature::EndSpike::getCenterX() { + return m_centerX; +} +// name guessed +int SpikeFeature::EndSpike::getCenterZ() { + return m_centerZ; +} +// name guessed +int SpikeFeature::EndSpike::getRadius() { + return m_radius; +} +// name guessed +int SpikeFeature::EndSpike::getHeight() { + return m_height; +} +// name guessed +bool SpikeFeature::EndSpike::isGuarded() { + return m_guarded; +} +// name guessed +AABB* SpikeFeature::EndSpike::getTopBoundingBox() { + return m_bounds; +} + +// name guessed +SpikeFeature::SpikeFeature() + : Feature(false), m_crystalInvulnerable(false), m_spike(nullptr), m_beamTarget(nullptr) {} + +// name guessed +SpikeFeature::~SpikeFeature() { + delete m_beamTarget; +} + +// name guessed +void SpikeFeature::setCrystalInvulnerable(bool invulnerable) { + m_crystalInvulnerable = invulnerable; +} + +// name guessed +void SpikeFeature::setCrystalBeamTarget(const BlockPos& target) { + delete m_beamTarget; + m_beamTarget = new BlockPos(target.getX(), target.getY(), target.getZ()); +} + +// name guessed +bool SpikeFeature::place(Level* level, Random& random, const BlockPos& pos) { + if (!m_spike) + return false; + int radius = m_spike->getRadius(); + BlockPosIterator* iterator + = BlockPos::between(BlockPos(pos.getX() - radius, 1, pos.getZ() - radius), + BlockPos(pos.getX() + radius, m_spike->getHeight() + 10, pos.getZ() + radius)); + while (iterator->hasNext()) { + BlockPos candidate = *iterator->next(); + if (candidate.distSqr(pos.getX(), candidate.getY(), pos.getZ()) <= radius * radius + 1 + && candidate.getY() < m_spike->getHeight()) { + setBlock(level, candidate, Blocks::OBSIDIAN->defaultBlockState()); + } else if (candidate.getY() > 65) { + setBlock(level, candidate, Blocks::AIR->defaultBlockState()); + } + } + delete iterator; + if (m_spike->isGuarded()) { + for (int x = -2; x <= 2; ++x) { + for (int z = -2; z <= 2; ++z) { + if (abs(x) == 2 || abs(z) == 2) { + setBlock(level, BlockPos(pos.getX() + x, m_spike->getHeight(), pos.getZ() + z), + Blocks::IRON_BARS->defaultBlockState()); + setBlock(level, BlockPos(pos.getX() + x, m_spike->getHeight() + 1, pos.getZ() + z), + Blocks::IRON_BARS->defaultBlockState()); + setBlock(level, BlockPos(pos.getX() + x, m_spike->getHeight() + 2, pos.getZ() + z), + Blocks::IRON_BARS->defaultBlockState()); + } + setBlock(level, BlockPos(pos.getX() + x, m_spike->getHeight() + 3, pos.getZ() + z), + Blocks::IRON_BARS->defaultBlockState()); + } + } + } + std::shared_ptr crystal(new EnderCrystal(level)); + if (m_beamTarget) + crystal->setBeamTarget(new BlockPos(*m_beamTarget)); + else + crystal->setBeamTarget(nullptr); + crystal->setInvulnerable(m_crystalInvulnerable); + crystal->moveTo(pos.getX() + 0.5f, m_spike->getHeight() + 1, pos.getZ() + 0.5f, + random.nextFloat() * 360.0f, 0); + level->addEntity(crystal); + setBlock(level, BlockPos(pos.getX(), m_spike->getHeight(), pos.getZ()), + Blocks::BEDROCK->defaultBlockState()); + delete m_spike; + m_spike = nullptr; + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpikeFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpikeFeature.h new file mode 100644 index 00000000..38602f26 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpikeFeature.h @@ -0,0 +1,42 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" + +class AABB; + +class SpikeFeature : public Feature { +public: + class EndSpike { + public: + EndSpike(int centerX, int centerZ, int radius, int height, bool guarded); + ~EndSpike(); + int getCenterX(); + int getCenterZ(); + int getRadius(); + int getHeight(); + bool isGuarded(); + AABB* getTopBoundingBox(); + + int m_centerX; + int m_centerZ; + int m_radius; + int m_height; + bool m_guarded; + AABB* m_bounds; + }; + + SpikeFeature(); + ~SpikeFeature() override; + bool place(Level*, Random&, const BlockPos&) override; + void setSpike(EndSpike*); + void setCrystalInvulnerable(bool); + void setCrystalBeamTarget(const BlockPos&); + +private: + bool m_crystalInvulnerable; + EndSpike* m_spike; + BlockPos* m_beamTarget; +}; + +static_assert(sizeof(SpikeFeature::EndSpike) == 0x20, "EndSpike ABI"); +static_assert(sizeof(SpikeFeature) == 0x20, "SpikeFeature ABI"); diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpringFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpringFeature.cpp new file mode 100644 index 00000000..1c875f37 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpringFeature.cpp @@ -0,0 +1,56 @@ +#include "net/minecraft/world/level/levelgen/feature/SpringFeature.h" + +#include "net/minecraft/client/CMinecraftApp.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Block.h" + +// name guessed +SpringFeature::SpringFeature(Block* block) : Feature(false), mBlock(block) {} + +bool SpringFeature::place(Level* level, Random& random, const BlockPos& pos) { + if (CConsoleMinecraftApp::sInstance.getLevelGenerationOptions()) { + LevelGenerationOptions* options = CConsoleMinecraftApp::sInstance.getLevelGenerationOptions(); + if (options->intersects(pos, pos)) + return false; + } + + int x = pos.getX(); + int y = pos.getY(); + int z = pos.getZ(); + if (level->getBlockId(x, y + 1, z) != 1 || level->getBlockId(x, y - 1, z) != 1) + return false; + if (level->getBlockId(x, y, z) != 0 && level->getBlockId(x, y, z) != 1) + return false; + + int stoneCount = 0; + int west = level->getBlockId(x - 1, y, z); + if (west == 1) + stoneCount = 1; + else if (west != 0) + return false; + int east = level->getBlockId(x + 1, y, z); + if (east != 0) { + if (east != 1) + return false; + stoneCount++; + } + int north = level->getBlockId(x, y, z - 1); + if (north != 0) { + if (north != 1) + return false; + stoneCount++; + } + int south = level->getBlockId(x, y, z + 1); + if (south != 0) { + if (south != 1) + return false; + stoneCount++; + } + if (stoneCount == 3) { + const BlockState* state = mBlock->defaultBlockState(); + level->setBlock(pos, state, 2, false); + level->instaTick(pos, state, random); + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpringFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpringFeature.h index 2de54367..b1fede19 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpringFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpringFeature.h @@ -6,10 +6,12 @@ class Block; class SpringFeature : public Feature { public: - SpringFeature(Block* block, bool unk); + SpringFeature(Block* block); bool place(Level* level, Random& random, const BlockPos& pos) override; private: Block* mBlock; }; + +static_assert(sizeof(SpringFeature) == 0x18, "SpringFeature layout must match the Switch object"); diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpruceFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpruceFeature.cpp new file mode 100644 index 00000000..76026f9a --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpruceFeature.cpp @@ -0,0 +1,92 @@ +#include "net/minecraft/world/level/levelgen/feature/SpruceFeature.h" + +#include "NX/Platform.h" +#include "net/minecraft/client/CMinecraftApp.h" +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/OldLeafBlock.h" +#include "net/minecraft/world/level/block/OldLogBlock.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/material/Material.h" +#include + +const BlockState* SpruceFeature::TRUNK; // name guessed +const BlockState* SpruceFeature::LEAVES; + +void SpruceFeature::staticCtor() { + TRUNK = Blocks::LOG->defaultBlockState()->setValue(OldLogBlock::VARIANT, PlanksBlock::Variant::SPRUCE); + LEAVES = Blocks::LEAVES->defaultBlockState() + ->setValue(OldLeafBlock::VARIANT, PlanksBlock::Variant::SPRUCE) + ->setValue(LeafBlock::CHECK_DECAY, false); +} + +// name guessed +SpruceFeature::SpruceFeature(bool update) : AbstractTreeFeature(update, 6, TRUNK, LEAVES, false) {} + +// name guessed +bool SpruceFeature::place(Level* level, Random& random, const BlockPos& pos) { + int height = random.nextInt(4) + m_minHeight; + int bareHeight = random.nextInt(2) + 1; + int maxRadius = random.nextInt(2) + 2; + if (pos.getY() <= 0 || pos.getY() + height >= 256) + return false; + if (CConsoleMinecraftApp::sInstance.getLevelGenerationOptions() + && CConsoleMinecraftApp::sInstance.getLevelGenerationOptions()->intersects( + pos.offset(-maxRadius, -1, -maxRadius), pos.offset(maxRadius, height, maxRadius))) + return false; + MutableBlockPos cursor; + bool free = true; + for (int y = pos.getY(); y <= pos.getY() + height + 1 && free; ++y) { + int radius = maxRadius; + if (y - pos.getY() <= bareHeight - 1) + radius = 0; + for (int x = pos.getX() - radius; x <= pos.getX() + radius && free; ++x) { + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius && free; ++z) { + if (y >= 0 && y < 256) { + Material* material = level->getBlockState(*cursor.set(x, y, z))->getMaterial(); + free = material == Material::AIR || material == Material::LEAVES; + } else { + free = false; + } + } + } + } + if (!free) + return false; + Block* ground = level->getBlockState(pos.below())->getBlock(); + if ((ground != Blocks::GRASS && ground != Blocks::DIRT && ground != Blocks::FARMLAND) + || pos.getY() >= 255 - height) + return false; + setDirtAt(level, pos.below()); + int trunkHeight = height - random.nextInt(3); + if (placeTrunk(level, pos, random, trunkHeight)) { + int layers = height - bareHeight; + int radius = random.nextInt(2); + int limit = 1; + int reset = 0; + for (int layer = 0; layer <= layers; ++layer) { + int y = pos.getY() + height - layer; + for (int x = pos.getX() - radius; x <= pos.getX() + radius; ++x) { + int dx = x - pos.getX(); + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius; ++z) { + int dz = z - pos.getZ(); + if (std::abs(dx) == radius && std::abs(dz) == radius && radius > 0) + continue; + BlockPos leaves(x, y, z); + if (!level->getBlockState(leaves)->isSolid()) + setBlock(level, leaves, m_leaves); + } + } + if (radius >= limit) { + radius = reset; + reset = 1; + if (++limit > maxRadius) + limit = maxRadius; + } else { + ++radius; + } + } + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpruceFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpruceFeature.h index beeb2264..215a16c7 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpruceFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SpruceFeature.h @@ -2,8 +2,14 @@ #include "net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h" -// STUB class SpruceFeature : public AbstractTreeFeature { public: + SpruceFeature(bool update); static void staticCtor(); + bool place(Level*, Random&, const BlockPos&) override; + + static const BlockState* TRUNK; + static const BlockState* LEAVES; }; + +ASSERT_SIZEOF(SpruceFeature, 0x28) 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/SwampTreeFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp new file mode 100644 index 00000000..e0276d9b --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp @@ -0,0 +1,143 @@ +#include "net/minecraft/world/level/levelgen/feature/SwampTreeFeature.h" + +#include "NX/Platform.h" +#include "net/minecraft/client/CMinecraftApp.h" +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/OldLeafBlock.h" +#include "net/minecraft/world/level/block/OldLogBlock.h" +#include "net/minecraft/world/level/block/VineBlock.h" +#include "net/minecraft/world/level/material/Material.h" +#include + +const BlockState* SwampTreeFeature::TRUNK; // name guessed +const BlockState* SwampTreeFeature::LEAVES; + +void SwampTreeFeature::staticCtor() { + TRUNK = Blocks::LOG->defaultBlockState()->setValue(OldLogBlock::VARIANT, PlanksBlock::Variant::OAK); + LEAVES = Blocks::LEAVES->defaultBlockState() + ->setValue(OldLeafBlock::VARIANT, PlanksBlock::Variant::OAK) + ->setValue(LeafBlock::CHECK_DECAY, false); +} + +// name guessed +SwampTreeFeature::SwampTreeFeature() : AbstractTreeFeature(false, 5, TRUNK, LEAVES, false) {} + +// name guessed +void SwampTreeFeature::addVine(Level* level, const BlockPos& pos, const BooleanProperty* property) { + const BlockState* state + = Blocks::VINE->defaultBlockState()->setValue(const_cast(property), true); + BlockPos current = pos; + setBlock(level, current, state); + current = current.below(); + int remaining = 4; + while (level->getBlockState(current)->getBlock()->getMaterial() == Material::AIR && remaining > 0) { + setBlock(level, current, state); + current = current.below(); + --remaining; + } +} + +// name guessed +// NON_MATCHING | score: 1410 (lower is better) +bool SwampTreeFeature::place(Level* level, Random& random, const BlockPos& input) { + PIXBeginNamedEvent(0, "SwampTreeFeature::place"); + BlockPos pos = input; + int height = random.nextInt(4) + m_minHeight; + while (level->getBlockState(pos.below())->getMaterial() == Material::WATER) + pos = pos.below(); + if (pos.getY() <= 0 || pos.getY() + height >= 128) { + PIXEndNamedEvent(); + return false; + } + if (CConsoleMinecraftApp::sInstance.getLevelGenerationOptions() + && CConsoleMinecraftApp::sInstance.getLevelGenerationOptions()->intersects( + pos.offset(-3, -1, -3), pos.offset(3, height, 3))) { + PIXEndNamedEvent(); + return false; + } + MutableBlockPos cursor(0, 0, 0); + int free = true; + for (int y = pos.getY(); y <= pos.getY() + height + 1; ++y) { + int radius = y == pos.getY() ? 0 : 1; + if (y >= pos.getY() + height - 1) + radius = 3; + for (int x = pos.getX() - radius; x <= pos.getX() + radius && free; ++x) { + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius && free; ++z) { + if (y >= 0 && y < 128) { + const BlockState* state = level->getBlockState(*cursor.set(x, y, z)); + Block* block = state->getBlock(); + if (state->getMaterial() == Material::AIR || state->getMaterial() == Material::LEAVES) + free = true; + else if (block == Blocks::WATER || block == Blocks::FLOWING_WATER) + free = y <= pos.getY(); + else + free = false; + } else { + free = false; + } + } + } + } + if (!free) { + PIXEndNamedEvent(); + return false; + } + Block* ground = level->getBlockState(pos.below())->getBlock(); + if ((ground != Blocks::GRASS && ground != Blocks::DIRT) || pos.getY() >= 127 - height) { + PIXEndNamedEvent(); + return false; + } + setDirtAt(level, pos.below()); + MutableBlockPos leaf(0, 0, 0); + for (int y = pos.getY() + height - 3; y <= pos.getY() + height; ++y) { + int relative = y - (pos.getY() + height); + int radius = 2 - relative / 2; + for (int x = pos.getX() - radius; x <= pos.getX() + radius; ++x) { + int dx = x - pos.getX(); + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius; ++z) { + int dz = z - pos.getZ(); + if (std::abs(dx) != radius || std::abs(dz) != radius + || (random.nextInt(2) != 0 && relative != 0)) { + leaf.set(x, y, z); + if (!level->getBlockState(leaf)->isSolid()) + setBlock(level, leaf, m_leaves); + } + } + } + } + for (int y = 0; y < height; ++y) { + const BlockState* state = level->getBlockState(pos.above(y)); + Block* block = state->getBlock(); + if (state->getMaterial() == Material::AIR || state->getMaterial() == Material::LEAVES + || block == Blocks::FLOWING_WATER || block == Blocks::WATER) + setBlock(level, pos.above(y), m_trunk); + } + MutableBlockPos vines(0, 0, 0); + for (int y = pos.getY() + height - 3; y <= pos.getY() + height; ++y) { + int relative = y - (pos.getY() + height); + int radius = 2 - relative / 2; + for (int x = pos.getX() - radius; x <= pos.getX() + radius; ++x) { + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius; ++z) { + vines.set(x, y, z); + if (level->getBlockState(vines)->getMaterial() == Material::LEAVES) { + BlockPos west = vines.west(); + BlockPos east = vines.east(); + BlockPos north = vines.north(); + BlockPos south = vines.south(); + if (random.nextInt(4) == 0 && level->getBlockState(west)->getMaterial() == Material::AIR) + addVine(level, west, VineBlock::EAST); + if (random.nextInt(4) == 0 && level->getBlockState(east)->getMaterial() == Material::AIR) + addVine(level, east, VineBlock::WEST); + if (random.nextInt(4) == 0 && level->getBlockState(north)->getMaterial() == Material::AIR) + addVine(level, north, VineBlock::SOUTH); + if (random.nextInt(4) == 0 && level->getBlockState(south)->getMaterial() == Material::AIR) + addVine(level, south, VineBlock::NORTH); + } + } + } + } + PIXEndNamedEvent(); + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SwampTreeFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SwampTreeFeature.h index e8a85249..26dbae99 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SwampTreeFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/SwampTreeFeature.h @@ -1,7 +1,15 @@ #pragma once -// STUB -class SwampTreeFeature { +#include "net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h" + +class SwampTreeFeature : public AbstractTreeFeature { public: + static const BlockState* TRUNK; + static const BlockState* LEAVES; + SwampTreeFeature(); static void staticCtor(); + bool place(Level*, Random&, const BlockPos&) override; + void addVine(Level*, const BlockPos&, const BooleanProperty*); }; + +ASSERT_SIZEOF(SwampTreeFeature, 0x28) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/TallgrassFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/TallgrassFeature.cpp new file mode 100644 index 00000000..8de10a0b --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/TallgrassFeature.cpp @@ -0,0 +1,37 @@ +#include "net/minecraft/world/level/levelgen/feature/TallgrassFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/material/Material.h" + +// name guessed +TallgrassFeature::TallgrassFeature(TallGrassBlock::Variant* variant) + : Feature(false), + m_state(Blocks::TALLGRASS->defaultBlockState()->setValue(TallGrassBlock::TYPE, variant)) {} + +/** Descend through air and leaf materials before scattering exactly 128 attempts. + */ +// name guessed +bool TallgrassFeature::place(Level* level, Random& random, const BlockPos& origin) { + BlockPos pos = origin; + const BlockState* state = level->getBlockState(pos); + while ((state->getMaterial() == Material::AIR || state->getMaterial() == Material::LEAVES) + && pos.getY() > 0) { + pos = pos.below(); + state = level->getBlockState(pos); + } + + for (int attempt = 0; attempt < 128; ++attempt) { + BlockPos candidate + = pos.offset(random.nextInt(8) - random.nextInt(8), random.nextInt(4) - random.nextInt(4), + random.nextInt(8) - random.nextInt(8)); + if (level->isEmptyBlock(candidate) + && static_cast(Blocks::TALLGRASS)->canSurvive(level, candidate, m_state)) { + level->setBlock(candidate, m_state, 2, false); + } + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/TallgrassFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/TallgrassFeature.h new file mode 100644 index 00000000..8d83f2d3 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/TallgrassFeature.h @@ -0,0 +1,17 @@ +#pragma once + +#include "net/minecraft/world/level/block/TallGrassBlock.h" +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" + +class TallgrassFeature : public Feature { +public: + TallgrassFeature(TallGrassBlock::Variant*); + ~TallgrassFeature() override = default; + bool place(Level*, Random&, const BlockPos&) override; + +private: + const BlockState* m_state; +}; + +ASSERT_SIZEOF(TallgrassFeature, 0x18) diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/TreeFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/TreeFeature.cpp new file mode 100644 index 00000000..992db166 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/TreeFeature.cpp @@ -0,0 +1,208 @@ +#include "net/minecraft/world/level/levelgen/feature/TreeFeature.h" + +#include "NX/Platform.h" +#include "net/minecraft/client/CMinecraftApp.h" +#include "net/minecraft/core/Direction.h" +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/CocoaBlock.h" +#include "net/minecraft/world/level/block/OldLeafBlock.h" +#include "net/minecraft/world/level/block/OldLogBlock.h" +#include "net/minecraft/world/level/block/VineBlock.h" +#include "net/minecraft/world/level/levelgen/LevelGenerationOptions.h" +#include "net/minecraft/world/level/material/Material.h" +#include + +const BlockState* TreeFeature::TRUNK; // name guessed +const BlockState* TreeFeature::LEAVES; + +void TreeFeature::staticCtor() { + TRUNK = Blocks::LOG->defaultBlockState()->setValue(OldLogBlock::VARIANT, + PlanksBlock::Variant::OAK); + LEAVES = Blocks::LEAVES->defaultBlockState() + ->setValue(OldLeafBlock::VARIANT, PlanksBlock::Variant::OAK) + ->setValue(LeafBlock::CHECK_DECAY, false); +} + +// name guessed +TreeFeature::TreeFeature(bool update) : AbstractTreeFeature(update, 4, TRUNK, LEAVES, false) {} + +// name guessed +TreeFeature::TreeFeature(bool update, int minHeight, const BlockState* trunk, const BlockState* leaves, + bool vines) + : AbstractTreeFeature(update, minHeight, trunk, leaves, vines) {} + +/** Preserve the original clearance scan and profiling/query order. + */ +// name guessed +bool TreeFeature::prepareSpawn(Level* level, const BlockPos& pos, int height) { + PIXBeginNamedEvent(0.0f, "TreeFeature::prepareSpawn"); + bool free = false; + if (pos.getY() <= 0 || pos.getY() + height >= 256) { + PIXEndNamedEvent(); + return false; + } + if (CConsoleMinecraftApp::sInstance.getLevelGenerationOptions()) { + PIXBeginNamedEvent(0.0f, "TreeFeature checking intersects"); + auto options = CConsoleMinecraftApp::sInstance.getLevelGenerationOptions(); + bool excluded = options->intersects(pos.offset(-2, -1, -2), pos.offset(2, height, 2)); + PIXEndNamedEvent(); + if (excluded) { + PIXEndNamedEvent(); + return false; + } + } + MutableBlockPos current; + free = true; + for (int y = pos.getY(); y <= pos.getY() + height + 1; ++y) { + int radius = y == pos.getY() ? 0 : 1; + if (y >= pos.getY() + height - 1) + radius = 2; + for (int x = pos.getX() - radius; x <= pos.getX() + radius && free; ++x) { + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius && free; ++z) { + if ((unsigned int)y < 256) { + current.set(x, y, z); + free = isFree(level->getBlockState(current)->getBlock()); + } else { + free = false; + } + } + } + } + if (free) { + Block* ground = level->getBlockState(pos.below())->getBlock(); + if ((ground == Blocks::GRASS || ground == Blocks::DIRT || ground == Blocks::FARMLAND) + && pos.getY() < 255 - height) { + setDirtAt(level, pos.below()); + PIXEndNamedEvent(); + return true; + } + } + PIXEndNamedEvent(); + return false; +} + +// name guessed +void TreeFeature::placeLeaf(Level* level, const MutableBlockPos& pos) { + Material* material = level->getBlockState(pos)->getMaterial(); + if (material == Material::AIR || material == Material::LEAVES || material == Material::MOSS) + setBlock(level, pos, m_leaves); +} + +// name guessed +void TreeFeature::addHangingVine(Level* level, const BlockPos& pos, const BooleanProperty* property) { + BlockPos current = pos; + addVine(level, current, property); + current = pos.below(); + int remaining = 4; + while (level->getBlockState(current)->getBlock()->getMaterial() == Material::AIR && remaining > 0) { + addVine(level, current, property); + current = current.below(); + --remaining; + } +} + +// name guessed +void TreeFeature::placeCocoa(Level* level, int age, const BlockPos& pos, const Direction* direction) { + setBlock(level, pos, + Blocks::COCOA->defaultBlockState() + ->setValue(CocoaBlock::AGE, age) + ->setValue(HorizontalDirectionalBlock::FACING, direction)); +} + +/** Keep the original leaf/vine scan ordering and random draws. + */ +// name guessed +bool TreeFeature::place(Level* level, Random& random, const BlockPos& pos) { + PIXBeginNamedEvent(0.0f, "TreeFeature::place"); + int height = random.nextInt(3) + m_minHeight; + if (!prepareSpawn(level, pos, height)) { + PIXEndNamedEvent(); + return false; + } + if (placeTrunk(level, pos, random, height)) { + PIXBeginNamedEvent(0.0f, "Placing TreeFeature leaves"); + MutableBlockPos current(0, 0, 0); + for (int y = pos.getY() + height; y >= pos.getY() + height - 3; --y) { + int topOffset = y - (pos.getY() + height); + int radius = 1 - topOffset / 2; + for (int x = pos.getX() - radius; x <= pos.getX() + radius; ++x) { + int dx = x - pos.getX(); + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius; ++z) { + int dz = z - pos.getZ(); + // Top corners still consume the random draw before being skipped. + if (std::abs(dx) != radius || std::abs(dz) != radius + || (random.nextInt(2) != 0 && topOffset != 0)) { + current.set(x, y, z); + placeLeaf(level, current); + } + } + } + } + PIXEndNamedEvent(); + if (m_vines) { + PIXBeginNamedEvent(0.0f, "TreeFeature adding vines"); + MutableBlockPos vinePos(0, 0, 0); + for (int y = pos.getY() + height - 3; y <= pos.getY() + height; ++y) { + int radius = 2 - (y - (pos.getY() + height)) / 2; + for (int x = pos.getX() - radius; x <= pos.getX() + radius; ++x) { + for (int z = pos.getZ() - radius; z <= pos.getZ() + radius; ++z) { + vinePos.set(x, y, z); + if (level->getBlockState(vinePos)->getBlock()->getMaterial() == Material::LEAVES) { + auto west = vinePos.west(); + auto east = vinePos.east(); + auto north = vinePos.north(); + auto south = vinePos.south(); + if (random.nextInt(4) == 0 + && level->getBlockState(west)->getMaterial() == Material::AIR) + addHangingVine(level, west, VineBlock::EAST); + if (random.nextInt(4) == 0 + && level->getBlockState(east)->getMaterial() == Material::AIR) + addHangingVine(level, east, VineBlock::WEST); + if (random.nextInt(4) == 0 + && level->getBlockState(north)->getMaterial() == Material::AIR) + addHangingVine(level, north, VineBlock::SOUTH); + if (random.nextInt(4) == 0 + && level->getBlockState(south)->getMaterial() == Material::AIR) + addHangingVine(level, south, VineBlock::NORTH); + } + } + } + } + PIXEndNamedEvent(); + int cocoa = random.nextInt(5); + if (height > 5 && cocoa == 0) { + PIXBeginNamedEvent(0.0f, "TreeFeature adding cocoa"); + { + auto directions = Direction::Plane::HORIZONTAL->iterator(); + for (unsigned int i = 0; i < directions.m_length; ++i) { + const Direction* direction = directions[i]; + if (random.nextInt(4) == 0) { + const Direction* opposite = direction->getOpposite(); + int age = random.nextInt(3); + placeCocoa(level, age, pos.offset(opposite->getX(), height - 5, opposite->getZ()), + direction); + } + } + } + { + auto directions = Direction::Plane::HORIZONTAL->iterator(); + for (unsigned int i = 0; i < directions.m_length; ++i) { + const Direction* direction = directions[i]; + if (random.nextInt(3) == 0) { + const Direction* opposite = direction->getOpposite(); + int age = random.nextInt(3); + placeCocoa(level, age, pos.offset(opposite->getX(), height - 4, opposite->getZ()), + direction); + } + } + } + PIXEndNamedEvent(); + } + } + } + PIXEndNamedEvent(); + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/TreeFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/TreeFeature.h index d43bf123..b47652a0 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/TreeFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/TreeFeature.h @@ -2,8 +2,23 @@ #include "net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h" -// STUB +class Direction; +class MutableBlockPos; + class TreeFeature : public AbstractTreeFeature { public: static void staticCtor(); + TreeFeature(bool update); + TreeFeature(bool update, int minHeight, const BlockState* trunk, const BlockState* leaves, bool vines); + bool place(Level*, Random&, const BlockPos&) override; + + bool prepareSpawn(Level*, const BlockPos&, int height); + void placeLeaf(Level*, const MutableBlockPos&); + void addHangingVine(Level*, const BlockPos&, const BooleanProperty*); + void placeCocoa(Level*, int age, const BlockPos&, const Direction*); + + static const BlockState* TRUNK; + static const BlockState* LEAVES; }; + +ASSERT_SIZEOF(TreeFeature, 0x28) 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/VinesFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/VinesFeature.cpp new file mode 100644 index 00000000..b44b7e00 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/VinesFeature.cpp @@ -0,0 +1,38 @@ +#include "net/minecraft/world/level/levelgen/feature/VinesFeature.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/core/Direction.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/VineBlock.h" + +// name guessed +VinesFeature::VinesFeature() : Feature(false) {} + +// name guessed +bool VinesFeature::place(Level* level, Random& random, const BlockPos& origin) { + BlockPos pos = origin; + for (; pos.getY() < 128; pos = pos.above()) { + if (level->isEmptyBlock(pos)) { + auto directions = Direction::Plane::HORIZONTAL->iterator(); + for (unsigned int i = 0; i < directions.m_length; ++i) { + const Direction* direction = directions[i]; + if (Blocks::VINE->mayPlace(level, pos, direction)) { + const BlockState* state = Blocks::VINE->defaultBlockState() + ->setValue(VineBlock::SOUTH, direction == Direction::SOUTH) + ->setValue(VineBlock::WEST, direction == Direction::WEST) + ->setValue(VineBlock::NORTH, direction == Direction::NORTH) + ->setValue(VineBlock::EAST, direction == Direction::EAST); + level->setBlock(pos, state, 2, false); + break; + } + } + } else { + int x = random.nextInt(4) - random.nextInt(4); + int z = random.nextInt(4) - random.nextInt(4); + pos = pos.offset(x, 0, z); + } + } + return true; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/VinesFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/VinesFeature.h new file mode 100644 index 00000000..ea49375d --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/VinesFeature.h @@ -0,0 +1,9 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" + +class VinesFeature : public Feature { +public: + VinesFeature(); + bool place(Level*, Random&, const BlockPos&) override; +}; 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..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 @@ -1,6 +1,7 @@ #pragma once #include "net/minecraft/world/ArrayWithLength.h" +#include class IntCache { public: @@ -14,5 +15,20 @@ 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..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 @@ -1,10 +1,50 @@ #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/level/storage/loot/BuiltInLootTables.h b/src/Minecraft.World/net/minecraft/world/level/storage/loot/BuiltInLootTables.h index 83b085bb..940a1bf2 100644 --- a/src/Minecraft.World/net/minecraft/world/level/storage/loot/BuiltInLootTables.h +++ b/src/Minecraft.World/net/minecraft/world/level/storage/loot/BuiltInLootTables.h @@ -4,7 +4,7 @@ class ResourceLocation; class BuiltInLootTables { public: - static ResourceLocation* SPAWN_BONUS_CHEST; + static ResourceLocation SPAWN_BONUS_CHEST; static ResourceLocation* ABANDONED_MINESHAFT; static ResourceLocation* DESERT_PYRAMID; static ResourceLocation* DISPENSER_TRAP; @@ -14,7 +14,7 @@ class BuiltInLootTables { static ResourceLocation* JUNGLE_TEMPLE_DISPENSER; static ResourceLocation* MONSTER_ROOM; static ResourceLocation* NETHER_BRIDGE; - static ResourceLocation* SIMPLE_DUNGEON; + static ResourceLocation SIMPLE_DUNGEON; static ResourceLocation* STRONGHOLD_CORRIDOR; static ResourceLocation* STRONGHOLD_CROSSING; static ResourceLocation* STRONGHOLD_LIBRARY; 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/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/Vec3.cpp b/src/Minecraft.World/net/minecraft/world/phys/Vec3.cpp index dbf75105..f2ca8aab 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; // name guessed + +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); };