Skip to content

Commit

Permalink
Support for MC 1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinSRG committed Jun 18, 2022
1 parent 301044e commit 04d53c8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
17 changes: 13 additions & 4 deletions src/minecraft/mc_common.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/*
* This file is part of ImageToMapMC project
*
*
* Copyright (c) 2021 Agustin San Roman
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
Expand Down Expand Up @@ -66,6 +66,11 @@ minecraft::McVersion minecraft::getVersionFromText(std::string versionStr)
return McVersion::MC_1_18;
}

if (versionStr.substr(0, 4).compare("1.19") == 0)
{
return McVersion::MC_1_19;
}

if (versionStr.compare("last") == 0)
{
return MC_LAST_VERSION;
Expand All @@ -92,6 +97,8 @@ std::string minecraft::versionToString(minecraft::McVersion version)
return std::string("1.17.1");
case McVersion::MC_1_18:
return std::string("1.18.2");
case McVersion::MC_1_19:
return std::string("1.19");
default:
return std::string("???");
}
Expand All @@ -115,6 +122,8 @@ int minecraft::versionToDataVersion(minecraft::McVersion version)
return 2730;
case McVersion::MC_1_18:
return 2975;
case McVersion::MC_1_19:
return 3105;
default:
return 1343;
}
Expand All @@ -135,7 +144,7 @@ std::string minecraft::getMinecraftFolderLocation()
else
{
std::wstring resultStr(res);
char * resStr = new char[resultStr.length() * 2 + 1];
char *resStr = new char[resultStr.length() * 2 + 1];
int bytesW = WideCharToMultiByte(CP_UTF8, 0, res, resultStr.length(), resStr, resultStr.length() * 2 + 1, NULL, NULL);

resStr[bytesW] = '\0';
Expand Down
3 changes: 2 additions & 1 deletion src/minecraft/mc_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#pragma once

#define MC_LAST_VERSION (minecraft::McVersion::MC_1_18)
#define MC_LAST_VERSION (minecraft::McVersion::MC_1_19)

#include <string>

Expand All @@ -44,6 +44,7 @@ namespace minecraft
MC_1_16 = 16,
MC_1_17 = 17,
MC_1_18 = 18,
MC_1_19 = 19,
};

/**
Expand Down
21 changes: 13 additions & 8 deletions src/wx/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ MainWindow::MainWindow() : wxFrame(NULL, wxID_ANY, string("Minecraft Map Art Too

// Version
wxMenu *menuVersion = new wxMenu();
menuVersion->AppendRadioItem(getIdForVersionMenu(McVersion::MC_1_18), "&1.18.2", "Version: 1.18.2")->Check(true);
menuVersion->AppendRadioItem(getIdForVersionMenu(McVersion::MC_1_19), "&1.19", "Version: 1.19")->Check(true);
menuVersion->AppendRadioItem(getIdForVersionMenu(McVersion::MC_1_18), "&1.18.2", "Version: 1.18.2");
menuVersion->AppendRadioItem(getIdForVersionMenu(McVersion::MC_1_17), "&1.17.1", "Version: 1.17.1");
menuVersion->AppendRadioItem(getIdForVersionMenu(McVersion::MC_1_16), "&1.16.5", "Version: 1.16.5");
menuVersion->AppendRadioItem(getIdForVersionMenu(McVersion::MC_1_15), "&1.15.2", "Version: 1.15.2");
Expand Down Expand Up @@ -1033,30 +1034,34 @@ void MainWindow::updateMenuBarRadios()
GetMenuBar()->GetMenu(6)->GetMenuItems()[4]->Check(false);
GetMenuBar()->GetMenu(6)->GetMenuItems()[5]->Check(false);
GetMenuBar()->GetMenu(6)->GetMenuItems()[6]->Check(false);
GetMenuBar()->GetMenu(6)->GetMenuItems()[7]->Check(false);

switch (project.version)
{
case McVersion::MC_1_18:
case McVersion::MC_1_19:
GetMenuBar()->GetMenu(6)->GetMenuItems()[0]->Check(true);
break;
case McVersion::MC_1_17:
case McVersion::MC_1_18:
GetMenuBar()->GetMenu(6)->GetMenuItems()[1]->Check(true);
break;
case McVersion::MC_1_16:
case McVersion::MC_1_17:
GetMenuBar()->GetMenu(6)->GetMenuItems()[2]->Check(true);
break;
case McVersion::MC_1_15:
case McVersion::MC_1_16:
GetMenuBar()->GetMenu(6)->GetMenuItems()[3]->Check(true);
break;
case McVersion::MC_1_14:
case McVersion::MC_1_15:
GetMenuBar()->GetMenu(6)->GetMenuItems()[4]->Check(true);
break;
case McVersion::MC_1_13:
case McVersion::MC_1_14:
GetMenuBar()->GetMenu(6)->GetMenuItems()[5]->Check(true);
break;
default:
case McVersion::MC_1_13:
GetMenuBar()->GetMenu(6)->GetMenuItems()[6]->Check(true);
break;
default:
GetMenuBar()->GetMenu(6)->GetMenuItems()[7]->Check(true);
break;
}
}

Expand Down

0 comments on commit 04d53c8

Please sign in to comment.