From 8e31c2d29d1c57a66eb6e556e4583e18c68e5fbf Mon Sep 17 00:00:00 2001 From: Fireblade <3+fireblade@noreply.neolegacy.dev> Date: Sat, 20 Jun 2026 20:56:13 -0400 Subject: [PATCH] fix: misc --- Minecraft.Client/AbstractTexturePack.cpp | 115 +++++++++++++++++- Minecraft.Client/CMakeLists.txt | 12 ++ Minecraft.Client/Common/App_enums.h | 2 + .../Common/Colours/ColourTable.cpp | 2 + .../Common/res/TitleUpdate/res/colours.col | Bin 5902 -> 0 bytes .../Common/res/TitleUpdate/res/colours.xml | 2 + Minecraft.World/Biome.cpp | 4 +- Minecraft.World/Item.cpp | 2 +- Minecraft.World/Item.h | 1 + Minecraft.World/PistonPieceEntity.cpp | 1 + 10 files changed, 136 insertions(+), 5 deletions(-) delete mode 100644 Minecraft.Client/Common/res/TitleUpdate/res/colours.col diff --git a/Minecraft.Client/AbstractTexturePack.cpp b/Minecraft.Client/AbstractTexturePack.cpp index 04435970..5a92e830 100644 --- a/Minecraft.Client/AbstractTexturePack.cpp +++ b/Minecraft.Client/AbstractTexturePack.cpp @@ -35,6 +35,107 @@ wstring AbstractTexturePack::trim(wstring line) return line; } +namespace { + class XmlColourTableCallback : public ATG::ISAXCallback + { + public: + HRESULT StartDocument() override { return S_OK; } + HRESULT EndDocument() override { return S_OK; } + + HRESULT ElementBegin(CONST WCHAR *strName, UINT NameLen, CONST ATG::XMLAttribute *pAttributes, UINT NumAttributes) override + { + const wstring elementName(strName, NameLen); + if (!equalsIgnoreCase(elementName, L"colour")) + { + return S_OK; + } + + wstring colourName; + wstring colourValueText; + for(UINT i = 0; i < NumAttributes; ++i) + { + const ATG::XMLAttribute &attribute = pAttributes[i]; + if (attribute.strValue == nullptr) + { + continue; + } + + const wstring attributeName(attribute.strName, attribute.NameLen); + if (equalsIgnoreCase(attributeName, L"name")) + { + colourName.assign(attribute.strValue, attribute.ValueLen); + } + else if (equalsIgnoreCase(attributeName, L"value")) + { + colourValueText.assign(attribute.strValue, attribute.ValueLen); + } + } + + if (!colourName.empty() && !colourValueText.empty()) + { + if (colourValueText[0] == L'#') + { + colourValueText = colourValueText.substr(1); + } + int colourValue = _fromHEXString(colourValueText); + m_colours.emplace_back(colourName, colourValue); + } + + return S_OK; + } + + HRESULT ElementContent(CONST WCHAR *, UINT, BOOL) override { return S_OK; } + HRESULT ElementEnd(CONST WCHAR *, UINT) override { return S_OK; } + HRESULT CDATABegin() override { return S_OK; } + HRESULT CDATAData(CONST WCHAR *, UINT, BOOL) override { return S_OK; } + HRESULT CDATAEnd() override { return S_OK; } + + VOID Error(HRESULT hError, CONST CHAR *strMessage) override + { + app.DebugPrintf("colours.xml parse error (%08X): %s\n", hError, strMessage ? strMessage : "(unknown)"); + } + + vector> m_colours; + }; + + static bool loadColourTableFromXmlFile(File xmlFile, ColourTable *&outTable) + { + FileInputStream fis(xmlFile); + DWORD dwLength = xmlFile.length(); + if(dwLength == 0) return false; + + byteArray textData(static_cast(dwLength)); + fis.read(textData, 0, dwLength); + fis.close(); + + ATG::XMLParser parser; + XmlColourTableCallback callback; + parser.RegisterSAXCallbackInterface(&callback); + + HRESULT hr = parser.ParseXMLBuffer(reinterpret_cast(textData.data), static_cast(dwLength)); + delete [] textData.data; + + if (FAILED(hr) || callback.m_colours.empty()) + return false; + + ByteArrayOutputStream baos; + DataOutputStream dos(&baos); + dos.writeInt(1); + dos.writeInt(static_cast(callback.m_colours.size())); + for (const auto &entry : callback.m_colours) + { + dos.writeUTF(entry.first); + dos.writeInt(entry.second); + } + + byteArray binaryData = baos.toByteArray(); + outTable = new ColourTable(binaryData.data, binaryData.length); + delete [] binaryData.data; + + return true; + } +} + void AbstractTexturePack::loadIcon() { #ifdef _XBOX @@ -261,12 +362,12 @@ void AbstractTexturePack::loadDefaultColourTable() #ifdef __PS3__ // need to check if it's a BD build, so pass in the name File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":nullptr).append(L"res/colours.col")); - + File coloursXmlFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.xml":nullptr).append(L"res/colours.xml")); #else File coloursFile(AbstractTexturePack::getPath(true).append(L"res/colours.col")); + File coloursXmlFile(AbstractTexturePack::getPath(true).append(L"res/colours.xml")); #endif - if(coloursFile.exists()) { DWORD dwLength = coloursFile.length(); @@ -280,6 +381,16 @@ void AbstractTexturePack::loadDefaultColourTable() delete [] data.data; } + else if(coloursXmlFile.exists()) + { + app.DebugPrintf("Default colours table not found, loading colours.xml fallback\n"); + if(m_colourTable != nullptr) delete m_colourTable; + if(!loadColourTableFromXmlFile(coloursXmlFile, m_colourTable)) + { + app.DebugPrintf("Failed to load colours.xml as a fallback\n"); + app.FatalLoadError(); + } + } else { app.DebugPrintf("Failed to load the default colours table\n"); diff --git a/Minecraft.Client/CMakeLists.txt b/Minecraft.Client/CMakeLists.txt index 7e435a1d..fe87cc40 100644 --- a/Minecraft.Client/CMakeLists.txt +++ b/Minecraft.Client/CMakeLists.txt @@ -148,6 +148,18 @@ endif() # Copy redist files add_copyredist_target(Minecraft.Client) +# replace col file with xml file +add_custom_target(AssetTitleUpdateColourOverride_Minecraft.Client ALL + COMMAND ${CMAKE_COMMAND} -E remove "$/Common/res/TitleUpdate/res/colours.col" + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CMAKE_CURRENT_SOURCE_DIR}/Common/res/TitleUpdate/res/colours.xml" + "$/Common/res/TitleUpdate/res/colours.xml" + VERBATIM +) +add_dependencies(AssetTitleUpdateColourOverride_Minecraft.Client AssetFolderCopy_Minecraft.Client) +add_dependencies(Minecraft.Client AssetTitleUpdateColourOverride_Minecraft.Client) +set_property(TARGET AssetTitleUpdateColourOverride_Minecraft.Client PROPERTY FOLDER "Build") + # Make sure GameHDD exists on Windows if(PLATFORM_NAME STREQUAL "Windows64") add_gamehdd_target(Minecraft.Client) diff --git a/Minecraft.Client/Common/App_enums.h b/Minecraft.Client/Common/App_enums.h index c2ef72c0..a6951e98 100644 --- a/Minecraft.Client/Common/App_enums.h +++ b/Minecraft.Client/Common/App_enums.h @@ -286,6 +286,7 @@ enum eMinecraftColour eMinecraftColour_Water_ExtremeHillsEdge, eMinecraftColour_Water_Jungle, eMinecraftColour_Water_JungleHills, + eMinecraftColour_Water_JungleEdge, eMinecraftColour_Water_Mesa, eMinecraftColour_Sky_Ocean, @@ -311,6 +312,7 @@ enum eMinecraftColour eMinecraftColour_Sky_ExtremeHillsEdge, eMinecraftColour_Sky_Jungle, eMinecraftColour_Sky_JungleHills, + eMinecraftColour_Sky_JungleEdge, eMinecraftColour_Tile_RedstoneDust, eMinecraftColour_Tile_RedstoneDustUnlit, diff --git a/Minecraft.Client/Common/Colours/ColourTable.cpp b/Minecraft.Client/Common/Colours/ColourTable.cpp index 5e7afa74..6e6b4755 100644 --- a/Minecraft.Client/Common/Colours/ColourTable.cpp +++ b/Minecraft.Client/Common/Colours/ColourTable.cpp @@ -90,6 +90,7 @@ const wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] = L"Water_ExtremeHillsEdge", L"Water_Jungle", L"Water_JungleHills", + L"Water_JungleEdge", L"Water_Mesa", L"Sky_Ocean", @@ -115,6 +116,7 @@ const wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] = L"Sky_ExtremeHillsEdge", L"Sky_Jungle", L"Sky_JungleHills", + L"Sky_JungleEdge", L"Tile_RedstoneDust", L"Tile_RedstoneDustUnlit", diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/colours.col b/Minecraft.Client/Common/res/TitleUpdate/res/colours.col deleted file mode 100644 index 60257b37afa73448bdca3a45227fce0f0b783624..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5902 zcmZ`-U2GKB6+U@@05<-^*q}C|3jI-1mD*$TleS98?%J%;uH$+!6q;%~_TJr{dUj@+ znYA(D$4PnUk5r|#)XG&A*$`?Z5JH`#(=9l;k`3L)Ox>_tn7#Vh5KA$aIUZbp z^I7Qj!wsGC99Cgz!!%u}T$&EOhi!+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~~!0LoP|$R-TACFr3`UAqJCQF^%@#RXW{u3gKpRYpnU_Y{7i zerYBbP z&dMjoF9&c=_iBq%T#XGjZv51wHW(Itp z;$Jtd$W1eo;aenFa_`=~rWOrGMn<5Euc;b%$b%JwpTVuga1E}swF&%$U70jk;14%$ zG{H5P`w@dq9>+8)q5Bt?o{z&CoO{a>@S(EqdO`5@_4PQc!R_0(VLQbhGfI(i{;{yo z+@wL~r$Wl*FPg9Fvwudq$^%<6HWU4hW3e9bTEpE#hCjJ^yG~9BqDa*3N zx|mIaK73nq))J6LK6vmT4r4X9Zix^{dp7V*?fYaD)L?meSqiyqOii<}5sxuoY}}4e z)5)4q2%3F;s*5H@*+O zC?CIp@lF}!`PX01Ho-MGni>=;JBq)!;Y<$C+|e%#G_`1O=i82;FQJDCGSBx#K@Hm5 z+XWRkqNYNzkq$URB-C%2DVv3DK|sYom#Z#+0}6ikPxx!XD8Jt2 z6?kCNCTK(cRcvW~2|rtnl9fNgPT^M${%y+YRsKYW54w;T9AX)Ir~0+d7xDNBoIWmn W_{5=o&`K}({7X3d@Y81v3;aKBZ$ + @@ -113,6 +114,7 @@ + diff --git a/Minecraft.World/Biome.cpp b/Minecraft.World/Biome.cpp index 1ce86752..ac105b23 100644 --- a/Minecraft.World/Biome.cpp +++ b/Minecraft.World/Biome.cpp @@ -109,7 +109,7 @@ void Biome::staticCtor() Biome::smallerExtremeHills = (new ExtremeHillsBiome(20))->setColor(0x72789a)->setName(L"Extreme Hills Edge")->setDepthAndScale(0.2f, 0.8f)->setTemperatureAndDownfall(0.2f, 0.3f)->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_ExtremeHillsEdge, eMinecraftColour_Foliage_ExtremeHillsEdge, eMinecraftColour_Water_ExtremeHillsEdge,eMinecraftColour_Sky_ExtremeHillsEdge); Biome::jungle = (new JungleBiome(21, false))->setColor(0x537b09)->setName(L"Jungle")->setLeafColor(0x537b09)->setTemperatureAndDownfall(1.2f, 0.9f)->setDepthAndScale(0.2f, 0.4f)->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_Jungle, eMinecraftColour_Foliage_Jungle, eMinecraftColour_Water_Jungle,eMinecraftColour_Sky_Jungle); Biome::jungleHills = (new JungleBiome(22, false))->setColor(0x2c4205)->setName(L"Jungle Hills")->setLeafColor(0x537b09)->setTemperatureAndDownfall(1.2f, 0.9f)->setDepthAndScale(1.8f, 0.5f)->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_JungleHills, eMinecraftColour_Foliage_JungleHills, eMinecraftColour_Water_JungleHills,eMinecraftColour_Sky_JungleHills); - Biome::jungleEdge = (new JungleBiome(23, true))->setColor(0x6458135)->setName(L"Jungle Edge")->setLeafColor(0x5470985)->setTemperatureAndDownfall(0.95F, 0.8F); + Biome::jungleEdge = (new JungleBiome(23, true))->setColor(0x628b17)->setName(L"Jungle Edge")->setLeafColor(0x537b09)->setTemperatureAndDownfall(0.95F, 0.8F)->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_Jungle, eMinecraftColour_Foliage_Jungle, eMinecraftColour_Water_JungleEdge,eMinecraftColour_Sky_JungleEdge); Biome::deepOcean= (new OceanBiome(24))->setName(L"Deep Ocean")->setDepthAndScale(-1.8,0.1f)->setColor(0x000070)->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_Ocean, eMinecraftColour_Foliage_Ocean, eMinecraftColour_Water_Ocean,eMinecraftColour_Sky_Ocean);; //public static final BiomeGenBase stoneBeach = (new BiomeGenStoneBeach(25)).setColor(10658436).setBiomeName("Stone Beach").setTemperatureRainfall(0.2F, 0.3F).setHeight(height_RockyWaters); Biome::coldBeach = (new BeachBiome(26))->setColor(0xFAF0C0)->setName(L"Cold Beach")->setTemperatureAndDownfall(0.05F, 0.3F)->setDepthAndScale(0.0F, 0.025F)->setSnowCovered()->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_IcePlains, eMinecraftColour_Foliage_IcePlains, eMinecraftColour_Water_IcePlains, eMinecraftColour_Sky_IcePlains); @@ -137,7 +137,7 @@ void Biome::staticCtor() Biome::swamplandM = (new SwampBiome(134))->setColor(0x07F9B2)->setName(L"Swampland M")->setLeafColor(0x8BAF48)->setDepthAndScale(-0.1f, 0.3f)->setTemperatureAndDownfall(0.8f, 0.9f)->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_Swampland, eMinecraftColour_Foliage_Swampland, eMinecraftColour_Water_Swampland,eMinecraftColour_Sky_Swampland); Biome::iceSpikes = (new IceBiome(140,true))->setColor(0xffffff)->setName(L"Ice Spikes")->setSnowCovered()->setTemperatureAndDownfall(0, 0.5f)->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_IcePlains, eMinecraftColour_Foliage_IcePlains, eMinecraftColour_Water_IcePlains,eMinecraftColour_Sky_IcePlains); Biome::jungleM = (new JungleBiome(149, false))->setColor(0x537b09)->setName(L"Jungle M")->setLeafColor(0x537b09)->setTemperatureAndDownfall(1.2f, 0.9f)->setDepthAndScale(0.2f, 0.4f)->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_Jungle, eMinecraftColour_Foliage_Jungle, eMinecraftColour_Water_Jungle,eMinecraftColour_Sky_Jungle); - Biome::jungleEdgeM = (new JungleBiome(151, true))->setColor(0x6458135)->setName(L"Jungle Edge M")->setLeafColor(0x5470985)->setTemperatureAndDownfall(0.95F, 0.8F); + Biome::jungleEdgeM = (new JungleBiome(151, true))->setColor(0x628b17)->setName(L"Jungle Edge M")->setLeafColor(0x537b09)->setTemperatureAndDownfall(0.95F, 0.8F)->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_Jungle, eMinecraftColour_Foliage_Jungle, eMinecraftColour_Water_JungleEdge, eMinecraftColour_Sky_JungleEdge); Biome::birchForestM=(new ForestBiome::MutatedBirchForestBiome(155, biomes[27]))->setColor(0x47875a)->setName(L"Birch Forest M")->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_Forest, eMinecraftColour_Foliage_Birch, eMinecraftColour_Water_Forest, eMinecraftColour_Sky_Forest); Biome::birchForestHillsM=(new ForestBiome::MutatedBirchForestBiome(156, biomes[28]))->setColor(0x47875a)->setName(L"Birch Forest Hills M")->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_ForestHills, eMinecraftColour_Foliage_Birch, eMinecraftColour_Water_Forest, eMinecraftColour_Sky_ForestHills); Biome::roofedForestM=(new ForestBiome::MutatedForestBiome(157, biomes[29]))->setColor(0x177a35)->setName(L"Roofed Forest M")->setLeafFoliageWaterSkyColor(eMinecraftColour_Grass_RoofedForest, eMinecraftColour_Foliage_RoofedForest, eMinecraftColour_Water_Forest, eMinecraftColour_Sky_Forest); diff --git a/Minecraft.World/Item.cpp b/Minecraft.World/Item.cpp index 27437a21..3ffe9a5a 100644 --- a/Minecraft.World/Item.cpp +++ b/Minecraft.World/Item.cpp @@ -397,7 +397,7 @@ void Item::staticCtor() Item::reeds = ( new TilePlanterItem(82, Tile::reeds) ) ->setIconName(L"reeds")->setDescriptionId(IDS_ITEM_REEDS)->setUseDescriptionId(IDS_DESC_REEDS); Item::paper = ( new Item(83) ) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_paper, Item::eMaterial_paper)->setIconName(L"paper")->setDescriptionId(IDS_ITEM_PAPER)->setUseDescriptionId(IDS_DESC_PAPER); Item::book = ( new BookItem(84) ) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_paper, Item::eMaterial_book)->setIconName(L"book")->setDescriptionId(IDS_ITEM_BOOK)->setUseDescriptionId(IDS_DESC_BOOK); - Item::slime_ball = ( new Item(85) ) ->setIconName(L"slimeball")->setDescriptionId(IDS_ITEM_SLIMEBALL)->setUseDescriptionId(IDS_DESC_SLIMEBALL); + Item::slime_ball = ( new Item(85) ) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_treasure, Item::eMaterial_slime)->setIconName(L"slimeball")->setDescriptionId(IDS_ITEM_SLIMEBALL)->setUseDescriptionId(IDS_DESC_SLIMEBALL); Item::chest_minecart = ( new MinecartItem(86, Minecart::TYPE_CHEST) ) ->setIconName(L"chest_minecart")->setDescriptionId(IDS_ITEM_MINECART_CHEST)->setUseDescriptionId(IDS_DESC_MINECARTWITHCHEST); Item::furnace_minecart = ( new MinecartItem(87, Minecart::TYPE_FURNACE) )->setIconName(L"furnace_minecart")->setDescriptionId(IDS_ITEM_MINECART_FURNACE)->setUseDescriptionId(IDS_DESC_MINECARTWITHFURNACE); Item::egg = ( new EggItem(88) ) ->setIconName(L"egg")->setDescriptionId(IDS_ITEM_EGG)->setUseDescriptionId(IDS_DESC_EGG); diff --git a/Minecraft.World/Item.h b/Minecraft.World/Item.h index 51908607..f1feb30f 100644 --- a/Minecraft.World/Item.h +++ b/Minecraft.World/Item.h @@ -87,6 +87,7 @@ public: eMaterial_redstone, eMaterial_coal, eMaterial_paper, + eMaterial_slime, eMaterial_book, eMaterial_bookshelf, eMaterial_wheat, diff --git a/Minecraft.World/PistonPieceEntity.cpp b/Minecraft.World/PistonPieceEntity.cpp index 627c4b28..6faa0daa 100644 --- a/Minecraft.World/PistonPieceEntity.cpp +++ b/Minecraft.World/PistonPieceEntity.cpp @@ -147,6 +147,7 @@ void PistonPieceEntity::moveCollidedEntities(float progress, float amount) { it->yd = amount; } + it->yd = it->yd * 1.25f; it->onGround = false; it->fallDistance = 0.0f; it->hasImpulse = true;