diff --git a/data/data_symbols.csv b/data/data_symbols.csv index 0fe1d7e5..0c294364 100644 --- a/data/data_symbols.csv +++ b/data/data_symbols.csv @@ -1,3 +1,52 @@ +0x00000071000441a4,_ZN14BiomeDecoratorC1Ev +0x00000071000f8fac,_ZN13FossilFeatureC2Ev +0x0000007100119ce4,_ZN14EndDragonFight15createNewDragonEv +0x000000710017f35c,_ZN17FlatGeneratorInfo9getLayersERNSt3__16vectorI13FlatLayerInfoNS0_9allocatorIS2_EEEE +0x000000710017f470,_ZN17FlatGeneratorInfo9getLayersEPPK10BlockState +0x0000007100183648,_ZNK11FlowerBlock6Flower11getCategoryEv +0x0000007100183c9c,_ZN11FlowerBlock14FlowerCategory8getBlockEv +0x000000710018c020,_ZN13FossilFeature5placeEP5LevelR6RandomRK8BlockPos +0x00000071001ff5a4,_ZN5Level19getTopSolidBlockPosERK8BlockPos +0x000000710050eb18,_ZN22LevelGenerationOptions16getBiomeOverrideEiPN5Biome15LegacyBlockDataES2_ +0x0000007100e134b8,gFreezingTemperature +0x0000007100e171b0,_ZN20TheEndBiomeDecorator6SPIKESE +0x0000007101023598,_ZTV10BeachBiome +0x0000007101024e80,_ZTV5Biome +0x000000710103e7e0,_ZTV11DesertBiome +0x0000007101051860,_ZTIPN9SandBlock7VariantE +0x0000007101055e10,_ZTV17ExtremeHillsBiome +0x000000710105a410,_ZTV16FixedBiomeSource +0x000000710105c598,_ZTV11ForestBiome +0x00000071010663e0,_ZTV9HellBiome +0x0000007101069b78,_ZTV8IceBiome +0x000000710106afa0,_ZN13ImprovedNoise6GRAD_XE +0x000000710106b020,_ZN13ImprovedNoise6GRAD_YE +0x000000710106b0a0,_ZN13ImprovedNoise6GRAD_ZE +0x000000710106b120,_ZN13ImprovedNoise9GRAD_2D_XE +0x000000710106b1a0,_ZN13ImprovedNoise9GRAD_2D_ZE +0x000000710106cff8,_ZTV11JungleBiome +0x000000710106f978,_ZTV18HellBiomeDecorator +0x000000710107b258,_ZTV9MesaBiome +0x0000007101085c48,_ZTV19MushroomIslandBiome +0x0000007101085e28,_ZTV18MutatedForestBiome +0x0000007101085f00,_ZTV19MutatedSavannaBiome +0x00000071010880b0,_ZTV21FjNetherrackBlockPred +0x00000071010880e0,_ZN17NetherLevelSource20NETHERRACK_PREDICATEE +0x00000071010880e8,_ZTV17NetherLevelSource +0x000000710108a498,_ZTV10OceanBiome +0x0000007101091978,_ZTVN9MesaBiome13MesaDecoratorE +0x000000710109cde0,_ZTV11PlainsBiome +0x00000071010a7630,_ZTV10RiverBiome +0x00000071010a9068,_ZTV12SavannaBiome +0x00000071010b0b18,_ZN12SimplexNoise4GRADE +0x00000071010c2de0,_ZTV15StoneBeachBiome +0x00000071010c6fe8,_ZTV10SwampBiome +0x00000071010c74b8,_ZTV10TaigaBiome +0x00000071010c8cb8,_ZTV11TheEndBiome +0x00000071010c8d90,_ZTV20TheEndBiomeDecorator +0x00000071010c8fd8,_ZTV17TheEndLevelSource +0x00000071010d3518,_ZTV9VoidBiome +0x00000071010e0078,_ZTV18VoidBiomeDecorator 0x0000007101781BBC,AABB__sThreadStorageCount 0x0000007101781BC0,AABB__sDefaultThreadStorage 0x0000007101781BE0,_ZN6Blocks8RegistryE @@ -119,7 +168,17 @@ 0x0000007101783538,_ZN5Biome16MESA_PLATEAU_F_ME 0x0000007101783540,_ZN5Biome14MESA_PLATEAU_ME 0x0000007101783548,_ZN5Biome7DEFAULTE +0x0000007101783550,_ZN5Biome5STONEE +0x0000007101783558,_ZN5Biome3AIRE +0x0000007101783560,_ZN5Biome7BEDROCKE +0x0000007101783568,_ZN5Biome6GRAVELE +0x0000007101783570,_ZN5Biome13RED_SANDSTONEE +0x0000007101783578,_ZN5Biome9SANDSTONEE +0x0000007101783580,_ZN5Biome3ICEE +0x0000007101783588,_ZN5Biome5WATERE 0x0000007101783590,_ZN5Biome17TEMPERATURE_NOISEE +0x0000007101783598,_ZN5Biome16BIOME_INFO_NOISEE +0x00000071017835a0,_ZN5Biome20DOUBLE_PLANT_FEATUREE 0x00000071017835C8,_ZN6Blocks6GRAVELE 0x00000071017835D0,_ZN6Blocks13YELLOW_FLOWERE 0x00000071017835D8,_ZN6Blocks5STONEE @@ -355,8 +414,13 @@ 0x0000007101786150,_ZN8DyeColor4CYANE 0x0000007101786158,_ZN8DyeColor6PURPLEE 0x0000007101786160,_ZN8DyeColor7MAGENTAE +0x0000007101786168,_ZN16DoublePlantBlock7Variant9SUNFLOWERE +0x0000007101786170,_ZN16DoublePlantBlock7Variant7SYRINGAE +0x0000007101786178,_ZN16DoublePlantBlock7Variant4ROSEE +0x0000007101786180,_ZN16DoublePlantBlock7Variant7PAEONIAE 0x0000007101786238,_ZN9Direction5NORTHE 0x0000007101786240,_ZN8DyeColor5BROWNE +0x0000007101786248,_ZN12ColoredBlock5COLORE 0x0000007101786280,_ZN12DamageSource13BYPASS_ARMOURE 0x0000007101786298,FACING 0x00000071017863D0,_ZN9Direction4DOWNE @@ -383,6 +447,11 @@ 0x0000007101789158,_ZN9Direction4Axis1ZE 0x0000007101789160,_ZN9Direction4Axis1XE 0x0000007101789190,_ZN9Direction4Axis6VALUESE +0x00000071017891f0,_ZN9DirtBlock7VARIANTE +0x0000007101789208,_ZN9DirtBlock7Variant6COARSEE +0x0000007101789210,_ZN9DirtBlock7Variant6PODZOLE +0x00000071017894e0,_ZN16DoublePlantBlock7Variant5GRASSE +0x0000007101789548,_ZN16DoublePlantBlock7Variant4FERNE 0x00000071017899A8,sEnchantmentRegistry 0x0000007101789A38,_ZN12Enchantments9KNOCKBACKE 0x0000007101789A40,_ZN12Enchantments11FIRE_ASPECTE @@ -413,6 +482,7 @@ 0x0000007101789B08,_ZN12Enchantments5FLAMEE 0x0000007101789B10,_ZN12Enchantments8INFINITYE 0x0000007101789B18,_ZN12Enchantments7MENDINGE +0x0000007101789bf8,endTerrainSpawn 0x000000710178A320,_ZN21EntityDataSerializers25sINT_EntityDataSerializerE 0x000000710178A328,_ZN21EntityDataSerializers28sSTRING_EntityDataSerializerE 0x000000710178A330,_ZN21EntityDataSerializers29sBOOLEAN_EntityDataSerializerE @@ -456,7 +526,14 @@ 0x000000710178A9B0,_ZN5Items11FISHING_RODE 0x000000710178AA48,_ZN11FlowerBlock6Flower10RED_FLOWERE 0x000000710178AA50,_ZN11FlowerBlock6Flower13YELLOW_FLOWERE +0x000000710178aa58,_ZN11FlowerBlock6Flower7FLOWERSE 0x000000710178AAA8,FlowerBlock::FlowerCategory::YELLOW_FLOWER +0x000000710178aac0,_ZN11FlowerBlock6Flower11BLUE_ORCHIDE +0x000000710178aad0,_ZN11FlowerBlock6Flower9HOUSTONIAE +0x000000710178aad8,_ZN11FlowerBlock6Flower9RED_TULIPE +0x000000710178aae0,_ZN11FlowerBlock6Flower12ORANGE_TULIPE +0x000000710178aae8,_ZN11FlowerBlock6Flower11WHITE_TULIPE +0x000000710178aaf0,_ZN11FlowerBlock6Flower10PINK_TULIPE 0x000000710178AC28,_ZN5Items10FLOWER_POTE 0x000000710178ACE8,_ZN5Items12ROTTEN_FLESHE 0x000000710178ACF0,_ZN5Items12GOLDEN_APPLEE @@ -666,11 +743,16 @@ 0x000000710178BB88,_ZN5Items6ELYTRAE 0x000000710178BB90,_ZN5Items13SHULKER_SHELLE 0x000000710178BB98,_ZN5Items16DEBUG_FOURJ_ITEME +0x000000710178bd40,_ZN11JungleBiome5TRUNKE +0x000000710178bd48,_ZN11JungleBiome6LEAVESE +0x000000710178bd50,_ZN11JungleBiome11BUSH_LEAVESE 0x000000710178BD78,_ZGVZN9FireBlock26createBlockStateDefinitionEvE15blockProperties 0x000000710178BEA0,_ZZN9FireBlock26createBlockStateDefinitionEvE15blockProperties 0x000000710178BEF8,_ZN8Material8CIRCUITSE 0x000000710178BF00,_ZN8Material4LAVAE 0x000000710178BF08,_ZN8Material5WATERE +0x000000710178bf78,endCityFeatureName +0x000000710178bfc0,_ZN17NetherLevelSource13FORTRESS_NAMEE 0x000000710178BFD8,_ZN9LevelType10CUSTOMIZEDE 0x000000710178BFE0,_ZN9LevelType12LARGE_BIOMESE 0x000000710178C110,_ZN9LeafBlock11CHECK_DECAYE @@ -678,6 +760,7 @@ 0x000000710178C130,_ZN9LevelType4FLATE 0x000000710178C138,_ZN8Material3AIRE 0x000000710178C140,_ZN8Material6PORTALE +0x000000710178c148,_ZN20BlockStateProperties11WATER_LEVELE 0x000000710178C1B0,_ZN10LevelChunk10touchedSkyE 0x000000710178C1B8,_ZN9LevelType6NORMALE 0x000000710178C270,_ZN9LevelType9AMPLIFIEDE @@ -803,6 +886,12 @@ 0x000000710178CAE8,_ZN13MaterialColor16TERRACOTTA_GREENE 0x000000710178CAF0,_ZN13MaterialColor14TERRACOTTA_REDE 0x000000710178CAF8,_ZN13MaterialColor16TERRACOTTA_BLACKE +0x000000710178cb98,_ZN9MesaBiome11COARSE_DIRTE +0x000000710178cba0,_ZN9MesaBiome5GRASSE +0x000000710178cba8,_ZN9MesaBiome13HARDENED_CLAYE +0x000000710178cbb0,_ZN9MesaBiome21STAINED_HARDENED_CLAYE +0x000000710178cbb8,_ZN9MesaBiome11ORANGE_CLAYE +0x000000710178cbc0,_ZN9MesaBiome8RED_SANDE 0x000000710178CD28,_ZN13ParticleTypes5SMOKEE 0x000000710178CD68,_ZN11MobCategory7MONSTERE 0x000000710178CD70,_ZN11MobCategory8CREATUREE @@ -838,6 +927,7 @@ 0x00000071017A1958,_ZN11PlanksBlock7Variant8VARIANTSE 0x00000071017A1988,_ZN11PlanksBlock9PREDICATEE 0x00000071017A1A30,_ZN15RangedAttribute12ATTACK_SPEEDE +0x00000071017a1a40,_ZN14DataFixerUpper16DATA_VERSION_KEYE 0x00000071017A1BB0,_ZN9Direction4Axis9PREDICATEE 0x00000071017A1E70,_ZN15PrismarineBlock7VARIANTE 0x00000071017A1E78,_ZN15PrismarineBlock7Variant8VARIANTSE @@ -887,6 +977,8 @@ 0x00000071017A2781,_ZN15SharedConstants12sIsHalloweenE 0x00000071017A2782,_ZN15SharedConstants7sIsXmasE 0x00000071017A2783,_ZN15SharedConstants15sIsDec17ToDec23E +0x00000071017a28e0,_ZN12SimplexNoise2F2E +0x00000071017a28e8,_ZN12SimplexNoise2G2E 0x00000071017A29F0,_ZZN11PlanksBlock26createBlockStateDefinitionEvE10properties 0x00000071017A2AE0,_ZZN17RedSandStoneBlock26createBlockStateDefinitionEvE10properties 0x00000071017A2AF8,ReedsBlock__sAgeProperties @@ -919,7 +1011,13 @@ 0x00000071017A4BD8,_ZN15StoneBrickBlock7Variant5MOSSYE 0x00000071017A4BE0,_ZN15StoneBrickBlock7Variant7CRACKEDE 0x00000071017A4BE8,_ZN15StoneBrickBlock7Variant8CHISELEDE +0x00000071017a5398,_ZN10SwampBiome9WATERLILYE 0x00000071017A53F8,SynchedEntityData__sIdMap +0x00000071017a5448,_ZN14TallGrassBlock7Variant4FERNE +0x00000071017a5450,_ZN14TallGrassBlock7Variant5GRASSE +0x00000071017a54f0,endIslandCenters +0x00000071017A58E8,_ZN4Vec34ZEROE +0x00000071017a5938,_ZN14VillageFeature14ALLOWED_BIOMESE 0x00000071017A5ED8,_ZZN10StoneBlock26createBlockStateDefinitionEvE10properties 0x00000071017A8380,_ZN3fui9sInstanceE 0x00000071017AA788,CGameNetworkManager__sInstance diff --git a/data/mcswitch_functions.csv b/data/mcswitch_functions.csv index 186c2e38..2742c6d6 100644 --- a/data/mcswitch_functions.csv +++ b/data/mcswitch_functions.csv @@ -1434,7 +1434,7 @@ Address,Quality,Size,Name 0x00000071000366cc,U,000216, 0x00000071000367a4,U,000016, 0x00000071000367b4,U,000012, -0x00000071000367c0,U,000292,_ZN10BeachBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE +0x00000071000367c0,O,000292,_ZN10BeachBiomeC1EN5Biome9EBiomeIDsEPNS0_15BiomePropertiesE 0x00000071000368e4,O,001640,_ZN5BiomeC2ENS_9EBiomeIDsEPNS_15BiomePropertiesE 0x0000007100036f4c,O,000008,_ZN5Biome15LegacyBlockDataC2Eii 0x0000007100036f54,U,000104,_ZN11BeaconBlockC_gen @@ -1707,9 +1707,9 @@ Address,Quality,Size,Name 0x000000710003effc,M,013580,_ZN5Biome10staticCtorEv 0x0000007100042508,O,000008,_ZN5Biome15BiomeProperties5depthEf 0x0000007100042510,O,000008,_ZN5Biome15BiomeProperties5scaleEf -0x0000007100042518,U,000008,_ZN5Biome15setPreviewColorE16eMinecraftColour +0x0000007100042518,O,000008,_ZN5Biome15setPreviewColorE16eMinecraftColour 0x0000007100042520,O,000008,_ZN5Biome21setNameAndDescriptionEii -0x0000007100042528,U,000012,_ZN5Biome16setWaterSkyColorE16eMinecraftColourS0_ +0x0000007100042528,O,000012,_ZN5Biome16setWaterSkyColorE16eMinecraftColourS0_ 0x0000007100042534,O,000008,_ZN5Biome15BiomeProperties11temperatureEf 0x000000710004253c,O,000008,_ZN5Biome15BiomeProperties8downfallEf 0x0000007100042544,O,000008,_ZN5Biome15BiomeProperties3dryEv @@ -1717,35 +1717,35 @@ Address,Quality,Size,Name 0x0000007100042554,O,000012,_ZN5Biome15BiomeProperties4snowEv 0x0000007100042560,O,000040,_ZN5Biome15BiomeProperties7mutatedERKNSt3__112basic_stringIwNS1_11char_traitsIwEENS1_9allocatorIwEEEE 0x0000007100042588,O,000004,_ZN5Biome26generateColoursDebugOutputEv -0x000000710004258c,U,000032,_ZN5Block5getIdEP5Block +0x000000710004258c,U,000032,_ZN5Block5getIdEPS_ 0x00000071000425ac,O,000040,_ZN5Biome15BiomePropertiesD2Ev -0x00000071000425d4,U,000044,_ZN5Biome15createDecoratorEv +0x00000071000425d4,O,000044,_ZN5Biome15createDecoratorEv 0x0000007100042600,O,000080,_ZN5Biome14MobSpawnerDataC2Eiiii 0x0000007100042650,U,000056, -0x0000007100042688,U,000036,_ZN5BiomeD0Ev -0x00000071000426ac,U,000092,_ZN5Biome14getTreeFeatureER6Random -0x0000007100042708,U,000056,_ZN5Biome15getGrassFeatureER6Random +0x0000007100042688,O,000036,_ZN5BiomeD0Ev +0x00000071000426ac,O,000092,_ZN5Biome14getTreeFeatureER6Random +0x0000007100042708,O,000056,_ZN5Biome15getGrassFeatureER6Random 0x0000007100042740,O,000060,_ZN5Biome15getRandomFlowerER6RandomPK8BlockPos -0x000000710004277c,U,000096,_ZN5Biome7getNameEb -0x00000071000427dc,U,000108,_ZN5Biome14getDescriptionEv -0x0000007100042848,U,000008, +0x000000710004277c,O,000096,_ZN5Biome7getNameEb +0x00000071000427dc,O,000108,_ZN5Biome14getDescriptionEv +0x0000007100042848,O,000008,_ZN5Biome15getPreviewColorEv 0x0000007100042850,O,000156,_ZN5Biome11getSkyColorEf -0x00000071000428ec,U,000224,_ZN5Biome7getMobsEP11MobCategory +0x00000071000428ec,O,000224,_ZN5Biome7getMobsEP11MobCategory 0x00000071000429cc,O,000004,_ZN5Biome7hasSnowEv 0x00000071000429d0,O,000008,_ZN5Biome13isSnowCoveredEv 0x00000071000429d8,O,000056,_ZN5Biome7hasRainEv 0x0000007100042a10,O,000036,_ZN5Biome7isHumidEv -0x0000007100042a34,U,000008,_ZN5Biome11getDownfallEv +0x0000007100042a34,O,000008,_ZN5Biome11getDownfallEv 0x0000007100042a3c,O,000012,_ZN5Biome22getCreatureProbabilityEv 0x0000007100042a48,O,000240,_ZN5Biome14getTemperatureEPK8BlockPos -0x0000007100042b38,U,000008,_ZN5Biome14getTemperatureEv -0x0000007100042b40,U,000032,_ZN5Biome8decorateEP5LevelR6RandomRK8BlockPos +0x0000007100042b38,O,000008,_ZN5Biome14getTemperatureEv +0x0000007100042b40,O,000032,_ZN5Biome8decorateEP5LevelR6RandomRK8BlockPos 0x0000007100042b60,O,000108,_ZN5Biome13getGrassColorEPK8BlockPos 0x0000007100042bcc,O,000108,_ZN5Biome15getFoliageColorEPK8BlockPos 0x0000007100042c38,O,000116,_ZN5Biome13setGrassColorEPK8BlockPosj 0x0000007100042cac,O,000116,_ZN5Biome15setFoliageColorEPK8BlockPosj -0x0000007100042d20,U,000012,_ZN5Biome14buildSurfaceAtEP5LevelR6RandomP11ChunkPrimeriid -0x0000007100042d2c,U,000852,_ZN5Biome21buildSurfaceAtDefaultEP5LevelR6RandomP11ChunkPrimeriid +0x0000007100042d20,O,000012,_ZN5Biome14buildSurfaceAtEP5LevelR6RandomP11ChunkPrimeriid +0x0000007100042d2c,O,000852,_ZN5Biome21buildSurfaceAtDefaultEP5LevelR6RandomP11ChunkPrimeriid 0x0000007100043080,O,000124,_ZN11ChunkPrimer15setBlockAndDataEiii 0x00000071000430fc,O,000024,_ZN11ChunkPrimer10getBlockIdEi 0x0000007100043114,O,000060,_ZN5Biome22getTemperatureCategoryEv @@ -1753,8 +1753,8 @@ Address,Quality,Size,Name 0x000000710004315c,O,000008,_ZN5Biome8getBiomeEi 0x0000007100043164,O,000048,_ZN5Biome8getBiomeEiPS_ 0x0000007100043194,O,000008,_ZN5Biome18isAlwaysValidSpawnEv -0x000000710004319c,U,000008,_ZN5Biome8getDepthEv -0x00000071000431a4,U,000008,_ZN5Biome8getScaleEv +0x000000710004319c,O,000008,_ZN5Biome8getDepthEv +0x00000071000431a4,O,000008,_ZN5Biome8getScaleEv 0x00000071000431ac,O,000040,_ZN5Biome13getWaterColorEv 0x00000071000431d4,O,000204,_ZNK5Biome11getFogColorEff 0x00000071000432a0,O,000108,_ZN5Biome15BiomePropertiesC1ERKNSt3__112basic_stringIwNS1_11char_traitsIwEENS1_9allocatorIwEEEE @@ -1773,7 +1773,7 @@ Address,Quality,Size,Name 0x00000071000438b4,U,000296, 0x00000071000439dc,U,000160, 0x0000007100043a7c,O,000068,_ZN15arrayWithLengthIP5BiomeEC2Ejb -0x0000007100043ac0,U,000012,_ZN15arrayWithLengthIP5BiomeE3getEj +0x0000007100043ac0,O,000012,_ZN15arrayWithLengthIP5BiomeE3getEj 0x0000007100043acc,U,000028, 0x0000007100043ae8,O,000272,_ZN15BiomeCacheLayerC1ExNSt3__110shared_ptrI5LayerEEihii 0x0000007100043bf8,U,000060,_ZN15BiomeCacheLayerD2Ev @@ -1796,19 +1796,19 @@ Address,Quality,Size,Name 0x0000007100044174,U,000016, 0x0000007100044184,U,000016, 0x0000007100044194,U,000016,getAverageSkyColor__11BiomeColorsSFP11LevelSourceRC8BlockPos -0x00000071000441a4,U,000424,_ZN14BiomeDecoratorC2Ev -0x000000710004434c,U,000052,_ZN12ReedsFeatureC1Ev -0x0000007100044380,U,000052,_ZN13CactusFeatureC1Ev -0x00000071000443b4,O,000052,_ZN16WaterlilyFeatureC1Ev -0x00000071000443e8,U,000484,_ZN14BiomeDecoratorD2Ev -0x00000071000445cc,U,000036,_ZN14BiomeDecoratorD0Ev -0x00000071000445f0,U,001040,_ZN14BiomeDecorator8decorateEP5LevelR6RandomP5BiomeRK8BlockPos +0x00000071000441a4,O,000424,_ZN14BiomeDecoratorC2Ev +0x000000710004434c,O,000052,_ZN12ReedsFeatureC2Ev +0x0000007100044380,O,000052,_ZN13CactusFeatureC2Ev +0x00000071000443b4,O,000052,_ZN16WaterlilyFeatureC2Ev +0x00000071000443e8,O,000484,_ZN14BiomeDecoratorD2Ev +0x00000071000445cc,O,000036,_ZN14BiomeDecoratorD0Ev +0x00000071000445f0,O,001040,_ZN14BiomeDecorator8decorateEP5LevelR6RandomP5BiomeRK8BlockPos 0x0000007100044a00,O,000096,_ZNK10BlockState8setValueIPN10StoneBlock7VariantEEEPKS_P8PropertyT_ -0x0000007100044a60,U,004100,_ZN14BiomeDecorator8decorateEP5BiomeP5LevelR6Random -0x0000007100045a64,O,000052,_ZN14PumpkinFeatureC1Ev -0x0000007100045a98,U,000416,_ZN14BiomeDecorator12decorateOresEP5LevelR6Random -0x0000007100045c38,U,000300, -0x0000007100045d64,U,000268, +0x0000007100044a60,O,004100,_ZN14BiomeDecorator8decorateEP5BiomeP5LevelR6Random +0x0000007100045a64,O,000052,_ZN14PumpkinFeatureC2Ev +0x0000007100045a98,O,000416,_ZN14BiomeDecorator12decorateOresEP5LevelR6Random +0x0000007100045c38,O,000300,_ZN14BiomeDecorator17decorateDepthSpanEP5LevelR6RandomiP7Featureii +0x0000007100045d64,O,000268,_ZN14BiomeDecorator20decorateDepthAverageEP5LevelR6RandomiP7Featureii 0x0000007100045e70,O,000128,_ZN14BiomeEdgeLayerC1ExNSt3__110shared_ptrI5LayerEE 0x0000007100045ef0,U,000004,_ZN14BiomeEdgeLayerD2Ev 0x0000007100045ef4,O,000036,_ZN14BiomeEdgeLayerD0Ev @@ -1857,7 +1857,7 @@ Address,Quality,Size,Name 0x00000071000486b8,U,000232, 0x00000071000487a0,U,000172, 0x000000710004884c,O,000008,_ZN11BiomeSource21LayerOverrideSettings20GetBiomeSectionWidthEv -0x0000007100048854,U,000664,_ZN11BiomeSource21LayerOverrideSettings28UpdateBiomeMapPixelsInRegionEPjjjjjRbb +0x0000007100048854,M,000664,_ZN11BiomeSource21LayerOverrideSettings28UpdateBiomeMapPixelsInRegionEPjjjjjRbb 0x0000007100048aec,O,000012,_ZN15arrayWithLengthIhEC2EPhi 0x0000007100048af8,U,000360, 0x0000007100048c60,O,000256,_ZN11BiomeSource21LayerOverrideSettings17GetCursorBlockPosEff @@ -1886,7 +1886,7 @@ Address,Quality,Size,Name 0x00000071000494fc,U,000004, 0x0000007100049500,O,000172,_ZNK11BiomeSource18getRawBiomeIndicesER15arrayWithLengthIiEiiii 0x00000071000495ac,O,000284,_ZNK11BiomeSource16getRawBiomeBlockER15arrayWithLengthIP5BiomeEiiii -0x00000071000496c8,U,000112, +0x00000071000496c8,O,000112,_ZN15arrayWithLengthIP5BiomeE6resizeEj 0x0000007100049738,O,000168,_ZNK11BiomeSource18getBiomeIndexBlockEiiii 0x00000071000497e0,O,000364,_ZNK11BiomeSource18getBiomeIndexBlockER15arrayWithLengthIhEiiiib 0x000000710004994c,O,000112,_ZN15arrayWithLengthIhE6resizeEj @@ -4095,9 +4095,9 @@ Address,Quality,Size,Name 0x00000071000b36bc,U,000056,_ZN10PredicatesIPKN8BedBlock4PartEE17ConstantPredicateC1Eb 0x00000071000b36f4,U,000088, 0x00000071000b374c,U,000056,_ZN10PredicatesIP12BlockInWorldE17ConstantPredicateC1Eb -0x00000071000b3784,U,000140,_ZN5BiomeD2Ev -0x00000071000b3810,U,000036,_ZN10BeachBiomeD0Ev -0x00000071000b3834,U,000008, +0x00000071000b3784,O,000140,_ZN5BiomeD2Ev +0x00000071000b3810,O,000036,_ZN10BeachBiomeD0Ev +0x00000071000b3834,O,000008,_ZN10BeachBiome12getBaseClassEv 0x00000071000b383c,O,000036,_ZN9BlockImplD0Ev 0x00000071000b3860,U,000004,_ZN6BufferD2Ev 0x00000071000b3864,U,000036,_ZN6BufferD0Ev @@ -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, @@ -6928,10 +6928,10 @@ Address,Quality,Size,Name 0x00000071000f83cc,U,000016, 0x00000071000f83dc,U,000016, 0x00000071000f83ec,U,000016, -0x00000071000f83fc,U,000832,_ZN11DesertBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE -0x00000071000f873c,U,000252,vtbl_710103E7F0_func_11 +0x00000071000f83fc,O,000832,_ZN11DesertBiomeC1EN5Biome9EBiomeIDsEPNS0_15BiomePropertiesE +0x00000071000f873c,M,000252,_ZN11DesertBiome8decorateEP5LevelR6RandomRK8BlockPos 0x00000071000f8838,U,001908, -0x00000071000f8fac,U,000052,_ZN13FossilFeatureC_gen +0x00000071000f8fac,O,000052,_ZN13FossilFeatureC2Ev 0x00000071000f8fe0,U,000100,_ZN17DesertWellFeature10staticCtorEv 0x00000071000f9044,U,000076, 0x00000071000f9090,U,000052, @@ -7617,7 +7617,7 @@ Address,Quality,Size,Name 0x000000710010e43c,U,000008, 0x000000710010e444,U,000060, 0x000000710010e480,U,000108, -0x000000710010e4ec,U,000036, +0x000000710010e4ec,O,000036,_Z21fillFixedBiomeIndices15arrayWithLengthIhEjji 0x000000710010e510,U,000064, 0x000000710010e550,U,000008, 0x000000710010e558,U,000148, @@ -8368,8 +8368,8 @@ Address,Quality,Size,Name 0x000000710012ae20,U,000036,_ZN23DefendVillageTargetGoalD0Ev 0x000000710012ae44,U,000064, 0x000000710012ae84,U,000036,_ZN16DerivedLevelDataD0Ev -0x000000710012aea8,U,000036,_ZN11DesertBiomeD0Ev -0x000000710012aecc,U,000008,vtbl_710103E7F0_func_18 +0x000000710012aea8,O,000036,_ZN11DesertBiomeD0Ev +0x000000710012aecc,O,000008,_ZN11DesertBiome12getBaseClassEv 0x000000710012aed4,U,000036,_ZN17DesertWellFeatureD0Ev 0x000000710012aef8,U,000036,_ZN17DetectorRailBlockD0Ev 0x000000710012af1c,O,000036,_ZN24DigDurabilityEnchantmentD0Ev @@ -8595,7 +8595,7 @@ Address,Quality,Size,Name 0x000000710012cec0,U,000008, 0x000000710012cec8,U,000036,_ZN12PositionImplD0Ev 0x000000710012ceec,O,000004,_ZN5SynthD1Ev -0x000000710012cef0,M,000036,_ZN5SynthD0Ev +0x000000710012cef0,O,000036,_ZN5SynthD0Ev 0x000000710012cf14,U,000020,_ZN22DragonRespawnAnimationC1Ev 0x000000710012cf28,U,000200, 0x000000710012cff0,U,000160, @@ -8824,7 +8824,7 @@ Address,Quality,Size,Name 0x0000007100132868,U,000108, 0x00000071001328d4,U,001012, 0x0000007100132cc8,U,000004, -0x0000007100132ccc,U,000036,_ZN10TypedBoxedIPK8DyeColorED0Ev +0x0000007100132ccc,O,000036,_ZN10TypedBoxedIPK8DyeColorED0Ev 0x0000007100132cf0,U,000048, 0x0000007100132d20,U,000088, 0x0000007100132d78,U,000048, @@ -10492,13 +10492,13 @@ Address,Quality,Size,Name 0x00000071001698e4,U,000028,_ZN9Explosion15getDirectSourceEv 0x0000007100169900,U,000008, 0x0000007100169908,U,000008, -0x0000007100169910,U,000248,_ZN17ExtremeHillsBiomeC1EN5Biome9EBiomeIDsEN17ExtremeHillsBiome5ETypeEPN5Biome15BiomePropertiesE +0x0000007100169910,O,000248,_ZN17ExtremeHillsBiomeC1EN5Biome9EBiomeIDsENS_5ETypeEPNS0_15BiomePropertiesE 0x0000007100169a08,O,000096,_ZNK10BlockState8setValueIPN15MonsterEggBlock7VariantEEEPKS_P8PropertyT_ -0x0000007100169a68,U,000068,_ZN17ExtremeHillsBiomeD2Ev -0x0000007100169aac,U,000036,_ZN17ExtremeHillsBiomeD0Ev -0x0000007100169ad0,U,000096, -0x0000007100169b30,U,000412, -0x0000007100169ccc,U,000348, +0x0000007100169a68,O,000068,_ZN17ExtremeHillsBiomeD2Ev +0x0000007100169aac,O,000036,_ZN17ExtremeHillsBiomeD0Ev +0x0000007100169ad0,O,000096,_ZN17ExtremeHillsBiome14getTreeFeatureER6Random +0x0000007100169b30,O,000412,_ZN17ExtremeHillsBiome8decorateEP5LevelR6RandomRK8BlockPos +0x0000007100169ccc,O,000348,_ZN17ExtremeHillsBiome14buildSurfaceAtEP5LevelR6RandomP11ChunkPrimeriid 0x0000007100169e28,U,000064, 0x0000007100169e68,U,000080,_ZN16EyeOfEnderSignalC_gen 0x0000007100169eb8,U,000004, @@ -10912,15 +10912,16 @@ Address,Quality,Size,Name 0x000000710017c728,O,000012,_ZN23FishingSpeedEnchantment10getMinCostEi 0x000000710017c734,O,000024,_ZN23FishingSpeedEnchantment10getMaxCostEi 0x000000710017c74c,O,000008,_ZN23FishingSpeedEnchantment11getMaxLevelEv -0x000000710017c754,U,000056,_ZN16FixedBiomeSourceC_gen -0x000000710017c78c,U,000008, -0x000000710017c794,U,000148, -0x000000710017c828,U,000100, -0x000000710017c88c,U,000096, -0x000000710017c8ec,U,000192, -0x000000710017c9ac,U,000052, -0x000000710017c9e0,U,000008, -0x000000710017c9e8,U,000008, +0x000000710017c754,O,000056,_ZN16FixedBiomeSourceC1EP5Biome +0x000000710017c78c,O,000008,_ZN16FixedBiomeSource8getBiomeERK8BlockPos +0x000000710017c794,O,000096,_ZNK16FixedBiomeSource13getBiomeBlockER15arrayWithLengthIP5BiomeEiiiib +0x000000710017c7f4,O,000052,_Z22fillFixedBiomePointers15arrayWithLengthIP5BiomeEjjS1_ +0x000000710017c828,O,000100,_ZNK16FixedBiomeSource18getBiomeIndexBlockER15arrayWithLengthIhEiiiib +0x000000710017c88c,O,000096,_ZNK16FixedBiomeSource16getRawBiomeBlockER15arrayWithLengthIP5BiomeEiiii +0x000000710017c8ec,O,000192,_ZN16FixedBiomeSource9findBiomeEiiiNSt3__16vectorIP5BiomeNS0_9allocatorIS3_EEEEP6Random +0x000000710017c9ac,O,000052,_ZN16FixedBiomeSource12containsOnlyEiiiRKNSt3__16vectorIP5BiomeNS0_9allocatorIS3_EEEE +0x000000710017c9e0,O,000008,_ZN16FixedBiomeSource12isFixedBiomeEv +0x000000710017c9e8,O,000008,_ZN16FixedBiomeSource13getFixedBiomeEv 0x000000710017c9f0,O,000020,_ZN26FjFeatureBiomeRequirementsC1Ev 0x000000710017ca04,O,000020,_ZN26FjFeatureBiomeRequirementsC1EPKNSt3__16vectorIP5BiomeNS0_9allocatorIS3_EEEEjS8_j 0x000000710017ca18,U,000016, @@ -11017,10 +11018,10 @@ Address,Quality,Size,Name 0x000000710017f994,U,000096,_ZN17FlatGeneratorInfo10getVillageEi 0x000000710017f9f4,U,000024,_ZN17FlatGeneratorInfo8hasCavesEv 0x000000710017fa0c,U,000072,_ZN17FlatGeneratorInfo8getCavesEv -0x000000710017fa54,U,000048,_ZN16LargeCaveFeatureC1Ev +0x000000710017fa54,O,000048,_ZN16LargeCaveFeatureC2Ev 0x000000710017fa84,U,000024,_ZN17FlatGeneratorInfo10hasCanyonsEv 0x000000710017fa9c,U,000080,_ZN17FlatGeneratorInfo10getCanyonsEv -0x000000710017faec,U,000048,_ZN13CanyonFeatureC1Ev +0x000000710017faec,O,000048,_ZN13CanyonFeatureC2Ev 0x000000710017fb1c,U,000024,_ZN17FlatGeneratorInfo12hasMineshaftEv 0x000000710017fb34,U,000032, 0x000000710017fb54,U,000080,_ZN17FlatGeneratorInfo12getMineshaftEv @@ -11049,29 +11050,29 @@ Address,Quality,Size,Name 0x0000007100180664,U,000248, 0x000000710018075c,U,000412, 0x00000071001808f8,U,000008, -0x0000007100180900,U,000604,_ZN8IntCache8allocateEi +0x0000007100180900,M,000604,_ZN8IntCache8allocateEi 0x0000007100180b5c,U,000056, 0x0000007100180b94,U,000004, 0x0000007100180b98,U,000096, 0x0000007100180bf8,U,000008, 0x0000007100180c00,U,000148, -0x0000007100180c94,U,001496,_ZN15FlatLevelSourceC1EP5LevelxbP15SuperflatConfig +0x0000007100180c94,M,001496,_ZN15FlatLevelSourceC1EP5LevelxbP15SuperflatConfig 0x000000710018126c,U,000752, -0x000000710018155c,U,000208,_ZN15FlatLevelSourceD1Ev +0x000000710018155c,O,000208,_ZN15FlatLevelSourceD1Ev 0x000000710018162c,U,000004, -0x0000007100181630,U,000036,_ZN15FlatLevelSourceD0Ev -0x0000007100181654,U,000068, +0x0000007100181630,O,000036,_ZN15FlatLevelSourceD0Ev +0x0000007100181654,O,000068,_ZN15FlatLevelSource14prepareHeightsEiiP11ChunkPrimer 0x0000007100181698,U,000008, 0x00000071001816a0,U,000008, -0x00000071001816a8,U,000008, -0x00000071001816b0,U,000520,_ZN15FlatLevelSource11createChunkEii -0x00000071001818b8,U,000968,_ZN15FlatLevelSource11postProcessEii +0x00000071001816a8,O,000008,_ZN15FlatLevelSource6isFlatEv +0x00000071001816b0,O,000520,_ZN15FlatLevelSource11createChunkEii +0x00000071001818b8,M,000968,_ZN15FlatLevelSource11postProcessEii 0x0000007100181c80,U,000052,_ZN18MonsterRoomFeatureC_gen -0x0000007100181cb4,U,000008,_ZN15FlatLevelSource22postProcessLoadedChunkEP10LevelChunkii -0x0000007100181cbc,U,000140,_ZN15FlatLevelSource9getMobsAtEP11MobCategoryRK8BlockPos -0x0000007100181d48,U,001044,_ZN15FlatLevelSource21findNearestMapFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPosb -0x000000710018215c,U,000072,_ZN15FlatLevelSource14isPosInFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPos -0x00000071001821a4,U,000092,_ZN15FlatLevelSource31recreateLogicStructuresForChunkEP10LevelChunkii +0x0000007100181cb4,O,000008,_ZN15FlatLevelSource22postProcessLoadedChunkEP10LevelChunkii +0x0000007100181cbc,O,000140,_ZN15FlatLevelSource9getMobsAtEP11MobCategoryRK8BlockPos +0x0000007100181d48,M,001044,_ZN15FlatLevelSource21findNearestMapFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPosb +0x000000710018215c,O,000072,_ZN15FlatLevelSource14isPosInFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPos +0x00000071001821a4,O,000092,_ZN15FlatLevelSource31recreateLogicStructuresForChunkEP10LevelChunkii 0x0000007100182200,U,000092,_ZN11FleeSunGoalC_gen 0x000000710018225c,U,000244, 0x0000007100182350,U,000316, @@ -11335,13 +11336,13 @@ Address,Quality,Size,Name 0x000000710018b1cc,U,000068, 0x000000710018b210,U,000012, 0x000000710018b21c,U,001792, -0x000000710018b91c,U,000328,_ZN11ForestBiomeC1EN5Biome9EBiomeIDsEN11ForestBiome5ETypeEPN5Biome15BiomePropertiesE -0x000000710018ba64,U,000208, -0x000000710018bb34,U,000240, -0x000000710018bc24,U,000144, -0x000000710018bcb4,U,000388, -0x000000710018be38,U,000404, -0x000000710018bfcc,U,000084, +0x000000710018b91c,M,000328,_ZN11ForestBiomeC1EN5Biome9EBiomeIDsENS_5ETypeEPNS0_15BiomePropertiesE +0x000000710018ba64,O,000208,_ZN11ForestBiome14getTreeFeatureER6Random +0x000000710018bb34,O,000240,_ZN11ForestBiome15getRandomFlowerER6RandomPK8BlockPos +0x000000710018bc24,O,000144,_ZN11ForestBiome8decorateEP5LevelR6RandomRK8BlockPos +0x000000710018bcb4,O,000388,_ZN11ForestBiome12addMushroomsEP5LevelR6RandomRK8BlockPos +0x000000710018be38,M,000404,_ZN11ForestBiome15addDoublePlantsEP5LevelR6RandomRK8BlockPosi +0x000000710018bfcc,O,000084,_ZN11ForestBiome13getGrassColorEPK8BlockPos 0x000000710018c020,U,000772, 0x000000710018c324,U,000012,_ZN10FrameTimerC1Ev 0x000000710018c330,U,000096, @@ -12247,13 +12248,13 @@ Address,Quality,Size,Name 0x00000071001a20e4,U,000024, 0x00000071001a20fc,U,000052,_ZN20HealthBoostMobEffectC_gen 0x00000071001a2130,U,000148, -0x00000071001a21c4,U,000772,_ZN9HellBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE -0x00000071001a24c8,U,000048,_ZN18HellBiomeDecoratorC_gen -0x00000071001a24f8,U,000088, -0x00000071001a2550,U,000008, -0x00000071001a2558,U,000008, -0x00000071001a2560,U,000008, -0x00000071001a2568,U,000004, +0x00000071001a21c4,O,000772,_ZN9HellBiomeC1EN5Biome9EBiomeIDsEPNS0_15BiomePropertiesE +0x00000071001a24c8,O,000048,_ZN18HellBiomeDecoratorC2Ev +0x00000071001a24f8,O,000088,_ZNK9HellBiome11getFogColorEff +0x00000071001a2550,O,000008,_ZN9HellBiome7isFoggyEv +0x00000071001a2558,O,000008,_ZN9HellBiome9isNaturalEv +0x00000071001a2560,O,000008,_ZN9HellBiome11getSkyColorEf +0x00000071001a2568,O,000004,_ZN18HellBiomeDecorator8decorateEP5LevelR6RandomP5BiomeRK8BlockPos 0x00000071001a256c,O,000352,_ZN15HellFireFeature5placeEP5LevelR6RandomRK8BlockPos 0x00000071001a26cc,U,000568, 0x00000071001a2904,O,000076,_ZN17HellSpringFeatureC1EP5Blockb @@ -12517,11 +12518,11 @@ Address,Quality,Size,Name 0x00000071001ac430,U,000348, 0x00000071001ac58c,U,000016, 0x00000071001ac59c,U,000104, -0x00000071001ac604,U,000700,_ZN8IceBiomeC1EN5Biome9EBiomeIDsEbPN5Biome15BiomePropertiesE -0x00000071001ac8c0,U,000052,_ZN15IceSpikeFeatureC_gen -0x00000071001ac8f4,U,000012, -0x00000071001ac900,U,000640, -0x00000071001acb80,U,000048, +0x00000071001ac604,O,000700,_ZN8IceBiomeC1EN5Biome9EBiomeIDsEbPNS0_15BiomePropertiesE +0x00000071001ac8c0,O,000052,_ZN15IceSpikeFeatureC2Ev +0x00000071001ac8f4,O,000012,_ZN8IceBiome22getCreatureProbabilityEv +0x00000071001ac900,O,000640,_ZN8IceBiome8decorateEP5LevelR6RandomRK8BlockPos +0x00000071001acb80,O,000048,_ZN8IceBiome14getTreeFeatureER6Random 0x00000071001acbb0,U,000008,_ZN15FrostedIceBlock14getRenderLayerEv 0x00000071001acbb8,U,000500,_ZN15FrostedIceBlock13playerDestroyEP5LevelSt10shared_ptrI6PlayerERK8BlockPosPK10BlockStateNSt3__110shared_ptrI11BlockEntityE12not_null_ptrI12ItemInstanceE 0x00000071001acdac,U,000008,_ZN15FrostedIceBlock16getResourceCountEP6Random @@ -12572,16 +12573,16 @@ Address,Quality,Size,Name 0x00000071001ae998,U,000012, 0x00000071001ae9a4,U,000012, 0x00000071001ae9b0,U,000072, -0x00000071001ae9f8,U,000276,_ZN13ImprovedNoise4initEP6Random -0x00000071001aeb0c,U,000060,_ZN13ImprovedNoiseC1EP6Random -0x00000071001aeb48,U,000060,_ZN13ImprovedNoiseD2Ev -0x00000071001aeb84,U,000036,_ZN13ImprovedNoiseD0Ev -0x00000071001aeba8,U,000796, -0x00000071001aeec4,U,000016, -0x00000071001aeed4,U,000068, -0x00000071001aef18,U,000008,_ZN13ImprovedNoise8getValueEdd -0x00000071001aef20,U,002556,_ZN13ImprovedNoise3addE15arrayWithLengthIdEdddiiidddd -0x00000071001af91c,U,000048, +0x00000071001ae9f8,O,000276,_ZN13ImprovedNoise4initEP6Random +0x00000071001aeb0c,O,000060,_ZN13ImprovedNoiseC1EP6Random +0x00000071001aeb48,O,000060,_ZN13ImprovedNoiseD2Ev +0x00000071001aeb84,O,000036,_ZN13ImprovedNoiseD0Ev +0x00000071001aeba8,M,000796,_ZN13ImprovedNoise8getValueEddd +0x00000071001aeec4,O,000016,_ZN13ImprovedNoise4lerpEddd +0x00000071001aeed4,O,000068,_ZN13ImprovedNoise4gradEiddd +0x00000071001aef18,O,000008,_ZN13ImprovedNoise8getValueEdd +0x00000071001aef20,M,002556,_ZN13ImprovedNoise3addE15arrayWithLengthIdEdddiiidddd +0x00000071001af91c,O,000048,_ZN13ImprovedNoise4gradEidd 0x00000071001af94c,U,000212,_ZN26IndirectEntityDamageSourceC_gen 0x00000071001afa20,U,000028, 0x00000071001afa3c,U,000028, @@ -12614,14 +12615,14 @@ Address,Quality,Size,Name 0x00000071001b03f8,U,000036,_ZN9IntBufferD0Ev 0x00000071001b041c,U,000012,_ZN9IntBuffer4flipEv 0x00000071001b0428,U,000012, -0x00000071001b0434,U,000084,_ZN8IntCache22CreateNewThreadStorageEv -0x00000071001b0488,U,000036, -0x00000071001b04ac,U,000424, +0x00000071001b0434,M,000084,_ZN8IntCache22CreateNewThreadStorageEv +0x00000071001b0488,O,000036,_ZN8IntCache13ThreadStorageC1Ev +0x00000071001b04ac,M,000424,_ZN8IntCache13ThreadStorageD1Ev 0x00000071001b0654,U,000056, -0x00000071001b068c,U,000072, +0x00000071001b068c,O,000072,_ZN8IntCache20ReleaseThreadStorageEv 0x00000071001b06d4,U,000336, -0x00000071001b0824,U,000360, -0x00000071001b098c,U,000640,_ZN8IntCache5ResetEv +0x00000071001b0824,M,000360,_ZN8IntCache10releaseAllEv +0x00000071001b098c,M,000640,_ZN8IntCache5ResetEv 0x00000071001b0c0c,U,000200,_ZN15IntegerPropertyC_gen 0x00000071001b0cd4,U,000076,_ZN16AbstractPropertyIiEC_gen 0x00000071001b0d20,U,000148,_ZN15IntegerPropertyD2Ev @@ -13058,11 +13059,11 @@ Address,Quality,Size,Name 0x00000071001ceaf0,U,000260,_ZN12JukeboxBlock13registerIconsEP12IconRegister 0x00000071001cebf4,O,000024,_ZN11JumpControlC1EP3Mob 0x00000071001cec0c,O,000052,_ZN11JumpControl4tickEv -0x00000071001cec40,U,000208,_ZN11JungleBiome10staticCtorEv -0x00000071001ced10,U,000388,_ZN11JungleBiomeC1EN5Biome9EBiomeIDsEbPN5Biome15BiomePropertiesE -0x00000071001cee94,U,000284, -0x00000071001cefb0,U,000096, -0x00000071001cf010,U,000372, +0x00000071001cec40,O,000208,_ZN11JungleBiome10staticCtorEv +0x00000071001ced10,O,000388,_ZN11JungleBiomeC1EN5Biome9EBiomeIDsEbPNS0_15BiomePropertiesE +0x00000071001cee94,O,000284,_ZN11JungleBiome14getTreeFeatureER6Random +0x00000071001cefb0,O,000096,_ZN11JungleBiome15getGrassFeatureER6Random +0x00000071001cf010,O,000372,_ZN11JungleBiome8decorateEP5LevelR6RandomRK8BlockPos 0x00000071001cf184,O,000056,_ZN16KickPlayerPacketC1Ev 0x00000071001cf1bc,O,000060,_ZN16KickPlayerPacketC1Eh 0x00000071001cf1f8,O,000080,_ZN16KickPlayerPacket6handleEP14PacketListener @@ -13135,7 +13136,7 @@ Address,Quality,Size,Name 0x00000071001cff70,U,000036,_ZN13ExperienceOrbD0Ev 0x00000071001cff94,U,000012, 0x00000071001cffa0,M,000036,_ZN7FeatureD0Ev -0x00000071001cffc4,U,000008, +0x00000071001cffc4,O,000008,_ZN17ExtremeHillsBiome12getBaseClassEv 0x00000071001cffcc,U,000192,_ZN6EntityD2Ev 0x00000071001d008c,U,000036,_ZN16EyeOfEnderSignalD0Ev 0x00000071001d00b0,U,000012, @@ -13171,7 +13172,7 @@ Address,Quality,Size,Name 0x00000071001d04b4,U,000036,_ZN11FishingHookD0Ev 0x00000071001d04d8,U,000012, 0x00000071001d04e4,U,000036,_ZN14FishingRodItemD0Ev -0x00000071001d0508,U,000036,_ZN16FixedBiomeSourceD0Ev +0x00000071001d0508,O,000036,_ZN16FixedBiomeSourceD0Ev 0x00000071001d052c,U,000036,_ZN11FleeSunGoalD0Ev 0x00000071001d0550,U,000008, 0x00000071001d0558,U,000064, @@ -13208,8 +13209,8 @@ Address,Quality,Size,Name 0x00000071001d097c,U,000052,_ZN16FollowParentGoalD2Ev 0x00000071001d09b0,U,000036,_ZN16FollowParentGoalD0Ev 0x00000071001d09d4,U,000064, -0x00000071001d0a14,U,000036,_ZN11ForestBiomeD0Ev -0x00000071001d0a38,U,000008, +0x00000071001d0a14,O,000036,_ZN11ForestBiomeD0Ev +0x00000071001d0a38,O,000008,_ZN11ForestBiome12getBaseClassEv 0x00000071001d0a40,U,000036,_ZN19HugeMushroomFeatureD0Ev 0x00000071001d0a64,U,000036,_ZN13FossilFeatureD0Ev 0x00000071001d0a88,O,000036,_ZN20HalfTransparentBlockD0Ev @@ -13302,9 +13303,9 @@ Address,Quality,Size,Name 0x00000071001d1630,U,000064, 0x00000071001d1670,U,000036,_ZN8HayBlockD0Ev 0x00000071001d1694,U,000036,_ZN20HealthBoostMobEffectD0Ev -0x00000071001d16b8,U,000036,_ZN18HellBiomeDecoratorD0Ev -0x00000071001d16dc,U,000036,_ZN9HellBiomeD0Ev -0x00000071001d1700,U,000008, +0x00000071001d16b8,O,000036,_ZN18HellBiomeDecoratorD0Ev +0x00000071001d16dc,O,000036,_ZN9HellBiomeD0Ev +0x00000071001d1700,O,000008,_ZN9HellBiome12getBaseClassEv 0x00000071001d1708,O,000036,_ZN15HellFireFeatureD0Ev 0x00000071001d172c,U,000036,_ZN17HellPortalFeatureD0Ev 0x00000071001d1750,O,000036,_ZN17HellSpringFeatureD0Ev @@ -13329,8 +13330,8 @@ Address,Quality,Size,Name 0x00000071001d19dc,U,000036,_ZN4HuskD0Ev 0x00000071001d1a00,U,000012, 0x00000071001d1a0c,U,000036,_ZN15IceSpikeFeatureD0Ev -0x00000071001d1a30,U,000036,_ZN8IceBiomeD0Ev -0x00000071001d1a54,U,000008, +0x00000071001d1a30,O,000036,_ZN8IceBiomeD0Ev +0x00000071001d1a54,O,000008,_ZN8IceBiome12getBaseClassEv 0x00000071001d1a5c,U,000040, 0x00000071001d1a84,U,000036,_ZN15IllusionIllagerD0Ev 0x00000071001d1aa8,U,000012, @@ -13366,8 +13367,8 @@ Address,Quality,Size,Name 0x00000071001d1f18,U,000036,_ZN12JukeboxBlockD0Ev 0x00000071001d1f3c,U,000008, 0x00000071001d1f44,U,000008, -0x00000071001d1f4c,U,000036,_ZN11JungleBiomeD0Ev -0x00000071001d1f70,U,000008, +0x00000071001d1f4c,O,000036,_ZN11JungleBiomeD0Ev +0x00000071001d1f70,O,000008,_ZN11JungleBiome12getBaseClassEv 0x00000071001d1f78,O,000040,_ZN16KickPlayerPacketD2Ev 0x00000071001d1fa0,O,000036,_ZN16KickPlayerPacketD0Ev 0x00000071001d1fc4,O,000008,_ZN16KickPlayerPacket11getPacketIdEv @@ -14308,7 +14309,7 @@ Address,Quality,Size,Name 0x00000071001f15d8,U,000008,_ZN11LadderBlock14getRenderShapeEPK10BlockState 0x00000071001f15e0,O,000060,_ZN11LakeFeatureC1EP5Block 0x00000071001f161c,U,003008,_ZN11LakeFeature5placeEP5LevelR6RandomRK8BlockPos -0x00000071001f21dc,U,000008,shouldFreezeIgnoreNeighbors__5LevelFRC8BlockPos +0x00000071001f21dc,O,000008,_ZN5Level27shouldFreezeIgnoreNeighborsERK8BlockPos 0x00000071001f21e4,U,000060,_ZN24LandOnOwnersShoulderGoalC_gen 0x00000071001f2220,U,000332, 0x00000071001f236c,U,000016, @@ -14622,9 +14623,9 @@ Address,Quality,Size,Name 0x0000007100202a60,O,000004,_ZN5Level20tickClientSideBlocksEiiP10LevelChunk 0x0000007100202a64,O,000012,_ZN5Level10tickBlocksEv 0x0000007100202a70,O,000104,_ZN5Level9instaTickERK8BlockPosPK10BlockStateR6Random -0x0000007100202ad8,U,000400, -0x0000007100202c68,U,000008, -0x0000007100202c70,U,000060, +0x0000007100202ad8,M,000400,_ZN5Level12shouldFreezeERK8BlockPosb +0x0000007100202c68,O,000008,_ZN5Level25shouldFreezeWithNeighborsERK8BlockPos +0x0000007100202c70,O,000060,_ZN5Level9isWaterAtERK8BlockPos 0x0000007100202cac,U,000272,shouldSnow__5LevelFRC8BlockPosb 0x0000007100202dbc,U,000864, 0x000000710020311c,U,000460, @@ -15910,19 +15911,19 @@ Address,Quality,Size,Name 0x00000071002393a0,U,000456, 0x0000007100239568,U,000328, 0x00000071002396b0,U,000008, -0x00000071002396b8,U,000544,_ZN9MesaBiome10staticCtorEv +0x00000071002396b8,O,000544,_ZN9MesaBiome10staticCtorEv 0x00000071002398d8,O,000096,_ZNK10BlockState8setValueIPN9SandBlock7VariantEEEPKS_P8PropertyT_ -0x0000007100239938,U,000308,_ZN9MesaBiomeC1EN5Biome9EBiomeIDsEbbPN5Biome15BiomePropertiesE -0x0000007100239a6c,U,000048,_ZN9MesaBiome13MesaDecoratorC_gen -0x0000007100239a9c,U,000120,_ZN9MesaBiomeD2Ev -0x0000007100239b14,U,000036,_ZN9MesaBiomeD0Ev -0x0000007100239b38,U,000048, -0x0000007100239b68,U,000028, -0x0000007100239b84,U,000028, -0x0000007100239ba0,U,001432, -0x000000710023a138,U,001272, -0x000000710023a630,U,000112, -0x000000710023a6a0,U,000076, +0x0000007100239938,M,000308,_ZN9MesaBiomeC1EN5Biome9EBiomeIDsEbbPNS0_15BiomePropertiesE +0x0000007100239a6c,O,000048,_ZN9MesaBiome13MesaDecoratorC2Ev +0x0000007100239a9c,O,000120,_ZN9MesaBiomeD2Ev +0x0000007100239b14,O,000036,_ZN9MesaBiomeD0Ev +0x0000007100239b38,O,000048,_ZN9MesaBiome14getTreeFeatureER6Random +0x0000007100239b68,O,000028,_ZN9MesaBiome15getFoliageColorEPK8BlockPos +0x0000007100239b84,O,000028,_ZN9MesaBiome13getGrassColorEPK8BlockPos +0x0000007100239ba0,M,001432,_ZN9MesaBiome14buildSurfaceAtEP5LevelR6RandomP11ChunkPrimeriid +0x000000710023a138,M,001272,_ZN9MesaBiome13generateBandsEx +0x000000710023a630,O,000112,_ZN9MesaBiome7getBandEiii +0x000000710023a6a0,O,000076,_ZN9MesaBiome13MesaDecorator12decorateOresEP5LevelR6Random 0x000000710023a6ec,U,000056,_ZN14MilkBucketItemC_gen 0x000000710023a724,U,000396,_ZN14MilkBucketItem15finishUsingItemE12not_null_ptrI12ItemInstanceEP5LevelNSt3__110shared_ptrI12LivingEntityEE 0x000000710023a8b0,U,000008,_ZN14MilkBucketItem14getUseDurationE12not_null_ptrI12ItemInstanceE @@ -16730,7 +16731,7 @@ Address,Quality,Size,Name 0x000000710025c4ac,U,000216,_ZNSt3__120__shared_ptr_pointerIP11MushroomCowNS_14default_deleteIS1_EENS_9allocatorIS1_EEEC_gen 0x000000710025c584,U,000016, 0x000000710025c594,U,000140, -0x000000710025c620,U,000432,_ZN19MushroomIslandBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE +0x000000710025c620,O,000432,_ZN19MushroomIslandBiomeC1EN5Biome9EBiomeIDsEPNS0_15BiomePropertiesE 0x000000710025c7d0,U,000052,_ZN16MusicBlockEntityC_gen 0x000000710025c804,U,000184, 0x000000710025c8bc,U,000204, @@ -16739,11 +16740,11 @@ Address,Quality,Size,Name 0x000000710025cb94,U,000148, 0x000000710025cc28,U,000216,_ZNSt3__120__shared_ptr_pointerIP16MusicBlockEntityNS_14default_deleteIS1_EENS_9allocatorIS1_EEEC_gen 0x000000710025cd00,U,000016, -0x000000710025cd10,U,000060,_ZN18MutatedForestBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE -0x000000710025cd4c,U,000088, -0x000000710025cda4,U,000080,_ZN19MutatedSavannaBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE -0x000000710025cdf4,U,000308, -0x000000710025cf28,U,000032, +0x000000710025cd10,O,000060,_ZN18MutatedForestBiomeC1EN5Biome9EBiomeIDsEPNS0_15BiomePropertiesE +0x000000710025cd4c,O,000088,_ZN18MutatedForestBiome14getTreeFeatureER6Random +0x000000710025cda4,O,000080,_ZN19MutatedSavannaBiomeC1EN5Biome9EBiomeIDsEPNS0_15BiomePropertiesE +0x000000710025cdf4,O,000308,_ZN19MutatedSavannaBiome14buildSurfaceAtEP5LevelR6RandomP11ChunkPrimeriid +0x000000710025cf28,O,000032,_ZN19MutatedSavannaBiome8decorateEP5LevelR6RandomRK8BlockPos 0x000000710025cf48,U,000136,_ZN13MyceliumBlockC_gen 0x000000710025cfd0,U,000160,_ZN13MyceliumBlock31fillVirtualBlockStatePropertiesEPK10BlockStateP11LevelSourceRK8BlockPos 0x000000710025d070,U,000612,_ZN13MyceliumBlock4tickEP5LevelRK8BlockPosPK10BlockStateP6Random @@ -16936,30 +16937,30 @@ 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 0x000000710026af88,O,000008,_ZN21NetherFlatLevelSource14isPosInFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPos 0x000000710026af90,O,000004,_ZN21NetherFlatLevelSource31recreateLogicStructuresForChunkEP10LevelChunkii -0x000000710026af94,U,000004, -0x000000710026af98,U,000824,_ZN17NetherLevelSourceC1EP5Levelbx -0x000000710026b2d0,U,000052,_ZN17HellPortalFeatureC2Ev -0x000000710026b304,U,000048,_ZN20LargeHellCaveFeatureC1Ev -0x000000710026b334,U,000408,_ZN17NetherLevelSourceD1Ev -0x000000710026b4cc,U,000036,_ZN17NetherLevelSourceD0Ev -0x000000710026b4f0,U,001272,_ZN17NetherLevelSource14prepareHeightsEiiP11ChunkPrimer -0x000000710026b9e8,U,001928,_ZN17NetherLevelSource13buildSurfacesEiiP11ChunkPrimer -0x000000710026c170,U,000416,_ZN17NetherLevelSource11createChunkEii -0x000000710026c310,U,000016,_ZN17NetherLevelSource10lightChunkEP10LevelChunk -0x000000710026c320,U,001160, -0x000000710026c7a8,U,001968,_ZN17NetherLevelSource11postProcessEii -0x000000710026cf58,U,000008,_ZN17NetherLevelSource22postProcessLoadedChunkEP10LevelChunkii -0x000000710026cf60,U,000272,_ZN17NetherLevelSource9getMobsAtEP11MobCategoryRK8BlockPos -0x000000710026d070,U,000200,_ZN17NetherLevelSource21findNearestMapFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPosb -0x000000710026d138,U,000192,_ZN17NetherLevelSource14isPosInFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPos -0x000000710026d1f8,U,000028,_ZN17NetherLevelSource31recreateLogicStructuresForChunkEP10LevelChunkii +0x000000710026af94,M,000004,_ZN21FjNetherrackBlockPredD2Ev +0x000000710026af98,O,000824,_ZN17NetherLevelSourceC1EP5Levelbx +0x000000710026b2d0,O,000052,_ZN17HellPortalFeatureC2Ev +0x000000710026b304,O,000048,_ZN20LargeHellCaveFeatureC2Ev +0x000000710026b334,O,000408,_ZN17NetherLevelSourceD1Ev +0x000000710026b4cc,O,000036,_ZN17NetherLevelSourceD0Ev +0x000000710026b4f0,M,001272,_ZN17NetherLevelSource14prepareHeightsEiiP11ChunkPrimer +0x000000710026b9e8,M,001928,_ZN17NetherLevelSource13buildSurfacesEiiP11ChunkPrimer +0x000000710026c170,O,000416,_ZN17NetherLevelSource11createChunkEii +0x000000710026c310,O,000016,_ZN17NetherLevelSource10lightChunkEP10LevelChunk +0x000000710026c320,O,001160,_ZN17NetherLevelSource10getHeightsE15arrayWithLengthIdEiiiiii +0x000000710026c7a8,M,001968,_ZN17NetherLevelSource11postProcessEii +0x000000710026cf58,O,000008,_ZN17NetherLevelSource22postProcessLoadedChunkEP10LevelChunkii +0x000000710026cf60,O,000272,_ZN17NetherLevelSource9getMobsAtEP11MobCategoryRK8BlockPos +0x000000710026d070,O,000200,_ZN17NetherLevelSource21findNearestMapFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPosb +0x000000710026d138,O,000192,_ZN17NetherLevelSource14isPosInFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPos +0x000000710026d1f8,O,000028,_ZN17NetherLevelSource31recreateLogicStructuresForChunkEP10LevelChunkii 0x000000710026d214,U,000064,_ZN15NetherrackBlockC_gen 0x000000710026d254,U,000016,_ZN15NetherrackBlock11getMapColorEPK10BlockStateP11LevelSourceRK8BlockPos 0x000000710026d264,U,000136,_ZN15NetherWartBlockC_gen @@ -17096,8 +17097,8 @@ Address,Quality,Size,Name 0x0000007100270a1c,U,000064,_ZN13ObsidianBlockC_gen 0x0000007100270a5c,U,000016,_ZN13ObsidianBlock11getResourceEPK10BlockStateP6Randomi 0x0000007100270a6c,U,000016,_ZN13ObsidianBlock11getMapColorEPK10BlockStateP11LevelSourceRK8BlockPos -0x0000007100270a7c,U,000156,_ZN10OceanBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE -0x0000007100270b18,U,000008, +0x0000007100270a7c,O,000156,_ZN10OceanBiomeC1EN5Biome9EBiomeIDsEPNS0_15BiomePropertiesE +0x0000007100270b18,O,000008,_ZN10OceanBiome22getTemperatureCategoryEv 0x0000007100270b20,U,000176,_ZN20OceanMonumentFeatureC_gen 0x0000007100270bd0,U,000248,_ZN20OceanMonumentFeatureC_gen2 0x0000007100270cc8,U,000004,_ZN20OceanMonumentFeatureD2Ev @@ -17354,7 +17355,7 @@ Address,Quality,Size,Name 0x0000007100286c88,O,001140,_ZN20OverworldLevelSourceC1EP5LevelxbP15SuperflatConfig 0x00000071002870fc,O,000420,_ZN20OverworldLevelSourceD1Ev 0x00000071002872a0,O,000036,_ZN20OverworldLevelSourceD0Ev -0x00000071002872c4,M,000400,_ZN20OverworldLevelSource14distanceToEdgeEfiiii +0x00000071002872c4,O,000400,_ZN20OverworldLevelSource14distanceToEdgeEfiiii 0x0000007100287454,O,000292,_ZN20OverworldLevelSource16getHeightFalloffEiiPi 0x0000007100287578,M,001324,_ZN20OverworldLevelSource14prepareHeightsEiiP11ChunkPrimer 0x0000007100287aa4,O,001524,_ZN20OverworldLevelSource10getHeightsEiiiR15arrayWithLengthIP5BiomeERS0_IdE @@ -17365,7 +17366,7 @@ Address,Quality,Size,Name 0x0000007100288688,O,001708,_ZN20OverworldLevelSource11postProcessEii 0x0000007100288d34,O,000008,_ZN20OverworldLevelSource22postProcessLoadedChunkEP10LevelChunkii 0x0000007100288d3c,O,000232,_ZN20OverworldLevelSource9getMobsAtEP11MobCategoryRK8BlockPos -0x0000007100288e24,M,000756,_ZN20OverworldLevelSource14isPosInFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPos +0x0000007100288e24,O,000756,_ZN20OverworldLevelSource14isPosInFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPos 0x0000007100289118,O,000772,_ZN20OverworldLevelSource21findNearestMapFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPosb 0x000000710028941c,O,000328,_ZN20OverworldLevelSource31recreateLogicStructuresForChunkEP10LevelChunkii 0x0000007100289564,U,000076,_ZN21OwnerHurtByTargetGoalC_gen @@ -17902,8 +17903,8 @@ Address,Quality,Size,Name 0x0000007100295564,U,000036,_ZN12MerchantMenuD0Ev 0x0000007100295588,U,000068,_ZN18MerchantResultSlotD2Ev 0x00000071002955cc,U,000036,_ZN18MerchantResultSlotD0Ev -0x00000071002955f0,U,000036,_ZN9MesaBiome13MesaDecoratorD0Ev -0x0000007100295614,U,000008, +0x00000071002955f0,O,000036,_ZN9MesaBiome13MesaDecoratorD0Ev +0x0000007100295614,O,000008,_ZN9MesaBiome12getBaseClassEv 0x000000710029561c,U,000036,_ZN14MilkBucketItemD0Ev 0x0000007100295640,U,000008, 0x0000007100295648,U,000004, @@ -18005,9 +18006,9 @@ Address,Quality,Size,Name 0x0000007100296168,U,000012, 0x0000007100296174,U,000012, 0x0000007100296180,U,000036,_ZN16MusicBlockEntityD0Ev -0x00000071002961a4,U,000036,_ZN18MutatedForestBiomeD0Ev -0x00000071002961c8,U,000036,_ZN19MutatedSavannaBiomeD0Ev -0x00000071002961ec,U,000008, +0x00000071002961a4,O,000036,_ZN18MutatedForestBiomeD0Ev +0x00000071002961c8,O,000036,_ZN19MutatedSavannaBiomeD0Ev +0x00000071002961ec,O,000008,_ZN12SavannaBiome12getBaseClassEv 0x00000071002961f4,U,000036,_ZN13MyceliumBlockD0Ev 0x0000007100296218,U,000036,_ZN11NameTagItemD0Ev 0x000000710029623c,U,000004, @@ -18058,8 +18059,8 @@ Address,Quality,Size,Name 0x0000007100296700,U,000008, 0x0000007100296708,U,000036,_ZN13ObserverBlockD0Ev 0x000000710029672c,U,000036,_ZN13ObsidianBlockD0Ev -0x0000007100296750,U,000036,_ZN10OceanBiomeD0Ev -0x0000007100296774,U,000008, +0x0000007100296750,O,000036,_ZN10OceanBiomeD0Ev +0x0000007100296774,O,000008,_ZN10OceanBiome12getBaseClassEv 0x000000710029677c,U,000052,_ZN20OceanMonumentFeature18OceanMonumentStartD2Ev 0x00000071002967b0,U,000036,_ZN20OceanMonumentFeature18OceanMonumentStartD0Ev 0x00000071002967d4,U,000008, @@ -18143,15 +18144,15 @@ Address,Quality,Size,Name 0x000000710029730c,U,000036,_ZN5Llama14LlamaGroupDataD0Ev 0x0000007100297330,U,000036,_ZN14MineShaftStartD0Ev 0x0000007100297354,U,000008, -0x000000710029735c,U,000036,_ZN19MushroomIslandBiomeD0Ev -0x0000007100297380,U,000008, +0x000000710029735c,O,000036,_ZN19MushroomIslandBiomeD0Ev +0x0000007100297380,O,000008,_ZN19MushroomIslandBiome12getBaseClassEv 0x0000007100297388,U,000036,_ZN19NetherBridgeFeature17NetherBridgeStartD0Ev 0x00000071002973ac,U,000008, 0x00000071002973b4,U,000008, 0x00000071002973bc,U,000076,_ZN18NetherBridgePieces10StartPieceD2Ev 0x0000007100297408,U,000036,_ZN18NetherBridgePieces10StartPieceD0Ev -0x000000710029742c,U,000124, -0x00000071002974a8,U,000036,_ZN21FjNetherrackBlockPredD0Ev +0x000000710029742c,M,000124,_ZNK21FjNetherrackBlockPred5applyERKN5Biome15LegacyBlockDataE +0x00000071002974a8,O,000036,_ZN21FjNetherrackBlockPredD0Ev 0x00000071002974cc,U,000004,_ZN11LevelSourceD1Ev 0x00000071002974d0,U,000036,_ZN11LevelSourceD0Ev 0x00000071002974f4,O,000060,_ZNSt3__112__hash_tableINS_17__hash_value_typeIiNS_10shared_ptrI6EntityEEEENS_22__unordered_map_hasherIiS5_11IntKeyHash2Lb1EEENS_21__unordered_map_equalIiS5_8IntKeyEqLb1EEENS_9allocatorIS5_EEED2Ev @@ -19610,14 +19611,15 @@ Address,Quality,Size,Name 0x00000071002b8988,O,000156,_ZN11PerlinNoise8getValueEdd 0x00000071002b8a24,O,000460,_ZN11PerlinNoise9getRegionE15arrayWithLengthIdEiiiiiiddd 0x00000071002b8bf0,O,000064,_ZN11PerlinNoise9getRegionE15arrayWithLengthIdEiiiiddd -0x00000071002b8c30,U,000160,_ZN18PerlinSimplexNoise4initEP6Randomi -0x00000071002b8cd0,U,000076,_ZN18PerlinSimplexNoiseC1EP6Randomi -0x00000071002b8d1c,U,000128,_ZN18PerlinSimplexNoiseD2Ev -0x00000071002b8d9c,U,000036,_ZN18PerlinSimplexNoiseD0Ev -0x00000071002b8dc0,U,000148,_ZN18PerlinSimplexNoise8getValueEdd -0x00000071002b8e54,U,000588, -0x00000071002b90a0,U,000400,_ZN18PerlinSimplexNoise9getRegionE15arrayWithLengthIdEddiiddd -0x00000071002b9230,U,000832, +0x00000071002b8c30,O,000160,_ZN18PerlinSimplexNoise4initEP6Randomi +0x00000071002b8cd0,O,000076,_ZN18PerlinSimplexNoiseC1EP6Randomi +0x00000071002b8d1c,O,000128,_ZN18PerlinSimplexNoiseD2Ev +0x00000071002b8d9c,O,000036,_ZN18PerlinSimplexNoiseD0Ev +0x00000071002b8dc0,O,000148,_ZN18PerlinSimplexNoise8getValueEdd +0x00000071002b8e54,M,000588,_ZN12SimplexNoise8getValueEdd +0x00000071002b90a0,O,000008,_ZN18PerlinSimplexNoise9getRegionE15arrayWithLengthIdEddiiddd +0x00000071002b90a8,O,000392,_ZN18PerlinSimplexNoise9getRegionE15arrayWithLengthIdEddiidddd +0x00000071002b9230,O,000832,_ZN12SimplexNoise3addE15arrayWithLengthIdEddiiddd 0x00000071002b9570,U,000020, 0x00000071002b9584,U,000012, 0x00000071002b9590,U,000080, @@ -20028,10 +20030,10 @@ Address,Quality,Size,Name 0x00000071002c61d8,U,000172, 0x00000071002c6284,U,000292, 0x00000071002c63a8,U,000380, -0x00000071002c6524,U,000296,_ZN11PlainsBiomeC1EN5Biome9EBiomeIDsEbPN5Biome15BiomePropertiesE -0x00000071002c664c,U,000272, -0x00000071002c675c,U,000668, -0x00000071002c69f8,U,000092, +0x00000071002c6524,O,000296,_ZN11PlainsBiomeC1EN5Biome9EBiomeIDsEbPNS0_15BiomePropertiesE +0x00000071002c664c,M,000272,_ZN11PlainsBiome15getRandomFlowerER6RandomPK8BlockPos +0x00000071002c675c,O,000668,_ZN11PlainsBiome8decorateEP5LevelR6RandomRK8BlockPos +0x00000071002c69f8,O,000092,_ZN11PlainsBiome14getTreeFeatureER6Random 0x00000071002c6a54,O,000840,_ZN11PlanksBlock15blockStaticCtorEv 0x00000071002c6d9c,O,000128,_ZN11PlanksBlockC1Ev 0x00000071002c6e1c,O,000040,_ZN11PlanksBlock25getSpawnResourcesAuxValueEPK10BlockState @@ -21202,7 +21204,7 @@ Address,Quality,Size,Name 0x00000071002fbf10,U,000844, 0x00000071002fc25c,U,000024, 0x00000071002fc274,U,000040, -0x00000071002fc29c,U,000156,_ZN10RiverBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE +0x00000071002fc29c,O,000156,_ZN10RiverBiomeC1EN5Biome9EBiomeIDsEPNS0_15BiomePropertiesE 0x00000071002fc338,O,000128,_ZN14RiverInitLayerC1ExNSt3__110shared_ptrI5LayerEE 0x00000071002fc3b8,O,000352,_ZN14RiverInitLayer7getAreaEiiii 0x00000071002fc518,O,000128,_ZN10RiverLayerC1ExNSt3__110shared_ptrI5LayerEE @@ -21317,9 +21319,9 @@ Address,Quality,Size,Name 0x000000710030108c,U,000060,_ZN12SaplingBlock10getTextureEPK9DirectionPK10BlockState 0x00000071003010c8,U,000192,_ZN12SaplingBlock13registerIconsEP12IconRegister 0x0000007100301188,U,000064,_ZN12SaplingBlock16getDescriptionIdEi -0x00000071003011c8,U,000380,_ZN12SavannaBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE -0x0000007100301344,U,000088, -0x000000710030139c,U,000300, +0x00000071003011c8,O,000380,_ZN12SavannaBiomeC1EN5Biome9EBiomeIDsEPNS0_15BiomePropertiesE +0x0000007100301344,O,000088,_ZN12SavannaBiome14getTreeFeatureER6Random +0x000000710030139c,O,000300,_ZN12SavannaBiome8decorateEP5LevelR6RandomRK8BlockPos 0x00000071003014c8,U,000148,_ZN18SavannaTreeFeature10staticCtorEv 0x000000710030155c,U,000084,_ZN18SavannaTreeFeatureC_gen 0x00000071003015b0,U,000004,_ZN18SavannaTreeFeatureD2Ev @@ -22201,11 +22203,11 @@ Address,Quality,Size,Name 0x0000007100322188,U,000008, 0x0000007100322190,U,000048,_ZN16SimpleFoiledItemC_gen 0x00000071003221c0,U,000008,_ZN16SimpleFoiledItem6isFoilE12not_null_ptrI12ItemInstanceE -0x00000071003221c8,U,000276, -0x00000071003222dc,U,000004, -0x00000071003222e0,U,000016, -0x00000071003222f0,U,000020, -0x0000007100322304,U,000036, +0x00000071003221c8,O,000276,_ZN12SimplexNoise4initEP6Random +0x00000071003222dc,O,000004,_ZN12SimplexNoiseC1EP6Random +0x00000071003222e0,O,000016,_ZN12SimplexNoiseD1Ev +0x00000071003222f0,O,000020,_ZN12SimplexNoise9fastFloorEd +0x0000007100322304,O,000036,_ZN12SimplexNoise3dotEPKidd 0x0000007100322328,U,000068,_ZN7SitGoalC_gen 0x000000710032236c,U,000352, 0x00000071003224cc,U,000064, @@ -22301,8 +22303,8 @@ Address,Quality,Size,Name 0x00000071003254e8,U,000008, 0x00000071003254f0,U,000008, 0x00000071003254f8,U,000012, -0x0000007100325504,U,000036,_ZN11PlainsBiomeD0Ev -0x0000007100325528,U,000008, +0x0000007100325504,O,000036,_ZN11PlainsBiomeD0Ev +0x0000007100325528,O,000008,_ZN11PlainsBiome12getBaseClassEv 0x0000007100325530,O,000036,_ZN11PlanksBlockD0Ev 0x0000007100325554,U,000052,_ZN10ResultSlotD2Ev 0x0000007100325588,U,000036,_ZN10ResultSlotD0Ev @@ -22437,7 +22439,7 @@ Address,Quality,Size,Name 0x00000071003265b8,U,000036,_ZN11SandFeatureD0Ev 0x00000071003265dc,O,000036,_ZN14SandStoneBlockD0Ev 0x0000007100326600,U,000036,_ZN12SaplingBlockD0Ev -0x0000007100326624,U,000036,_ZN12SavannaBiomeD0Ev +0x0000007100326624,O,000036,_ZN12SavannaBiomeD0Ev 0x0000007100326648,U,000036,_ZN16SavedDataStorageD0Ev 0x000000710032666c,U,000068,SavedDataStorage__D1 0x00000071003266b0,U,000036,_ZN22SavedDataMemoryStorageD0Ev @@ -22613,8 +22615,8 @@ Address,Quality,Size,Name 0x0000007100327d28,U,000036,_ZN6Rabbit15RabbitGroupDataD0Ev 0x0000007100327d4c,U,000036,_ZN27RandomScatteredLargeFeature21ScatteredFeatureStartD0Ev 0x0000007100327d70,U,000008, -0x0000007100327d78,U,000036,_ZN10RiverBiomeD0Ev -0x0000007100327d9c,U,000008, +0x0000007100327d78,O,000036,_ZN10RiverBiomeD0Ev +0x0000007100327d9c,O,000008,_ZN10RiverBiome12getBaseClassEv 0x0000007100327da4,U,000036,_ZN19ShulkerBoxBlockItemD0Ev 0x0000007100327dc8,U,000060, 0x0000007100327e04,U,000048, @@ -24367,7 +24369,7 @@ Address,Quality,Size,Name 0x000000710036a86c,U,000148,_ZN9StemBlock13registerIconsEP12IconRegister 0x000000710036a900,U,000008, 0x000000710036a908,U,000008,_ZN9StemBlock14getRenderShapeEPK10BlockState -0x000000710036a910,U,000256,_ZN15StoneBeachBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE +0x000000710036a910,O,000256,_ZN15StoneBeachBiomeC1EN5Biome9EBiomeIDsEPNS0_15BiomePropertiesE 0x000000710036aa10,O,001400,_ZN10StoneBlock15blockStaticCtorEv 0x000000710036af88,O,000664,_ZN12EnumPropertyIPN10StoneBlock7VariantEE6createILi7EEEPS3_RKNSt3__112basic_stringIwNS6_11char_traitsIwEENS6_9allocatorIwEEEERKSt9type_infoRAT__S2_P9PredicateIS2_E 0x000000710036b220,O,000112,_ZN10StoneBlockC2Ev @@ -24816,13 +24818,13 @@ Address,Quality,Size,Name 0x00000071003803dc,U,000008,_ZN18StructureVoidBlock19mayReplaceWithPlaceEP11LevelSourceRK8BlockPos 0x00000071003803e4,U,000008,_ZN18StructureVoidBlock21getPistonPushReactionEPK10BlockState 0x00000071003803ec,U,000008,_ZN18StructureVoidBlock17getBlockFaceShapeEP11LevelSourcePK10BlockStateRK8BlockPosPK9Direction -0x00000071003803f4,U,000244,_ZN10SwampBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE -0x00000071003804e8,U,000044, -0x0000007100380514,U,000152, -0x00000071003805ac,U,000028, -0x00000071003805c8,U,000016, -0x00000071003805d8,U,000400, -0x0000007100380768,U,000112, +0x00000071003803f4,O,000244,_ZN10SwampBiomeC1EN5Biome9EBiomeIDsEPNS0_15BiomePropertiesE +0x00000071003804e8,O,000044,_ZN10SwampBiome14getTreeFeatureER6Random +0x0000007100380514,O,000152,_ZN10SwampBiome13getGrassColorEPK8BlockPos +0x00000071003805ac,O,000028,_ZN10SwampBiome15getFoliageColorEPK8BlockPos +0x00000071003805c8,O,000016,_ZN10SwampBiome15getRandomFlowerER6RandomPK8BlockPos +0x00000071003805d8,M,000400,_ZN10SwampBiome14buildSurfaceAtEP5LevelR6RandomP11ChunkPrimeriid +0x0000007100380768,O,000112,_ZN10SwampBiome8decorateEP5LevelR6RandomRK8BlockPos 0x00000071003807d8,U,000148,_ZN16SwampTreeFeature10staticCtorEv 0x000000710038086c,U,000084,_ZN16SwampTreeFeatureC_gen 0x00000071003808c0,U,002660, @@ -24934,11 +24936,11 @@ Address,Quality,Size,Name 0x000000710038460c,O,000004,_ZN3Tag18stripEmptyChildrenEv 0x0000007100384610,O,000008,_ZNK3Tag7isEmptyEv 0x0000007100384618,O,000012,_ZN3Tag11getAsStringEv -0x0000007100384624,U,000308,_ZN10TaigaBiomeC1EN5Biome9EBiomeIDsEN10TaigaBiome5ETypeEPN5Biome15BiomePropertiesE -0x0000007100384758,U,000192, -0x0000007100384818,U,000100, -0x000000710038487c,U,000476, -0x0000007100384a58,U,000380, +0x0000007100384624,O,000308,_ZN10TaigaBiomeC1EN5Biome9EBiomeIDsENS_5ETypeEPNS0_15BiomePropertiesE +0x0000007100384758,O,000192,_ZN10TaigaBiome14getTreeFeatureER6Random +0x0000007100384818,O,000100,_ZN10TaigaBiome15getGrassFeatureER6Random +0x000000710038487c,O,000476,_ZN10TaigaBiome8decorateEP5LevelR6RandomRK8BlockPos +0x0000007100384a58,O,000380,_ZN10TaigaBiome14buildSurfaceAtEP5LevelR6RandomP11ChunkPrimeriid 0x0000007100384bd4,U,000128,_ZN14TakeFlowerGoalC_gen 0x0000007100384c54,U,000016, 0x0000007100384c64,U,000476, @@ -25080,12 +25082,12 @@ Address,Quality,Size,Name 0x0000007100389da8,U,000264,_ZN13TexturePacket4readEP15DataInputStream 0x0000007100389eb0,U,000120,_ZN13TexturePacket5writeEP16DataOutputStream 0x0000007100389f28,U,000008,_ZN13TexturePacket16getEstimatedSizeEv -0x0000007100389f30,U,000512,_ZN11TheEndBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE -0x000000710038a130,U,000028, -0x000000710038a14c,U,000188, -0x000000710038a208,U,000092,_ZN20TheEndBiomeDecoratorC_gen -0x000000710038a264,U,000392, -0x000000710038a3ec,U,000008, +0x0000007100389f30,O,000512,_ZN11TheEndBiomeC1EN5Biome9EBiomeIDsEPNS0_15BiomePropertiesE +0x000000710038a130,O,000028,_ZN11TheEndBiome11getSkyColorEf +0x000000710038a14c,O,000188,_ZNK11TheEndBiome11getFogColorEff +0x000000710038a208,O,000092,_ZN20TheEndBiomeDecoratorC1Ev +0x000000710038a264,O,000392,_ZN20TheEndBiomeDecorator8decorateEP5BiomeP5LevelR6Random +0x000000710038a3ec,O,000008,_ZN15TheEndDimension14getDragonFightEv 0x000000710038a3f4,U,000280, 0x000000710038a50c,U,000132, 0x000000710038a590,U,000092,_ZN15TheEndDimensionC1Ev @@ -25108,8 +25110,8 @@ Address,Quality,Size,Name 0x000000710038aa14,U,000176, 0x000000710038aac4,U,000016, 0x000000710038aad4,U,000024, -0x000000710038aaec,U,000192, -0x000000710038abac,U,000076, +0x000000710038aaec,O,000192,_Z16endNearestIslandii +0x000000710038abac,O,000076,_Z17endIslandDistanceiiPKi 0x000000710038abf8,U,000192, 0x000000710038acb8,U,000200, 0x000000710038ad80,U,000028, @@ -25142,23 +25144,23 @@ Address,Quality,Size,Name 0x000000710038c3f0,U,000136, 0x000000710038c478,U,000112, 0x000000710038c4e8,U,000192, -0x000000710038c5a8,U,000384,_ZN17TheEndLevelSourceC1EP5LevelbxRK8BlockPos -0x000000710038c728,U,000236,_ZN17TheEndLevelSourceD1Ev -0x000000710038c814,U,000036,_ZN17TheEndLevelSourceD0Ev -0x000000710038c838,U,001236, -0x000000710038cd0c,U,001300, -0x000000710038d220,U,000356, -0x000000710038d384,U,000420,_ZN17TheEndLevelSource11createChunkEii -0x000000710038d528,U,000032,_ZN17TheEndLevelSource13fjIslandCheckEii -0x000000710038d548,U,000580,_ZN17TheEndLevelSource20getIslandHeightValueEiiii -0x000000710038d78c,U,000148, -0x000000710038d820,U,000160, -0x000000710038d8c0,U,001040,_ZN17TheEndLevelSource11postProcessEii -0x000000710038dcd0,U,000008,_ZN17TheEndLevelSource22postProcessLoadedChunkEP10LevelChunkii -0x000000710038dcd8,U,000052,_ZN17TheEndLevelSource9getMobsAtEP11MobCategoryRK8BlockPos -0x000000710038dd0c,U,000200,_ZN17TheEndLevelSource21findNearestMapFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPosb -0x000000710038ddd4,U,000192,_ZN17TheEndLevelSource14isPosInFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPos -0x000000710038de94,U,000004,_ZN17TheEndLevelSource31recreateLogicStructuresForChunkEP10LevelChunkii +0x000000710038c5a8,M,000384,_ZN17TheEndLevelSourceC1EP5LevelbxRK8BlockPos +0x000000710038c728,O,000236,_ZN17TheEndLevelSourceD1Ev +0x000000710038c814,O,000036,_ZN17TheEndLevelSourceD0Ev +0x000000710038c838,M,001236,_ZN17TheEndLevelSource14prepareHeightsEiiP11ChunkPrimer +0x000000710038cd0c,M,001300,_ZN17TheEndLevelSource10getHeightsE15arrayWithLengthIdEiiiiii +0x000000710038d220,O,000356,_ZN17TheEndLevelSource13buildSurfacesEP11ChunkPrimer +0x000000710038d384,M,000420,_ZN17TheEndLevelSource11createChunkEii +0x000000710038d528,O,000032,_ZN17TheEndLevelSource13fjIslandCheckEii +0x000000710038d548,M,000580,_ZN17TheEndLevelSource20getIslandHeightValueEiiii +0x000000710038d78c,O,000148,_ZN17TheEndLevelSource17fjIslandProximityEii +0x000000710038d820,O,000160,_Z18endDistanceToSpawnPK5Vec3iiii +0x000000710038d8c0,M,001040,_ZN17TheEndLevelSource11postProcessEii +0x000000710038dcd0,O,000008,_ZN17TheEndLevelSource22postProcessLoadedChunkEP10LevelChunkii +0x000000710038dcd8,O,000052,_ZN17TheEndLevelSource9getMobsAtEP11MobCategoryRK8BlockPos +0x000000710038dd0c,O,000200,_ZN17TheEndLevelSource21findNearestMapFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPosb +0x000000710038ddd4,O,000192,_ZN17TheEndLevelSource14isPosInFeatureEP5LevelRKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEERK8BlockPos +0x000000710038de94,O,000004,_ZN17TheEndLevelSource31recreateLogicStructuresForChunkEP10LevelChunkii 0x000000710038de98,U,000152, 0x000000710038df30,U,000024, 0x000000710038df48,U,000520,_ZN14ThinFenceBlock31fillVirtualBlockStatePropertiesEPK10BlockStateP11LevelSourceRK8BlockPos @@ -25993,10 +25995,10 @@ Address,Quality,Size,Name 0x00000071003ba608,U,000036,_ZN9VineBlock15shouldBlockTickEP5LevelRK8BlockPosPK10BlockState 0x00000071003ba62c,U,000052,_ZN12VinesFeatureC_gen 0x00000071003ba660,U,000544, -0x00000071003ba880,U,000320,_ZN9VoidBiomeC1EN5Biome9EBiomeIDsEPN5Biome15BiomePropertiesE -0x00000071003ba9c0,U,000048,_ZN18VoidBiomeDecoratorC_gen -0x00000071003ba9f0,U,000008, -0x00000071003ba9f8,U,000616, +0x00000071003ba880,O,000320,_ZN9VoidBiomeC1EN5Biome9EBiomeIDsEPNS0_15BiomePropertiesE +0x00000071003ba9c0,O,000048,_ZN18VoidBiomeDecoratorC2Ev +0x00000071003ba9f0,O,000008,_ZN9VoidBiome18isAlwaysValidSpawnEv +0x00000071003ba9f8,O,000616,_ZN18VoidBiomeDecorator8decorateEP5LevelR6RandomP5BiomeRK8BlockPos 0x00000071003bac60,O,000128,_ZN11VoronoiZoomC1ExNSt3__110shared_ptrI5LayerEE 0x00000071003bace0,M,001268,_ZN11VoronoiZoom7getAreaEiiii 0x00000071003bb1d4,O,000076,_ZN10VotePacketC1Ev @@ -26789,15 +26791,15 @@ Address,Quality,Size,Name 0x00000071003d8e40,U,000036,_ZN16StrongholdPieces10PortalRoomD0Ev 0x00000071003d8e64,U,000036,_ZN14StructureBlockD0Ev 0x00000071003d8e88,U,000036,_ZN18StructureVoidBlockD0Ev -0x00000071003d8eac,U,000036,_ZN10SwampBiomeD0Ev -0x00000071003d8ed0,U,000008, +0x00000071003d8eac,O,000036,_ZN10SwampBiomeD0Ev +0x00000071003d8ed0,O,000008,_ZN10SwampBiome12getBaseClassEv 0x00000071003d8ed8,U,000036,_ZN16SwampTreeFeatureD0Ev 0x00000071003d8efc,U,000052,_ZN9SwellGoalD2Ev 0x00000071003d8f30,U,000036,_ZN9SwellGoalD0Ev 0x00000071003d8f54,U,000064, 0x00000071003d8f94,U,000036,_ZN9SwordItemD0Ev -0x00000071003d8fb8,U,000036,_ZN10TaigaBiomeD0Ev -0x00000071003d8fdc,U,000008, +0x00000071003d8fb8,O,000036,_ZN10TaigaBiomeD0Ev +0x00000071003d8fdc,O,000008,_ZN10TaigaBiome12getBaseClassEv 0x00000071003d8fe4,U,000052,_ZN14TakeFlowerGoalD2Ev 0x00000071003d9018,U,000036,_ZN14TakeFlowerGoalD0Ev 0x00000071003d903c,U,000064, @@ -26814,10 +26816,10 @@ Address,Quality,Size,Name 0x00000071003d9218,U,000036,_ZN19TextureChangePacketD0Ev 0x00000071003d923c,U,000008,_ZN19TextureChangePacket11getPacketIdEv 0x00000071003d9244,U,000008,_ZN13TexturePacket11getPacketIdEv -0x00000071003d924c,U,000036,_ZN11TheEndBiomeD0Ev -0x00000071003d9270,U,000008, -0x00000071003d9278,U,000008, -0x00000071003d9280,U,000036,_ZN20TheEndBiomeDecoratorD0Ev +0x00000071003d924c,O,000036,_ZN11TheEndBiomeD0Ev +0x00000071003d9270,O,000008,_ZN11TheEndBiome12getBaseClassEv +0x00000071003d9278,O,000008,_ZN11TheEndBiome9isNaturalEv +0x00000071003d9280,O,000036,_ZN20TheEndBiomeDecoratorD0Ev 0x00000071003d92a4,U,000012, 0x00000071003d92b0,U,000036,_ZN23TheEndPortalBlockEntityD0Ev 0x00000071003d92d4,U,000012, @@ -26926,9 +26928,9 @@ Address,Quality,Size,Name 0x00000071003d9ecc,U,000036,_ZN18VindicationIllager26VindicatorJohnnyAttackGoalD0Ev 0x00000071003d9ef0,U,000036,_ZN9VineBlockD0Ev 0x00000071003d9f14,U,000036,_ZN12VinesFeatureD0Ev -0x00000071003d9f38,U,000036,_ZN18VoidBiomeDecoratorD0Ev -0x00000071003d9f5c,U,000036,_ZN9VoidBiomeD0Ev -0x00000071003d9f80,U,000008, +0x00000071003d9f38,O,000036,_ZN18VoidBiomeDecoratorD0Ev +0x00000071003d9f5c,O,000036,_ZN9VoidBiomeD0Ev +0x00000071003d9f80,O,000008,_ZN9VoidBiome12getBaseClassEv 0x00000071003d9f88,O,000036,_ZN11VoronoiZoomD0Ev 0x00000071003d9fac,O,000040,_ZN10VotePacketD2Ev 0x00000071003d9fd4,O,000036,_ZN10VotePacketD0Ev @@ -27024,8 +27026,8 @@ Address,Quality,Size,Name 0x00000071003dac14,U,000088, 0x00000071003dac6c,U,000056,_ZN10PredicatesIPN9WallBlock7VariantEE17ConstantPredicateC1Eb 0x00000071003daca4,U,000036,_ZN6Spider22SpiderEffectsGroupDataD0Ev -0x00000071003dacc8,U,000036,_ZN15StoneBeachBiomeD0Ev -0x00000071003dacec,U,000008, +0x00000071003dacc8,O,000036,_ZN15StoneBeachBiomeD0Ev +0x00000071003dacec,O,000008,_ZN15StoneBeachBiome12getBaseClassEv 0x00000071003dacf4,U,000036,_ZN17StrongholdFeature15StrongholdStartD0Ev 0x00000071003dad18,U,000008, 0x00000071003dad20,U,000052,_ZN15WeighedTreasureD2Ev 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/UnityWorldSimplex.cpp b/src/Minecraft.World/UnityWorldSimplex.cpp new file mode 100644 index 00000000..e920b920 --- /dev/null +++ b/src/Minecraft.World/UnityWorldSimplex.cpp @@ -0,0 +1,5 @@ +/** Compile the octave caller with its sampler so Clang 4.0.1 can infer the + * sampler's memory effects, as in the original 0x71002b8dc0 instructions. + */ +#include "net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.cpp" +#include "net/minecraft/world/level/levelgen/synth/SimplexNoise.cpp" 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..788b2b67 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) @@ -29,8 +35,10 @@ class arrayWithLength { } T& operator[](unsigned int i) { return m_data[i]; } + const T& operator[](unsigned int i) const { return m_data[i]; } T& get(unsigned int i) { return m_data[i]; } + // name guessed void resize(unsigned int newSize) { if (m_length == newSize) { return; @@ -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/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/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/Level.cpp b/src/Minecraft.World/net/minecraft/world/level/Level.cpp index cdcdee2d..124997d6 100644 --- a/src/Minecraft.World/net/minecraft/world/level/Level.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/Level.cpp @@ -1,5 +1,9 @@ #include "net/minecraft/world/level/Level.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/level/biome/Biome.h" +#include "net/minecraft/world/level/block/state/properties/BlockStateProperties.h" + #include "NX/Platform.h" #include "net/minecraft/core/System.h" #include "net/minecraft/world/entity/Entity.h" @@ -32,7 +36,7 @@ Level::Level(std::shared_ptr levelStorage, LevelData* levelData, D m_seaLevel = 64; } -// NON_MATCHING +// NON_MATCHING | score: 1507 (lower is better) void Level::_init() { m_cloudColor = 0xFFFFFF; m_skyDarken = 0; @@ -528,6 +532,7 @@ long Level::getDayTime() { return m_levelData->getDayTime(); } +// NON_MATCHING | score: 200 (lower is better) BlockPos Level::getSharedSpawnPos() { BlockPos spawnPos = {m_levelData->getXSpawn(), m_levelData->getYSpawn(), m_levelData->getZSpawn()}; if (!getWorldBorder()->isWithinBounds(spawnPos)) { @@ -610,3 +615,44 @@ bool Level::newFallingBlockAllowed() { bool Level::explodeNextEnderCrystal() { return true; } + +// name guessed: the shared read-only 0.15f threshold at 0x7100e134b8. +extern const float gFreezingTemperature; + +bool Level::shouldFreezeIgnoreNeighbors(const BlockPos& pos) { + return shouldFreeze(pos, false); +} + +// name guessed +bool Level::shouldFreezeWithNeighbors(const BlockPos& pos) { + return shouldFreeze(pos, true); +} + +// name guessed +bool Level::isWaterAt(const BlockPos& pos) { + return getBlockState(pos)->getMaterial() == Material::WATER; +} + +// name guessed +// NON_MATCHING | score: 315 (lower is better) +bool Level::shouldFreeze(const BlockPos& pos, bool checkNeighbors) { + // The original b.gt allows an unordered temperature to continue. + if (getBiome(pos)->getTemperature(&pos) > gFreezingTemperature) + return false; + if (pos.getY() >= 0 && pos.getY() < 256 && getBrightness(LightLayer::BLOCK, pos) < 10) { + const BlockState* state = getBlockState(pos); + Block* block = state->getBlock(); + if ((block == Blocks::WATER || block == Blocks::FLOWING_WATER) + && state->getValue(BlockStateProperties::WATER_LEVEL) == 0) { + if (!checkNeighbors) + return true; + if (!isWaterAt(pos.west()) || !isWaterAt(pos.east()) || !isWaterAt(pos.north()) + || !isWaterAt(pos.south())) + return true; + } + } + return false; +} + +/** Freezing threshold shared by the temperature checks. */ +extern const float gFreezingTemperature = 0.15f; 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/BeachBiome.cpp new file mode 100644 index 00000000..7827e654 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/BeachBiome.cpp @@ -0,0 +1,24 @@ +#include "net/minecraft/world/level/biome/BeachBiome.h" + +#include "net/minecraft/world/level/biome/BiomeDecorator.h" +#include "net/minecraft/world/level/block/Block.h" +#include "net/minecraft/world/level/block/Blocks.h" + +// name guessed +BeachBiome::BeachBiome(EBiomeIDs id, BiomeProperties* properties) : Biome(id, properties) { + m_passiveMobs.clear(); + m_chickens.clear(); + m_grass + = LegacyBlockData(12, Blocks::SAND->convertBlockStateToLegacyData(Blocks::SAND->defaultBlockState())); + m_dirt + = LegacyBlockData(12, Blocks::SAND->convertBlockStateToLegacyData(Blocks::SAND->defaultBlockState())); + m_biomeDecorator->m_treeCount = -999; + m_biomeDecorator->m_deadBushCount = 0; + m_biomeDecorator->m_reedCount = 0; + m_biomeDecorator->m_cactusCount = 0; +} + +// name guessed +int BeachBiome::getBaseClass() { + return _BEACH; +} 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..a74a74db 100644 --- a/src/Minecraft.World/net/minecraft/world/level/biome/Biome.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/biome/Biome.cpp @@ -1,5 +1,22 @@ #include "net/minecraft/world/level/biome/Biome.h" +#include "net/minecraft/client/CMinecraftApp.h" +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/world/level/block/SandBlock.h" +#include "net/minecraft/world/level/levelgen/ChunkPrimer.h" + +#include "net/minecraft/client/resources/L10N.h" +#include "net/minecraft/world/entity/MobCategory.h" + +#include "net/minecraft/world/level/biome/BiomeDecorator.h" +#include "net/minecraft/world/level/levelgen/feature/BigTreeFeature.h" +#include "net/minecraft/world/level/levelgen/feature/TallgrassFeature.h" +#include "net/minecraft/world/level/levelgen/feature/TreeFeature.h" + +#include "NX/Platform.h" +#include "net/minecraft/world/level/biome/BiomeSource.h" +#include + #include "net/minecraft/client/Minecraft.h" #include "net/minecraft/client/color/ColourTable.h" #include "net/minecraft/client/ui/StringIDs.h" @@ -145,10 +162,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 +286,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)); @@ -900,3 +908,215 @@ void Biome::staticCtor() { Biome::DEFAULT = Biome::OCEAN; } + +// name guessed +eMinecraftColour Biome::getPreviewColor() { + return m_previewColor; +} + +// NON_MATCHING | score: 4320 (lower is better) +void BiomeSource::LayerOverrideSettings::UpdateBiomeMapPixelsInRegion(unsigned int* pixels, unsigned int x, + unsigned int z, unsigned int width, + unsigned int depth, bool& missing, + bool unzoomed) { + unsigned int scale = 1; + int offsetX = 0; + int offsetZ = 0; + if (!unzoomed) { + scale = static_cast(std::pow(2.0, m_zoomLevel)); + if (isZoomed()) { + int divisor = static_cast(std::pow(2.0, m_zoomLevel + 1.0)); + offsetX = m_zoomX * m_field18 / divisor; + offsetZ = m_zoomZ * m_field18 / divisor; + } + } + int border = m_field18 - m_field18 / static_cast(scale); + int startZ = border + offsetZ + z / scale; + unsigned int rows = depth / scale; + ColourTable* colours = Minecraft::GetInstance()->getColourTable(); + int startX = border + offsetX + x / scale; + unsigned int columns = width / scale; + for (int row = startZ; row < static_cast(startZ + rows); ++row) { + for (unsigned int subRow = 0; subRow < scale; ++subRow) { + unsigned int* target = pixels + x + m_imageWidth * (z + (row - startZ) * scale + subRow); + for (int column = startX; column < static_cast(startX + columns); ++column) { + unsigned int index = getBiomeIndex(column, row); + if (index < m_biomes.m_length) { + EnterCriticalSection(&m_mutexType); + unsigned int colour; + if (m_biomes.get(index) == nullptr) { + colour = 0; + missing = true; + } else { + colour = colours->getColour(m_biomes.get(index)->getPreviewColor()); + } + LeaveCriticalSection(&m_mutexType); + colour |= 0xff000000; + for (unsigned int i = 0; i < scale; ++i) + *target++ = colour; + } + } + } + } +} + +BiomeDecorator* Biome::createDecorator() { + return new BiomeDecorator(); +} + +Feature* Biome::getTreeFeature(Random& random) { + if (random.nextInt(10) == 0) + return new BigTreeFeature(false); + return new TreeFeature(false); +} + +Feature* Biome::getGrassFeature(Random&) { + return new TallgrassFeature(TallGrassBlock::Variant::GRASS); +} + +void Biome::decorate(Level* level, Random& random, const BlockPos& pos) { + m_biomeDecorator->decorate(level, random, this, pos); +} + +Biome::~Biome() { + delete m_biomeDecorator; +} + +Biome* Biome::setPreviewColor(eMinecraftColour color) { + m_previewColor = color; + return this; +} + +Biome* Biome::setWaterSkyColor(eMinecraftColour water, eMinecraftColour sky) { + m_waterColor = water; + m_skyColor = sky; + return this; +} + +std::wstring Biome::getName(bool) { + if (m_nameId == -1) + return L""; + return L10N::GetString(m_nameId); +} + +std::wstring Biome::getDescription() { + std::wstring description = L""; + if (m_descriptionId != -1) + description = L10N::GetString(m_descriptionId); + return description; +} + +std::vector* Biome::getMobs(MobCategory* category) { + if (category == MobCategory::MONSTER) + return &m_hostileMobs; + if (category == MobCategory::CREATURE) + return &m_passiveMobs; + if (category == MobCategory::WATER_CREATURE) + return &m_aquaticMobs; + if (category == MobCategory::CHICKEN) + return &m_chickens; + if (category == MobCategory::WOLF) + return &m_fieldD8; + if (category == MobCategory::MUSHROOM_COW) + return &m_fieldF0; + if (category == MobCategory::SLIME) + return &m_neutralMobs; + if (category == MobCategory::AMBIENT) + return &m_ambientMobs; + return nullptr; +} + +float Biome::getDownfall() { + return m_downfall; +} +float Biome::getTemperature() { + return m_temperature; +} +float Biome::getDepth() { + return m_depth; +} +float Biome::getScale() { + return m_scale; +} + +extern const float gFreezingTemperature; + +Biome::LegacyBlockData Biome::STONE(1, 0); +Biome::LegacyBlockData Biome::AIR(0, 0); +Biome::LegacyBlockData Biome::BEDROCK(7, 0); +Biome::LegacyBlockData Biome::GRAVEL(13, 0); +Biome::LegacyBlockData Biome::RED_SANDSTONE(179, 0); +Biome::LegacyBlockData Biome::SANDSTONE(24, 0); +Biome::LegacyBlockData Biome::ICE(79, 0); +Biome::LegacyBlockData Biome::WATER(9, 0); + +void Biome::buildSurfaceAt(Level* level, Random& random, ChunkPrimer* primer, int x, int z, double noise) { + buildSurfaceAtDefault(level, random, primer, x, z, noise); +} + +/** Surface data uses the original lower 128-layer primer indexing and sea level 63. + */ +void Biome::buildSurfaceAtDefault(Level*, Random& random, ChunkPrimer* primer, int x, int z, double noise) { + PIXBeginNamedEvent(0.0f, "Biome::buildSurfaceAtDefault"); + LegacyBlockData surface = m_grass; + LegacyBlockData filler = m_dirt; + LevelGenerationOptions* options = CConsoleMinecraftApp::sInstance.getLevelGenerationOptions(); + if (options) + options->getBiomeOverride(m_biomeId, &filler, &surface); + int depth = static_cast(noise / 3.0 + 3.0 + random.nextDouble() * 0.25); + MutableBlockPos pos(0, 0, 0); + int remaining = -1; + for (int y = 127; y >= 0; --y) { + int index = ((x & 15) << 7) | ((z & 15) << 11) | y; + if (y <= random.nextInt(2) + 1) { + primer->setBlockAndData(index, BEDROCK.m_id, BEDROCK.m_data); + continue; + } + int block = primer->getBlockId(index); + if (block == 0) { + remaining = -1; + } else if (block == 1) { + if (remaining == -1) { + if (depth <= 0) { + surface = AIR; + filler = STONE; + } else if (y >= 59 && y <= 64) { + surface = m_grass; + filler = m_dirt; + if (options) + options->getBiomeOverride(m_biomeId, &filler, &surface); + } + if (y < 63 && surface.m_id == 0) { + pos.set(x, y, z); + if (getTemperature(&pos) < gFreezingTemperature) + surface = ICE; + else + surface = WATER; + } + if (y >= 62) { + primer->setBlockAndData(index, surface.m_id, surface.m_data); + } else if (y < 56 - depth) { + surface = AIR; + filler = STONE; + primer->setBlockAndData(index, GRAVEL.m_id, GRAVEL.m_data); + } else { + primer->setBlockAndData(index, filler.m_id, filler.m_data); + } + remaining = depth; + } else if (remaining > 0) { + primer->setBlockAndData(index, filler.m_id, filler.m_data); + --remaining; + if (remaining == 0) { + // The branch state is constant zero in the Switch executable. + remaining = 0; + if (depth > 1 && filler.m_id == 12) { + remaining = random.nextInt(4) + (y - 63 < 0 ? 0 : y - 63); + filler + = filler.m_data == SandBlock::Variant::RED->getData() ? RED_SANDSTONE : SANDSTONE; + } + } + } + } + } + PIXEndNamedEvent(); +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/BiomeDecorator.cpp new file mode 100644 index 00000000..6772de05 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/BiomeDecorator.cpp @@ -0,0 +1,403 @@ +#include "net/minecraft/world/level/biome/BiomeDecorator.h" + +#include "NX/Platform.h" +#include "net/minecraft/core/BlockPos.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/biome/Biome.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/Bush.h" +#include "net/minecraft/world/level/block/StoneBlock.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/levelgen/CustomizableSourceSettings.h" +#include "net/minecraft/world/level/levelgen/feature/AbstractTreeFeature.h" +#include "net/minecraft/world/level/levelgen/feature/BushFeature.h" +#include "net/minecraft/world/level/levelgen/feature/CactusFeature.h" +#include "net/minecraft/world/level/levelgen/feature/ClayFeature.h" +#include "net/minecraft/world/level/levelgen/feature/DeadBushFeature.h" +#include "net/minecraft/world/level/levelgen/feature/FlowerFeature.h" +#include "net/minecraft/world/level/levelgen/feature/HugeMushroomFeature.h" +#include "net/minecraft/world/level/levelgen/feature/OreFeature.h" +#include "net/minecraft/world/level/levelgen/feature/PumpkinFeature.h" +#include "net/minecraft/world/level/levelgen/feature/ReedsFeature.h" +#include "net/minecraft/world/level/levelgen/feature/SandFeature.h" +#include "net/minecraft/world/level/levelgen/feature/SpringFeature.h" +#include "net/minecraft/world/level/levelgen/feature/WaterlilyFeature.h" +#include "net/minecraft/world/level/material/Material.h" +#include "net/minecraft/world/level/storage/LevelData.h" + +BiomeDecorator::BiomeDecorator() { + m_clay = new ClayFeature(4); + m_sand = new SandFeature(Blocks::SAND, 7); + m_gravelPatch = new SandFeature(Blocks::GRAVEL, 6); + m_dirt = nullptr; + m_gravel = nullptr; + m_granite = nullptr; + m_diorite = nullptr; + m_andesite = nullptr; + m_coal = nullptr; + m_iron = nullptr; + m_gold = nullptr; + m_redstone = nullptr; + m_diamond = nullptr; + m_lapis = nullptr; + m_flowers = new FlowerFeature(static_cast(Blocks::YELLOW_FLOWER), + FlowerBlock::Flower::YELLOW_FLOWER); + m_brownMushrooms = new BushFeature(static_cast(Blocks::BROWN_MUSHROOM)); + m_redMushrooms = new BushFeature(static_cast(Blocks::RED_MUSHROOM)); + m_hugeMushrooms = new HugeMushroomFeature; + m_reeds = new ReedsFeature(); + m_cactus = new CactusFeature(); + m_waterlilies = new WaterlilyFeature(); + m_waterlilyCount = 0; + m_treeCount = 0; + m_extraTreeChance = 0.1f; + m_flowerCount = 2; + m_grassCount = 1; + m_deadBushCount = 0; + m_mushroomCount = 0; + m_reedCount = 0; + m_cactusCount = 0; + m_gravelPatchCount = 1; + m_sandCount = 3; + m_clayCount = 1; + m_hugeMushroomCount = 0; + m_generateLiquids = true; + m_decorating = false; + m_settings = nullptr; +} + +BiomeDecorator::~BiomeDecorator() { + delete m_clay; + delete m_sand; + delete m_gravelPatch; + delete m_dirt; + delete m_gravel; + delete m_granite; + delete m_diorite; + delete m_andesite; + delete m_coal; + delete m_iron; + delete m_gold; + delete m_redstone; + delete m_diamond; + delete m_lapis; + delete m_flowers; + delete m_brownMushrooms; + delete m_redMushrooms; + delete m_hugeMushrooms; + delete m_reeds; + delete m_cactus; + delete m_waterlilies; + delete m_settings; +} + +void BiomeDecorator::decorate(Level* level, Random& random, Biome* biome, const BlockPos& pos) { + delete m_settings; + CustomizableSourceSettings::Builder* builder + = CustomizableSourceSettings::Builder::fromString(level->getLevelData()->getGeneratorOptions()); + m_settings = builder->build(); + m_origin = pos; + delete m_dirt; + delete m_gravel; + delete m_granite; + delete m_diorite; + delete m_andesite; + delete m_coal; + delete m_iron; + delete m_gold; + delete m_redstone; + delete m_diamond; + delete m_lapis; + m_dirt = new OreFeature(Blocks::DIRT->defaultBlockState(), m_settings->m_dirtSize); + m_gravel = new OreFeature(Blocks::GRAVEL->defaultBlockState(), m_settings->m_gravelSize); + m_granite = new OreFeature( + Blocks::STONE->defaultBlockState()->setValue(StoneBlock::VARIANT, StoneBlock::Variant::GRANITE), + m_settings->m_graniteSize); + m_diorite = new OreFeature( + Blocks::STONE->defaultBlockState()->setValue(StoneBlock::VARIANT, StoneBlock::Variant::DIORITE), + m_settings->m_dioriteSize); + m_andesite = new OreFeature( + Blocks::STONE->defaultBlockState()->setValue(StoneBlock::VARIANT, StoneBlock::Variant::ANDESITE), + m_settings->m_andesiteSize); + m_coal = new OreFeature(Blocks::COAL_ORE->defaultBlockState(), m_settings->m_coalSize); + m_iron = new OreFeature(Blocks::IRON_ORE->defaultBlockState(), m_settings->m_ironSize); + m_gold = new OreFeature(Blocks::GOLD_ORE->defaultBlockState(), m_settings->m_goldSize); + m_redstone = new OreFeature(Blocks::REDSTONE_ORE->defaultBlockState(), m_settings->m_redstoneSize); + m_diamond = new OreFeature(Blocks::DIAMOND_ORE->defaultBlockState(), m_settings->m_diamondSize); + m_lapis = new OreFeature(Blocks::LAPIS_ORE->defaultBlockState(), m_settings->m_lapisSize); + decorate(biome, level, random); + m_decorating = false; + delete builder; +} + +void BiomeDecorator::decorateOres(Level* level, Random& random) { + Level::setInstaTick(true); + decorateDepthSpan(level, random, m_settings->m_dirtCount, m_dirt, m_settings->m_dirtMinHeight, + m_settings->m_dirtMaxHeight); + decorateDepthSpan(level, random, m_settings->m_gravelCount, m_gravel, m_settings->m_gravelMinHeight, + m_settings->m_gravelMaxHeight); + decorateDepthSpan(level, random, m_settings->m_dioriteCount, m_diorite, m_settings->m_dioriteMinHeight, + m_settings->m_dioriteMaxHeight); + decorateDepthSpan(level, random, m_settings->m_graniteCount, m_granite, m_settings->m_graniteMinHeight, + m_settings->m_graniteMaxHeight); + decorateDepthSpan(level, random, m_settings->m_andesiteCount, m_andesite, m_settings->m_andesiteMinHeight, + m_settings->m_andesiteMaxHeight); + decorateDepthSpan(level, random, m_settings->m_coalCount, m_coal, m_settings->m_coalMinHeight, + m_settings->m_coalMaxHeight); + decorateDepthSpan(level, random, m_settings->m_ironCount, m_iron, m_settings->m_ironMinHeight, + m_settings->m_ironMaxHeight); + decorateDepthSpan(level, random, m_settings->m_goldCount, m_gold, m_settings->m_goldMinHeight, + m_settings->m_goldMaxHeight); + decorateDepthSpan(level, random, m_settings->m_redstoneCount, m_redstone, m_settings->m_redstoneMinHeight, + m_settings->m_redstoneMaxHeight); + decorateDepthSpan(level, random, m_settings->m_diamondCount, m_diamond, m_settings->m_diamondMinHeight, + m_settings->m_diamondMaxHeight); + decorateDepthAverage(level, random, m_settings->m_lapisCount, m_lapis, m_settings->m_lapisCenterHeight, + m_settings->m_lapisSpread); + Level::setInstaTick(false); +} + +// name guessed +void BiomeDecorator::decorateDepthSpan(Level* level, Random& random, int count, Feature* feature, + int minHeight, int maxHeight) { + if (maxHeight < minHeight) { + int height = minHeight; + minHeight = maxHeight; + maxHeight = height; + } else if (maxHeight == minHeight) { + if (maxHeight < 255) + ++maxHeight; + else + --minHeight; + } + int x = m_origin.getX(); + int z = m_origin.getZ(); + MutableBlockPos pos(0, 0, 0); + for (int i = 0; i < count; ++i) { + int px = random.nextInt(16) + x; + int py = random.nextInt(maxHeight - minHeight) + minHeight; + int pz = random.nextInt(16) + z; + pos.set(px, py, pz); + feature->place(level, random, pos); + } +} + +// name guessed +void BiomeDecorator::decorateDepthAverage(Level* level, Random& random, int count, Feature* feature, + int center, int spread) { + int x = m_origin.getX(); + int z = m_origin.getZ(); + MutableBlockPos pos(0, 0, 0); + for (int i = 0; i < count; ++i) { + int px = random.nextInt(16) + x; + int py = random.nextInt(spread) + random.nextInt(spread) + center - spread; + int pz = random.nextInt(16) + z; + pos.set(px, py, pz); + feature->place(level, random, pos); + } +} + +void BiomeDecorator::decorate(Biome* biome, Level* level, Random& random) { + PIXBeginNamedEvent(0.0f, "Decorate ores"); + decorateOres(level, random); + PIXEndNamedEvent(); + PIXBeginNamedEvent(0.0f, "Decorate sand/clay/gravel"); + for (int i = 0; i < m_sandCount; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + m_sand->place(level, random, level->getTopSolidBlockPos(m_origin.offset(x, 0, z))); + } + for (int i = 0; i < m_clayCount; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + m_clay->place(level, random, level->getTopSolidBlockPos(m_origin.offset(x, 0, z))); + } + for (int i = 0; i < m_gravelPatchCount; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + m_gravelPatch->place(level, random, level->getTopSolidBlockPos(m_origin.offset(x, 0, z))); + } + PIXEndNamedEvent(); + PIXBeginNamedEvent(0.0f, "Decorate forests"); + int treeCount = m_treeCount; + if (random.nextFloat() < m_extraTreeChance) + ++treeCount; + for (int i = 0; i < treeCount; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + AbstractTreeFeature* tree = static_cast(biome->getTreeFeature(random)); + tree->init(); + BlockPos pos = level->getHeightmapPos(m_origin.offset(x, 0, z)); + if (tree->place(level, random, pos)) + tree->postPlaceTree(level, random, pos); + delete tree; + } + PIXEndNamedEvent(); + PIXBeginNamedEvent(0.0f, "Decorate mushrooms/flowers/grass"); + for (int i = 0; i < m_hugeMushroomCount; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + m_hugeMushrooms->place(level, random, level->getHeightmapPos(m_origin.offset(x, 0, z))); + } + for (int i = 0; i < m_flowerCount; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(m_origin.offset(x, 0, z)).getY() + 32; + if (height > 0) { + int y = random.nextInt(height); + BlockPos pos = m_origin.offset(x, y, z); + FlowerBlock::Flower* flower = biome->getRandomFlower(random, &pos); + FlowerBlock* block = flower->getCategory()->getBlock(); + if (block->getMaterial() != Material::AIR) { + m_flowers->setFlower(block, flower); + m_flowers->place(level, random, pos); + } + } + } + for (int i = 0; i < m_grassCount; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(m_origin.offset(x, 0, z)).getY(); + if (height > 0) { + int y = random.nextInt(height * 2); + MemSect(50); + Feature* grass = biome->getGrassFeature(random); + MemSect(0); + grass->place(level, random, m_origin.offset(x, y, z)); + delete grass; + } + } + PIXEndNamedEvent(); + PIXBeginNamedEvent(0.0f, "Decorate bush/waterlily/mushroom/reeds/pumpkins/cactuses"); + if (m_deadBushCount > 0) { + Feature* bush = new DeadBushFeature(Blocks::DEADBUSH); + for (int i = 0; i < m_deadBushCount; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(m_origin.offset(x, 0, z)).getY(); + if (height > 0) { + int y = random.nextInt(height * 2); + bush->place(level, random, m_origin.offset(x, y, z)); + } + } + delete bush; + } + for (int i = 0; i < m_waterlilyCount; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(m_origin.offset(x, 0, z)).getY(); + if (height > 0) { + int y = random.nextInt(height * 2); + BlockPos pos = m_origin.offset(x, y, z); + while (pos.getY() > 0) { + BlockPos below = pos.below(); + if (!level->isEmptyBlock(below)) + break; + pos = below; + } + m_waterlilies->place(level, random, pos); + } + } + for (int i = 0; i < m_mushroomCount; ++i) { + if (random.nextInt(4) == 0) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + BlockPos pos = level->getHeightmapPos(m_origin.offset(x, 0, z)); + m_brownMushrooms->place(level, random, pos); + } + if (random.nextInt(8) == 0) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(m_origin.offset(x, 0, z)).getY(); + if (height > 0) { + int y = random.nextInt(height * 2); + BlockPos pos = m_origin.offset(x, y, z); + m_redMushrooms->place(level, random, pos); + } + } + } + if (random.nextInt(4) == 0) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(m_origin.offset(x, 0, z)).getY(); + if (height > 0) { + int y = random.nextInt(height * 2); + m_brownMushrooms->place(level, random, m_origin.offset(x, y, z)); + } + } + if (random.nextInt(8) == 0) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(m_origin.offset(x, 0, z)).getY(); + if (height > 0) { + int y = random.nextInt(height * 2); + m_redMushrooms->place(level, random, m_origin.offset(x, y, z)); + } + } + for (int i = 0; i < m_reedCount; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(m_origin.offset(x, 0, z)).getY(); + if (height > 0) { + int y = random.nextInt(height * 2); + m_reeds->place(level, random, m_origin.offset(x, y, z)); + } + } + for (int i = 0; i < 10; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(m_origin.offset(x, 0, z)).getY(); + if (height > 0) { + int y = random.nextInt(height * 2); + m_reeds->place(level, random, m_origin.offset(x, y, z)); + } + } + if (random.nextInt(32) == 0) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(m_origin.offset(x, 0, z)).getY(); + if (height > 0) { + int y = random.nextInt(height * 2); + PumpkinFeature* pumpkin = new PumpkinFeature(); + pumpkin->place(level, random, m_origin.offset(x, y, z)); + delete pumpkin; + } + } + for (int i = 0; i < m_cactusCount; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(m_origin.offset(x, 0, z)).getY(); + if (height > 0) { + int y = random.nextInt(height * 2); + m_cactus->place(level, random, m_origin.offset(x, y, z)); + } + } + PIXEndNamedEvent(); + PIXBeginNamedEvent(0.0f, "Decorate liquids"); + if (m_generateLiquids) { + Feature* water = new SpringFeature(Blocks::FLOWING_WATER); + for (int i = 0; i < 50; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int maxY = random.nextInt(120) + 8; + if (maxY > 0) { + int y = random.nextInt(maxY); + BlockPos pos = m_origin.offset(x, y, z); + water->place(level, random, pos); + } + } + delete water; + Feature* lava = new SpringFeature(Blocks::FLOWING_LAVA); + for (int i = 0; i < 20; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int y = random.nextInt(random.nextInt(random.nextInt(112) + 8) + 8); + BlockPos pos = m_origin.offset(x, y, z); + lava->place(level, random, pos); + } + delete lava; + } + PIXEndNamedEvent(); +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/DesertBiome.cpp new file mode 100644 index 00000000..7f2f46d5 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/DesertBiome.cpp @@ -0,0 +1,59 @@ +#include "net/minecraft/world/level/biome/DesertBiome.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/BiomeDecorator.h" +#include "net/minecraft/world/level/block/Block.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/levelgen/feature/DesertWellFeature.h" +#include "net/minecraft/world/level/levelgen/feature/FossilFeature.h" + +// name guessed +DesertBiome::DesertBiome(EBiomeIDs id, BiomeProperties* properties) : Biome(id, properties) { + m_passiveMobs.clear(); + m_passiveMobs.push_back(new MobSpawnerData(eRabbit, 4, 2, 3)); + m_chickens.clear(); + m_fieldD8.clear(); + m_grass + = LegacyBlockData(12, Blocks::SAND->convertBlockStateToLegacyData(Blocks::SAND->defaultBlockState())); + m_dirt + = LegacyBlockData(12, Blocks::SAND->convertBlockStateToLegacyData(Blocks::SAND->defaultBlockState())); + m_biomeDecorator->m_treeCount = -999; + m_biomeDecorator->m_deadBushCount = 2; + m_biomeDecorator->m_reedCount = 50; + m_biomeDecorator->m_cactusCount = 10; + // The original advances after erasure, skipping the entry shifted into this slot. + for (auto it = m_hostileMobs.begin(); it != m_hostileMobs.end(); ++it) { + MobSpawnerData* mob = *it; + if (mob->m_instanceType == eZombie || mob->m_instanceType == eZombieVillager) { + it = m_hostileMobs.erase(it); + delete mob; + } + } + m_hostileMobs.push_back(new MobSpawnerData(eZombie, 19, 4, 4)); + m_hostileMobs.push_back(new MobSpawnerData(eZombieVillager, 1, 1, 1)); + m_hostileMobs.push_back(new MobSpawnerData(eHusk, 80, 4, 4)); +} + +// name guessed +int DesertBiome::getBaseClass() { + return _DESERT; +} + +// name guessed +// NON_MATCHING | score: 100 (lower is better) +void DesertBiome::decorate(Level* level, Random& random, const BlockPos& pos) { + Biome::decorate(level, random, pos); + if (random.nextInt(1000) == 0) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + BlockPos candidate = level->getHeightmapPos(pos.offset(x, 0, z)).above(); + DesertWellFeature well; + well.place(level, random, candidate); + } + if (random.nextInt(64) == 0) { + FossilFeature fossil{}; + fossil.place(level, random, pos); + } +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/ExtremeHillsBiome.cpp new file mode 100644 index 00000000..e58adc2c --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/ExtremeHillsBiome.cpp @@ -0,0 +1,76 @@ +#include "net/minecraft/world/level/biome/ExtremeHillsBiome.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/biome/BiomeDecorator.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/MonsterEggBlock.h" +#include "net/minecraft/world/level/levelgen/feature/OreFeature.h" +#include "net/minecraft/world/level/levelgen/feature/SpruceFeature.h" + +// name guessed +ExtremeHillsBiome::ExtremeHillsBiome(EBiomeIDs id, EType type, BiomeProperties* properties) + : Biome(id, properties) { + if (type == EDGE) + m_biomeDecorator->m_treeCount = 3; + m_passiveMobs.push_back(new MobSpawnerData(eLlama, 5, 4, 6)); + m_type = type; + m_oreFeature = new OreFeature(Blocks::MONSTER_EGG->defaultBlockState()->setValue( + MonsterEggBlock::VARIANT, MonsterEggBlock::Variant::STONE), + 9); +} + +ExtremeHillsBiome::~ExtremeHillsBiome() { + delete m_oreFeature; +} + +// name guessed +int ExtremeHillsBiome::getBaseClass() { + return _EXTREME_HILLS; +} + +// name guessed +Feature* ExtremeHillsBiome::getTreeFeature(Random& random) { + if (random.nextInt(3) > 0) + return new SpruceFeature(false); + return Biome::getTreeFeature(random); +} + +// name guessed +void ExtremeHillsBiome::decorate(Level* level, Random& random, const BlockPos& pos) { + Biome::decorate(level, random, pos); + int count = random.nextInt(6) + 3; + for (int i = 0; i < count; ++i) { + int x = random.nextInt(16); + int y = random.nextInt(28) + 4; + int z = random.nextInt(16); + BlockPos candidate = pos.offset(x, y, z); + if (level->getBlockState(candidate)->getBlock() == Blocks::STONE) + level->setBlock(candidate, Blocks::EMERALD_ORE->defaultBlockState(), 2, false); + } + for (int i = 0; i < 7; ++i) { + int x = random.nextInt(16); + int y = random.nextInt(64); + int z = random.nextInt(16); + m_oreFeature->place(level, random, pos.offset(x, y, z)); + } +} + +// name guessed +void ExtremeHillsBiome::buildSurfaceAt(Level* level, Random& random, ChunkPrimer* primer, int x, int z, + double noise) { + PIXBeginNamedEvent(0.0f, "ExtremeHillsBiome::buildSurfaceAtDefault"); + m_grass = LegacyBlockData(2, 0); + m_dirt = LegacyBlockData(3, 0); + if ((noise < -1.0 || noise > 2.0) && m_type == M) { + m_grass = LegacyBlockData(13, 0); + m_dirt = LegacyBlockData(13, 0); + } else if (noise > 1.0 && m_type != EDGE) { + m_grass = LegacyBlockData(1, 0); + m_dirt = LegacyBlockData(1, 0); + } + buildSurfaceAtDefault(level, random, primer, x, z, noise); + PIXEndNamedEvent(); +} 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/FixedBiomeSource.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/FixedBiomeSource.cpp new file mode 100644 index 00000000..8fa8b8b6 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/FixedBiomeSource.cpp @@ -0,0 +1,77 @@ +#include "net/minecraft/world/level/biome/FixedBiomeSource.h" + +#include "NX/Platform.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/biome/Biome.h" +#include + +/** Shared fill routines retain their original array-by-value calling convention. + */ +// name guessed +void fillFixedBiomePointers(arrayWithLength array, unsigned int from, unsigned int to, Biome* value) { + std::fill(array.m_data + from, array.m_data + to, value); +} + +// name guessed +void fillFixedBiomeIndices(arrayWithLength array, unsigned int from, unsigned int to, + int value) { + std::fill(array.m_data + from, array.m_data + to, static_cast(value)); +} + +// name guessed +FixedBiomeSource::FixedBiomeSource(Biome* biome) : m_biome(biome) {} + +// name guessed +Biome* FixedBiomeSource::getBiome(const BlockPos&) { + return m_biome; +} +// name guessed +bool FixedBiomeSource::isFixedBiome() { + return true; +} +// name guessed +Biome* FixedBiomeSource::getFixedBiome() { + return m_biome; +} + +// name guessed +void FixedBiomeSource::getBiomeBlock(arrayWithLength& biomes, int, int, int width, int depth, + bool) const { + MemSect(36); + biomes.resize(width * depth); + MemSect(0); + fillFixedBiomePointers(biomes, 0, width * depth, m_biome); +} + +// name guessed +void FixedBiomeSource::getRawBiomeBlock(arrayWithLength& biomes, int, int, int width, + int depth) const { + MemSect(36); + biomes.resize(width * depth); + MemSect(0); + fillFixedBiomePointers(biomes, 0, width * depth, m_biome); +} + +// name guessed +void FixedBiomeSource::getBiomeIndexBlock(arrayWithLength& biomes, int, int, int width, + int depth, bool) const { + MemSect(36); + biomes.resize(width * depth); + MemSect(0); + int biomeId = m_biome->m_biomeId; + fillFixedBiomeIndices(biomes, 0, width * depth, biomeId); +} + +// name guessed +bool FixedBiomeSource::containsOnly(int, int, int, const std::vector& biomes) { + return std::find(biomes.begin(), biomes.end(), m_biome) != biomes.end(); +} + +// name guessed +BlockPos* FixedBiomeSource::findBiome(int x, int z, int radius, std::vector biomes, Random* random) { + if (std::find(biomes.begin(), biomes.end(), m_biome) == biomes.end()) + return nullptr; + return new BlockPos(x - radius + random->nextInt(radius * 2 + 1), 0, + z - radius + random->nextInt(radius * 2 + 1)); +} diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/FixedBiomeSource.h b/src/Minecraft.World/net/minecraft/world/level/biome/FixedBiomeSource.h new file mode 100644 index 00000000..0a25e516 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/FixedBiomeSource.h @@ -0,0 +1,22 @@ +#pragma once + +#include "net/minecraft/world/level/biome/BiomeSource.h" +#include "types.h" + +class FixedBiomeSource : public BiomeSource { +public: + explicit FixedBiomeSource(Biome*); + Biome* getBiome(const BlockPos&) override; + void getRawBiomeBlock(arrayWithLength&, int, int, int, int) const override; + void getBiomeBlock(arrayWithLength&, int, int, int, int, bool) const override; + void getBiomeIndexBlock(arrayWithLength&, int, int, int, int, bool) const override; + bool containsOnly(int, int, int, const std::vector&) override; + BlockPos* findBiome(int, int, int, std::vector, Random*) override; + bool isFixedBiome() override; + Biome* getFixedBiome() override; + +private: + Biome* m_biome; +}; + +ASSERT_SIZEOF(FixedBiomeSource, 0x88) diff --git a/src/Minecraft.World/net/minecraft/world/level/biome/ForestBiome.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/ForestBiome.cpp new file mode 100644 index 00000000..8493e616 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/ForestBiome.cpp @@ -0,0 +1,132 @@ +#include "net/minecraft/world/level/biome/ForestBiome.h" + +#include "net/minecraft/client/Minecraft.h" +#include "net/minecraft/client/color/ColourTable.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/util/Mth.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/eINSTANCEOF.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/biome/BiomeDecorator.h" +#include "net/minecraft/world/level/levelgen/feature/BigTreeFeature.h" +#include "net/minecraft/world/level/levelgen/feature/BirchFeature.h" +#include "net/minecraft/world/level/levelgen/feature/DoublePlantFeature.h" +#include "net/minecraft/world/level/levelgen/feature/HugeMushroomFeature.h" +#include "net/minecraft/world/level/levelgen/feature/RoofTreeFeature.h" +#include "net/minecraft/world/level/levelgen/feature/TreeFeature.h" +#include "net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.h" + +// name guessed +// NON_MATCHING | score: 1900 (lower is better) +ForestBiome::ForestBiome(EBiomeIDs id, EType type, BiomeProperties* properties) + : Biome(id, properties), m_type(type) { + m_biomeDecorator->m_treeCount = 10; + m_biomeDecorator->m_grassCount = 2; + if (type == DEFAULT) { + m_fieldD8.push_back(new MobSpawnerData(eWolf, 5, 4, 4)); + } + if (type == ROOFED) { + m_biomeDecorator->m_treeCount = -999; + } + if (type == FLOWER) { + m_biomeDecorator->m_treeCount = 6; + m_biomeDecorator->m_flowerCount = 100; + m_biomeDecorator->m_grassCount = 1; + m_passiveMobs.push_back(new MobSpawnerData(eRabbit, 4, 2, 3)); + } +} + +// name guessed +int ForestBiome::getBaseClass() { + return _FOREST; +} + +// name guessed +Feature* ForestBiome::getTreeFeature(Random& random) { + if (m_type == ROOFED && random.nextInt(3) > 0) + return new RoofTreeFeature(false); + if (m_type == BIRCH || random.nextInt(5) == 0) + return new BirchFeature(false, false); + if (random.nextInt(10) == 0) + return new BigTreeFeature(false); + return new TreeFeature(false); +} + +// name guessed +FlowerBlock::Flower* ForestBiome::getRandomFlower(Random& random, const BlockPos* pos) { + if (m_type == FLOWER) { + double noise = BIOME_INFO_NOISE->getValue(pos->getX() / 48.0, pos->getZ() / 48.0); + int index = static_cast(Mth::clamp((noise + 1.0) * 0.5, 0.0, 0.9999) * 10.0); + FlowerBlock::Flower* flower = FlowerBlock::Flower::FLOWERS[index]; + return flower == FlowerBlock::Flower::BLUE_ORCHID ? FlowerBlock::Flower::RED_FLOWER : flower; + } + return Biome::getRandomFlower(random, pos); +} + +// name guessed +unsigned int ForestBiome::getGrassColor(const BlockPos* pos) { + unsigned int color = Biome::getGrassColor(pos); + if (m_type == ROOFED) { + color &= 0xfefefe; + unsigned int modifier + = Minecraft::GetInstance()->getColourTable()->getColour(Grass_Roofed_Forest_Modifier); + return ((modifier & 0xfefefe) + color) >> 1; + } + return color; +} + +// name guessed +void ForestBiome::decorate(Level* level, Random& random, const BlockPos& pos) { + if (m_type == ROOFED) + addMushrooms(level, random, pos); + int count = random.nextInt(5) - 3; + if (m_type == FLOWER) + count += 2; + addDoublePlants(level, random, pos, count); + Biome::decorate(level, random, pos); +} + +// name guessed +void ForestBiome::addMushrooms(Level* level, Random& random, const BlockPos& pos) { + for (int x = 0; x < 4; ++x) { + for (int z = 0; z < 4; ++z) { + int dx = x * 4 + 1 + 8 + random.nextInt(3); + int dz = z * 4 + 1 + 8 + random.nextInt(3); + BlockPos candidate = level->getHeightmapPos(pos.offset(dx, 0, dz)); + if (random.nextInt(20) == 0) { + HugeMushroomFeature* mushroom = new HugeMushroomFeature(); + mushroom->place(level, random, candidate); + delete mushroom; + } else { + AbstractTreeFeature* tree = static_cast(getTreeFeature(random)); + tree->init(); + if (tree->place(level, random, candidate)) + tree->postPlaceTree(level, random, candidate); + delete tree; + } + } + } +} + +// name guessed +// NON_MATCHING | score: 1786 (lower is better) +void ForestBiome::addDoublePlants(Level* level, Random& random, const BlockPos& pos, int count) { + for (int i = 0; i < count; ++i) { + int type = random.nextInt(3); + if (type == 0) + DOUBLE_PLANT_FEATURE->setNextPlantType(DoublePlantBlock::Variant::SYRINGA); + else if (type == 1) + DOUBLE_PLANT_FEATURE->setNextPlantType(DoublePlantBlock::Variant::ROSE); + else if (type == 2) + DOUBLE_PLANT_FEATURE->setNextPlantType(DoublePlantBlock::Variant::PAEONIA); + for (int attempt = 0; attempt < 5; ++attempt) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(pos.offset(x, 0, z)).getY(); + int y = random.nextInt(height + 32); + BlockPos candidate(pos.getX() + x, y, pos.getZ() + z); + if (DOUBLE_PLANT_FEATURE->place(level, random, candidate)) + break; + } + } +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/HellBiome.cpp new file mode 100644 index 00000000..571d2c64 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/HellBiome.cpp @@ -0,0 +1,63 @@ +#include "net/minecraft/world/level/biome/HellBiome.h" + +#include "net/minecraft/client/Minecraft.h" +#include "net/minecraft/client/color/ColourTable.h" +#include "net/minecraft/world/eINSTANCEOF.h" +#include "net/minecraft/world/level/biome/BiomeDecorator.h" + +class HellBiomeDecorator : public BiomeDecorator { +public: + // name guessed + HellBiomeDecorator() = default; + ~HellBiomeDecorator() override = default; + void decorate(Level*, Random&, Biome*, const BlockPos&) override; +}; + +// name guessed +void HellBiomeDecorator::decorate(Level*, Random&, Biome*, const BlockPos&) {} + +// name guessed +HellBiome::HellBiome(EBiomeIDs id, BiomeProperties* properties) : Biome(id, properties) { + m_hostileMobs.clear(); + m_passiveMobs.clear(); + m_chickens.clear(); + m_fieldD8.clear(); + m_aquaticMobs.clear(); + m_ambientMobs.clear(); + m_hostileMobs.push_back(new MobSpawnerData(eGhast, 100, 4, 4)); + m_hostileMobs.push_back(new MobSpawnerData(ePigZombie, 200, 4, 4)); + m_hostileMobs.push_back(new MobSpawnerData(eMagmaCube, 2, 4, 4)); + m_hostileMobs.push_back(new MobSpawnerData(eEnderMan, 1, 4, 4)); + m_hostileMobs.push_back(new MobSpawnerData(eWitherSkeleton, 1, 4, 4)); + delete m_biomeDecorator; + m_biomeDecorator = new HellBiomeDecorator(); +} + +// name guessed +int HellBiome::getBaseClass() { + return _HELL; +} +// name guessed +unsigned int HellBiome::getSkyColor(float) { + return 0; +} +// name guessed +bool HellBiome::isFoggy() { + return true; +} +// name guessed +bool HellBiome::isNatural() { + return false; +} + +// name guessed +Vec3* HellBiome::getFogColor(float, float) const { + unsigned int color = Minecraft::GetInstance()->getColourTable()->getColour(Nether_Fog_Colour); + unsigned int red = color >> 16 & 255; + unsigned int green = color >> 8 & 255; + unsigned int blue = color & 255; + float r = red / 256.0f; + float g = green / 256.0f; + float b = blue / 256.0f; + return Vec3::newTemp(r, g, b); +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/IceBiome.cpp new file mode 100644 index 00000000..47ea056a --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/IceBiome.cpp @@ -0,0 +1,61 @@ +#include "net/minecraft/world/level/biome/IceBiome.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/levelgen/feature/IcePatchFeature.h" +#include "net/minecraft/world/level/levelgen/feature/IceSpikeFeature.h" +#include "net/minecraft/world/level/levelgen/feature/SpruceFeature.h" + +// name guessed +IceBiome::IceBiome(EBiomeIDs id, bool spikes, BiomeProperties* properties) : Biome(id, properties) { + m_spikeFeature = new IceSpikeFeature(); + m_patchFeature = new IcePatchFeature(4); + m_spikes = spikes; + if (spikes) + m_grass = LegacyBlockData( + 80, Blocks::SNOW->convertBlockStateToLegacyData(Blocks::SNOW->defaultBlockState())); + m_passiveMobs.clear(); + m_passiveMobs.push_back(new MobSpawnerData(eRabbit, 10, 2, 3)); + m_passiveMobs.push_back(new MobSpawnerData(ePolarBear, 1, 1, 2)); + for (auto it = m_hostileMobs.begin(); it != m_hostileMobs.end();) { + if ((*it)->m_instanceType == eSkeleton) + it = m_hostileMobs.erase(it); + else + ++it; + } + m_hostileMobs.push_back(new MobSpawnerData(eSkeleton, 20, 4, 4)); + m_hostileMobs.push_back(new MobSpawnerData(eStray, 80, 4, 4)); +} + +// name guessed +int IceBiome::getBaseClass() { + return _ICE; +} +// name guessed +float IceBiome::getCreatureProbability() { + return 0.07f; +} +// name guessed +Feature* IceBiome::getTreeFeature(Random&) { + return new SpruceFeature(false); +} + +// name guessed +void IceBiome::decorate(Level* level, Random& random, const BlockPos& pos) { + if (m_spikes) { + for (int i = 0; i < 3; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + m_spikeFeature->place(level, random, level->getHeightmapPos(pos.offset(x, 0, z))); + } + for (int i = 0; i < 2; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + m_patchFeature->place(level, random, level->getHeightmapPos(pos.offset(x, 0, z))); + } + } + Biome::decorate(level, random, pos); +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/JungleBiome.cpp new file mode 100644 index 00000000..c7be9421 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/JungleBiome.cpp @@ -0,0 +1,89 @@ +#include "net/minecraft/world/level/biome/JungleBiome.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/biome/BiomeDecorator.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/levelgen/feature/BigTreeFeature.h" +#include "net/minecraft/world/level/levelgen/feature/GroundBushFeature.h" +#include "net/minecraft/world/level/levelgen/feature/MegaJungleTreeFeature.h" +#include "net/minecraft/world/level/levelgen/feature/MelonFeature.h" +#include "net/minecraft/world/level/levelgen/feature/TallgrassFeature.h" +#include "net/minecraft/world/level/levelgen/feature/VinesFeature.h" + +const BlockState* JungleBiome::TRUNK; // name guessed +const BlockState* JungleBiome::LEAVES; +const BlockState* JungleBiome::BUSH_LEAVES; + +void JungleBiome::staticCtor() { + TRUNK = Blocks::LOG->defaultBlockState()->setValue(OldLogBlock::VARIANT, PlanksBlock::Variant::JUNGLE); + LEAVES = Blocks::LEAVES->defaultBlockState() + ->setValue(OldLeafBlock::VARIANT, PlanksBlock::Variant::JUNGLE) + ->setValue(LeafBlock::CHECK_DECAY, false); + BUSH_LEAVES = Blocks::LEAVES->defaultBlockState() + ->setValue(OldLeafBlock::VARIANT, PlanksBlock::Variant::OAK) + ->setValue(LeafBlock::CHECK_DECAY, false); +} + +// name guessed +JungleBiome::JungleBiome(EBiomeIDs id, bool edge, BiomeProperties* properties) + : Biome(id, properties), m_edge(edge) { + if (edge) + m_biomeDecorator->m_treeCount = 2; + else + m_biomeDecorator->m_treeCount = 50; + m_biomeDecorator->m_grassCount = 25; + m_biomeDecorator->m_flowerCount = 4; + if (!edge) + m_hostileMobs.push_back(new MobSpawnerData(eOcelot, 2, 1, 1)); + m_passiveMobs.push_back(new MobSpawnerData(eParrot, 40, 1, 2)); + m_passiveMobs.push_back(new MobSpawnerData(eChicken, 10, 4, 4)); +} + +// name guessed +int JungleBiome::getBaseClass() { + return _JUNGLE; +} + +// name guessed +Feature* JungleBiome::getTreeFeature(Random& random) { + if (random.nextInt(10) == 0) + return new BigTreeFeature(false); + if (random.nextInt(2) == 0) + return new GroundBushFeature(TRUNK, BUSH_LEAVES); + if (!m_edge && random.nextInt(3) == 0) + return new MegaJungleTreeFeature(false, 10, 20, TRUNK, LEAVES); + return new TreeFeature(false, 4 + random.nextInt(7), TRUNK, LEAVES, true); +} + +// name guessed +Feature* JungleBiome::getGrassFeature(Random& random) { + if (random.nextInt(4) == 0) + return new TallgrassFeature(TallGrassBlock::Variant::FERN); + return new TallgrassFeature(TallGrassBlock::Variant::GRASS); +} + +// name guessed +void JungleBiome::decorate(Level* level, Random& random, const BlockPos& pos) { + Biome::decorate(level, random, pos); + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(pos.offset(x, 0, z)).getY(); + int y = height < 1 ? 0 : random.nextInt(height * 2); + { + MelonFeature melon; + melon.place(level, random, pos.offset(x, y, z)); + } + PIXBeginNamedEvent(0.0f, "Adding vines"); + VinesFeature vines; + for (int i = 0; i < 50; ++i) { + x = random.nextInt(16) + 8; + z = random.nextInt(16) + 8; + vines.place(level, random, pos.offset(x, 64, z)); + } + PIXEndNamedEvent(); +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/MesaBiome.cpp new file mode 100644 index 00000000..e1e9caaf --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/MesaBiome.cpp @@ -0,0 +1,265 @@ +#include "net/minecraft/world/level/biome/MesaBiome.h" + +#include "NX/Platform.h" +#include "net/minecraft/client/Minecraft.h" +#include "net/minecraft/client/color/ColourTable.h" +#include "net/minecraft/util/Mth.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/item/DyeColor.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/ColoredBlock.h" +#include "net/minecraft/world/level/block/DirtBlock.h" +#include "net/minecraft/world/level/block/SandBlock.h" +#include "net/minecraft/world/level/levelgen/ChunkPrimer.h" +#include "net/minecraft/world/level/levelgen/feature/TreeFeature.h" +#include "net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.h" +#include "net/minecraft/world/level/material/Material.h" +#include + +Biome::LegacyBlockData MesaBiome::COARSE_DIRT; // name guessed +Biome::LegacyBlockData MesaBiome::GRASS; +Biome::LegacyBlockData MesaBiome::HARDENED_CLAY; +Biome::LegacyBlockData MesaBiome::STAINED_HARDENED_CLAY; // name guessed +Biome::LegacyBlockData MesaBiome::ORANGE_CLAY; +Biome::LegacyBlockData MesaBiome::RED_SAND; + +void MesaBiome::staticCtor() { + COARSE_DIRT = LegacyBlockData( + 3, Blocks::DIRT->convertBlockStateToLegacyData( + Blocks::DIRT->defaultBlockState()->setValue(DirtBlock::VARIANT, DirtBlock::Variant::COARSE))); + GRASS = LegacyBlockData(2, + Blocks::GRASS->convertBlockStateToLegacyData(Blocks::GRASS->defaultBlockState())); + HARDENED_CLAY = LegacyBlockData(172, Blocks::HARDENED_CLAY->convertBlockStateToLegacyData( + Blocks::HARDENED_CLAY->defaultBlockState())); + STAINED_HARDENED_CLAY = LegacyBlockData(159, Blocks::STAINED_HARDENED_CLAY->convertBlockStateToLegacyData( + Blocks::STAINED_HARDENED_CLAY->defaultBlockState())); + ORANGE_CLAY = LegacyBlockData(159, Blocks::STAINED_HARDENED_CLAY->convertBlockStateToLegacyData( + Blocks::STAINED_HARDENED_CLAY->defaultBlockState()->setValue( + ColoredBlock::COLOR, DyeColor::ORANGE))); + RED_SAND = LegacyBlockData( + 12, Blocks::SAND->convertBlockStateToLegacyData( + Blocks::SAND->defaultBlockState()->setValue(SandBlock::VARIANT, SandBlock::Variant::RED))); +} + +// name guessed +// NON_MATCHING | score: 610 (lower is better) +MesaBiome::MesaBiome(EBiomeIDs id, bool bryce, bool forest, BiomeProperties* properties) + : Biome(id, properties) { + m_bryce = bryce; + m_forest = forest; + m_clayBands = nullptr; + m_seed = 0; + m_pillarNoise = nullptr; + m_pillarRoofNoise = nullptr; + m_clayBandsOffsetNoise = nullptr; + m_passiveMobs.clear(); + m_grass = RED_SAND; + m_dirt = STAINED_HARDENED_CLAY; + delete m_biomeDecorator; + m_biomeDecorator = new MesaDecorator(); + m_biomeDecorator->m_treeCount = -999; + m_biomeDecorator->m_deadBushCount = 20; + m_biomeDecorator->m_reedCount = 3; + m_biomeDecorator->m_cactusCount = 5; + m_biomeDecorator->m_flowerCount = 0; + m_passiveMobs.clear(); + if (forest) + m_biomeDecorator->m_treeCount = 5; +} + +MesaBiome::~MesaBiome() { + delete m_pillarNoise; + delete m_pillarRoofNoise; + delete m_clayBandsOffsetNoise; + delete[] m_clayBands; +} + +// name guessed +int MesaBiome::getBaseClass() { + return _MESA; +} +// name guessed +Feature* MesaBiome::getTreeFeature(Random&) { + return new TreeFeature(false); +} +// name guessed +unsigned int MesaBiome::getGrassColor(const BlockPos*) { + return Minecraft::GetInstance()->getColourTable()->getColour(Grass_Mesa); +} +// name guessed +unsigned int MesaBiome::getFoliageColor(const BlockPos*) { + return Minecraft::GetInstance()->getColourTable()->getColour(Foliage_Mesa); +} + +// name guessed +void MesaBiome::MesaDecorator::decorateOres(Level* level, Random& random) { + BiomeDecorator::decorateOres(level, random); + decorateDepthSpan(level, random, 20, m_gold, 32, 80); +} + +// name guessed +// NON_MATCHING | score: 6157 (lower is better) +void MesaBiome::generateBands(long long seed) { + delete[] m_clayBands; + m_clayBands = new LegacyBlockData[64]; + for (int i = 0; i < 64; ++i) + m_clayBands[i] = HARDENED_CLAY; + Random random(seed); + // Rebuilding this cache replaces the noise pointer without deleting the old one in the original. + m_clayBandsOffsetNoise = new PerlinSimplexNoise(&random, 1); + for (int i = 0; i < 64; ++i) { + i += random.nextInt(5) + 1; + if (i < 64) + m_clayBands[i] = ORANGE_CLAY; + } + + LegacyBlockData clay(159, Blocks::STAINED_HARDENED_CLAY->convertBlockStateToLegacyData( + Blocks::STAINED_HARDENED_CLAY->defaultBlockState()->setValue( + ColoredBlock::COLOR, DyeColor::YELLOW))); + int count = random.nextInt(4) + 2; + for (int i = 0; i < count; ++i) { + int width = random.nextInt(3) + 1; + int start = random.nextInt(64); + for (int j = 0; j < width && start + j < 64; ++j) + m_clayBands[start + j] = clay; + } + clay = LegacyBlockData(159, Blocks::STAINED_HARDENED_CLAY->convertBlockStateToLegacyData( + Blocks::STAINED_HARDENED_CLAY->defaultBlockState()->setValue( + ColoredBlock::COLOR, DyeColor::BROWN))); + count = random.nextInt(4) + 2; + for (int i = 0; i < count; ++i) { + int width = random.nextInt(3) + 2; + int start = random.nextInt(64); + for (int j = 0; j < width && start + j < 64; ++j) + m_clayBands[start + j] = clay; + } + clay = LegacyBlockData(159, Blocks::STAINED_HARDENED_CLAY->convertBlockStateToLegacyData( + Blocks::STAINED_HARDENED_CLAY->defaultBlockState()->setValue( + ColoredBlock::COLOR, DyeColor::RED))); + count = random.nextInt(4) + 2; + for (int i = 0; i < count; ++i) { + int width = random.nextInt(3) + 1; + int start = random.nextInt(64); + for (int j = 0; j < width && start + j < 64; ++j) + m_clayBands[start + j] = clay; + } + clay = LegacyBlockData(159, Blocks::STAINED_HARDENED_CLAY->convertBlockStateToLegacyData( + Blocks::STAINED_HARDENED_CLAY->defaultBlockState()->setValue( + ColoredBlock::COLOR, DyeColor::SILVER))); + LegacyBlockData white(159, Blocks::STAINED_HARDENED_CLAY->convertBlockStateToLegacyData( + Blocks::STAINED_HARDENED_CLAY->defaultBlockState()->setValue( + ColoredBlock::COLOR, DyeColor::WHITE))); + count = random.nextInt(3) + 3; + int start = 0; + for (int i = 0; i < count; ++i) { + start += random.nextInt(16) + 4; + if (start < 64) { + m_clayBands[start] = white; + if (start > 1 && random.nextBoolean()) + m_clayBands[start - 1] = clay; + if (start < 63 && random.nextBoolean()) + m_clayBands[start + 1] = clay; + } + } +} + +// name guessed +Biome::LegacyBlockData MesaBiome::getBand(int x, int y, int) { + // The Switch implementation samples X for both noise coordinates. + int offset = static_cast(Mth::round(m_clayBandsOffsetNoise->getValue(x / 512.0, x / 512.0) * 2.0)); + return m_clayBands[(y + offset + 64) % 64]; +} + +// name guessed +// NON_MATCHING | score: 18722 (lower is better) +void MesaBiome::buildSurfaceAt(Level* level, Random& random, ChunkPrimer* primer, int x, int z, + double noise) { + PIXBeginNamedEvent(0.0f, "MesaBiome::buildSurfaceAtDefault"); + if (!m_clayBands || m_seed != level->getSeed()) + generateBands(level->getSeed()); + if (!m_pillarNoise || !m_pillarRoofNoise || m_seed != level->getSeed()) { + // The original uses the previous cached seed and retains this heap Random. + Random* noiseRandom = new Random(m_seed); + m_pillarNoise = new PerlinSimplexNoise(noiseRandom, 4); + m_pillarRoofNoise = new PerlinSimplexNoise(noiseRandom, 1); + } + m_seed = level->getSeed(); + int pillarHeight = 0; + if (m_bryce) { + int pillarX = (x & ~15) | (z & 15); + int pillarZ = (z & ~15) | (x & 15); + double pillar = std::fabs(noise); + double sample = m_pillarNoise->getValue(pillarX * 0.25, pillarZ * 0.25); + if (sample < pillar) + pillar = sample; + if (pillar > 0.0) { + double roof = std::fabs(m_pillarRoofNoise->getValue(pillarX / 512.0, pillarZ / 512.0)); + double height = pillar * pillar * 2.5; + double limit = std::ceil(roof * 50.0) + 14.0; + if (height > limit) + height = limit; + pillarHeight = static_cast(height + 64.0); + } + } + int localX = x & 15; + int localZ = z & 15; + LegacyBlockData filler = m_dirt; + int depth = static_cast(noise / 3.0 + 3.0 + random.nextDouble() * 0.25); + bool hardened = std::cos(noise / 3.0 * Mth::PI) > 0.0; + int remaining = -1; + bool redSand = false; + int stoneCount = 0; + for (int y = 127; y >= 0; --y) { + int index = (localZ << 11) | (localX << 7) | y; + const BlockState* state = primer->getState(localZ, y, localX); + Material* material = state->getBlock()->getMaterial(); + if (y < pillarHeight && material == Material::AIR) + primer->setBlockAndData(index, STONE.m_id, STONE.m_data); + if (y <= random.nextInt(2) + 1) { + primer->setBlockAndData(index, BEDROCK.m_id, BEDROCK.m_data); + } else if (stoneCount < 15 || m_bryce) { + state = primer->getState(localZ, y, localX); + if (state->getBlock()->getMaterial() == Material::AIR) { + remaining = -1; + } else if (state->getBlock() == Blocks::STONE) { + if (remaining == -1) { + if (depth < 1) + filler = STONE; + else if (y >= 59 && y <= 64) + filler = m_dirt; + remaining = depth + (y > 63 ? y - 63 : 0); + redSand = false; + if (y >= 62) { + if (m_forest && y > 86 + depth * 2) { + const LegacyBlockData& surface = hardened ? COARSE_DIRT : GRASS; + primer->setBlockAndData(index, surface.m_id, surface.m_data); + } else if (y > 66 + depth) { + LegacyBlockData surface; + if (y >= 64 && y <= 127) + surface = hardened ? HARDENED_CLAY : getBand(x, y, z); + else + surface = ORANGE_CLAY; + primer->setBlockAndData(index, surface.m_id, surface.m_data); + } else { + primer->setBlockAndData(index, m_grass.m_id, m_grass.m_data); + redSand = true; + } + } else { + primer->setBlockAndData(index, filler.m_id, filler.m_data); + if (filler.m_id == 159) { + primer->setBlockAndData(index, ORANGE_CLAY.m_id, ORANGE_CLAY.m_data); + filler.m_id = 159; + } + } + } else if (remaining > 0) { + --remaining; + LegacyBlockData band = redSand ? ORANGE_CLAY : getBand(x, y, z); + primer->setBlockAndData(index, band.m_id, band.m_data); + } + ++stoneCount; + } + } + } + PIXEndNamedEvent(); +} 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..b5d4efe3 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,44 @@ #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: + // name guessed + 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/MushroomIslandBiome.cpp new file mode 100644 index 00000000..275e93ec --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/MushroomIslandBiome.cpp @@ -0,0 +1,28 @@ +#include "net/minecraft/world/level/biome/MushroomIslandBiome.h" + +#include "net/minecraft/world/eINSTANCEOF.h" +#include "net/minecraft/world/level/biome/BiomeDecorator.h" +#include "net/minecraft/world/level/block/Block.h" +#include "net/minecraft/world/level/block/Blocks.h" + +// name guessed +MushroomIslandBiome::MushroomIslandBiome(EBiomeIDs id, BiomeProperties* properties) : Biome(id, properties) { + m_biomeDecorator->m_treeCount = -100; + m_biomeDecorator->m_flowerCount = -100; + m_biomeDecorator->m_grassCount = -100; + m_biomeDecorator->m_mushroomCount = 1; + m_biomeDecorator->m_hugeMushroomCount = 1; + m_grass = LegacyBlockData( + 110, Blocks::MYCELIUM->convertBlockStateToLegacyData(Blocks::MYCELIUM->defaultBlockState())); + m_hostileMobs.clear(); + m_passiveMobs.clear(); + m_chickens.clear(); + m_fieldD8.clear(); + m_aquaticMobs.clear(); + m_fieldF0.push_back(new MobSpawnerData(eMushroomCow, 8, 4, 8)); +} + +// name guessed +int MushroomIslandBiome::getBaseClass() { + return _MUSHROOM_ISLAND; +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/MutatedForestBiome.cpp new file mode 100644 index 00000000..f7d179b7 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/MutatedForestBiome.cpp @@ -0,0 +1,15 @@ +#include "net/minecraft/world/level/biome/MutatedForestBiome.h" + +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/levelgen/feature/BirchFeature.h" + +// name guessed +MutatedForestBiome::MutatedForestBiome(EBiomeIDs id, BiomeProperties* properties) + : ForestBiome(id, BIRCH, properties) {} + +// name guessed +Feature* MutatedForestBiome::getTreeFeature(Random& random) { + if (random.nextBoolean()) + return new BirchFeature(false, true); + return new BirchFeature(false, false); +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/MutatedSavannaBiome.cpp new file mode 100644 index 00000000..1eafd0e6 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/MutatedSavannaBiome.cpp @@ -0,0 +1,34 @@ +#include "net/minecraft/world/level/biome/MutatedSavannaBiome.h" + +#include "net/minecraft/world/level/biome/BiomeDecorator.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/DirtBlock.h" + +// name guessed +MutatedSavannaBiome::MutatedSavannaBiome(EBiomeIDs id, BiomeProperties* properties) + : SavannaBiome(id, properties) { + m_biomeDecorator->m_treeCount = 2; + m_biomeDecorator->m_flowerCount = 2; + m_biomeDecorator->m_grassCount = 5; +} + +// name guessed +void MutatedSavannaBiome::buildSurfaceAt(Level* level, Random& random, ChunkPrimer* primer, int x, int z, + double noise) { + m_grass = LegacyBlockData(2, 0); + m_dirt = LegacyBlockData(3, 0); + if (noise > 1.75) { + m_grass = STONE; + m_dirt = STONE; + } else if (noise > -0.5) { + m_grass = LegacyBlockData( + 3, Blocks::DIRT->convertBlockStateToLegacyData(Blocks::DIRT->defaultBlockState()->setValue( + DirtBlock::VARIANT, DirtBlock::Variant::COARSE))); + } + buildSurfaceAtDefault(level, random, primer, x, z, noise); +} + +// name guessed +void MutatedSavannaBiome::decorate(Level* level, Random& random, const BlockPos& pos) { + m_biomeDecorator->decorate(level, random, this, pos); +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/OceanBiome.cpp new file mode 100644 index 00000000..a8646a00 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/OceanBiome.cpp @@ -0,0 +1,18 @@ +#include "net/minecraft/world/level/biome/OceanBiome.h" + +// name guessed +OceanBiome::OceanBiome(EBiomeIDs id, BiomeProperties* properties) : Biome(id, properties) { + m_passiveMobs.clear(); + m_chickens.clear(); + m_fieldD8.clear(); +} + +// name guessed +int OceanBiome::getBaseClass() { + return _OCEAN; +} + +// name guessed +int OceanBiome::getTemperatureCategory() { + return 0; +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/PlainsBiome.cpp new file mode 100644 index 00000000..648d732c --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/PlainsBiome.cpp @@ -0,0 +1,92 @@ +#include "net/minecraft/world/level/biome/PlainsBiome.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/eINSTANCEOF.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/biome/BiomeDecorator.h" +#include "net/minecraft/world/level/levelgen/feature/BigTreeFeature.h" +#include "net/minecraft/world/level/levelgen/feature/DoublePlantFeature.h" +#include "net/minecraft/world/level/levelgen/feature/TreeFeature.h" +#include "net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.h" + +// name guessed +PlainsBiome::PlainsBiome(EBiomeIDs id, bool sunflowers, BiomeProperties* properties) + : Biome(id, properties), m_sunflowers(sunflowers) { + m_passiveMobs.push_back(new MobSpawnerData(eHorse, 5, 2, 6)); + m_passiveMobs.push_back(new MobSpawnerData(eDonkey, 1, 1, 3)); + m_biomeDecorator->m_treeCount = 0; + m_biomeDecorator->m_extraTreeChance = 0.05f; + m_biomeDecorator->m_flowerCount = 4; + m_biomeDecorator->m_grassCount = 10; +} + +// name guessed +int PlainsBiome::getBaseClass() { + return _PLAINS; +} + +// name guessed +Feature* PlainsBiome::getTreeFeature(Random& random) { + if (random.nextInt(3) == 0) + return new BigTreeFeature(false); + return new TreeFeature(false); +} + +// name guessed +// NON_MATCHING | score: 205 (lower is better) +FlowerBlock::Flower* PlainsBiome::getRandomFlower(Random& random, const BlockPos* pos) { + double noise = BIOME_INFO_NOISE->getValue(pos->getX() / 200.0, pos->getZ() / 200.0); + if (noise < -0.8) { + switch (random.nextInt(4)) { + case 0: + return FlowerBlock::Flower::ORANGE_TULIP; // name guessed + case 1: + return FlowerBlock::Flower::RED_TULIP; + case 2: + return FlowerBlock::Flower::PINK_TULIP; // name guessed + default: + return FlowerBlock::Flower::WHITE_TULIP; + } + } + if (random.nextInt(3) > 0) { + int type = random.nextInt(3); + if (type == 0) + return FlowerBlock::Flower::RED_FLOWER; + if (type == 1) + return FlowerBlock::Flower::HOUSTONIA; // name guessed + return FlowerBlock::Flower::OXEYE_DAISY; + } + return FlowerBlock::Flower::YELLOW_FLOWER; +} + +// name guessed +void PlainsBiome::decorate(Level* level, Random& random, const BlockPos& pos) { + double noise = BIOME_INFO_NOISE->getValue((pos.getX() + 8) / 200.0, (pos.getZ() + 8) / 200.0); + if (noise < -0.8) { + m_biomeDecorator->m_flowerCount = 15; + m_biomeDecorator->m_grassCount = 5; + } else { + m_biomeDecorator->m_flowerCount = 4; + m_biomeDecorator->m_grassCount = 10; + DOUBLE_PLANT_FEATURE->setNextPlantType(DoublePlantBlock::Variant::GRASS); + for (int i = 0; i < 7; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(pos.offset(x, 0, z)).getY(); + int y = random.nextInt(height + 32); + DOUBLE_PLANT_FEATURE->place(level, random, pos.offset(x, y, z)); + } + } + if (m_sunflowers) { + DOUBLE_PLANT_FEATURE->setNextPlantType(DoublePlantBlock::Variant::SUNFLOWER); + for (int i = 0; i < 10; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(pos.offset(x, 0, z)).getY(); + int y = random.nextInt(height + 32); + DOUBLE_PLANT_FEATURE->place(level, random, pos.offset(x, y, z)); + } + } + Biome::decorate(level, random, pos); +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/RiverBiome.cpp new file mode 100644 index 00000000..b5c13eff --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/RiverBiome.cpp @@ -0,0 +1,13 @@ +#include "net/minecraft/world/level/biome/RiverBiome.h" + +// name guessed +RiverBiome::RiverBiome(EBiomeIDs id, BiomeProperties* properties) : Biome(id, properties) { + m_passiveMobs.clear(); + m_chickens.clear(); + m_fieldD8.clear(); +} + +// name guessed +int RiverBiome::getBaseClass() { + return _RIVER; +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/SavannaBiome.cpp new file mode 100644 index 00000000..42339b3f --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/SavannaBiome.cpp @@ -0,0 +1,46 @@ +#include "net/minecraft/world/level/biome/SavannaBiome.h" + +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/eINSTANCEOF.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/biome/BiomeDecorator.h" +#include "net/minecraft/world/level/levelgen/feature/DoublePlantFeature.h" +#include "net/minecraft/world/level/levelgen/feature/SavannaTreeFeature.h" +#include "net/minecraft/world/level/levelgen/feature/TreeFeature.h" + +// name guessed +SavannaBiome::SavannaBiome(EBiomeIDs id, BiomeProperties* properties) : Biome(id, properties) { + m_passiveMobs.push_back(new MobSpawnerData(eHorse, 1, 2, 6)); + m_passiveMobs.push_back(new MobSpawnerData(eDonkey, 1, 1, 1)); + if (getDepth() > 1.1f) + m_passiveMobs.push_back(new MobSpawnerData(eLlama, 8, 4, 4)); + m_biomeDecorator->m_treeCount = 1; + m_biomeDecorator->m_flowerCount = 4; + m_biomeDecorator->m_grassCount = 20; +} + +// name guessed +int SavannaBiome::getBaseClass() { + return _SAVANNA; +} + +// name guessed +Feature* SavannaBiome::getTreeFeature(Random& random) { + if (random.nextInt(5) > 0) + return new SavannaTreeFeature(false); + return new TreeFeature(false); +} + +// name guessed +void SavannaBiome::decorate(Level* level, Random& random, const BlockPos& pos) { + DOUBLE_PLANT_FEATURE->setNextPlantType(DoublePlantBlock::Variant::GRASS); + for (int i = 0; i < 7; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(pos.offset(x, 0, z)).getY(); + int y = random.nextInt(height + 32); + DOUBLE_PLANT_FEATURE->place(level, random, pos.offset(x, y, z)); + } + Biome::decorate(level, random, pos); +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/StoneBeachBiome.cpp new file mode 100644 index 00000000..04344921 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/StoneBeachBiome.cpp @@ -0,0 +1,23 @@ +#include "net/minecraft/world/level/biome/StoneBeachBiome.h" + +#include "net/minecraft/world/level/biome/BiomeDecorator.h" +#include "net/minecraft/world/level/block/Block.h" +#include "net/minecraft/world/level/block/Blocks.h" + +// name guessed +StoneBeachBiome::StoneBeachBiome(EBiomeIDs id, BiomeProperties* properties) : Biome(id, properties) { + m_passiveMobs.clear(); + m_grass = LegacyBlockData( + 1, Blocks::STONE->convertBlockStateToLegacyData(Blocks::STONE->defaultBlockState())); + m_dirt = LegacyBlockData( + 1, Blocks::STONE->convertBlockStateToLegacyData(Blocks::STONE->defaultBlockState())); + m_biomeDecorator->m_treeCount = -999; + m_biomeDecorator->m_deadBushCount = 0; + m_biomeDecorator->m_reedCount = 0; + m_biomeDecorator->m_cactusCount = 0; +} + +// name guessed +int StoneBeachBiome::getBaseClass() { + return _STONE_BEACH; +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/SwampBiome.cpp new file mode 100644 index 00000000..b6c1abed --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/SwampBiome.cpp @@ -0,0 +1,95 @@ +#include "net/minecraft/world/level/biome/SwampBiome.h" + +#include "NX/Platform.h" +#include "net/minecraft/client/Minecraft.h" +#include "net/minecraft/client/color/ColourTable.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/eINSTANCEOF.h" +#include "net/minecraft/world/level/biome/BiomeDecorator.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" +#include "net/minecraft/world/level/levelgen/feature/FossilFeature.h" +#include "net/minecraft/world/level/levelgen/feature/SwampTreeFeature.h" +#include "net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.h" +#include "net/minecraft/world/level/material/Material.h" + +// name guessed +SwampBiome::SwampBiome(EBiomeIDs id, BiomeProperties* properties) : Biome(id, properties) { + m_biomeDecorator->m_treeCount = 2; + m_biomeDecorator->m_flowerCount = 1; + m_biomeDecorator->m_deadBushCount = 1; + m_biomeDecorator->m_mushroomCount = 8; + m_biomeDecorator->m_reedCount = 10; + m_biomeDecorator->m_clayCount = 1; + m_biomeDecorator->m_waterlilyCount = 4; + m_biomeDecorator->m_sandCount = 0; + m_biomeDecorator->m_gravelPatchCount = 0; + m_biomeDecorator->m_grassCount = 5; + m_neutralMobs.push_back(new MobSpawnerData(eSlime, 1, 1, 1)); +} + +// name guessed +int SwampBiome::getBaseClass() { + return _SWAMP; +} + +// name guessed +Feature* SwampBiome::getTreeFeature(Random&) { + return new SwampTreeFeature(); +} + +// name guessed +FlowerBlock::Flower* SwampBiome::getRandomFlower(Random&, const BlockPos*) { + return FlowerBlock::Flower::BLUE_ORCHID; +} + +// name guessed +unsigned int SwampBiome::getGrassColor(const BlockPos* pos) { + double noise = BIOME_INFO_NOISE->getValue(pos->getX() * 0.0225, pos->getZ() * 0.0225); + return Minecraft::GetInstance()->getColourTable()->getColour(noise < -0.1 ? Grass_Swamp1 : Grass_Swamp2); +} + +// name guessed +unsigned int SwampBiome::getFoliageColor(const BlockPos*) { + return Minecraft::GetInstance()->getColourTable()->getColour(Foliage_Swampland); +} + +// name guessed +void SwampBiome::decorate(Level* level, Random& random, const BlockPos& pos) { + Biome::decorate(level, random, pos); + if (random.nextInt(64) == 0) { + FossilFeature fossil{}; + fossil.place(level, random, pos); + } +} + +// name guessed +// NON_MATCHING | score: 455 (lower is better) +void SwampBiome::buildSurfaceAt(Level* level, Random& random, ChunkPrimer* primer, int x, int z, + double noise) { + PIXBeginNamedEvent(0.0f, "SwampBiome::buildSurfaceAtDefault"); + double swampNoise = BIOME_INFO_NOISE->getValue(x * 0.25, z * 0.25); + if (swampNoise > 0.0) { + int localX = x & 15; + int localZ = z & 15; + unsigned int y = 128; + do { + unsigned int currentY = y - 1; + Block* block = primer->getState(localZ, currentY, localX)->getBlock(); + if (block->getMaterial() != Material::AIR) { + if (y == 63 && block != Blocks::WATER) { + int packedPos = (localZ << 11) | (localX << 7) | currentY; + primer->setBlockAndData(packedPos, WATER.m_id, WATER.m_data); + if (swampNoise < 0.12) + primer->setBlockAndData(packedPos + 1, WATERLILY.m_id, WATERLILY.m_data); + } + break; + } + y = currentY; + } while (static_cast(y) > 0); + } + buildSurfaceAtDefault(level, random, primer, x, z, noise); + PIXEndNamedEvent(); +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/TaigaBiome.cpp new file mode 100644 index 00000000..e08c28f3 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/TaigaBiome.cpp @@ -0,0 +1,101 @@ +#include "net/minecraft/world/level/biome/TaigaBiome.h" + +#include "NX/Platform.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/eINSTANCEOF.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/biome/BiomeDecorator.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/DirtBlock.h" +#include "net/minecraft/world/level/levelgen/feature/BlockBlobFeature.h" +#include "net/minecraft/world/level/levelgen/feature/DoublePlantFeature.h" +#include "net/minecraft/world/level/levelgen/feature/MegaPineTreeFeature.h" +#include "net/minecraft/world/level/levelgen/feature/PineFeature.h" +#include "net/minecraft/world/level/levelgen/feature/SpruceFeature.h" +#include "net/minecraft/world/level/levelgen/feature/TallgrassFeature.h" + +// name guessed +TaigaBiome::TaigaBiome(EBiomeIDs id, EType type, BiomeProperties* properties) + : Biome(id, properties), m_type(type) { + m_fieldD8.push_back(new MobSpawnerData(eWolf, 8, 4, 4)); + m_passiveMobs.push_back(new MobSpawnerData(eRabbit, 4, 2, 3)); + m_biomeDecorator->m_treeCount = 10; + if (type == MEGA || type == MEGA_SPRUCE) { + m_biomeDecorator->m_grassCount = 7; + m_biomeDecorator->m_deadBushCount = 1; + m_biomeDecorator->m_mushroomCount = 3; + } else { + m_biomeDecorator->m_grassCount = 1; + m_biomeDecorator->m_mushroomCount = 1; + } +} + +// name guessed +int TaigaBiome::getBaseClass() { + return _TAIGA; +} + +// name guessed +Feature* TaigaBiome::getTreeFeature(Random& random) { + if ((m_type == MEGA || m_type == MEGA_SPRUCE) && random.nextInt(3) == 0) { + if (m_type == MEGA_SPRUCE || random.nextInt(13) == 0) + return new MegaPineTreeFeature(false, true); + return new MegaPineTreeFeature(false, false); + } + if (random.nextInt(3) == 0) + return new PineFeature(); + return new SpruceFeature(false); +} + +// name guessed +Feature* TaigaBiome::getGrassFeature(Random& random) { + if (random.nextInt(5) > 0) + return new TallgrassFeature(TallGrassBlock::Variant::FERN); + return new TallgrassFeature(TallGrassBlock::Variant::GRASS); +} + +// name guessed +void TaigaBiome::decorate(Level* level, Random& random, const BlockPos& pos) { + if (m_type == MEGA || m_type == MEGA_SPRUCE) { + int count = random.nextInt(3); + for (int i = 0; i < count; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + BlockPos candidate = level->getHeightmapPos(pos.offset(x, 0, z)); + BlockBlobFeature blob(Blocks::MOSSY_COBBLESTONE, 0); + blob.place(level, random, candidate); + } + } + + DOUBLE_PLANT_FEATURE->setNextPlantType(DoublePlantBlock::Variant::FERN); + for (int i = 0; i < 7; ++i) { + int x = random.nextInt(16) + 8; + int z = random.nextInt(16) + 8; + int height = level->getHeightmapPos(pos.offset(x, 0, z)).getY(); + int y = random.nextInt(height + 32); + DOUBLE_PLANT_FEATURE->place(level, random, pos.offset(x, y, z)); + } + Biome::decorate(level, random, pos); +} + +// name guessed +void TaigaBiome::buildSurfaceAt(Level* level, Random& random, ChunkPrimer* primer, int x, int z, + double noise) { + PIXBeginNamedEvent(0.0f, "TaigaBiome::buildSurfaceAtDefault"); + if (m_type == MEGA || m_type == MEGA_SPRUCE) { + m_grass = LegacyBlockData(2, 0); + m_dirt = LegacyBlockData(3, 0); + if (noise > 1.75) { + m_grass = LegacyBlockData( + 3, Blocks::DIRT->convertBlockStateToLegacyData(Blocks::DIRT->defaultBlockState()->setValue( + DirtBlock::VARIANT, DirtBlock::Variant::COARSE))); + } else if (noise > -0.95) { + m_grass = LegacyBlockData( + 3, Blocks::DIRT->convertBlockStateToLegacyData(Blocks::DIRT->defaultBlockState()->setValue( + DirtBlock::VARIANT, DirtBlock::Variant::PODZOL))); + } + } + buildSurfaceAtDefault(level, random, primer, x, z, noise); + PIXEndNamedEvent(); +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/TheEndBiome.cpp new file mode 100644 index 00000000..d06fca7f --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/TheEndBiome.cpp @@ -0,0 +1,116 @@ +#include "net/minecraft/world/level/biome/TheEndBiome.h" + +#include + +#include "net/minecraft/client/Minecraft.h" +#include "net/minecraft/client/color/ColourTable.h" +#include "net/minecraft/util/Mth.h" +#include "net/minecraft/world/eINSTANCEOF.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/biome/BiomeDecorator.h" +#include "net/minecraft/world/level/block/Block.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/dimension/EndDragonFight.h" +#include "net/minecraft/world/level/dimension/TheEndDimension.h" +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "net/minecraft/world/level/levelgen/feature/SpikeFeature.h" + +class EndPodiumFeature : public Feature { +public: + EndPodiumFeature(bool active); + bool place(Level*, Random&, const BlockPos&) override; + +private: + bool m_active; +}; + +class TheEndBiomeDecorator : public BiomeDecorator { +public: + TheEndBiomeDecorator(); + ~TheEndBiomeDecorator() override; + void decorate(Biome*, Level*, Random&) override; + static const int SPIKES[8][7]; + +private: + SpikeFeature* m_spike; + Feature* m_podium; +}; + +inline TheEndBiomeDecorator::~TheEndBiomeDecorator() = default; + +// name guessed +TheEndBiomeDecorator::TheEndBiomeDecorator() { + m_spike = new SpikeFeature; + m_podium = new EndPodiumFeature(false); +} + +/** Chunk origins, centers, radii, height offsets and guarded flags from the Switch table. + */ +const int TheEndBiomeDecorator::SPIKES[8][7] + = {{32, -16, 40, 0, 2, 12, 0}, {16, 16, 28, 28, 2, 15, 0}, {-16, 32, 0, 40, 2, 18, 0}, + {-32, 16, -28, 28, 3, 21, 0}, {-48, -16, -40, 0, 3, 24, 0}, {-32, -32, -28, -28, 3, 27, 0}, + {-16, -48, 0, -40, 4, 30, 1}, {16, -32, 28, -28, 4, 33, 1}}; + +extern BlockPos endTerrainSpawn; + +// name guessed +void TheEndBiomeDecorator::decorate(Biome*, Level* level, Random& random) { + decorateOres(level, random); + for (unsigned long i = 0; i < 8; ++i) { + if (m_origin.getX() == SPIKES[i][0] && m_origin.getZ() == SPIKES[i][1]) { + m_spike->setSpike(new SpikeFeature::EndSpike(SPIKES[i][2], SPIKES[i][3], SPIKES[i][4], + SPIKES[i][5] + endTerrainSpawn.getY(), + i == 6 || i == 7)); + m_spike->place(level, random, BlockPos(SPIKES[i][2], endTerrainSpawn.getY(), SPIKES[i][3])); + } + } + if (m_origin.getX() == 0 && m_origin.getZ() == 0) { + if (TheEndDimension* dimension = dynamic_cast(level->m_dimension)) + dimension->getDragonFight()->createNewDragon(); + } +} + +// name guessed +TheEndBiome::TheEndBiome(EBiomeIDs id, BiomeProperties* properties) : Biome(id, properties) { + m_hostileMobs.clear(); + m_passiveMobs.clear(); + m_chickens.clear(); + m_fieldD8.clear(); + m_aquaticMobs.clear(); + m_ambientMobs.clear(); + m_hostileMobs.push_back(new MobSpawnerData(eEnderMan, 10, 4, 4)); + m_grass + = LegacyBlockData(3, Blocks::DIRT->convertBlockStateToLegacyData(Blocks::DIRT->defaultBlockState())); + m_dirt + = LegacyBlockData(3, Blocks::DIRT->convertBlockStateToLegacyData(Blocks::DIRT->defaultBlockState())); + m_biomeDecorator = new TheEndBiomeDecorator; +} + +// name guessed +int TheEndBiome::getBaseClass() { + return _THE_END; +} +// name guessed +bool TheEndBiome::isNatural() { + return false; +} + +// name guessed +unsigned int TheEndBiome::getSkyColor(float) { + return Minecraft::GetInstance()->getColourTable()->getColour(Sky_Sky); +} + +// name guessed +Vec3* TheEndBiome::getFogColor(float timeOfDay, float) const { + int color = Minecraft::GetInstance()->getColourTable()->getColour(End_Fog_Colour); + float cosine = Mth::cos(timeOfDay * 3.1415927f * 2.0f); + float factor = std::min(std::max(cosine + cosine + 0.5f, 0.0f), 1.0f); + float red = (color >> 16 & 255) / 255.0f; + float green = (color >> 8 & 255) / 255.0f; + float blue = (color & 255) / 255.0f; + factor = factor * 0.0f + 0.15f; + red *= factor; + green *= factor; + blue *= factor; + return Vec3::newTemp(red, green, blue); +} 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.cpp b/src/Minecraft.World/net/minecraft/world/level/biome/VoidBiome.cpp new file mode 100644 index 00000000..8f10eb31 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/biome/VoidBiome.cpp @@ -0,0 +1,56 @@ +#include "net/minecraft/world/level/biome/VoidBiome.h" + +#include "net/minecraft/core/MutableBlockPos.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/biome/BiomeDecorator.h" +#include "net/minecraft/world/level/block/Block.h" +#include "net/minecraft/world/level/block/Blocks.h" + +class VoidBiomeDecorator : public BiomeDecorator { +public: + // name guessed + VoidBiomeDecorator() = default; + void decorate(Level*, Random&, Biome*, const BlockPos&) override; +}; + +// name guessed +VoidBiome::VoidBiome(EBiomeIDs id, BiomeProperties* properties) : Biome(id, properties) { + m_hostileMobs.clear(); + m_neutralMobs.clear(); + m_passiveMobs.clear(); + m_chickens.clear(); + m_aquaticMobs.clear(); + m_ambientMobs.clear(); + delete m_biomeDecorator; + m_biomeDecorator = new VoidBiomeDecorator(); +} + +// name guessed +int VoidBiome::getBaseClass() { + return _VOID; +} +// name guessed +bool VoidBiome::isAlwaysValidSpawn() { + return true; +} + +// name guessed +void VoidBiomeDecorator::decorate(Level* level, Random&, Biome*, const BlockPos& pos) { + BlockPos spawn = level->getSharedSpawnPos(); + if (spawn.distSqr(pos.offset(8, spawn.getY(), 8)) > 1024.0) + return; + BlockPos lower(spawn.getX() - 16, spawn.getY() - 1, spawn.getZ() - 16); + BlockPos upper(spawn.getX() + 16, spawn.getY() - 1, spawn.getZ() + 16); + MutableBlockPos candidate(spawn.getX() - 16, spawn.getY() - 1, spawn.getZ() - 16); + for (int z = pos.getZ(); z < pos.getZ() + 16; ++z) { + for (int x = pos.getX(); x < pos.getX() + 16; ++x) { + if (z >= lower.getZ() && z <= upper.getZ() && x >= lower.getX() && x <= upper.getX()) { + candidate.set(x, candidate.getY(), z); + if (x == spawn.getX() && spawn.getZ() == z) + level->setBlock(candidate, Blocks::COBBLESTONE->defaultBlockState(), 2, false); + else + level->setBlock(candidate, Blocks::STONE->defaultBlockState(), 2, false); + } + } + } +} 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..65cc4c6d 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: 60185 (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/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/properties/AbstractProperty.h b/src/Minecraft.World/net/minecraft/world/level/block/state/properties/AbstractProperty.h index 29adffb1..2eef33a3 100644 --- a/src/Minecraft.World/net/minecraft/world/level/block/state/properties/AbstractProperty.h +++ b/src/Minecraft.World/net/minecraft/world/level/block/state/properties/AbstractProperty.h @@ -20,6 +20,7 @@ class Predicate { template class Predicates { public: + static Predicate* equalTo(T value) { return new EqualToValuePredicate(value); } // TODO: impl those, and check if those below are correctly declared class ConnectivePredicate : public Predicate { bool apply(T) const override; @@ -46,7 +47,13 @@ class Predicates { bool m_constValue; // I guess it's bool, could be union; if you find possiblity of it, do it }; class EqualToValuePredicate : public Predicate { - bool apply(T) const override; + public: + EqualToValuePredicate(T value) : m_value(value) {} + + bool apply(T value) const override { return m_value == value; } + + private: + T m_value; }; }; @@ -110,7 +117,10 @@ class AbstractProperty : public Property { return this->m_name == otherCasted->m_name; } // TODO: this is wrong as hell btw !!!!! - int hashCode() const override { return 31 * (size_t)this->m_typeInfo + javaStringHashCode(this->m_name); } + int hashCode() const override { + return 31 * static_cast(reinterpret_cast(this->m_typeInfo)) + + static_cast(javaStringHashCode(this->m_name)); + } virtual T getUnboxedValue(const std::wstring&) const = 0; virtual std::wstring getName(const T&) const = 0; diff --git a/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkGenerator.h b/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkGenerator.h index f259aed9..3d27b537 100644 --- a/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkGenerator.h +++ b/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkGenerator.h @@ -17,13 +17,14 @@ class ChunkGenerator { static const std::wstring VILLAGE_NAME; static const std::wstring MINESHAFT_NAME; static const std::wstring TEMPLE_NAME; + static const std::wstring END_CITY_NAME; ChunkGenerator() {} virtual ~ChunkGenerator(); virtual LevelChunk* createChunk(int, int) = 0; virtual void postProcess(int, int) = 0; virtual bool postProcessLoadedChunk(LevelChunk*, int, int) = 0; - virtual std::vector* getMobsAt(MobCategory*, const BlockPos&) = 0; + virtual std::vector* getMobsAt(MobCategory*, const BlockPos&) = 0; virtual BlockPos* findNearestMapFeature(Level*, const std::wstring&, const BlockPos&, bool) = 0; virtual void recreateLogicStructuresForChunk(LevelChunk*, int, int) = 0; virtual bool isPosInFeature(Level*, const std::wstring&, const BlockPos&) = 0; diff --git a/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkSource.h b/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkSource.h index f6f520af..9c71b77a 100644 --- a/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkSource.h +++ b/src/Minecraft.World/net/minecraft/world/level/chunk/ChunkSource.h @@ -32,7 +32,7 @@ class ChunkSource { virtual bool shouldSave() = 0; virtual ChunkSource* getCache(); virtual void dataReceived(int, int); - virtual std::vector* getMobsAt(MobCategory*, const BlockPos&) = 0; + virtual std::vector* getMobsAt(MobCategory*, const BlockPos&) = 0; virtual void findNearestMapFeature(Level*, const std::wstring&, const BlockPos&, bool) = 0; virtual int getLoadedChunks() = 0; virtual void recreateLogicStructuresForChunk(LevelChunk*, int, int) = 0; diff --git a/src/Minecraft.World/net/minecraft/world/level/chunk/LevelChunk.h b/src/Minecraft.World/net/minecraft/world/level/chunk/LevelChunk.h index af6b2f10..cfcdab2b 100644 --- a/src/Minecraft.World/net/minecraft/world/level/chunk/LevelChunk.h +++ b/src/Minecraft.World/net/minecraft/world/level/chunk/LevelChunk.h @@ -33,6 +33,7 @@ class LevelChunk { static bool touchedSky; // Name from b1.2_02 LevelChunk(Level*, ChunkPrimer*, int, int); + void setCheckAllLight(); enum EntityCreationType {}; diff --git a/src/Minecraft.World/net/minecraft/world/level/dimension/EndDragonFight.h b/src/Minecraft.World/net/minecraft/world/level/dimension/EndDragonFight.h new file mode 100644 index 00000000..045b836a --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/dimension/EndDragonFight.h @@ -0,0 +1,6 @@ +#pragma once + +class EndDragonFight { +public: + void createNewDragon(); +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/dimension/TheEndDimension.cpp b/src/Minecraft.World/net/minecraft/world/level/dimension/TheEndDimension.cpp new file mode 100644 index 00000000..250b7f95 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/dimension/TheEndDimension.cpp @@ -0,0 +1,6 @@ +#include "net/minecraft/world/level/dimension/TheEndDimension.h" + +// name guessed +EndDragonFight* TheEndDimension::getDragonFight() { + return m_dragonFight; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/dimension/TheEndDimension.h b/src/Minecraft.World/net/minecraft/world/level/dimension/TheEndDimension.h index ce3ec3bf..9c20166c 100644 --- a/src/Minecraft.World/net/minecraft/world/level/dimension/TheEndDimension.h +++ b/src/Minecraft.World/net/minecraft/world/level/dimension/TheEndDimension.h @@ -2,6 +2,12 @@ #include "net/minecraft/world/level/dimension/Dimension.h" +class EndDragonFight; + class TheEndDimension : public Dimension { public: + EndDragonFight* getDragonFight(); + +private: + EndDragonFight* m_dragonFight; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/FlatGeneratorInfo.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/FlatGeneratorInfo.h new file mode 100644 index 00000000..7219848f --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/FlatGeneratorInfo.h @@ -0,0 +1,41 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/FlatLayerInfo.h" +#include + +class SuperflatConfig; +class LargeCaveFeature; +class CanyonFeature; +class StructureFeature; +class OceanMonumentFeature; +class LakeFeature; + +class FlatGeneratorInfo { +public: + FlatGeneratorInfo(SuperflatConfig*); + ~FlatGeneratorInfo(); + LargeCaveFeature* getCaves(); + CanyonFeature* getCanyons(); + bool hasVillage(); + StructureFeature* getVillage(int); + bool hasBiomeSpecific(); + StructureFeature* getBiomeSpecific(); + bool hasMineshaft(); + StructureFeature* getMineshaft(); + bool hasStronghold(); + StructureFeature* getStronghold(); + bool hasOceanMonument(); + OceanMonumentFeature* getOceanMonument(); + bool hasWoodlandMansion(); + bool hasDecorations(); + bool hasDungeons(); + LakeFeature* getLakes(); + LakeFeature* getLavaLakes(); + void getLayers(const BlockState**); + void getLayers(std::vector&); + +private: + char m_storage[0x20]; +}; + +static_assert(sizeof(FlatGeneratorInfo) == 0x20, "FlatGeneratorInfo ABI"); diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/FlatLayerInfo.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/FlatLayerInfo.h new file mode 100644 index 00000000..2654ea61 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/FlatLayerInfo.h @@ -0,0 +1,18 @@ +#pragma once + +class BlockState; + +class FlatLayerInfo { +public: + int getStart() const; + int getHeight() const; + const BlockState* getBlockState() const; + +private: + char m_field0[8]; + const BlockState* m_blockState; + int m_start; + int m_height; +}; + +static_assert(sizeof(FlatLayerInfo) == 0x18, "FlatLayerInfo ABI"); diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/FlatLevelSource.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/FlatLevelSource.cpp new file mode 100644 index 00000000..ded8918f --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/FlatLevelSource.cpp @@ -0,0 +1,230 @@ +#include "net/minecraft/world/level/levelgen/FlatLevelSource.h" + +#include "NX/Platform.h" +#include "net/minecraft/client/CMinecraftApp.h" +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/entity/MobCategory.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/biome/BiomeSource.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/chunk/ChunkPos.h" +#include "net/minecraft/world/level/chunk/LevelChunk.h" +#include "net/minecraft/world/level/levelgen/ChunkPrimer.h" +#include "net/minecraft/world/level/levelgen/FlatGeneratorInfo.h" +#include "net/minecraft/world/level/levelgen/feature/CanyonFeature.h" +#include "net/minecraft/world/level/levelgen/feature/LakeFeature.h" +#include "net/minecraft/world/level/levelgen/feature/LargeCaveFeature.h" +#include "net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.h" +#include "net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.h" +#include "net/minecraft/world/level/levelgen/feature/VillageFeature.h" +#include "net/minecraft/world/level/levelgen/feature/WoodlandMansionFeature.h" +#include "net/minecraft/world/level/storage/LevelData.h" +#include +#include + +// NON_MATCHING | score: 6910 (lower is better) +FlatLevelSource::FlatLevelSource(Level* level, long long seed, bool structures, SuperflatConfig* config) { + m_monument = nullptr; + m_size = level->getLevelData()->getXZSize(); + m_level = level; + m_random = Random(seed); + m_decorationRandom = Random(seed); + FlatGeneratorInfo settings(config); + m_caves = nullptr; + m_canyons = nullptr; + if (structures) { + m_caves = settings.getCaves(); + m_canyons = settings.getCanyons(); + if (settings.hasVillage()) + m_structures[VILLAGE_NAME] = settings.getVillage(m_size); + if (settings.hasBiomeSpecific()) + m_structures[TEMPLE_NAME] = settings.getBiomeSpecific(); + if (settings.hasMineshaft()) + m_structures[MINESHAFT_NAME] = settings.getMineshaft(); + if (settings.hasStronghold()) + m_structures[STRONGHOLD_NAME] = settings.getStronghold(); + if (settings.hasOceanMonument()) { + m_monument = settings.getOceanMonument(); + m_structures[MONUMENT_NAME] = m_monument; + } + if (settings.hasWoodlandMansion()) + m_structures[MANSION_NAME] = new WoodlandMansionFeature(this, config); + } + m_decorations = settings.hasDecorations(); + m_dungeons = settings.hasDungeons(); + m_lakes = settings.getLakes(); + m_lavaLakes = settings.getLavaLakes(); + memset(m_layers, 0, sizeof(m_layers)); + settings.getLayers(m_layers); + std::vector layers; + settings.getLayers(layers); + int seaLevel = 0; + int air = 0; + for (FlatLayerInfo layer : layers) { + Block* block; + int y = layer.getHeight() - 1; + do { + int end = layer.getHeight() + layer.getStart(); + block = layer.getBlockState()->getBlock(); + ++y; + if (y >= end) + break; + } while (true); + air += layer.getStart(); + if (block != Blocks::AIR) { + seaLevel += air; + air = 0; + } + } + level->setSeaLevel(seaLevel); + m_blockIds = arrayWithLength(0x10000, true); + m_blockData = arrayWithLength(0x8000, true); + ChunkPrimer primer(false, m_blockIds, m_blockData); + for (int y = 0; y < 128; ++y) { + if (m_layers[y]) { + for (int x = 0; x < 16; ++x) { + for (int z = 0; z < 16; ++z) + primer.setState(x, y, z, m_layers[y]); + } + } + } +} + +FlatLevelSource::~FlatLevelSource() { + delete m_caves; + delete m_canyons; + for (auto& structure : m_structures) + delete structure.second; + delete m_lakes; + delete m_lavaLakes; + delete[] m_blockIds.m_data; + delete[] m_blockData.m_data; +} + +// name guessed +void FlatLevelSource::prepareHeights(int, int, ChunkPrimer* primer) { + memcpy(primer->getBlockIds().m_data, m_blockIds.m_data, m_blockIds.m_length); + memcpy(primer->getBlockData().m_data, m_blockData.m_data, m_blockData.m_length); +} + +// name guessed +bool FlatLevelSource::isFlat() { + return true; +} + +LevelChunk* FlatLevelSource::createChunk(int x, int z) { + arrayWithLength ids( + static_cast(XPhysicalAlloc(m_blockIds.m_length, -1, 0x1000, 4)), m_blockIds.m_length); + XMemCpy(ids.m_data, m_blockIds.m_data, m_blockIds.m_length); + arrayWithLength data( + static_cast(XPhysicalAlloc(m_blockData.m_length, -1, 0x1000, 4)), + m_blockData.m_length); + XMemCpy(data.m_data, m_blockData.m_data, m_blockData.m_length); + ChunkPrimer primer(false, ids, data); + if (m_caves) + m_caves->apply(m_level, x, z, &primer); + if (m_canyons) + m_canyons->apply(m_level, x, z, &primer); + for (auto& structure : m_structures) + structure.second->apply(m_level, x, z, &primer); + LevelChunk* chunk = new LevelChunk(m_level, &primer, x, z); + XPhysicalFree(ids.m_data); + XPhysicalFree(data.m_data); + arrayWithLength biomes; + m_level->getBiomeSource()->getBiomeBlock(biomes, x << 4, z << 4, 16, 16, true); + arrayWithLength chunkBiomes = chunk->getBiomes(); + for (unsigned int i = 0; i < chunkBiomes.m_length; ++i) + chunkBiomes[i] = biomes.get(i)->m_biomeId; + delete[] biomes.m_data; + chunk->recalcHeightmap(); + return chunk; +} + +// NON_MATCHING | score: 1725 (lower is better) +void FlatLevelSource::postProcess(int x, int z) { + BlockPos origin(x * 16, 0, z * 16); + Biome* biome = m_level->getBiome(BlockPos(x * 16 + 16, 0, z * 16 + 16)); + m_decorationRandom.setSeed(m_level->getSeed()); + long long seedX = m_decorationRandom.nextLong() / 2 * 2 + 1; + long long seedZ = m_decorationRandom.nextLong() / 2 * 2 + 1; + m_decorationRandom.setSeed((x * seedX + z * seedZ) ^ m_level->getSeed()); + ChunkPos chunkPos(x, z); + bool village = false; + for (auto& entry : m_structures) { + bool placed = entry.second->postProcess(m_level, m_decorationRandom, &chunkPos); + if (dynamic_cast(entry.second)) { + bool allowed = std::find(VillageFeature::ALLOWED_BIOMES.begin(), + VillageFeature::ALLOWED_BIOMES.end(), biome) + != VillageFeature::ALLOWED_BIOMES.end(); + village |= placed && allowed; + } + } + if (!village && m_lakes && m_decorationRandom.nextInt(4) == 0) { + int px = m_decorationRandom.nextInt(16) + 8; + int py = m_decorationRandom.nextInt(128); + int pz = m_decorationRandom.nextInt(16) + 8; + m_lakes->place(m_level, m_decorationRandom, origin.offset(px, py, pz)); + } + if (!village && m_lavaLakes && m_random.nextInt(8) == 0) { + int px = m_decorationRandom.nextInt(16) + 8; + int py = m_decorationRandom.nextInt(m_decorationRandom.nextInt(120) + 8); + int pz = m_decorationRandom.nextInt(16) + 8; + BlockPos pos = origin.offset(px, py, pz); + if (pos.getY() < m_level->getSeaLevel() || m_decorationRandom.nextInt(10) == 0) + m_lavaLakes->place(m_level, m_decorationRandom, pos); + } + if (m_dungeons) { + for (int i = 0; i < 8; ++i) { + MonsterRoomFeature dungeon; + int px = m_decorationRandom.nextInt(16) + 8; + int py = m_decorationRandom.nextInt(128); + int pz = m_decorationRandom.nextInt(16) + 8; + dungeon.place(m_level, m_decorationRandom, origin.offset(px, py, pz)); + } + } + if (m_decorations) + biome->decorate(m_level, m_decorationRandom, origin); + CConsoleMinecraftApp::sInstance.processSchematics(m_level->getChunk(x, z)); +} + +bool FlatLevelSource::postProcessLoadedChunk(LevelChunk*, int, int) { + return false; +} + +std::vector* FlatLevelSource::getMobsAt(MobCategory* category, const BlockPos& pos) { + Biome* biome = m_level->getBiome(pos); + if (m_monument && category == MobCategory::GUARDIAN && m_monument->isInsideBoundingFeature(m_level, pos)) + return m_monument->getEnemies(); + return biome->getMobs(category); +} + +// NON_MATCHING | score: 590 (lower is better) +BlockPos* FlatLevelSource::findNearestMapFeature(Level* level, const std::wstring& name, const BlockPos& pos, + bool unexplored) { + if (STRONGHOLD_NAME.compare(name) == 0 && m_structures.find(name) != m_structures.end()) + return m_structures.find(name)->second->getNearestGeneratedFeature(level, pos, unexplored); + if (STRONGHOLD_NAME == name && m_structures.find(STRONGHOLD_NAME) != m_structures.end()) + return m_structures.find(STRONGHOLD_NAME)->second->getNearestGeneratedFeature(level, pos, unexplored); + if (MANSION_NAME == name && m_structures.find(MANSION_NAME) != m_structures.end()) + return m_structures.find(MANSION_NAME)->second->getNearestGeneratedFeature(level, pos, unexplored); + if (MONUMENT_NAME == name && m_structures.find(MONUMENT_NAME) != m_structures.end()) + return m_structures.find(MONUMENT_NAME)->second->getNearestGeneratedFeature(level, pos, unexplored); + if (VILLAGE_NAME == name && m_structures.find(VILLAGE_NAME) != m_structures.end()) + return m_structures.find(VILLAGE_NAME)->second->getNearestGeneratedFeature(level, pos, unexplored); + if (MINESHAFT_NAME == name && m_structures.find(MINESHAFT_NAME) != m_structures.end()) + return m_structures.find(MINESHAFT_NAME)->second->getNearestGeneratedFeature(level, pos, unexplored); + if (TEMPLE_NAME == name && m_structures.find(TEMPLE_NAME) != m_structures.end()) + return m_structures.find(TEMPLE_NAME)->second->getNearestGeneratedFeature(level, pos, unexplored); + return nullptr; +} + +bool FlatLevelSource::isPosInFeature(Level*, const std::wstring& name, const BlockPos& pos) { + auto found = m_structures.find(name); + return found != m_structures.end() && found->second->isInsideFeature(pos); +} + +void FlatLevelSource::recreateLogicStructuresForChunk(LevelChunk*, int x, int z) { + for (auto& entry : m_structures) + entry.second->apply(m_level, x, z, nullptr); +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/FlatLevelSource.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/FlatLevelSource.h new file mode 100644 index 00000000..8af388a8 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/FlatLevelSource.h @@ -0,0 +1,49 @@ +#pragma once + +#include "net/minecraft/world/ArrayWithLength.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/chunk/ChunkGenerator.h" +#include "net/minecraft/world/level/levelgen/GenericOverworldLevelSource.h" +#include "types.h" +#include + +class SuperflatConfig; +class BlockState; +class LargeCaveFeature; +class CanyonFeature; +class StructureFeature; +class OceanMonumentFeature; +class LakeFeature; + +class FlatLevelSource : public ChunkGenerator, public GenericOverworldLevelSource { +public: + FlatLevelSource(Level*, long long, bool, SuperflatConfig*); + ~FlatLevelSource() override; + LevelChunk* createChunk(int, int) override; + void postProcess(int, int) override; + bool postProcessLoadedChunk(LevelChunk*, int, int) 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; + void prepareHeights(int, int, ChunkPrimer*) override; + bool isFlat() override; + +private: + Level* m_level; + Random m_random; + Random m_decorationRandom; + const BlockState* m_layers[256]; + std::unordered_map m_structures; + LargeCaveFeature* m_caves; + CanyonFeature* m_canyons; + bool m_decorations; + bool m_dungeons; + LakeFeature* m_lakes; + LakeFeature* m_lavaLakes; + OceanMonumentFeature* m_monument; + arrayWithLength m_blockIds; + arrayWithLength m_blockData; +}; + +ASSERT_SIZEOF(FlatLevelSource, 0x8c8) 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/NetherLevelSource.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherLevelSource.cpp new file mode 100644 index 00000000..faff61c5 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherLevelSource.cpp @@ -0,0 +1,414 @@ +#include "net/minecraft/world/level/levelgen/NetherLevelSource.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/entity/MobCategory.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/chunk/LevelChunk.h" +#include "net/minecraft/world/level/levelgen/ChunkPrimer.h" +#include "net/minecraft/world/level/levelgen/feature/BushFeature.h" +#include "net/minecraft/world/level/levelgen/feature/HellFireFeature.h" +#include "net/minecraft/world/level/levelgen/feature/HellPortalFeature.h" +#include "net/minecraft/world/level/levelgen/feature/HellSpringFeature.h" +#include "net/minecraft/world/level/levelgen/feature/LargeHellCaveFeature.h" +#include "net/minecraft/world/level/levelgen/feature/LightGemFeature.h" +#include "net/minecraft/world/level/levelgen/feature/NetherBridgeFeature.h" +#include "net/minecraft/world/level/levelgen/feature/OreFeature.h" +#include "net/minecraft/world/level/levelgen/synth/PerlinNoise.h" +#include "net/minecraft/world/level/material/Material.h" +#include "net/minecraft/world/level/storage/LevelData.h" +#include + +class FjNetherrackBlockPred : public Predicate { +public: + bool apply(const Biome::LegacyBlockData&) const override; + ~FjNetherrackBlockPred() override; +}; + +// name guessed +// NON_MATCHING | score: 1525 (lower is better) +bool FjNetherrackBlockPred::apply(const Biome::LegacyBlockData& block) const { + static int id = Block::getId(Blocks::NETHERRACK); + return block.m_id == id; +} +// name guessed +// NON_MATCHING | score: 200 (lower is better) +FjNetherrackBlockPred::~FjNetherrackBlockPred() {} +const std::wstring NetherLevelSource::FORTRESS_NAME = L"Fortress"; // name guessed +const FjNetherrackBlockPred NetherLevelSource::NETHERRACK_PREDICATE; + +NetherLevelSource::NetherLevelSource(Level* level, bool generateStructures, long long seed) { + int size = level->getLevelData()->getXZSize(); + int hellScale = level->getLevelData()->getHellScale(); + m_size = static_cast(std::ceil(static_cast(size) / hellScale)); + m_level = level; + m_generateStructures = generateStructures; + m_random = Random(seed); + m_populationRandom = Random(seed); + m_minLimitNoise = new PerlinNoise(&m_random, 16); + m_maxLimitNoise = new PerlinNoise(&m_random, 16); + m_mainNoise = new PerlinNoise(&m_random, 8); + m_soulSandNoise = new PerlinNoise(&m_random, 4); + m_surfaceNoise = new PerlinNoise(&m_random, 4); + m_scaleNoise = new PerlinNoise(&m_random, 10); + m_depthNoise = new PerlinNoise(&m_random, 16); + level->setSeaLevel(63); + m_fire = new HellFireFeature(); + m_glowstone = new LightGemFeature(); + m_portal = new HellPortalFeature(); + m_quartz = new OreFeature(Blocks::QUARTZ_ORE->defaultBlockState(), 14, &NETHERRACK_PREDICATE); + m_magma = new OreFeature(Blocks::MAGMA->defaultBlockState(), 33, &NETHERRACK_PREDICATE); + m_enclosedLava = new HellSpringFeature(Blocks::FLOWING_LAVA, true); + m_openLava = new HellSpringFeature(Blocks::FLOWING_LAVA, false); + m_brownMushroom = new BushFeature(static_cast(Blocks::BROWN_MUSHROOM)); + m_redMushroom = new BushFeature(static_cast(Blocks::RED_MUSHROOM)); + m_fortress = new NetherBridgeFeature(); + m_caves = new LargeHellCaveFeature(); +} + +NetherLevelSource::~NetherLevelSource() { + delete m_minLimitNoise; + delete m_maxLimitNoise; + delete m_mainNoise; + delete m_soulSandNoise; + delete m_surfaceNoise; + delete m_scaleNoise; + delete m_depthNoise; + delete m_fire; + delete m_glowstone; + delete m_portal; + delete m_quartz; + delete m_magma; + delete m_enclosedLava; + delete m_openLava; + delete m_brownMushroom; + delete m_redMushroom; + delete m_fortress; + delete m_caves; +} + +// name guessed +arrayWithLength NetherLevelSource::getHeights(arrayWithLength output, int x, int y, int z, + int sizeX, int sizeY, int sizeZ) { + if (!output.m_data) + output = arrayWithLength(sizeX * sizeY * sizeZ, true); + arrayWithLength main, lower, upper, scale, depth, unused1, unused2; + scale = m_scaleNoise->getRegion(scale, x, y, z, sizeX, 1, sizeZ, 1.0, 0.0, 1.0); + depth = m_depthNoise->getRegion(depth, x, y, z, sizeX, 1, sizeZ, 100.0, 0.0, 100.0); + main = m_mainNoise->getRegion(main, x, y, z, sizeX, sizeY, sizeZ, 684.412 / 80.0, 2053.236 / 60.0, + 684.412 / 80.0); + lower = m_minLimitNoise->getRegion(lower, x, y, z, sizeX, sizeY, sizeZ, 684.412, 2053.236, 684.412); + upper = m_maxLimitNoise->getRegion(upper, x, y, z, sizeX, sizeY, sizeZ, 684.412, 2053.236, 684.412); + arrayWithLength falloff(sizeY, true); + for (int i = 0; i < sizeY; ++i) { + falloff[i] = std::cos(static_cast(i * Mth::PI * 6.0f) / sizeY) * 2.0; + int edge = i; + if (i > sizeY / 2) + edge = sizeY - 1 - i; + if (edge < 4) { + double distance = 4.0 - edge; + falloff[i] -= distance * distance * distance * 10.0; + } + } + int index = 0; + for (int dx = 0; dx < sizeX; ++dx) { + for (int dz = 0; dz < sizeZ; ++dz) { + for (int dy = 0; dy < sizeY; ++dy) { + double vertical = falloff[dy]; + double min = lower[index] / 512.0; + double max = upper[index] / 512.0; + double blend = (main[index] / 10.0 + 1.0) * 0.5; + double value; + if (blend < 0.0) + value = min; + else if (blend > 1.0) + value = max; + else + value = min + (max - min) * blend; + value -= vertical; + if (dy > sizeY - 4) { + double fade = static_cast(dy - (sizeY - 4)) / 3.0f; + value = value * (1.0 - fade) + -10.0 * fade; + } + output[index++] = value; + } + } + } + delete[] main.m_data; + delete[] lower.m_data; + delete[] upper.m_data; + delete[] scale.m_data; + delete[] depth.m_data; + delete[] unused1.m_data; + delete[] unused2.m_data; + delete[] falloff.m_data; + return output; +} + +// NON_MATCHING | score: 4375 (lower is better) +void NetherLevelSource::prepareHeights(int chunkX, int chunkZ, ChunkPrimer* primer) { + int lavaHeight = m_level->getSeaLevel() / 2; + arrayWithLength density; + density = getHeights(density, chunkX * 4, 0, chunkZ * 4, 5, 17, 5); + for (int x = 0; x < 4; ++x) { + for (int z = 0; z < 4; ++z) { + for (int y = 0; y < 16; ++y) { + int a = (x * 5 + z) * 17 + y; + int b = (x * 5 + z + 1) * 17 + y; + int c = ((x + 1) * 5 + z) * 17 + y; + int d = ((x + 1) * 5 + z + 1) * 17 + y; + double aa = density[a], bb = density[b], cc = density[c], dd = density[d]; + double da = (density[a + 1] - aa) * 0.125; + double db = (density[b + 1] - bb) * 0.125; + double dc = (density[c + 1] - cc) * 0.125; + double de = (density[d + 1] - dd) * 0.125; + for (int dy = 0; dy < 8; ++dy) { + double stepA = (cc - aa) * 0.25; + double stepB = (dd - bb) * 0.25; + double atA = aa, atB = bb; + for (int dx = 0; dx < 4; ++dx) { + double step = (atB - atA) * 0.25; + double value = atA; + for (int dz = 0; dz < 4; ++dz) { + const BlockState* state = nullptr; + if (y * 8 + dy <= lavaHeight) + state = Blocks::LAVA->defaultBlockState(); + if (value > 0.0) + state = Blocks::NETHERRACK->defaultBlockState(); + primer->setState(x * 4 + dx, y * 8 + dy, z * 4 + dz, state); + value += step; + } + atA += stepA; + atB += stepB; + } + aa += da; + bb += db; + cc += dc; + dd += de; + } + } + } + } + delete[] density.m_data; +} + +// NON_MATCHING | score: 2790 (lower is better) +void NetherLevelSource::buildSurfaces(int chunkX, int chunkZ, ChunkPrimer* primer) { + int seaLevel = m_level->getSeaLevel(); + arrayWithLength soul(256, true), gravel(256, true), thickness(256, true); + soul = m_soulSandNoise->getRegion(soul, chunkX * 16, chunkZ * 16, 0, 16, 16, 1, 0.03125, 0.03125, 1.0); + gravel + = m_soulSandNoise->getRegion(gravel, chunkX * 16, 109, chunkZ * 16, 16, 1, 16, 0.03125, 1.0, 0.03125); + thickness = m_surfaceNoise->getRegion(thickness, chunkX * 16, chunkZ * 16, 0, 16, 16, 1, 0.0625, 0.0625, + 0.0625); + for (int x = 0; x < 16; ++x) { + for (int z = 0; z < 16; ++z) { + bool soulSand = soul[x + z * 16] + m_random.nextDouble() * 0.2 > 0.0; + bool gravelPatch = gravel[x + z * 16] + m_random.nextDouble() * 0.2 > 0.0; + int depth = static_cast(thickness[x + z * 16] / 3.0 + 3.0 + m_random.nextDouble() * 0.25); + const BlockState* top = Blocks::NETHERRACK->defaultBlockState(); + const BlockState* filler = Blocks::NETHERRACK->defaultBlockState(); + int remaining = -1; + for (int y = 127; y >= 0; --y) { + int index = (x * 16 + z) * 128 + y; + bool wall = false; + if (chunkX <= -m_size / 2 && (x <= m_random.nextInt(4) || chunkX < -m_size / 2)) { + primer->setState(index, Blocks::BEDROCK->defaultBlockState()); + wall = true; + } + if (chunkZ <= -m_size / 2 && (z <= m_random.nextInt(4) || chunkZ < -m_size / 2)) { + primer->setState(index, Blocks::BEDROCK->defaultBlockState()); + wall = true; + } + if (chunkX >= m_size / 2 - 1 && (x + m_random.nextInt(4) >= 15 || chunkX > m_size / 2)) { + primer->setState(index, Blocks::BEDROCK->defaultBlockState()); + wall = true; + } + if (chunkZ >= m_size / 2 - 1 && (z + m_random.nextInt(4) >= 15 || chunkZ > m_size / 2)) { + primer->setState(index, Blocks::BEDROCK->defaultBlockState()); + } else if (!wall) { + if (y >= 127 - m_random.nextInt(5) || y <= m_random.nextInt(5)) { + primer->setState(index, Blocks::BEDROCK->defaultBlockState()); + continue; + } + const BlockState* state = primer->getState(index); + if (!state->getBlock() || state->getBlock()->getMaterial() == Material::AIR) { + remaining = -1; + } else if (state->getBlock() == Blocks::NETHERRACK) { + if (remaining == -1) { + if (depth < 1) { + top = Blocks::AIR->defaultBlockState(); + filler = Blocks::NETHERRACK->defaultBlockState(); + } else if (y >= seaLevel - 3 && y <= seaLevel + 2) { + top = Blocks::NETHERRACK->defaultBlockState(); + filler = Blocks::NETHERRACK->defaultBlockState(); + if (gravelPatch) { + top = Blocks::GRAVEL->defaultBlockState(); + filler = Blocks::NETHERRACK->defaultBlockState(); + } + if (soulSand) { + top = Blocks::SOUL_SAND->defaultBlockState(); + filler = Blocks::SOUL_SAND->defaultBlockState(); + if (m_random.nextInt(16) == 0) { + int above = (x * 16 + z) * 128 + (y + 1 < 127 ? y + 1 : 127); + if (primer->getState(above)->getBlock() != Blocks::BEDROCK) + primer->setState(above, Blocks::NETHER_WART->defaultBlockState()); + } + } + } + if (y <= seaLevel && (!top || top->getMaterial() == Material::AIR)) + top = Blocks::LAVA->defaultBlockState(); + remaining = depth; + const BlockState* surface = !soulSand && y < seaLevel ? filler : top; + if (primer->getState(index)->getBlock() != Blocks::BEDROCK) + primer->setState(index, surface); + } else if (remaining > 0) { + --remaining; + if (primer->getState(z, y, x)->getBlock() != Blocks::BEDROCK) + primer->setState(z, y, x, filler); + } + } + } + } + } + } + delete[] soul.m_data; + delete[] gravel.m_data; + delete[] thickness.m_data; +} + +LevelChunk* NetherLevelSource::createChunk(int x, int z) { + m_random.setSeed(341873128712LL * x + 132897987541LL * z); + void* ids = XPhysicalAlloc(0x8000, -1LL, 0x1000, 4); + XMemSet128(ids, 0, 0x8000); + arrayWithLength blockIds(static_cast(ids), 0x8000); + void* data = XPhysicalAlloc(0x4000, -1LL, 0x1000, 4); + XMemSet128(data, 0, 0x4000); + arrayWithLength blockData(static_cast(data), 0x4000); + ChunkPrimer primer(false, blockIds, blockData); + prepareHeights(x, z, &primer); + buildSurfaces(x, z, &primer); + m_caves->apply(m_level, x, z, &primer); + if (m_generateStructures) + m_fortress->apply(m_level, x, z, &primer); + LevelChunk* chunk = new LevelChunk(m_level, &primer, x, z); + chunk->setCheckAllLight(); + XPhysicalFree(ids); + XPhysicalFree(data); + return chunk; +} + +void NetherLevelSource::lightChunk(LevelChunk* chunk) { + chunk->recalcHeightmap(); +} + +// NON_MATCHING | score: 9195 (lower is better) +void NetherLevelSource::postProcess(int x, int z) { + inPostProcessStep = true; + BlockPos origin(x * 16, 0, z * 16); + Biome* biome = m_level->getBiome(origin.offset(16, 0, 16)); + ChunkPos chunk(x, z); + m_populationRandom.setSeed(m_level->getSeed()); + long long a = m_populationRandom.nextLong() / 2 * 2 + 1; + long long b = m_populationRandom.nextLong() / 2 * 2 + 1; + // Both original multipliers use Z; retain that Switch population behavior. + m_populationRandom.setSeed( + (static_cast(z) * a + static_cast(z) * b) + ^ m_level->getSeed()); + m_fortress->postProcess(m_level, m_populationRandom, &chunk); + for (int i = 0; i < 8; ++i) { + int dx = m_populationRandom.nextInt(16) + 8; + int dy = m_populationRandom.nextInt(120) + 4; + int dz = m_populationRandom.nextInt(16) + 8; + m_openLava->place(m_level, m_populationRandom, origin.offset(dx, dy, dz)); + } + for (int i = 0; i < m_populationRandom.nextInt(m_populationRandom.nextInt(10) + 1) + 1; ++i) { + int dx = m_populationRandom.nextInt(16) + 8; + int dy = m_populationRandom.nextInt(120) + 4; + int dz = m_populationRandom.nextInt(16) + 8; + m_fire->place(m_level, m_populationRandom, origin.offset(dx, dy, dz)); + } + for (int i = 0; i < m_populationRandom.nextInt(m_populationRandom.nextInt(10) + 1); ++i) { + int dx = m_populationRandom.nextInt(16) + 8; + int dy = m_populationRandom.nextInt(120) + 4; + int dz = m_populationRandom.nextInt(16) + 8; + m_glowstone->place(m_level, m_populationRandom, origin.offset(dx, dy, dz)); + } + for (int i = 0; i < 10; ++i) { + int dx = m_populationRandom.nextInt(16) + 8; + int dy = m_populationRandom.nextInt(128); + int dz = m_populationRandom.nextInt(16) + 8; + m_portal->place(m_level, m_populationRandom, origin.offset(dx, dy, dz)); + } + if (m_populationRandom.nextBoolean()) { + int dx = m_populationRandom.nextInt(16) + 8; + int dy = m_populationRandom.nextInt(128); + int dz = m_populationRandom.nextInt(16) + 8; + m_brownMushroom->place(m_level, m_populationRandom, origin.offset(dx, dy, dz)); + } + if (m_populationRandom.nextBoolean()) { + int dx = m_populationRandom.nextInt(16) + 8; + int dy = m_populationRandom.nextInt(128); + int dz = m_populationRandom.nextInt(16) + 8; + m_redMushroom->place(m_level, m_populationRandom, origin.offset(dx, dy, dz)); + } + for (int i = 0; i < 16; ++i) { + int dx = m_populationRandom.nextInt(16); + int dy = m_populationRandom.nextInt(108) + 10; + int dz = m_populationRandom.nextInt(16); + m_quartz->place(m_level, m_populationRandom, origin.offset(dx, dy, dz)); + } + int magmaHeight = m_level->getSeaLevel() / 2 - 4; + for (int i = 0; i < 4; ++i) { + int dx = m_populationRandom.nextInt(16); + int dy = magmaHeight + m_populationRandom.nextInt(10); + int dz = m_populationRandom.nextInt(16); + m_magma->place(m_level, m_populationRandom, origin.offset(dx, dy, dz)); + } + for (int i = 0; i < 16; ++i) { + int dx = m_populationRandom.nextInt(16); + int dy = m_populationRandom.nextInt(108) + 10; + int dz = m_populationRandom.nextInt(16); + m_enclosedLava->place(m_level, m_populationRandom, origin.offset(dx, dy, dz)); + } + biome->decorate(m_level, m_populationRandom, BlockPos(x * 16, 0, z * 16)); + inPostProcessStep = false; + CConsoleMinecraftApp::sInstance.processSchematics(m_level->getChunk(x, z)); +} + +bool NetherLevelSource::postProcessLoadedChunk(LevelChunk*, int, int) { + return false; +} + +std::vector* NetherLevelSource::getMobsAt(MobCategory* category, + const BlockPos& pos) { + if (category == MobCategory::MONSTER) { + if (m_fortress->isInsideFeature(pos)) + return m_fortress->getSpawnList(); + if (m_fortress->isInsideBoundingFeature(m_level, pos) + && m_level->getBlockState(pos.below())->getBlock() == Blocks::NETHER_BRICK) + return m_fortress->getSpawnList(); + } + return m_level->getBiome(pos)->getMobs(category); +} + +BlockPos* NetherLevelSource::findNearestMapFeature(Level* level, const std::wstring& name, + const BlockPos& pos, bool unexplored) { + if (FORTRESS_NAME == name && m_fortress) + return m_fortress->getNearestGeneratedFeature(level, pos, unexplored); + return nullptr; +} + +bool NetherLevelSource::isPosInFeature(Level*, const std::wstring& name, const BlockPos& pos) { + if (FORTRESS_NAME.compare(name) == 0 && m_fortress) + return m_fortress->isInsideFeature(pos); + return false; +} + +void NetherLevelSource::recreateLogicStructuresForChunk(LevelChunk*, int x, int z) { + m_fortress->apply(m_level, x, z, nullptr); +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherLevelSource.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherLevelSource.h new file mode 100644 index 00000000..f451622e --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/NetherLevelSource.h @@ -0,0 +1,59 @@ +#pragma once + +#include "net/minecraft/world/ArrayWithLength.h" +#include "net/minecraft/world/Random.h" +#include "net/minecraft/world/level/chunk/ChunkGenerator.h" +#include "types.h" + +class ChunkPrimer; +class PerlinNoise; +class Feature; +class NetherBridgeFeature; +class LargeHellCaveFeature; +class FjNetherrackBlockPred; + +class NetherLevelSource : public ChunkGenerator { +public: + static const std::wstring FORTRESS_NAME; + static const FjNetherrackBlockPred NETHERRACK_PREDICATE; + + NetherLevelSource(Level*, bool generateStructures, long long seed); + ~NetherLevelSource() override; + LevelChunk* createChunk(int, int) override; + void postProcess(int, int) override; + bool postProcessLoadedChunk(LevelChunk*, int, int) 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; + void lightChunk(LevelChunk*) override; + virtual arrayWithLength getHeights(arrayWithLength, int, int, int, int, int, int); + + void prepareHeights(int, int, ChunkPrimer*); + void buildSurfaces(int, int, ChunkPrimer*); + + Level* m_level; + bool m_generateStructures; + Random m_random; + Random m_populationRandom; + PerlinNoise* m_minLimitNoise; + PerlinNoise* m_maxLimitNoise; + PerlinNoise* m_mainNoise; + PerlinNoise* m_soulSandNoise; + PerlinNoise* m_surfaceNoise; + PerlinNoise* m_scaleNoise; + PerlinNoise* m_depthNoise; + Feature* m_fire; + Feature* m_glowstone; + Feature* m_portal; + Feature* m_quartz; + Feature* m_magma; + Feature* m_enclosedLava; + Feature* m_openLava; + Feature* m_brownMushroom; + Feature* m_redMushroom; + NetherBridgeFeature* m_fortress; + LargeHellCaveFeature* m_caves; +}; + +ASSERT_SIZEOF(NetherLevelSource, 0xe0) 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..630bb8d5 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.cpp @@ -1,5 +1,7 @@ #include "net/minecraft/world/level/levelgen/OverworldLevelSource.h" +#include + #include "NX/Platform.h" #include "net/minecraft/util/Mth.h" #include "net/minecraft/world/entity/MobCategory.h" @@ -128,7 +130,6 @@ float OverworldLevelSource::getHeightFalloff(int chunkX, int chunkZ, int* distan return result; } -// NON_MATCHING | Score: 1630 (lower is better) int OverworldLevelSource::distanceToEdge(float a, int, int x, int z, int size) { int halfSize = size / 2; @@ -150,18 +151,19 @@ int OverworldLevelSource::distanceToEdge(float a, int, int x, int z, int size) { if (inLeftBand || inRightBand) { Vec3* p = Vec3::newTemp(x, 0.0f, z); - Vec3* edgeStart = (x < 1) ? topLeft : topRight; - Vec3* edgeEnd = (x < 1) ? bottomLeft : bottomRight; - - distance = p->distanceToSegment(edgeStart, edgeEnd); + if (x >= 1) + distance = p->distanceToSegment(topRight, bottomRight); + else + distance = p->distanceToSegment(topLeft, bottomLeft); } if (((z > leftBound) && (z < rightBound)) || ((z > (maxCoord - a)) && (z < (maxCoord + a)))) { Vec3* p = Vec3::newTemp(x, 0.0f, z); - Vec3* edgeStart = (z < 1) ? topLeft : topRight; - Vec3* edgeEnd = (z < 1) ? bottomLeft : bottomRight; - - float verticalDistance = p->distanceToSegment(edgeStart, edgeEnd); + float verticalDistance; + if (z >= 1) + verticalDistance = p->distanceToSegment(bottomLeft, bottomRight); + else + verticalDistance = p->distanceToSegment(topLeft, topRight); if (verticalDistance < distance) { distance = verticalDistance; @@ -184,7 +186,7 @@ void OverworldLevelSource::buildSurfaces(int chunkX, int chunkZ, ChunkPrimer* pr for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { - Biome* biome = biomes[z + x * 16]; + Biome* biome = biomes.get(z + x * 16); { std::wstring biomeName = biome->getName(false); PIXBeginNamedEvent(0.0, "Building surface for biome %ls", biomeName.c_str()); @@ -322,11 +324,11 @@ void OverworldLevelSource::getHeights(int posX, int posY, int posZ, arrayWithLen float weightedScale = 0.0f; float weightedDepth = 0.0f; float totalWeight = 0.0f; - Biome* b = biomes[x + 2 + (z + 2) * 10]; + Biome* b = biomes.get(x + 2 + (z + 2) * 10); for (int xo = -2; xo <= 2; ++xo) { for (int zo = -2; zo <= 2; ++zo) { - Biome* b2 = biomes[x + xo + 2 + (z + zo + 2) * 10]; + Biome* b2 = biomes.get(x + xo + 2 + (z + zo + 2) * 10); float depth = m_sourceSettings->m_biomeDepthOffset + (b2->getDepth() * m_sourceSettings->m_biomeDepthWeight); @@ -540,7 +542,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 +565,25 @@ void OverworldLevelSource::prepareHeights(int chunkX, int chunkZ, ChunkPrimer* p PIXBeginNamedEvent(0.0, "Generating"); for (int subX = 0; subX < width; subX++) { + int leftColumn = subX * xSize; + int rightColumn = (subX + 1) * xSize; for (int subZ = 0; subZ < width; subZ++) { + int n00 = (subZ + leftColumn) * ySize; + int n10 = n00 + ySize; + int n01 = (subZ + rightColumn) * ySize; + int n11 = n01 + ySize; for (int subY = 0; subY < 16; subY++) { // + 0 is for padding so these look nicer - double h00 = heights[((subX + 0) * xSize + (subZ + 0)) * ySize + subY]; - double h10 = heights[((subX + 0) * xSize + (subZ + 1)) * ySize + subY]; - double h01 = heights[((subX + 1) * xSize + (subZ + 0)) * ySize + subY]; - double h11 = heights[((subX + 1) * xSize + (subZ + 1)) * ySize + subY]; + double h00 = heights[n00 + subY]; + double h10 = heights[n10 + subY]; + double h01 = heights[n01 + subY]; + double h11 = heights[n11 + subY]; // interpolation steps - double iy00 = (heights[((subX + 0) * xSize + (subZ + 0)) * ySize + subY + 1] - h00) * 0.125; - double iy10 = (heights[((subX + 0) * xSize + (subZ + 1)) * ySize + subY + 1] - h10) * 0.125; - double iy01 = (heights[((subX + 1) * xSize + (subZ + 0)) * ySize + subY + 1] - h01) * 0.125; - double iy11 = (heights[((subX + 1) * xSize + (subZ + 1)) * ySize + subY + 1] - h11) * 0.125; + double iy00 = (heights[n00 + subY + 1] - h00) * 0.125; + double iy10 = (heights[n10 + subY + 1] - h10) * 0.125; + double iy01 = (heights[n01 + subY + 1] - h01) * 0.125; + double iy11 = (heights[n11 + subY + 1] - h11) * 0.125; for (int ym = 0; ym < 8; ym++) { double heightAtXZ0 = h00; @@ -591,19 +599,20 @@ void OverworldLevelSource::prepareHeights(int chunkX, int chunkZ, ChunkPrimer* p int defaultId = (subY * height + ym < seaLevel) ? 9 : 0; - double _h = h00; + double _h = heightAtXZ0; double _hStep = (heightAtXZ1 - heightAtXZ0) * 0.25; _h -= _hStep; for (int zm = 0; zm < 4; zm++) { - int x = subX * width + xm; + int x = chunkX * 16 + subX * width + xm; int y = subY * height + ym; - int z = subZ * width + zm; + int z = chunkZ * 16 + subZ * width + zm; int blockId; int distance; // Falloff at the edge of the world, does not exist in Java Edition - if (getHeightFalloff(x, z, &distance) > (_h += _hStep)) { + float falloff = getHeightFalloff(x, z, &distance); + if ((_h += _hStep) > falloff) { blockId = 1; } else { blockId = defaultId; @@ -642,8 +651,8 @@ void OverworldLevelSource::prepareHeights(int chunkX, int chunkZ, ChunkPrimer* p delete[] biomes.m_data; } -std::vector* OverworldLevelSource::getMobsAt(MobCategory* category, - const BlockPos& pos) { +std::vector* OverworldLevelSource::getMobsAt(MobCategory* category, + const BlockPos& pos) { Biome* biome = m_level->getBiome(pos); if (m_shouldGenerateStructures) { @@ -687,30 +696,29 @@ void OverworldLevelSource::recreateLogicStructuresForChunk(LevelChunk* chunk, in } } -// NON_MATCHING | Score: 860- (lower is better) bool OverworldLevelSource::isPosInFeature(Level* level, const std::wstring& featureName, const BlockPos& pos) { if (!m_shouldGenerateStructures) { return false; } - if (ChunkGenerator::STRONGHOLD_NAME.compare(featureName) == 0) { - return m_strongholdFeature && m_strongholdFeature->isInsideFeature(pos); + if (ChunkGenerator::STRONGHOLD_NAME.compare(featureName) == 0 && m_strongholdFeature) { + return m_strongholdFeature->isInsideFeature(pos); } - if (ChunkGenerator::MANSION_NAME.compare(featureName) == 0) { - return m_woodlandMansionFeature && m_woodlandMansionFeature->isInsideFeature(pos); + if (ChunkGenerator::MANSION_NAME.compare(featureName) == 0 && m_woodlandMansionFeature) { + return m_woodlandMansionFeature->isInsideFeature(pos); } - if (ChunkGenerator::MONUMENT_NAME.compare(featureName) == 0) { - return m_oceanMonumentFeature && m_oceanMonumentFeature->isInsideFeature(pos); + if (ChunkGenerator::MONUMENT_NAME.compare(featureName) == 0 && m_oceanMonumentFeature) { + return m_oceanMonumentFeature->isInsideFeature(pos); } - if (ChunkGenerator::VILLAGE_NAME.compare(featureName) == 0) { - return m_villageFeature && m_villageFeature->isInsideFeature(pos); + if (ChunkGenerator::VILLAGE_NAME.compare(featureName) == 0 && m_villageFeature) { + return m_villageFeature->isInsideFeature(pos); } - if (ChunkGenerator::MINESHAFT_NAME.compare(featureName) == 0) { - return m_mineshaftFeature && m_mineshaftFeature->isInsideFeature(pos); + if (ChunkGenerator::MINESHAFT_NAME.compare(featureName) == 0 && m_mineshaftFeature) { + return m_mineshaftFeature->isInsideFeature(pos); } - if (ChunkGenerator::TEMPLE_NAME.compare(featureName) == 0) { - return m_randomScatteredLargeFeature && m_randomScatteredLargeFeature->isInsideFeature(pos); + if (ChunkGenerator::TEMPLE_NAME.compare(featureName) == 0 && m_randomScatteredLargeFeature) { + return m_randomScatteredLargeFeature->isInsideFeature(pos); } return false; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.h index 200aa253..0f46b7f5 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/OverworldLevelSource.h @@ -38,7 +38,7 @@ class OverworldLevelSource : public ChunkGenerator, public GenericOverworldLevel LevelChunk* createChunk(int, int) override; void postProcess(int, int) override; bool postProcessLoadedChunk(LevelChunk*, int, int) override; - std::vector* getMobsAt(MobCategory*, const BlockPos&) override; + std::vector* getMobsAt(MobCategory*, const BlockPos&) override; BlockPos* findNearestMapFeature(Level*, const std::wstring&, const BlockPos&, bool) override; void recreateLogicStructuresForChunk(LevelChunk*, int, int) override; bool isPosInFeature(Level*, const std::wstring&, const BlockPos&) override; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/TheEndLevelSource.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/TheEndLevelSource.cpp new file mode 100644 index 00000000..2d62a207 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/TheEndLevelSource.cpp @@ -0,0 +1,346 @@ +#include "net/minecraft/world/level/levelgen/TheEndLevelSource.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/biome/BiomeSource.h" +#include "net/minecraft/world/level/block/Blocks.h" +#include "net/minecraft/world/level/block/state/BlockState.h" +#include "net/minecraft/world/level/chunk/LevelChunk.h" +#include "net/minecraft/world/level/levelgen/ChunkPrimer.h" +#include "net/minecraft/world/level/levelgen/feature/EndCityFeature.h" +#include "net/minecraft/world/level/levelgen/feature/EndIslandFeature.h" +#include "net/minecraft/world/level/levelgen/synth/PerlinNoise.h" +#include "net/minecraft/world/level/levelgen/synth/SimplexNoise.h" +#include "net/minecraft/world/level/material/GasMaterial.h" +#include "net/minecraft/world/level/material/Material.h" +#include +#include + +// name guessed: shared End constants identified by their Switch addresses and uses. +extern int endIslandCenters[5][2]; +extern BlockPos endTerrainSpawn; +extern const std::wstring endCityFeatureName; +extern int endBiomeId(Biome*); +extern void endGenerateChorusPlant(Level*, BlockPos, Random*, int); + +// name guessed +int endIslandDistance(int x, int z, const int* center) { + int dx = std::abs(x - center[0]); + int dz = std::abs(z - center[1]); + return dx < dz ? dz : dx; +} + +// name guessed +const int* endNearestIsland(int x, int z) { + const int* nearest = endIslandCenters[0]; + unsigned distance = endIslandDistance(x, z, nearest); + for (int i = 1; i < 5; ++i) { + unsigned nextDistance = endIslandDistance(x, z, endIslandCenters[i]); + if (nextDistance < distance) { + distance = nextDistance; + nearest = endIslandCenters[i]; + } + } + return nearest; +} + +// name guessed +double endDistanceToSpawn(const Vec3i* pos, int x, int y, int z) { + double dx = pos->getX() - x; + double dy = pos->getY() - y; + double dz = pos->getZ() - z; + return std::sqrt(dx * dx + dy * dy + dz * dz); +} + +// NON_MATCHING | score: 100 (lower is better) +TheEndLevelSource::TheEndLevelSource(Level* level, bool generateStructures, long long seed, + const BlockPos& spawn) { + m_size = 268; + m_endCity = new EndCityFeature(this); + m_random = new Random(seed); + m_decorationRandom = new Random(seed); + m_minLimitNoise = new PerlinNoise(m_random, 16); + m_maxLimitNoise = new PerlinNoise(m_random, 16); + m_mainNoise = new PerlinNoise(m_random, 8); + m_scaleNoise = new PerlinNoise(m_random, 10); + m_depthNoise = new PerlinNoise(m_random, 16); + m_level = level; + m_generateStructures = generateStructures; + m_spawn = spawn; + m_islandNoise = new SimplexNoise(m_random); + m_islandFeature = new EndIslandFeature(); +} + +TheEndLevelSource::~TheEndLevelSource() { + delete m_endCity; + delete m_random; + delete m_decorationRandom; + delete m_minLimitNoise; + delete m_maxLimitNoise; + delete m_mainNoise; + delete m_scaleNoise; + delete m_depthNoise; + delete m_islandNoise; + delete m_islandFeature; +} + +bool TheEndLevelSource::fjIslandCheck(int x, int z) { + return fjIslandProximity(x, z) < 3.0; +} + +// name guessed +double TheEndLevelSource::fjIslandProximity(int x, int z) { + const int* island = endNearestIsland(x, z); + if (island == endIslandCenters[0]) + return 12.0; + double dx = (double)x + 0.5 - island[0]; + double dz = (double)z + 0.5 - island[1]; + dx = std::fabs(dx); + dz = std::fabs(dz); + return dx < dz ? dz : dx; +} + +// NON_MATCHING | score: 2358 (lower is better) +float TheEndLevelSource::getIslandHeightValue(int x, int z, int offsetX, int offsetZ) { + const int* island = endNearestIsland(x, z); + if (island == endIslandCenters[0]) { + float dx = (float)x + (float)x + (float)offsetX; + float dz = (float)z + (float)z + (float)offsetZ; + return std::sqrt(dx * dx + dz * dz) * -9.0f + 100.0f; + } + int dx = x * 2 + offsetX; + int dz = z * 2 + offsetZ; + float height = std::sqrt((float)(dx * dx + dz * dz)) * -8.0f + 100.0f; + if (height > 80.0f) + height = 80.0f; + if (height <= -100.0f) + height = -100.0f; + for (int ix = -4; ix <= 4; ++ix) { + for (int iz = -4; iz <= 4; ++iz) { + if (fjIslandCheck(x + ix, z + iz)) { + double ax = std::fabs((double)(x + ix)); + double az = std::fabs((double)(z + iz)); + int scale = (int)(ax * 3439.0 + az * 147.0) % 6 + 18; + int nx = offsetX - ix * 2; + int nz = offsetZ - iz * 2; + float candidate = 100.0f - std::sqrt((float)(nx * nx + nz * nz)) * (float)scale; + if (candidate > 80.0f) + candidate = 80.0f; + if (candidate <= -100.0f) + candidate = -100.0f; + if (candidate > height) + height = candidate; + } + } + } + return height; +} + +// name guessed +// NON_MATCHING | score: 3513 (lower is better) +arrayWithLength TheEndLevelSource::getHeights(arrayWithLength result, int x, int y, int z, + int width, int height, int depth) { + if (!result.m_data) + result = arrayWithLength(width * height * depth, true); + arrayWithLength main, low, high, scale, detail, unused1, unused2; + scale = m_scaleNoise->getRegion(scale, x, z, width, depth, 1.121, 1.121, 0.5); + detail = m_depthNoise->getRegion(detail, x, z, width, depth, 200.0, 200.0, 0.5); + main = m_mainNoise->getRegion(main, x, y, z, width, height, depth, 17.110300000000002, 4.277575000000001, + 17.110300000000002); + low = m_minLimitNoise->getRegion(low, x, y, z, width, height, depth, 1368.824, 684.412, 1368.824); + high = m_maxLimitNoise->getRegion(high, x, y, z, width, height, depth, 1368.824, 684.412, 1368.824); + unsigned index = 0; + for (int ix = 0; ix < width; ++ix) { + for (int iz = 0; iz < depth; ++iz) { + float island = getIslandHeightValue(x / 2, z / 2, ix, iz); + if (island > 80.0f) + island = 80.0f; + if (island <= -100.0f) + island = -100.0f; + for (int iy = 0; iy < height; ++iy, ++index) { + double a = low[index] / 512.0; + double b = high[index] / 512.0; + double blend = (main[index] / 10.0 + 1.0) * 0.5; + double density = a; + // Unordered comparisons take the interpolation branch in the Switch routine. + if (!(blend < 0.0)) { + density = b; + if (!(blend > 1.0)) + density = a + (b - a) * blend; + } + density = (double)island + (density - 8.0); + if (iy > height / 2 - 2) { + double falloff = Mth::clamp((double)((float)(iy - (height / 2 - 2)) / 64.0f), 0.0, 1.0); + density = density * (1.0 - falloff) + falloff * -3000.0; + } + if (iy < 8) { + double falloff = (double)((float)(8 - iy) / 7.0f); + density = (1.0 - falloff) * density + falloff * -30.0; + } + double distance + = endDistanceToSpawn(&endTerrainSpawn, (ix + x) * 8, (iy + y) * 4, (iz + z) * 8); + double spawnBlend = Mth::clamp((19.0 - distance) / 16.0, 0.0, 1.0); + double spawnDensity = endTerrainSpawn.getY() < ((iy + y) * 4 | 1) ? -50.0 : 50.0; + result[index] = density * (1.0 - spawnBlend) + spawnBlend * spawnDensity; + } + } + } + delete[] main.m_data; + delete[] low.m_data; + delete[] high.m_data; + delete[] scale.m_data; + delete[] detail.m_data; + delete[] unused1.m_data; + delete[] unused2.m_data; + return result; +} + +// name guessed +// NON_MATCHING | score: 6095 (lower is better) +void TheEndLevelSource::prepareHeights(int x, int z, ChunkPrimer* primer) { + arrayWithLength heights; + heights = getHeights(heights, x * 2, 0, z * 2, 3, 33, 3); + for (int ix = 0; ix < 2; ++ix) { + for (int iz = 0; iz < 2; ++iz) { + for (int iy = 0; iy < 32; ++iy) { + int i00 = (ix * 3 + iz) * 33 + iy; + int i01 = (ix * 3 + iz + 1) * 33 + iy; + int i10 = ((ix + 1) * 3 + iz) * 33 + iy; + int i11 = ((ix + 1) * 3 + iz + 1) * 33 + iy; + double a = heights[i00], b = heights[i01], c = heights[i10], d = heights[i11]; + double da = (heights[i00 + 1] - a) * 0.25; + double db = (heights[i01 + 1] - b) * 0.25; + double dc = (heights[i10 + 1] - c) * 0.25; + double dd = (heights[i11 + 1] - d) * 0.25; + for (int dy = 0; dy < 4; ++dy) { + double p = a, q = b; + double dp = (c - a) * 0.125, dq = (d - b) * 0.125; + for (int dx = 0; dx < 8; ++dx) { + double value = p, step = (q - p) * 0.125; + for (int dz = 0; dz < 8; ++dz) { + const BlockState* state = Blocks::AIR->defaultBlockState(); + if (value > 0.0) + state = Blocks::END_STONE->defaultBlockState(); + primer->setState(ix * 8 + dx, iy * 4 + dy, iz * 8 + dz, state); + value += step; + } + p += dp; + q += dq; + } + a += da; + b += db; + c += dc; + d += dd; + } + } + } + } + delete[] heights.m_data; +} + +// name guessed +void TheEndLevelSource::buildSurfaces(ChunkPrimer* primer) { + for (int x = 0; x < 16; ++x) { + for (int z = 0; z < 16; ++z) { + const BlockState* top = Blocks::END_STONE->defaultBlockState(); + const BlockState* filler = Blocks::END_STONE->defaultBlockState(); + int remaining = -1; + for (int y = 127; y >= 0; --y) { + const BlockState* state = primer->getState(x, y, z); + if (state->getBlock()->getMaterial() == Material::AIR) { + remaining = -1; + } else if (state->getBlock() == Blocks::STONE) { + if (remaining == -1) { + primer->setState(x, y, z, top); + remaining = 1; + } else if (remaining > 0) { + primer->setState(x, y, z, filler); + --remaining; + } + } + } + } + } +} + +// NON_MATCHING | score: 498 (lower is better) +LevelChunk* TheEndLevelSource::createChunk(int x, int z) { + m_random->setSeed((long long)x * 341873128712LL + (long long)z * 132897987541LL); + arrayWithLength ids(65536, true), data(32768, true); + ChunkPrimer primer(true, ids, data); + m_level->getBiomeSource()->getBiomeBlock(m_biomes, x << 4, z << 4, 16, 16, true); + prepareHeights(x, z, &primer); + buildSurfaces(&primer); + if (m_generateStructures) + m_endCity->apply(m_level, x, z, &primer); + LevelChunk* chunk = new LevelChunk(m_level, &primer, x, z); + arrayWithLength biomes = chunk->getBiomes(); + for (unsigned i = 0; i < biomes.m_length; ++i) + biomes[i] = endBiomeId(m_biomes.get(i)); + chunk->recalcHeightmap(); + return chunk; +} + +// NON_MATCHING | score: 3335 (lower is better) +void TheEndLevelSource::postProcess(int x, int z) { + inPostProcessStep = true; + BlockPos origin(x << 4, 0, z << 4); + m_decorationRandom->setSeed(m_level->getSeed()); + long long a = m_decorationRandom->nextLong(); + if (a < 0) + ++a; + long long b = m_decorationRandom->nextLong(); + if (b < 0) + ++b; + m_decorationRandom->setSeed((x * (a | 1) + z * (b | 1)) ^ m_level->getSeed()); + if (m_generateStructures) { + ChunkPos chunk(x, z); + m_endCity->postProcess(m_level, *m_decorationRandom, &chunk); + } + m_level->getBiome(origin.offset(16, 0, 16))->decorate(m_level, *m_decorationRandom, origin); + if (fjIslandCheck(x, z)) { + if (getIslandHeightValue(x, z, 1, 1) < -20.0f && m_decorationRandom->nextInt(14) == 0) { + int dx = m_decorationRandom->nextInt(16) + 8; + int dy = m_decorationRandom->nextInt(16) + 55; + int dz = m_decorationRandom->nextInt(16) + 8; + m_islandFeature->place(m_level, *m_decorationRandom, origin.offset(dx, dy, dz)); + if (m_decorationRandom->nextInt(4) == 0) { + dx = m_decorationRandom->nextInt(16) + 8; + dy = m_decorationRandom->nextInt(16) + 55; + dz = m_decorationRandom->nextInt(16) + 8; + m_islandFeature->place(m_level, *m_decorationRandom, origin.offset(dx, dy, dz)); + } + } + if (getIslandHeightValue(x, z, 1, 1) > 40.0f) { + int attempts = m_decorationRandom->nextInt(5); + for (int i = 0; i < attempts; ++i) { + int dx = m_decorationRandom->nextInt(16) + 8; + int dz = m_decorationRandom->nextInt(16) + 8; + int y = m_level->getHeightmapPos(origin.offset(dx, 0, dz)).getY(); + if (y > 0 && m_level->isEmptyBlock(origin.offset(dx, y, dz)) + && m_level->getBlockState(origin.offset(dx, y - 1, dz))->getBlock() == Blocks::END_STONE) + endGenerateChorusPlant(m_level, origin.offset(dx, y, dz), m_decorationRandom, 8); + } + } + } + inPostProcessStep = false; +} + +bool TheEndLevelSource::postProcessLoadedChunk(LevelChunk*, int, int) { + return false; +} +std::vector* TheEndLevelSource::getMobsAt(MobCategory* category, + const BlockPos& pos) { + return m_level->getBiome(pos)->getMobs(category); +} +BlockPos* TheEndLevelSource::findNearestMapFeature(Level* level, const std::wstring& name, + const BlockPos& pos, bool unexplored) { + if (endCityFeatureName == name && m_endCity) + return m_endCity->getNearestGeneratedFeature(level, pos, unexplored); + return nullptr; +} +bool TheEndLevelSource::isPosInFeature(Level*, const std::wstring& name, const BlockPos& pos) { + return endCityFeatureName.compare(name) == 0 && m_endCity && m_endCity->isInsideFeature(pos); +} +void TheEndLevelSource::recreateLogicStructuresForChunk(LevelChunk*, int, int) {} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/TheEndLevelSource.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/TheEndLevelSource.h index b164f753..9c8effa2 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/TheEndLevelSource.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/TheEndLevelSource.h @@ -1,16 +1,50 @@ #pragma once +#include "net/minecraft/core/BlockPos.h" +#include "net/minecraft/world/ArrayWithLength.h" #include "net/minecraft/world/level/chunk/ChunkGenerator.h" +#include "types.h" + +class ChunkPrimer; +class Random; +class PerlinNoise; +class SimplexNoise; +class EndCityFeature; +class EndIslandFeature; class TheEndLevelSource : public ChunkGenerator { public: TheEndLevelSource(Level*, bool, long long, const BlockPos&); - virtual ~TheEndLevelSource(); + ~TheEndLevelSource() override; 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; + + void prepareHeights(int, int, ChunkPrimer*); + arrayWithLength getHeights(arrayWithLength, int, int, int, int, int, int); + void buildSurfaces(ChunkPrimer*); + bool fjIslandCheck(int, int); + double fjIslandProximity(int, int); + float getIslandHeightValue(int, int, int, int); + + Random* m_random; + Random* m_decorationRandom; + PerlinNoise* m_minLimitNoise; + PerlinNoise* m_maxLimitNoise; + PerlinNoise* m_mainNoise; + PerlinNoise* m_scaleNoise; + PerlinNoise* m_depthNoise; + Level* m_level; + bool m_generateStructures; + BlockPos m_spawn; + EndCityFeature* m_endCity; + SimplexNoise* m_islandNoise; + arrayWithLength m_biomes; + EndIslandFeature* m_islandFeature; }; + +ASSERT_SIZEOF(TheEndLevelSource, 0x88) 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.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.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.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/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.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CactusFeature.h new file mode 100644 index 00000000..35debeac --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/CactusFeature.h @@ -0,0 +1,14 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" + +class CactusFeature : public Feature { +public: + // name guessed + 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/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.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.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/EndCityFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndCityFeature.h new file mode 100644 index 00000000..a7bec58e --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/EndCityFeature.h @@ -0,0 +1,19 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/StructureFeature.h" + +class TheEndLevelSource; + +/** Constructor and specialized virtual methods remain unreconstructed. + */ +class EndCityFeature : 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; + + explicit EndCityFeature(TheEndLevelSource*); + TheEndLevelSource* m_source; +}; +ASSERT_SIZEOF(EndCityFeature, 0x70) 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/Feature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/Feature.h index 8cdbf359..832283bb 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/Feature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/Feature.h @@ -7,7 +7,7 @@ class BlockState; class Feature { public: - Feature(bool isUpdate); + Feature(bool isUpdate = false); virtual ~Feature(); virtual bool place(Level* level, Random& random, const BlockPos& pos) = 0; virtual void init(); diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/FlowerFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/FlowerFeature.h index dc75dada..13a8daa3 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/FlowerFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/FlowerFeature.h @@ -7,9 +7,9 @@ class FlowerFeature : public Feature { public: FlowerFeature(FlowerBlock*, FlowerBlock::Flower*); - ~FlowerFeature() override; bool place(Level* level, Random& random, const BlockPos& pos) override; + void setFlower(FlowerBlock*, FlowerBlock::Flower*); - void* m_field10; - void* m_field18; + FlowerBlock* m_flower; + const BlockState* m_state; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/FossilFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/FossilFeature.h new file mode 100644 index 00000000..8e5ad815 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/FossilFeature.h @@ -0,0 +1,14 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" + +class FossilFeature : public Feature { +public: + // name guessed + FossilFeature() = default; + ~FossilFeature() override = default; + bool place(Level*, Random&, const BlockPos&) override; +}; + +ASSERT_SIZEOF(FossilFeature, 0x10) 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/HellFireFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HellFireFeature.cpp index 0d0c7f8a..a150aad5 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HellFireFeature.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HellFireFeature.cpp @@ -6,8 +6,6 @@ #include "net/minecraft/world/level/block/Blocks.h" #include "net/minecraft/world/level/block/state/BlockState.h" -HellFireFeature::HellFireFeature() : Feature(false) {} - bool HellFireFeature::place(Level* level, Random& random, const BlockPos& pos) { for (int i = 0; i < 64; i++) { BlockPos pos2 diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HellFireFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HellFireFeature.h index 2e7a1d59..4bbca3c2 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HellFireFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/HellFireFeature.h @@ -4,7 +4,8 @@ class HellFireFeature : public Feature { public: - HellFireFeature(); + // name guessed + HellFireFeature() = default; bool place(Level* level, Random& random, const BlockPos& pos) override; }; 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.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.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.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/IceSpikeFeature.h new file mode 100644 index 00000000..fd0f8796 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/IceSpikeFeature.h @@ -0,0 +1,10 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" + +class IceSpikeFeature : public Feature { +public: + // name guessed + IceSpikeFeature() = default; + bool place(Level*, Random&, const BlockPos&) override; +}; 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.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LargeHellCaveFeature.h new file mode 100644 index 00000000..96b6ce28 --- /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" + +class LargeHellCaveFeature : public LargeFeature { +public: + // name guessed + 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/LightGemFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LightGemFeature.cpp index ceb54e3e..e11f372d 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LightGemFeature.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LightGemFeature.cpp @@ -8,8 +8,6 @@ #include "net/minecraft/world/level/block/state/BlockState.h" #include "net/minecraft/world/level/material/Material.h" -LightGemFeature::LightGemFeature() : Feature(false) {} - bool LightGemFeature::place(Level* level, Random& random, const BlockPos& pos) { if (!level->isEmptyBlock(pos)) { return false; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LightGemFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LightGemFeature.h index 67449bdf..2349241e 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LightGemFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/LightGemFeature.h @@ -6,7 +6,8 @@ class Block; class LightGemFeature : public Feature { public: - LightGemFeature(); + // name guessed + LightGemFeature() = default; bool place(Level* level, Random& random, const BlockPos& pos) override; }; 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.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.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.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.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/NetherBridgeFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/NetherBridgeFeature.h new file mode 100644 index 00000000..3b720943 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/NetherBridgeFeature.h @@ -0,0 +1,23 @@ +#pragma once + +#include "net/minecraft/world/level/biome/Biome.h" +#include "net/minecraft/world/level/levelgen/feature/StructureFeature.h" + +class NetherBridgeFeature : 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; + + NetherBridgeFeature(); + ~NetherBridgeFeature() override; + std::vector* getSpawnList(); + +private: + /** Structure-owned spawn data and trailing state are still external reconstruction work. + */ + char m_unknown68[0x28]; +}; + +ASSERT_SIZEOF(NetherBridgeFeature, 0x90) 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.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.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/PumpkinFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/PumpkinFeature.cpp index 80f623c1..c78a93d8 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/PumpkinFeature.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/PumpkinFeature.cpp @@ -9,8 +9,6 @@ #include "net/minecraft/world/level/block/state/BlockState.h" #include "net/minecraft/world/level/levelgen/feature/Feature.h" -PumpkinFeature::PumpkinFeature() : Feature(false) {} - bool PumpkinFeature::place(Level* level, Random& rand, const BlockPos& pos) { for (int i = 0; i < 64; ++i) { BlockPos temp = pos.offset(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/PumpkinFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/PumpkinFeature.h index 51b0b7a3..4dde8e1b 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/PumpkinFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/PumpkinFeature.h @@ -4,7 +4,8 @@ class PumpkinFeature : public Feature { public: - PumpkinFeature(); + // name guessed + PumpkinFeature() = default; bool place(Level* level, Random& random, const BlockPos& pos) override; }; 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.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/ReedsFeature.h new file mode 100644 index 00000000..9347d611 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/ReedsFeature.h @@ -0,0 +1,14 @@ +#pragma once + +#include "net/minecraft/world/level/levelgen/feature/Feature.h" +#include "types.h" + +class ReedsFeature : public Feature { +public: + // name guessed + 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.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.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.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.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.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.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.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.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.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.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/WaterlilyFeature.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/WaterlilyFeature.cpp index fb2e3a71..cbc2e569 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/WaterlilyFeature.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/WaterlilyFeature.cpp @@ -6,8 +6,6 @@ #include "net/minecraft/world/level/block/Blocks.h" #include "net/minecraft/world/level/block/state/BlockState.h" -WaterlilyFeature::WaterlilyFeature() : Feature(false) {} - bool WaterlilyFeature::place(Level* level, Random& random, const BlockPos& pos) { for (int i = 0; i < 10; i++) { int x = pos.getX() + random.nextInt(8) - random.nextInt(8); diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/WaterlilyFeature.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/WaterlilyFeature.h index f37b2b25..6e4d6195 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/WaterlilyFeature.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/feature/WaterlilyFeature.h @@ -4,7 +4,8 @@ class WaterlilyFeature : public Feature { public: - WaterlilyFeature(); + // name guessed + WaterlilyFeature() = default; bool place(Level* level, Random& random, const BlockPos& pos) 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/ImprovedNoise.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/ImprovedNoise.cpp new file mode 100644 index 00000000..2e1470db --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/ImprovedNoise.cpp @@ -0,0 +1,224 @@ +#include "net/minecraft/world/level/levelgen/synth/ImprovedNoise.h" + +#include "net/minecraft/world/Random.h" + +#include + +double ImprovedNoise::GRAD_X[16] + = {1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, -1.0, 0.0}; +double ImprovedNoise::GRAD_Y[16] + = {1.0, 1.0, -1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0}; +double ImprovedNoise::GRAD_Z[16] + = {0.0, 0.0, 0.0, 0.0, 1.0, 1.0, -1.0, -1.0, 1.0, 1.0, -1.0, -1.0, 0.0, 1.0, 0.0, -1.0}; +double ImprovedNoise::GRAD_2D_X[16] + = {1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, -1.0, 0.0}; +double ImprovedNoise::GRAD_2D_Z[16] + = {0.0, 0.0, 0.0, 0.0, 1.0, 1.0, -1.0, -1.0, 1.0, 1.0, -1.0, -1.0, 0.0, 1.0, 0.0, -1.0}; + +ImprovedNoise::ImprovedNoise(Random* random) { + init(random); +} + +ImprovedNoise::~ImprovedNoise() { + if (m_permutations) + delete[] m_permutations; +} + +void ImprovedNoise::init(Random* random) { + m_permutations = new int[512]; + m_x = random->nextDouble() * 256.0; + m_y = random->nextDouble() * 256.0; + m_z = random->nextDouble() * 256.0; + + for (int i = 0; i < 256; i++) { + m_permutations[i] = i; + } + for (int i = 0; i < 256; i++) { + int j = random->nextInt(256 - i) + i; + int old = m_permutations[i]; + m_permutations[i] = m_permutations[j]; + m_permutations[j] = old; + m_permutations[i + 256] = m_permutations[i]; + } +} + +// name guessed +// NON_MATCHING | score: 8895 (lower is better) +double ImprovedNoise::getValue(double x, double y, double z) { + x += m_x; + y += m_y; + z += m_z; + + int floorX = static_cast(x); + int floorY = static_cast(y); + int floorZ = static_cast(z); + if (x < floorX) + --floorX; + if (y < floorY) + --floorY; + if (z < floorZ) + --floorZ; + + int cellX = floorX & 255; + int cellY = floorY & 255; + int cellZ = floorZ & 255; + x -= floorX; + y -= floorY; + z -= floorZ; + + double fadeX = x * x * x * (x * (x * 6.0 - 15.0) + 10.0); + double fadeY = y * y * y * (y * (y * 6.0 - 15.0) + 10.0); + double fadeZ = z * z * z * (z * (z * 6.0 - 15.0) + 10.0); + + int a = m_permutations[cellX] + cellY; + int aa = m_permutations[a] + cellZ; + int ab = m_permutations[a + 1] + cellZ; + int b = m_permutations[cellX + 1] + cellY; + int ba = m_permutations[b] + cellZ; + int bb = m_permutations[b + 1] + cellZ; + + return lerp(fadeZ, + lerp(fadeY, + lerp(fadeX, grad(m_permutations[aa], x, y, z), grad(m_permutations[ba], x - 1.0, y, z)), + lerp(fadeX, grad(m_permutations[ab], x, y - 1.0, z), + grad(m_permutations[bb], x - 1.0, y - 1.0, z))), + lerp(fadeY, + lerp(fadeX, grad(m_permutations[aa + 1], x, y, z - 1.0), + grad(m_permutations[ba + 1], x - 1.0, y, z - 1.0)), + lerp(fadeX, grad(m_permutations[ab + 1], x, y - 1.0, z - 1.0), + grad(m_permutations[bb + 1], x - 1.0, y - 1.0, z - 1.0)))); +} + +// name guessed +double ImprovedNoise::lerp(double weight, double a, double b) { + return a + weight * (b - a); +} + +// name guessed +double ImprovedNoise::grad(int hash, double x, double y, double z) { + int index = hash & 15; + return GRAD_X[index] * x + GRAD_Y[index] * y + GRAD_Z[index] * z; +} + +double ImprovedNoise::getValue(double x, double y) { + return getValue(x, y, 0.0); +} + +// NON_MATCHING | score: 37870 (lower is better) +void ImprovedNoise::add(arrayWithLength noise, double posX, double posY, double posZ, int width, + int depth, int length, double scaleX, double scaleY, double scaleZ, + double amplitude) { + double x = m_x + posX; + double inverseAmplitude = 1.0 / amplitude; + int index = 0; + + // The single-layer path samples X/Z and deliberately ignores the Y offset. + if (depth == 1) { + for (int ix = 0; ix < width; ix++) { + double floorX = std::floor(x); + x -= floorX; + double fadeX = x * x * x * (x * (x * 6.0 - 15.0) + 10.0); + double z = m_z + posZ; + for (int iz = 0; iz < length; iz++) { + double floorZ = std::floor(z); + z -= floorZ; + int cellX = static_cast(floorX) & 255; + int cellZ = static_cast(floorZ) & 255; + int a = m_permutations[m_permutations[cellX]] + cellZ; + int b = m_permutations[m_permutations[cellX + 1]] + cellZ; + double near + = lerp(fadeX, grad(m_permutations[a], x, z), grad(m_permutations[b], x - 1.0, 0.0, z)); + double far = lerp(fadeX, grad(m_permutations[a + 1], x, 0.0, z - 1.0), + grad(m_permutations[b + 1], x - 1.0, 0.0, z - 1.0)); + double fadeZ = z * z * z * (z * (z * 6.0 - 15.0) + 10.0); + noise[index++] += lerp(fadeZ, near, far) * inverseAmplitude; + z = floorZ + z + scaleZ; + } + x = floorX + x + scaleX; + } + return; + } + + // The binary caches 64 Y samples for the multi-layer path. + struct YSample { + double offset; + double fade; + int cell; + }; + YSample samples[64]; + bool firstColumn = true; + int lastCellY = -1; + double nearLow = 0.0; + double nearHigh = 0.0; + double farLow = 0.0; + double farHigh = 0.0; + + for (int ix = 0; ix < width; ix++) { + double floorX = std::floor(x); + x -= floorX; + int cellX = static_cast(floorX) & 255; + double fadeX = x * x * x * (x * (x * 6.0 - 15.0) + 10.0); + double z = m_z + posZ; + + for (int iz = 0; iz < length; iz++) { + double floorZ = std::floor(z); + z -= floorZ; + int cellZ = static_cast(floorZ) & 255; + double fadeZ = z * z * z * (z * (z * 6.0 - 15.0) + 10.0); + double y = m_y + posY; + + for (int iy = 0; iy < depth; iy++) { + double floorY = 0.0; + double fadeY; + int cellY; + if (firstColumn) { + floorY = std::floor(y); + y -= floorY; + fadeY = y * y * y * (y * (y * 6.0 - 15.0) + 10.0); + cellY = static_cast(floorY) & 255; + samples[iy].offset = y; + samples[iy].fade = fadeY; + samples[iy].cell = cellY; + } else { + y = samples[iy].offset; + fadeY = samples[iy].fade; + cellY = samples[iy].cell; + } + + // Reuse the gradients within each Y lattice cell. + if (iy == 0 || cellY != lastCellY) { + int a = m_permutations[cellX] + cellY; + int aa = m_permutations[a] + cellZ; + int ab = m_permutations[a + 1] + cellZ; + int b = m_permutations[cellX + 1] + cellY; + int ba = m_permutations[b] + cellZ; + int bb = m_permutations[b + 1] + cellZ; + nearLow = lerp(fadeX, grad(m_permutations[aa], x, y, z), + grad(m_permutations[ba], x - 1.0, y, z)); + nearHigh = lerp(fadeX, grad(m_permutations[ab], x, y - 1.0, z), + grad(m_permutations[bb], x - 1.0, y - 1.0, z)); + farLow = lerp(fadeX, grad(m_permutations[aa + 1], x, y, z - 1.0), + grad(m_permutations[ba + 1], x - 1.0, y, z - 1.0)); + farHigh = lerp(fadeX, grad(m_permutations[ab + 1], x, y - 1.0, z - 1.0), + grad(m_permutations[bb + 1], x - 1.0, y - 1.0, z - 1.0)); + lastCellY = cellY; + } + + double near = lerp(fadeY, nearLow, nearHigh); + double far = lerp(fadeY, farLow, farHigh); + noise[index++] += lerp(fadeZ, near, far) * inverseAmplitude; + if (firstColumn) + y = floorY + y + scaleY; + } + z = floorZ + z + scaleZ; + firstColumn = false; + } + x = floorX + x + scaleX; + } +} + +// name guessed +double ImprovedNoise::grad(int hash, double x, double z) { + int index = hash & 15; + return GRAD_2D_X[index] * x + GRAD_2D_Z[index] * z; +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/ImprovedNoise.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/ImprovedNoise.h index 379d6810..ebe2b841 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/ImprovedNoise.h +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/ImprovedNoise.h @@ -10,11 +10,23 @@ class ImprovedNoise : public Synth { ImprovedNoise(Random*); virtual ~ImprovedNoise(); double getValue(double, double) override; + double getValue(double, double, double); void init(Random*); void add(arrayWithLength, double, double, double, int, int, int, double, double, double, double); + double grad(int, double, double, double); + double grad(int, double, double); + static double lerp(double, double, double); - arrayWithLength m_byteArray; + int* m_permutations; + // The binary leaves these eight bytes untouched; the offsets begin at 0x18. + char m_padding[8]; double m_x; double m_y; double m_z; + + static double GRAD_X[16]; + static double GRAD_Y[16]; + static double GRAD_Z[16]; + static double GRAD_2D_X[16]; + static double GRAD_2D_Z[16]; }; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.cpp new file mode 100644 index 00000000..4f0eefc2 --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.cpp @@ -0,0 +1,63 @@ +#include "net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.h" + +#include "NX/Platform.h" +#include "net/minecraft/world/level/levelgen/synth/SimplexNoise.h" + +PerlinSimplexNoise::PerlinSimplexNoise(Random* random, int maxOctaves) { + init(random, maxOctaves); +} + +void PerlinSimplexNoise::init(Random* random, int maxOctaves) { + MemSect(3); + m_maxOctaves = maxOctaves; + m_noiseLevels = new SimplexNoise*[maxOctaves]; + for (int i = 0; i < maxOctaves; ++i) + m_noiseLevels[i] = new SimplexNoise(random); + MemSect(0); +} + +PerlinSimplexNoise::~PerlinSimplexNoise() { + for (int i = 0; i < m_maxOctaves; ++i) + delete m_noiseLevels[i]; + delete[] m_noiseLevels; +} + +double PerlinSimplexNoise::getValue(double x, double y) { + double result = 0.0; + double scale = 1.0; + for (int i = 0; i < m_maxOctaves; ++i) { + result += m_noiseLevels[i]->getValue(scale * x, scale * y) / scale; + scale *= 0.5; + } + return result; +} + +arrayWithLength PerlinSimplexNoise::getRegion(arrayWithLength output, double x, double y, + int width, int height, double scaleX, double scaleY, + double octaveScale) { + return getRegion(output, x, y, width, height, scaleX, scaleY, octaveScale, 0.5); +} + +// name guessed +arrayWithLength PerlinSimplexNoise::getRegion(arrayWithLength output, double x, double y, + int width, int height, double scaleX, double scaleY, + double octaveScale, double persistence) { + scaleX /= 1.5; + scaleY /= 1.5; + if (output.m_data && static_cast(output.m_length) >= width * height) { + for (unsigned int i = 0; i < output.m_length; ++i) + output[i] = 0.0; + } else { + delete[] output.m_data; + output = arrayWithLength(width * height, true); + } + double amplitudeScale = 1.0; + double frequency = 1.0; + for (int i = 0; i < m_maxOctaves; ++i) { + m_noiseLevels[i]->add(output, x, y, width, height, scaleX * frequency, scaleY * frequency, + 0.55 / amplitudeScale); + frequency *= octaveScale; + amplitudeScale *= persistence; + } + return output; +} 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/levelgen/synth/SimplexNoise.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/SimplexNoise.cpp new file mode 100644 index 00000000..4108bd7b --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/SimplexNoise.cpp @@ -0,0 +1,146 @@ +#include "net/minecraft/world/level/levelgen/synth/SimplexNoise.h" + +#include "net/minecraft/world/Random.h" + +#include + +const int SimplexNoise::GRAD[12][3] + = {{1, 1, 0}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, {1, 0, 1}, {-1, 0, 1}, + {1, 0, -1}, {-1, 0, -1}, {0, 1, 1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1}}; +double SimplexNoise::F2 = (std::sqrt(3.0) - 1.0) * 0.5; // name guessed +double SimplexNoise::G2 = (3.0 - std::sqrt(3.0)) / 6.0; + +// name guessed +SimplexNoise::SimplexNoise(Random* random) { + init(random); +} + +// name guessed +void SimplexNoise::init(Random* random) { + m_permutations = new int[512]; + m_x = random->nextDouble() * 256.0; + m_y = random->nextDouble() * 256.0; + m_z = random->nextDouble() * 256.0; + for (int i = 0; i < 256; ++i) + m_permutations[i] = i; + for (int i = 0; i < 256; ++i) { + int j = random->nextInt(256 - i) + i; + int old = m_permutations[i]; + m_permutations[i] = m_permutations[j]; + m_permutations[j] = old; + m_permutations[i + 256] = m_permutations[i]; + } +} + +// name guessed +SimplexNoise::~SimplexNoise() { + if (m_permutations) + delete[] m_permutations; +} + +// name guessed +int SimplexNoise::fastFloor(double value) { + // 0x71003222f0 subtracts at zero and negative integers too. + return static_cast(value) - !(value > 0.0); +} + +// name guessed +double SimplexNoise::dot(const int* gradient, double x, double y) { + return gradient[0] * x + gradient[1] * y; +} + +// name guessed +// NON_MATCHING | score: 5807 (lower is better) +double SimplexNoise::getValue(double x, double y) { + double n0 = 0.0; + double n1 = 0.0; + double n2 = 0.0; + double skew = (x + y) * F2; + int cellX = fastFloor(x + skew); + int cellY = fastFloor(y + skew); + double unskew = G2 * (cellX + cellY); + double x0 = x - (cellX - unskew); + double y0 = y - (cellY - unskew); + int stepX = x0 > y0 ? 1 : 0; + int stepY = x0 > y0 ? 0 : 1; + double x1 = G2 + (x0 - stepX); + double y1 = G2 + (y0 - stepY); + double twiceG2 = G2 + G2; + double x2 = twiceG2 + (x0 + -1.0); + double y2 = twiceG2 + (y0 + -1.0); + int ix = cellX & 255; + int iy = cellY & 255; + int hash1 = m_permutations[ix + stepX + m_permutations[iy + stepY]]; + int hash2 = m_permutations[ix + 1 + m_permutations[iy + 1]]; + double weight = (0.5 - x0 * x0) - y0 * y0; + if (!(weight < 0.0)) { + int gradient0 = m_permutations[ix + m_permutations[iy]] % 12; + weight *= weight; + n0 = weight * weight * dot(GRAD[gradient0], x0, y0); + } + weight = (0.5 - x1 * x1) - y1 * y1; + if (!(weight < 0.0)) { + weight *= weight; + n1 = weight * weight * dot(GRAD[hash1 % 12], x1, y1); + } + weight = (0.5 - x2 * x2) - y2 * y2; + if (!(weight < 0.0)) { + weight *= weight; + n2 = weight * weight * dot(GRAD[hash2 % 12], x2, y2); + } + return (n0 + n1 + n2) * 70.0; +} + +/** The Switch region routine contains its own sampler body. Keep that copy + * here so the original floor/dot call sequence and floating-point order survive. + */ +// name guessed +void SimplexNoise::add(arrayWithLength output, double x, double y, int width, int height, + double scaleX, double scaleY, double amplitude) { + int index = 0; + for (int row = 0; row < height; ++row) { + double sampleY = (row + y) * scaleY + m_y; + for (int column = 0; column < width; ++column) { + double sampleX = (column + x) * scaleX + m_x; + double x = sampleX; + double y = sampleY; + double n0 = 0.0; + double n1 = 0.0; + double n2 = 0.0; + double skew = (x + y) * F2; + int cellX = fastFloor(x + skew); + int cellY = fastFloor(y + skew); + double unskew = G2 * (cellX + cellY); + double x0 = x - (cellX - unskew); + double y0 = y - (cellY - unskew); + int stepX = x0 > y0 ? 1 : 0; + int stepY = x0 > y0 ? 0 : 1; + double x1 = G2 + (x0 - stepX); + double y1 = G2 + (y0 - stepY); + double twiceG2 = G2 + G2; + double x2 = twiceG2 + (x0 + -1.0); + double y2 = twiceG2 + (y0 + -1.0); + int ix = cellX & 255; + int iy = cellY & 255; + int gradient1 = m_permutations[ix + stepX + m_permutations[iy + stepY]] % 12; + int gradient2 = m_permutations[ix + 1 + m_permutations[iy + 1]] % 12; + double weight = (0.5 - x0 * x0) - y0 * y0; + if (!(weight < 0.0)) { + int gradient0 = m_permutations[ix + m_permutations[iy]] % 12; + weight *= weight; + n0 = weight * weight * dot(GRAD[gradient0], x0, y0); + } + weight = (0.5 - x1 * x1) - y1 * y1; + if (!(weight < 0.0)) { + weight *= weight; + n1 = weight * weight * dot(GRAD[gradient1], x1, y1); + } + weight = (0.5 - x2 * x2) - y2 * y2; + if (!(weight < 0.0)) { + weight *= weight; + n2 = weight * weight * dot(GRAD[gradient2], x2, y2); + } + output[index++] += (n0 + n1 + n2) * 70.0 * amplitude; + } + } +} diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/SimplexNoise.h b/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/SimplexNoise.h new file mode 100644 index 00000000..f05c30bc --- /dev/null +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/SimplexNoise.h @@ -0,0 +1,28 @@ +#pragma once + +#include "net/minecraft/world/ArrayWithLength.h" + +class Random; + +/** The binary's octave objects have no vtable; the permutation pointer is at 0. + */ +class SimplexNoise { +public: + explicit SimplexNoise(Random*); + ~SimplexNoise(); + void init(Random*); + double getValue(double, double); + void add(arrayWithLength, double, double, int, int, double, double, double); + static int fastFloor(double); + static double dot(const int*, double, double); + + int* m_permutations; + char m_padding[8]; + double m_x; + double m_y; + double m_z; + + static const int GRAD[12][3]; + static double F2; + static double G2; +}; diff --git a/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/Synth.cpp b/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/Synth.cpp index bde5f793..1af7d19d 100644 --- a/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/Synth.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/levelgen/synth/Synth.cpp @@ -2,4 +2,7 @@ Synth::Synth() {} -Synth::~Synth() = default; +/** Keep the deleting destructor's call to the empty base body. Weak linkage + * prevents Clang from discarding that call based on this body's known effects. + */ +__attribute__((weak)) Synth::~Synth() = default; 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.cpp b/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/IntCache.cpp index 79968175..438d7e13 100644 --- a/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/IntCache.cpp +++ b/src/Minecraft.World/net/minecraft/world/level/newbiome/layer/IntCache.cpp @@ -1 +1,104 @@ #include "net/minecraft/world/level/newbiome/layer/IntCache.h" + +#include "NX/Platform.h" + +unsigned int IntCache::sThreadStorageIndex = TlsAlloc(); + +namespace { +void freeArrays(std::vector>& arrays) { + for (const auto& array : arrays) + delete[] array.m_data; + arrays.clear(); +} + +IntCache::ThreadStorage* storage() { + auto* result = static_cast(TlsGetValue(IntCache::sThreadStorageIndex)); + return result; +} + +void trimOne(std::vector>& arrays) { + if (!arrays.empty()) { + delete[] arrays.back().m_data; + arrays.pop_back(); + } +} +} // namespace + +// name guessed +IntCache::ThreadStorage::ThreadStorage() = default; + +// name guessed +// NON_MATCHING | score: 7924 (lower is better) +IntCache::ThreadStorage::~ThreadStorage() { + freeArrays(m_freeSmall); + freeArrays(m_activeSmall); + freeArrays(m_freeLarge); + freeArrays(m_activeLarge); + freeArrays(m_retiredLarge); +} + +// NON_MATCHING | score: 410 (lower is better) +void IntCache::CreateNewThreadStorage() { + auto* current = new ThreadStorage(); + TlsSetValue(sThreadStorageIndex, current); + current->m_maxSize = 256; +} + +// name guessed +void IntCache::ReleaseThreadStorage() { + auto* current = static_cast(TlsGetValue(sThreadStorageIndex)); + delete current; +} + +// NON_MATCHING | score: 10226 (lower is better) +arrayWithLength IntCache::allocate(int size) { + ThreadStorage* current = storage(); + const bool small = size <= 256; + if (!small && size > current->m_maxSize) { + current->m_maxSize = size; + // Existing borrowers keep their views until releaseAll or Reset. + current->m_retiredLarge.insert(current->m_retiredLarge.end(), current->m_freeLarge.begin(), + current->m_freeLarge.end()); + current->m_retiredLarge.insert(current->m_retiredLarge.end(), current->m_activeLarge.begin(), + current->m_activeLarge.end()); + current->m_freeLarge.clear(); + current->m_activeLarge.clear(); + } + auto& free = small ? current->m_freeSmall : current->m_freeLarge; + auto& active = small ? current->m_activeSmall : current->m_activeLarge; + arrayWithLength result; + if (free.empty()) { + result = arrayWithLength(small ? 256 : current->m_maxSize, false); + } else { + result = free.back(); + free.pop_back(); + } + active.push_back(result); + return result; +} + +// name guessed +// NON_MATCHING | score: 4910 (lower is better) +void IntCache::releaseAll() { + ThreadStorage* current = storage(); + freeArrays(current->m_retiredLarge); + trimOne(current->m_freeLarge); + trimOne(current->m_freeSmall); + current->m_freeLarge.insert(current->m_freeLarge.end(), current->m_activeLarge.begin(), + current->m_activeLarge.end()); + current->m_freeSmall.insert(current->m_freeSmall.end(), current->m_activeSmall.begin(), + current->m_activeSmall.end()); + current->m_activeLarge.clear(); + current->m_activeSmall.clear(); +} + +// NON_MATCHING | score: 14248 (lower is better) +void IntCache::Reset() { + ThreadStorage* current = storage(); + current->m_maxSize = 256; + freeArrays(current->m_activeLarge); + freeArrays(current->m_freeLarge); + freeArrays(current->m_activeSmall); + freeArrays(current->m_freeSmall); + freeArrays(current->m_retiredLarge); +} 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/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); };