Merge remote-tracking branch 'upstream/main'

This commit is contained in:
lspepinho 2026-03-02 20:26:03 -03:00
commit 6a1e012bf7
57 changed files with 282 additions and 226 deletions

View file

Before

Width:  |  Height:  |  Size: 952 KiB

After

Width:  |  Height:  |  Size: 952 KiB

View file

@ -5,6 +5,9 @@ on:
push: push:
branches: branches:
- 'main' - 'main'
paths-ignore:
- '.gitignore'
- '*.md'
jobs: jobs:
build: build:

View file

@ -56,7 +56,7 @@ void SoundEngine::playMusicTick() {};
#else #else
#ifdef _WINDOWS64 #ifdef _WINDOWS64
char SoundEngine::m_szSoundPath[]={"Windows64\\Sound\\"}; char SoundEngine::m_szSoundPath[]={"Windows64Media\\Sound\\"};
char SoundEngine::m_szMusicPath[]={"music\\"}; char SoundEngine::m_szMusicPath[]={"music\\"};
char SoundEngine::m_szRedistName[]={"redist64"}; char SoundEngine::m_szRedistName[]={"redist64"};
#elif defined _DURANGO #elif defined _DURANGO

View file

@ -1342,9 +1342,13 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
case eGameSetting_Gamma: case eGameSetting_Gamma:
if(iPad==ProfileManager.GetPrimaryPad()) if(iPad==ProfileManager.GetPrimaryPad())
{ {
#if defined(_WIN64) || defined(_WINDOWS64)
pMinecraft->options->set(Options::Option::GAMMA, ((float)GameSettingsA[iPad]->ucGamma) / 100.0f);
#else
// ucGamma range is 0-100, UpdateGamma is 0 - 32768 // ucGamma range is 0-100, UpdateGamma is 0 - 32768
float fVal=((float)GameSettingsA[iPad]->ucGamma)*327.68f; float fVal=((float)GameSettingsA[iPad]->ucGamma)*327.68f;
RenderManager.UpdateGamma((unsigned short)fVal); RenderManager.UpdateGamma((unsigned short)fVal);
#endif
} }
break; break;

View file

@ -903,7 +903,7 @@ void GameRenderer::updateLightTexture(float a)
if (_g > 1) _g = 1; if (_g > 1) _g = 1;
if (_b > 1) _b = 1; if (_b > 1) _b = 1;
float brightness = 0.0f; // 4J - TODO - was mc->options->gamma; float brightness = mc->options->gamma;
float ir = 1 - _r; float ir = 1 - _r;
float ig = 1 - _g; float ig = 1 - _g;

View file

@ -87,6 +87,8 @@ int g_iScreenHeight = 1080;
char g_Win64Username[17] = { 0 }; char g_Win64Username[17] = { 0 };
wchar_t g_Win64UsernameW[17] = { 0 }; wchar_t g_Win64UsernameW[17] = { 0 };
UINT g_ScreenWidth = 1920;
UINT g_ScreenHeight = 1080;
// Fullscreen toggle state // Fullscreen toggle state
static bool g_isFullscreen = false; static bool g_isFullscreen = false;
@ -429,7 +431,90 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
} }
return DefWindowProc(hWnd, message, wParam, lParam); return DefWindowProc(hWnd, message, wParam, lParam);
case WM_SIZE:
{
if (wParam == SIZE_MINIMIZED)
return 0;
UINT width = LOWORD(lParam);
UINT height = HIWORD(lParam);
if (width == 0 || height == 0)
return 0;
g_ScreenWidth = width;
g_ScreenHeight = height;
if (g_pSwapChain)
{
g_pImmediateContext->OMSetRenderTargets(0, 0, 0);
g_pImmediateContext->ClearState();
g_pImmediateContext->Flush();
if (g_pRenderTargetView)
{
g_pRenderTargetView->Release();
g_pRenderTargetView = nullptr;
}
if (g_pDepthStencilView)
{
g_pDepthStencilView->Release();
g_pDepthStencilView = nullptr;
}
if (g_pDepthStencilBuffer)
{
g_pDepthStencilBuffer->Release();
g_pDepthStencilBuffer = nullptr;
}
HRESULT hr = g_pSwapChain->ResizeBuffers(
0,
width,
height,
DXGI_FORMAT_UNKNOWN,
0
);
if (FAILED(hr))
{
app.DebugPrintf("ResizeBuffers Failed! HRESULT: 0x%X\n", hr);
return 0;
}
ID3D11Texture2D* pBackBuffer = nullptr;
g_pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&pBackBuffer);
g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &g_pRenderTargetView);
pBackBuffer->Release();
D3D11_TEXTURE2D_DESC descDepth = {};
descDepth.Width = width;
descDepth.Height = height;
descDepth.MipLevels = 1;
descDepth.ArraySize = 1;
descDepth.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
descDepth.SampleDesc.Count = 1;
descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL;
g_pd3dDevice->CreateTexture2D(&descDepth, NULL, &g_pDepthStencilBuffer);
g_pd3dDevice->CreateDepthStencilView(g_pDepthStencilBuffer, NULL, &g_pDepthStencilView);
g_pImmediateContext->OMSetRenderTargets(1, &g_pRenderTargetView, g_pDepthStencilView);
D3D11_VIEWPORT vp = {};
vp.Width = (FLOAT)width;
vp.Height = (FLOAT)height;
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
vp.TopLeftX = 0;
vp.TopLeftY = 0;
g_pImmediateContext->RSSetViewports(1, &vp);
}
}
break;
default: default:
return DefWindowProc(hWnd, message, wParam, lParam); return DefWindowProc(hWnd, message, wParam, lParam);
} }
@ -795,7 +880,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
srand((unsigned int)time(NULL)); srand((unsigned int)time(NULL));
} }
int r = rand() % 10000; // 09999 int r = rand() % 10000; // 0<EFBFBD>9999
snprintf(g_Win64Username, 17, "Player%04d", r); snprintf(g_Win64Username, 17, "Player%04d", r);
@ -1282,13 +1367,14 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
ToggleFullscreen(); ToggleFullscreen();
} }
// TAB opens host options menu. - Vvis :3 // TAB opens game info menu. - Vvis :3 - Updated by detectiveren
if (KMInput.IsKeyPressed(VK_TAB) && !ui.GetMenuDisplayed(0)) if (KMInput.IsKeyPressed(VK_TAB) && !ui.GetMenuDisplayed(0))
{ {
if (Minecraft* pMinecraft = Minecraft::GetInstance()) if (Minecraft* pMinecraft = Minecraft::GetInstance())
{ {
{ {
ui.NavigateToScene(0, eUIScene_InGameHostOptionsMenu); ui.NavigateToScene(0, eUIScene_InGameInfoMenu);
} }
} }
} }

View file

@ -48,9 +48,13 @@ void glLoadIdentity()
RenderManager.MatrixSetIdentity(); RenderManager.MatrixSetIdentity();
} }
extern UINT g_ScreenWidth;
extern UINT g_ScreenHeight;
void gluPerspective(float fovy, float aspect, float zNear, float zFar) void gluPerspective(float fovy, float aspect, float zNear, float zFar)
{ {
RenderManager.MatrixPerspective(fovy,aspect,zNear,zFar); float dynamicAspect = (float)g_ScreenWidth / (float)g_ScreenHeight;
RenderManager.MatrixPerspective(fovy, dynamicAspect, zNear, zFar);
} }
void glOrtho(float left,float right,float bottom,float top,float zNear,float zFar) void glOrtho(float left,float right,float bottom,float top,float zNear,float zFar)

View file

@ -12,7 +12,7 @@ ArmorSlot::ArmorSlot(int slotNum, shared_ptr<Container> container, int id, int x
{ {
} }
int ArmorSlot::getMaxStackSize() int ArmorSlot::getMaxStackSize() const
{ {
return 1; return 1;
} }

View file

@ -16,7 +16,7 @@ public:
ArmorSlot(int slotNum, shared_ptr<Container> container, int id, int x, int y); ArmorSlot(int slotNum, shared_ptr<Container> container, int id, int x, int y);
virtual ~ArmorSlot() {} virtual ~ArmorSlot() {}
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual bool mayPlace(shared_ptr<ItemInstance> item); virtual bool mayPlace(shared_ptr<ItemInstance> item);
Icon *getNoItemIcon(); Icon *getNoItemIcon();
//virtual bool mayCombine(shared_ptr<ItemInstance> item); // 4J Added //virtual bool mayCombine(shared_ptr<ItemInstance> item); // 4J Added

View file

@ -134,7 +134,7 @@ bool BeaconMenu::PaymentSlot::mayPlace(shared_ptr<ItemInstance> item)
return false; return false;
} }
int BeaconMenu::PaymentSlot::getMaxStackSize() int BeaconMenu::PaymentSlot::getMaxStackSize() const
{ {
return 1; return 1;
} }

View file

@ -14,7 +14,7 @@ private:
PaymentSlot(shared_ptr<Container> container, int slot, int x, int y); PaymentSlot(shared_ptr<Container> container, int slot, int x, int y);
bool mayPlace(shared_ptr<ItemInstance> item); bool mayPlace(shared_ptr<ItemInstance> item);
int getMaxStackSize(); int getMaxStackSize() const;
}; };
public: public:

View file

@ -346,7 +346,7 @@ void BeaconTileEntity::setCustomName(const wstring &name)
this->name = name; this->name = name;
} }
int BeaconTileEntity::getMaxStackSize() int BeaconTileEntity::getMaxStackSize() const
{ {
return 1; return 1;
} }

View file

@ -64,7 +64,7 @@ public:
wstring getCustomName(); wstring getCustomName();
bool hasCustomName(); bool hasCustomName();
void setCustomName(const wstring &name); void setCustomName(const wstring &name);
int getMaxStackSize(); int getMaxStackSize() const;
bool stillValid(shared_ptr<Player> player); bool stillValid(shared_ptr<Player> player);
void startOpen(); void startOpen();
void stopOpen(); void stopOpen();

View file

@ -183,7 +183,7 @@ bool BrewingStandMenu::PotionSlot::mayPlace(shared_ptr<ItemInstance> item)
return mayPlaceItem(item); return mayPlaceItem(item);
} }
int BrewingStandMenu::PotionSlot::getMaxStackSize() int BrewingStandMenu::PotionSlot::getMaxStackSize() const
{ {
return 1; return 1;
} }
@ -231,7 +231,7 @@ bool BrewingStandMenu::IngredientsSlot::mayCombine(shared_ptr<ItemInstance> seco
return false; return false;
} }
int BrewingStandMenu::IngredientsSlot::getMaxStackSize() int BrewingStandMenu::IngredientsSlot::getMaxStackSize() const
{ {
return 64; return 64;
} }

View file

@ -47,7 +47,7 @@ private:
PotionSlot(shared_ptr<Player> player, shared_ptr<Container> container, int slot, int x, int y); PotionSlot(shared_ptr<Player> player, shared_ptr<Container> container, int slot, int x, int y);
virtual bool mayPlace(shared_ptr<ItemInstance> item); virtual bool mayPlace(shared_ptr<ItemInstance> item);
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual void onTake(shared_ptr<Player> player, shared_ptr<ItemInstance> carried); virtual void onTake(shared_ptr<Player> player, shared_ptr<ItemInstance> carried);
static bool mayPlaceItem(shared_ptr<ItemInstance> item); static bool mayPlaceItem(shared_ptr<ItemInstance> item);
virtual bool mayCombine(shared_ptr<ItemInstance> item); // 4J Added virtual bool mayCombine(shared_ptr<ItemInstance> item); // 4J Added
@ -59,7 +59,7 @@ private:
IngredientsSlot(shared_ptr<Container> container, int slot, int x, int y); IngredientsSlot(shared_ptr<Container> container, int slot, int x, int y);
virtual bool mayPlace(shared_ptr<ItemInstance> item); virtual bool mayPlace(shared_ptr<ItemInstance> item);
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual bool mayCombine(shared_ptr<ItemInstance> item); // 4J Added virtual bool mayCombine(shared_ptr<ItemInstance> item); // 4J Added
}; };
}; };

View file

@ -397,7 +397,7 @@ void BrewingStandTileEntity::setItem(unsigned int slot, shared_ptr<ItemInstance>
} }
} }
int BrewingStandTileEntity::getMaxStackSize() int BrewingStandTileEntity::getMaxStackSize() const
{ {
// this value is not used for the potion slots // this value is not used for the potion slots
return 64; return 64;

View file

@ -45,7 +45,7 @@ public:
virtual shared_ptr<ItemInstance> removeItem(unsigned int slot, int i); virtual shared_ptr<ItemInstance> removeItem(unsigned int slot, int i);
virtual shared_ptr<ItemInstance> removeItemNoUpdate(int slot); virtual shared_ptr<ItemInstance> removeItemNoUpdate(int slot);
virtual void setItem(unsigned int slot, shared_ptr<ItemInstance> item); virtual void setItem(unsigned int slot, shared_ptr<ItemInstance> item);
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual bool stillValid(shared_ptr<Player> player); virtual bool stillValid(shared_ptr<Player> player);
virtual void startOpen(); virtual void startOpen();
virtual void stopOpen(); virtual void stopOpen();

View file

@ -167,7 +167,7 @@ void ChestTileEntity::save(CompoundTag *base)
base->putBoolean(L"bonus", isBonusChest); base->putBoolean(L"bonus", isBonusChest);
} }
int ChestTileEntity::getMaxStackSize() int ChestTileEntity::getMaxStackSize() const
{ {
return Container::LARGE_MAX_STACK_SIZE; return Container::LARGE_MAX_STACK_SIZE;
} }

View file

@ -59,7 +59,7 @@ public:
virtual void setCustomName(const wstring &name); virtual void setCustomName(const wstring &name);
virtual void load(CompoundTag *base); virtual void load(CompoundTag *base);
virtual void save(CompoundTag *base); virtual void save(CompoundTag *base);
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual bool stillValid(shared_ptr<Player> player); virtual bool stillValid(shared_ptr<Player> player);
virtual void setChanged(); virtual void setChanged();
virtual void clearCache(); virtual void clearCache();

View file

@ -70,7 +70,7 @@ void CompoundContainer::setItem(unsigned int slot, shared_ptr<ItemInstance> item
else c1->setItem(slot, item); else c1->setItem(slot, item);
} }
int CompoundContainer::getMaxStackSize() int CompoundContainer::getMaxStackSize() const
{ {
return c1->getMaxStackSize(); return c1->getMaxStackSize();
} }

View file

@ -24,7 +24,7 @@ public:
virtual shared_ptr<ItemInstance> removeItem(unsigned int slot, int i); virtual shared_ptr<ItemInstance> removeItem(unsigned int slot, int i);
virtual shared_ptr<ItemInstance> removeItemNoUpdate(int slot); virtual shared_ptr<ItemInstance> removeItemNoUpdate(int slot);
virtual void setItem(unsigned int slot, shared_ptr<ItemInstance> item); virtual void setItem(unsigned int slot, shared_ptr<ItemInstance> item);
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual void setChanged(); virtual void setChanged();
virtual bool stillValid(shared_ptr<Player> player); virtual bool stillValid(shared_ptr<Player> player);

View file

@ -20,7 +20,7 @@ public:
virtual wstring getName() = 0; virtual wstring getName() = 0;
virtual wstring getCustomName() = 0; // 4J Stu added for sending over the network virtual wstring getCustomName() = 0; // 4J Stu added for sending over the network
virtual bool hasCustomName() = 0; virtual bool hasCustomName() = 0;
virtual int getMaxStackSize() = 0; virtual int getMaxStackSize() const = 0;
virtual void setChanged() = 0; virtual void setChanged() = 0;
virtual bool stillValid(shared_ptr<Player> player) = 0; virtual bool stillValid(shared_ptr<Player> player) = 0;
virtual void startOpen() = 0; virtual void startOpen() = 0;

View file

@ -95,7 +95,7 @@ void CraftingContainer::setItem(unsigned int slot, shared_ptr<ItemInstance> item
if(menu) menu->slotsChanged(); if(menu) menu->slotsChanged();
} }
int CraftingContainer::getMaxStackSize() int CraftingContainer::getMaxStackSize() const
{ {
return Container::LARGE_MAX_STACK_SIZE; return Container::LARGE_MAX_STACK_SIZE;
} }

View file

@ -24,7 +24,7 @@ public:
virtual shared_ptr<ItemInstance> removeItemNoUpdate(int slot); virtual shared_ptr<ItemInstance> removeItemNoUpdate(int slot);
virtual shared_ptr<ItemInstance> removeItem(unsigned int slot, int count); virtual shared_ptr<ItemInstance> removeItem(unsigned int slot, int count);
virtual void setItem(unsigned int slot, shared_ptr<ItemInstance> item); virtual void setItem(unsigned int slot, shared_ptr<ItemInstance> item);
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual void setChanged(); virtual void setChanged();
bool stillValid(shared_ptr<Player> player); bool stillValid(shared_ptr<Player> player);

View file

@ -198,7 +198,7 @@ void DispenserTileEntity::save(CompoundTag *base)
if (hasCustomName()) base->putString(L"CustomName", name); if (hasCustomName()) base->putString(L"CustomName", name);
} }
int DispenserTileEntity::getMaxStackSize() int DispenserTileEntity::getMaxStackSize() const
{ {
return Container::LARGE_MAX_STACK_SIZE; return Container::LARGE_MAX_STACK_SIZE;
} }

View file

@ -45,7 +45,7 @@ public:
virtual bool hasCustomName(); virtual bool hasCustomName();
virtual void load(CompoundTag *base); virtual void load(CompoundTag *base);
virtual void save(CompoundTag *base); virtual void save(CompoundTag *base);
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual bool stillValid(shared_ptr<Player> player); virtual bool stillValid(shared_ptr<Player> player);
virtual void setChanged(); virtual void setChanged();

View file

@ -6,7 +6,7 @@ EnchantmentContainer::EnchantmentContainer(EnchantmentMenu *menu) : SimpleContai
{ {
} }
int EnchantmentContainer::getMaxStackSize() int EnchantmentContainer::getMaxStackSize() const
{ {
return 1; return 1;
} }

View file

@ -13,7 +13,7 @@ private:
EnchantmentMenu *m_menu; EnchantmentMenu *m_menu;
public: public:
EnchantmentContainer(EnchantmentMenu *menu); EnchantmentContainer(EnchantmentMenu *menu);
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual void setChanged(); virtual void setChanged();
virtual bool canPlaceItem(int slot, shared_ptr<ItemInstance> item); virtual bool canPlaceItem(int slot, shared_ptr<ItemInstance> item);
}; };

View file

@ -1468,25 +1468,17 @@ void Entity::onLoadedFromSave()
} }
ListTag<DoubleTag> *Entity::newDoubleList(unsigned int number, double firstValue, ...) template<typename ...Args>
ListTag<DoubleTag> *Entity::newDoubleList(unsigned int, double firstValue, Args... args)
{ {
ListTag<DoubleTag> *res = new ListTag<DoubleTag>(); ListTag<DoubleTag> *res = new ListTag<DoubleTag>();
// Add the first parameter to the ListTag // Add the first parameter to the ListTag
res->add( new DoubleTag(L"", firstValue ) ); res->add( new DoubleTag(L"", firstValue ) );
va_list vl; // use pre-C++17 fold trick (TODO: once we drop C++14 support, use C++14 fold expression)
va_start(vl,firstValue); using expander = int[];
(void)expander{0, (res->add(new DoubleTag(L"", static_cast<double>(args))), 0)...};
double val;
for (unsigned int i=1;i<number;i++)
{
val=va_arg(vl,double);
res->add(new DoubleTag(L"", val));
}
va_end(vl);
return res; return res;
} }

View file

@ -304,7 +304,8 @@ public:
virtual void onLoadedFromSave(); virtual void onLoadedFromSave();
protected: protected:
ListTag<DoubleTag> *newDoubleList(unsigned int number, double firstValue, ...); template<typename ...Args>
ListTag<DoubleTag> *newDoubleList(unsigned int, double firstValue, Args... args);
ListTag<FloatTag> *newFloatList(unsigned int number, float firstValue, float secondValue); ListTag<FloatTag> *newFloatList(unsigned int number, float firstValue, float secondValue);
public: public:

View file

@ -160,7 +160,7 @@ void FurnaceTileEntity::save(CompoundTag *base)
} }
int FurnaceTileEntity::getMaxStackSize() int FurnaceTileEntity::getMaxStackSize() const
{ {
return Container::LARGE_MAX_STACK_SIZE; return Container::LARGE_MAX_STACK_SIZE;
} }
@ -250,7 +250,7 @@ void FurnaceTileEntity::tick()
bool FurnaceTileEntity::canBurn() bool FurnaceTileEntity::canBurn()
{ {
if (items[SLOT_INPUT] == NULL) return false; if (items[SLOT_INPUT] == NULL) return false;
ItemInstance *burnResult = FurnaceRecipes::getInstance()->getResult(items[SLOT_INPUT]->getItem()->id); const ItemInstance *burnResult = FurnaceRecipes::getInstance()->getResult(items[SLOT_INPUT]->getItem()->id);
if (burnResult == NULL) return false; if (burnResult == NULL) return false;
if (items[SLOT_RESULT] == NULL) return true; if (items[SLOT_RESULT] == NULL) return true;
if (!items[SLOT_RESULT]->sameItem_not_shared(burnResult)) return false; if (!items[SLOT_RESULT]->sameItem_not_shared(burnResult)) return false;
@ -264,7 +264,7 @@ void FurnaceTileEntity::burn()
{ {
if (!canBurn()) return; if (!canBurn()) return;
ItemInstance *result = FurnaceRecipes::getInstance()->getResult(items[SLOT_INPUT]->getItem()->id); const ItemInstance *result = FurnaceRecipes::getInstance()->getResult(items[SLOT_INPUT]->getItem()->id);
if (items[SLOT_RESULT] == NULL) items[SLOT_RESULT] = result->copy(); if (items[SLOT_RESULT] == NULL) items[SLOT_RESULT] = result->copy();
else if (items[SLOT_RESULT]->id == result->id) items[SLOT_RESULT]->count++; else if (items[SLOT_RESULT]->id == result->id) items[SLOT_RESULT]->count++;

View file

@ -57,7 +57,7 @@ public:
virtual void setCustomName(const wstring &name); virtual void setCustomName(const wstring &name);
virtual void load(CompoundTag *base); virtual void load(CompoundTag *base);
virtual void save(CompoundTag *base); virtual void save(CompoundTag *base);
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
int getBurnProgress(int max); int getBurnProgress(int max);
int getLitProgress(int max); int getLitProgress(int max);
bool isLit(); bool isLit();

View file

@ -131,7 +131,7 @@ void HopperTileEntity::setCustomName(const wstring &name)
this->name = name; this->name = name;
} }
int HopperTileEntity::getMaxStackSize() int HopperTileEntity::getMaxStackSize() const
{ {
return Container::LARGE_MAX_STACK_SIZE; return Container::LARGE_MAX_STACK_SIZE;
} }

View file

@ -35,7 +35,7 @@ public:
virtual wstring getCustomName(); virtual wstring getCustomName();
virtual bool hasCustomName(); virtual bool hasCustomName();
virtual void setCustomName(const wstring &name); virtual void setCustomName(const wstring &name);
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual bool stillValid(shared_ptr<Player> player); virtual bool stillValid(shared_ptr<Player> player);
virtual void startOpen(); virtual void startOpen();
virtual void stopOpen(); virtual void stopOpen();

View file

@ -3,20 +3,3 @@
#include "I18n.h" #include "I18n.h"
Language *I18n::lang = Language::getInstance(); Language *I18n::lang = Language::getInstance();
wstring I18n::get(const wstring& id, ...)
{
#ifdef __PSVITA__ // 4J - vita doesn't like having a reference type as the last parameter passed to va_start - we shouldn't need this method anyway
return L"";
#elif _MSC_VER >= 1930 // VS2022+ also disallows va_start with reference types
return id;
#else
va_list va;
va_start(va, id);
return I18n::get(id, va);
#endif
}
wstring I18n::get(const wstring& id, va_list args)
{
return lang->getElement(id, args);
}

View file

@ -10,6 +10,9 @@ private:
static Language *lang; static Language *lang;
public: public:
static wstring get(const wstring& id, ...); template<typename ...Args>
static wstring get(const wstring& id, va_list args); static wstring get(Args... args)
{
return lang->getElement(std::forward<Args>(args)...);
}
}; };

View file

@ -592,7 +592,7 @@ bool Inventory::hasCustomName()
return false; return false;
} }
int Inventory::getMaxStackSize() int Inventory::getMaxStackSize() const
{ {
return MAX_INVENTORY_STACK_SIZE; return MAX_INVENTORY_STACK_SIZE;
} }

View file

@ -81,7 +81,7 @@ public:
wstring getName(); wstring getName();
wstring getCustomName(); wstring getCustomName();
bool hasCustomName(); bool hasCustomName();
int getMaxStackSize(); int getMaxStackSize() const;
bool canDestroy(Tile *tile); bool canDestroy(Tile *tile);
shared_ptr<ItemInstance> getArmor(int layer); shared_ptr<ItemInstance> getArmor(int layer);
int getArmorValue(); int getArmorValue();

View file

@ -668,7 +668,7 @@ shared_ptr<ItemInstance> Item::useTimeDepleted(shared_ptr<ItemInstance> itemInst
return itemInstance; return itemInstance;
} }
int Item::getMaxStackSize() int Item::getMaxStackSize() const
{ {
return maxStackSize; return maxStackSize;
} }

View file

@ -668,7 +668,7 @@ public:
virtual bool TestUse(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player); virtual bool TestUse(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player);
virtual shared_ptr<ItemInstance> use(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player); virtual shared_ptr<ItemInstance> use(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player);
virtual shared_ptr<ItemInstance> useTimeDepleted(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player); virtual shared_ptr<ItemInstance> useTimeDepleted(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player);
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual int getLevelDataForAuxValue(int auxValue); virtual int getLevelDataForAuxValue(int auxValue);
bool isStackedByData(); bool isStackedByData();

View file

@ -169,7 +169,7 @@ void ItemInstance::load(CompoundTag *compoundTag)
} }
} }
int ItemInstance::getMaxStackSize() int ItemInstance::getMaxStackSize() const
{ {
return getItem()->getMaxStackSize(); return getItem()->getMaxStackSize();
} }
@ -393,7 +393,7 @@ bool ItemInstance::sameItemWithTags(shared_ptr<ItemInstance> b)
} }
// 4J Stu - Added this for the one time when we compare with a non-shared pointer // 4J Stu - Added this for the one time when we compare with a non-shared pointer
bool ItemInstance::sameItem_not_shared(ItemInstance *b) bool ItemInstance::sameItem_not_shared(const ItemInstance *b)
{ {
return id == b->id && auxValue == b->auxValue; return id == b->id && auxValue == b->auxValue;
} }

View file

@ -82,7 +82,7 @@ public:
shared_ptr<ItemInstance> useTimeDepleted(Level *level, shared_ptr<Player> player); shared_ptr<ItemInstance> useTimeDepleted(Level *level, shared_ptr<Player> player);
CompoundTag *save(CompoundTag *compoundTag); CompoundTag *save(CompoundTag *compoundTag);
void load(CompoundTag *compoundTag); void load(CompoundTag *compoundTag);
int getMaxStackSize(); int getMaxStackSize() const;
bool isStackable(); bool isStackable();
bool isDamageableItem(); bool isDamageableItem();
bool isStackedByData(); bool isStackedByData();
@ -113,7 +113,7 @@ private:
public: public:
bool sameItem(shared_ptr<ItemInstance> b); bool sameItem(shared_ptr<ItemInstance> b);
bool sameItemWithTags(shared_ptr<ItemInstance> b); //4J Added bool sameItemWithTags(shared_ptr<ItemInstance> b); //4J Added
bool sameItem_not_shared(ItemInstance *b); // 4J Stu - Added this for the one time I need it bool sameItem_not_shared(const ItemInstance *b); // 4J Stu - Added this for the one time I need it
virtual unsigned int getUseDescriptionId(); // 4J Added virtual unsigned int getUseDescriptionId(); // 4J Added
virtual unsigned int getDescriptionId(int iData = -1); virtual unsigned int getDescriptionId(int iData = -1);
virtual ItemInstance *setDescriptionId(unsigned int id); virtual ItemInstance *setDescriptionId(unsigned int id);

View file

@ -14,37 +14,12 @@ Language *Language::getInstance()
return singleton; return singleton;
} }
/* 4J Jev, creates 2 identical functions. std::wstring Language::getElementName(const std::wstring& elementId)
wstring Language::getElement(const wstring& elementId)
{
return elementId;
} */
wstring Language::getElement(const wstring& elementId, ...)
{
#ifdef __PSVITA__ // 4J - vita doesn't like having a reference type as the last parameter passed to va_start - we shouldn't need this method anyway
return L"";
#elif _MSC_VER >= 1930 // VS2022+ also disallows va_start with reference types
return elementId;
#else
va_list args;
va_start(args, elementId);
return getElement(elementId, args);
#endif
}
wstring Language::getElement(const wstring& elementId, va_list args)
{
// 4J TODO
return elementId;
}
wstring Language::getElementName(const wstring& elementId)
{ {
return elementId; return elementId;
} }
wstring Language::getElementDescription(const wstring& elementId) std::wstring Language::getElementDescription(const std::wstring& elementId)
{ {
return elementId; return elementId;
} }

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <string>
class Language class Language
{ {
private: private:
@ -7,8 +9,11 @@ private:
public: public:
Language(); Language();
static Language *getInstance(); static Language *getInstance();
wstring getElement(const wstring& elementId, ...); template<typename...Args>
wstring getElement(const wstring& elementId, va_list args); inline std::wstring getElement(const std::wstring& elementId, Args...)
wstring getElementName(const wstring& elementId); {
wstring getElementDescription(const wstring& elementId); return elementId;
}
std::wstring getElementName(const std::wstring& elementId);
std::wstring getElementDescription(const std::wstring& elementId);
}; };

View file

@ -105,7 +105,7 @@ bool MerchantContainer::hasCustomName()
return false; return false;
} }
int MerchantContainer::getMaxStackSize() int MerchantContainer::getMaxStackSize() const
{ {
return Container::LARGE_MAX_STACK_SIZE; return Container::LARGE_MAX_STACK_SIZE;
} }

View file

@ -33,7 +33,7 @@ public:
wstring getName(); wstring getName();
wstring getCustomName(); wstring getCustomName();
bool hasCustomName(); bool hasCustomName();
int getMaxStackSize(); int getMaxStackSize() const;
bool stillValid(shared_ptr<Player> player); bool stillValid(shared_ptr<Player> player);
void startOpen(); void startOpen();
void stopOpen(); void stopOpen();

View file

@ -127,7 +127,7 @@ wstring MinecartContainer::getName()
return hasCustomName() ? getCustomName() : app.GetString(IDS_CONTAINER_MINECART); return hasCustomName() ? getCustomName() : app.GetString(IDS_CONTAINER_MINECART);
} }
int MinecartContainer::getMaxStackSize() int MinecartContainer::getMaxStackSize() const
{ {
return Container::LARGE_MAX_STACK_SIZE; return Container::LARGE_MAX_STACK_SIZE;
} }

View file

@ -26,7 +26,7 @@ public:
virtual void stopOpen(); virtual void stopOpen();
virtual bool canPlaceItem(int slot, shared_ptr<ItemInstance> item); virtual bool canPlaceItem(int slot, shared_ptr<ItemInstance> item);
virtual wstring getName(); virtual wstring getName();
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual void changeDimension(int i); virtual void changeDimension(int i);
virtual void remove(); virtual void remove();

View file

@ -54,7 +54,7 @@ public:
virtual wstring getName() { return MinecartContainer::getName(); } virtual wstring getName() { return MinecartContainer::getName(); }
virtual wstring getCustomName() { return MinecartContainer::getCustomName(); } virtual wstring getCustomName() { return MinecartContainer::getCustomName(); }
virtual bool hasCustomName() { return MinecartContainer::hasCustomName(); } virtual bool hasCustomName() { return MinecartContainer::hasCustomName(); }
virtual int getMaxStackSize() { return MinecartContainer::getMaxStackSize(); } virtual int getMaxStackSize() const { return MinecartContainer::getMaxStackSize(); }
virtual void setChanged() { MinecartContainer::setChanged(); } virtual void setChanged() { MinecartContainer::setChanged(); }
virtual bool stillValid(shared_ptr<Player> player) { return MinecartContainer::stillValid(player); } virtual bool stillValid(shared_ptr<Player> player) { return MinecartContainer::stillValid(player); }

View file

@ -58,7 +58,7 @@ void ResultContainer::setItem(unsigned int slot, shared_ptr<ItemInstance> item)
items[0] = item; items[0] = item;
} }
int ResultContainer::getMaxStackSize() int ResultContainer::getMaxStackSize() const
{ {
return Container::LARGE_MAX_STACK_SIZE; return Container::LARGE_MAX_STACK_SIZE;
} }

View file

@ -19,7 +19,7 @@ public:
virtual shared_ptr<ItemInstance> removeItem(unsigned int slot, int count); virtual shared_ptr<ItemInstance> removeItem(unsigned int slot, int count);
virtual shared_ptr<ItemInstance> removeItemNoUpdate(int slot); virtual shared_ptr<ItemInstance> removeItemNoUpdate(int slot);
virtual void setItem(unsigned int slot, shared_ptr<ItemInstance> item); virtual void setItem(unsigned int slot, shared_ptr<ItemInstance> item);
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual void setChanged(); virtual void setChanged();
virtual bool stillValid(shared_ptr<Player> player); virtual bool stillValid(shared_ptr<Player> player);
virtual void startOpen() { } // TODO Auto-generated method stub virtual void startOpen() { } // TODO Auto-generated method stub

View file

@ -106,7 +106,7 @@ void SimpleContainer::setCustomName(const wstring &name)
this->stringName = name; this->stringName = name;
} }
int SimpleContainer::getMaxStackSize() int SimpleContainer::getMaxStackSize() const
{ {
return Container::LARGE_MAX_STACK_SIZE; return Container::LARGE_MAX_STACK_SIZE;
} }

View file

@ -28,7 +28,7 @@ public:
virtual wstring getCustomName(); virtual wstring getCustomName();
virtual bool hasCustomName(); virtual bool hasCustomName();
virtual void setCustomName(const wstring &name); virtual void setCustomName(const wstring &name);
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual void setChanged(); virtual void setChanged();
virtual bool stillValid(shared_ptr<Player> player); virtual bool stillValid(shared_ptr<Player> player);
virtual void startOpen() { } // TODO Auto-generated method stub virtual void startOpen() { } // TODO Auto-generated method stub

View file

@ -91,7 +91,7 @@ void Slot::setChanged()
container->setChanged(); container->setChanged();
} }
int Slot::getMaxStackSize() int Slot::getMaxStackSize() const
{ {
return container->getMaxStackSize(); return container->getMaxStackSize();
} }

View file

@ -31,7 +31,7 @@ public:
virtual bool hasItem(); virtual bool hasItem();
virtual void set(shared_ptr<ItemInstance> item); virtual void set(shared_ptr<ItemInstance> item);
virtual void setChanged(); virtual void setChanged();
virtual int getMaxStackSize(); virtual int getMaxStackSize() const;
virtual Icon *getNoItemIcon(); virtual Icon *getNoItemIcon();
virtual shared_ptr<ItemInstance> remove(int c); virtual shared_ptr<ItemInstance> remove(int c);
virtual bool isAt(shared_ptr<Container> c, int s); virtual bool isAt(shared_ptr<Container> c, int s);

View file

@ -2,11 +2,11 @@
[![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2?logo=discord&logoColor=white)](https://discord.gg/5CSzhc9t) [![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2?logo=discord&logoColor=white)](https://discord.gg/5CSzhc9t)
![Tutorial World](.github/IMG_8725.png) ![Tutorial World](.github/TutorialWorld.png)
## Introduction ## Introduction
This project contains the source code of Minecraft Legacy Console Edition v1.3.0494.0 from https://archive.org/details/minecraft-legacy-console-edition-source-code, with some fixes and improvements applied This project contains the source code of Minecraft Legacy Console Edition v1.6.0560.0 (TU19) from https://archive.org/details/minecraft-legacy-console-edition-source-code, with some fixes and improvements applied
[Nightly Build](https://github.com/smartcmd/MinecraftConsoles/releases/tag/nightly) [Nightly Build](https://github.com/smartcmd/MinecraftConsoles/releases/tag/nightly)
@ -42,7 +42,7 @@ This project contains the source code of Minecraft Legacy Console Edition v1.3.0
- **Use / Place**: `Right Click` - **Use / Place**: `Right Click`
- **Select Item**: `Mouse Wheel` or keys `1` to `9` - **Select Item**: `Mouse Wheel` or keys `1` to `9`
- **Accept or Decline Tutorial hints**: `Enter` to accept and `B` to decline - **Accept or Decline Tutorial hints**: `Enter` to accept and `B` to decline
- **Host Options**: `TAB` - **Game Info (Player list and Host Options)**: `TAB`
- **Toggle Debug Info**: `F3` - **Toggle Debug Info**: `F3`
- **Open Debug Overlay**: `F4` - **Open Debug Overlay**: `F4`