diff --git a/.github/workflows/nightly-server.yml b/.github/workflows/nightly-server.yml index 5450de9ac..0fc20eb13 100644 --- a/.github/workflows/nightly-server.yml +++ b/.github/workflows/nightly-server.yml @@ -5,11 +5,12 @@ on: push: branches: - 'main' - paths-ignore: - - '.gitignore' - - '*.md' - - '.github/**' - - '!.github/workflows/nightly-server.yml' + paths: + - '**' + - '!.gitignore' + - '!*.md' + - '!.github/**' + - '.github/workflows/nightly-server.yml' permissions: contents: write diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 789db3e84..a5b53be08 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -5,11 +5,12 @@ on: push: branches: - 'main' - paths-ignore: - - '.gitignore' - - '*.md' - - '.github/**' - - '!.github/workflows/nightly.yml' + paths: + - '**' + - '!.gitignore' + - '!*.md' + - '!.github/**' + - '.github/workflows/nightly.yml' permissions: contents: write diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 9d57f4b4b..3b5398a00 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -4,10 +4,12 @@ on: workflow_dispatch: pull_request: types: [opened, reopened, synchronize] - paths-ignore: - - '.gitignore' - - '*.md' - - '.github/*.md' + paths: + - '**' + - '!.gitignore' + - '!*.md' + - '!.github/**' + - '.github/workflows/pull-request.yml' jobs: build: diff --git a/Minecraft.Client/ChatScreen.cpp b/Minecraft.Client/ChatScreen.cpp index fffa1562f..992ae48dc 100644 --- a/Minecraft.Client/ChatScreen.cpp +++ b/Minecraft.Client/ChatScreen.cpp @@ -11,6 +11,7 @@ const wstring ChatScreen::allowedChars = SharedConstants::acceptableLetters; vector ChatScreen::s_chatHistory; int ChatScreen::s_historyIndex = -1; wstring ChatScreen::s_historyDraft; +int ChatScreen::s_chatIndex = 0; bool ChatScreen::isAllowedChatChar(wchar_t c) { @@ -22,6 +23,8 @@ ChatScreen::ChatScreen() frame = 0; cursorIndex = 0; s_historyIndex = -1; + + ChatScreen::s_chatIndex = 0; } void ChatScreen::init() @@ -83,6 +86,20 @@ void ChatScreen::handleHistoryDown() applyHistoryMessage(); } +int ChatScreen::getChatIndex() +{ + return ChatScreen::s_chatIndex; +} + +void ChatScreen::correctChatIndex(int newChatIndex) { + ChatScreen::s_chatIndex = newChatIndex; +} + +void ChatScreen::setWheelValue(int wheel) { + ChatScreen::s_chatIndex += wheel; + if (ChatScreen::s_chatIndex < 0) ChatScreen::s_chatIndex = 0; +} + void ChatScreen::keyPressed(wchar_t ch, int eventKey) { if (eventKey == Keyboard::KEY_ESCAPE) diff --git a/Minecraft.Client/ChatScreen.h b/Minecraft.Client/ChatScreen.h index c4e37a937..70d65e8ce 100644 --- a/Minecraft.Client/ChatScreen.h +++ b/Minecraft.Client/ChatScreen.h @@ -16,6 +16,7 @@ private: static std::vector s_chatHistory; static int s_historyIndex; static wstring s_historyDraft; + static int s_chatIndex; static const wstring allowedChars; static bool isAllowedChatChar(wchar_t c); @@ -28,6 +29,9 @@ public: virtual void handleHistoryUp(); virtual void handleHistoryDown(); + static int getChatIndex(); + static void correctChatIndex(int newChatIndex); + static void setWheelValue(int wheel); protected: void keyPressed(wchar_t ch, int eventKey); public: diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index b12ea5e73..046acefe5 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "UIController.h" +#include #include "UI.h" #include "UIScene.h" #include "UIControl_Slider.h" @@ -1428,6 +1429,9 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) } #endif + if (key == 4) ChatScreen::setWheelValue(1); + if (key == 5) ChatScreen::setWheelValue(-1); + if(pressed) app.DebugPrintf("Pressed %d\n",key); if(released) app.DebugPrintf("Released %d\n",key); // Repeat handling diff --git a/Minecraft.Client/Common/UI/UIScene_Credits.cpp b/Minecraft.Client/Common/UI/UIScene_Credits.cpp index 02dc66201..8c8d43bc1 100644 --- a/Minecraft.Client/Common/UI/UIScene_Credits.cpp +++ b/Minecraft.Client/Common/UI/UIScene_Credits.cpp @@ -491,17 +491,19 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = {L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {L"MinecraftConsoles", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eExtraLargeText}, - {L"Project Maintainers", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eLargeText}, - {L"smartcmd", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, - {L"codeHusky", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, - {L"Patoke", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, - {L"rtm516", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, - {L"mattsumi", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, - {L"dxf", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, - {L"la", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, - {L"Thank you to our 100+ contributors on GitHub!", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eLargeText}, - {L"github.com/smartcmd/MinecraftConsoles", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, + {L"Project Maintainers", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eLargeText}, + {L"codeHusky", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, + {L"mattsumi", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, + {L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, + {L"Former Maintainers", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eLargeText}, + {L"smartcmd", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, + {L"Patoke", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, + {L"rtm516", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, + {L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, + {L"Thank you to our 120+ contributors on GitHub!", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eLargeText}, + {L"github.com/MCLCE/MinecraftConsoles", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, + {L"(formerly smartcmd/MinecraftConsoles)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {L"Additional Thanks", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eLargeText}, diff --git a/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp b/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp index 5b10e8cfe..6ca6abb18 100644 --- a/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp @@ -50,14 +50,7 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer) Minecraft *pMinecraft = Minecraft::GetInstance(); wstring playerName = L""; - if(pMinecraft->localplayers[ui.GetWinUserIndex()] != nullptr) - { - playerName = escapeXML( pMinecraft->localplayers[ui.GetWinUserIndex()]->getDisplayName() ); - } - else - { - playerName = escapeXML( pMinecraft->localplayers[ProfileManager.GetPrimaryPad()]->getDisplayName() ); - } + playerName = escapeXML( pMinecraft->localplayers[ProfileManager.GetPrimaryPad()]->getDisplayName() ); noNoiseString = replaceAll(noNoiseString,L"{*PLAYER*}",playerName); Random random(8124371); diff --git a/Minecraft.Client/Common/UI/UIScene_HUD.cpp b/Minecraft.Client/Common/UI/UIScene_HUD.cpp index 4c8c66df4..04023fb94 100644 --- a/Minecraft.Client/Common/UI/UIScene_HUD.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HUD.cpp @@ -9,6 +9,7 @@ #include "..\..\EnderDragonRenderer.h" #include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h" #include "..\..\..\Minecraft.World\StringHelpers.h" +#include UIScene_HUD::UIScene_HUD(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { @@ -763,16 +764,31 @@ void UIScene_HUD::render(S32 width, S32 height, C4JRender::eViewportType viewpor void UIScene_HUD::handleTimerComplete(int id) { Minecraft *pMinecraft = Minecraft::GetInstance(); + bool isChatOpen = (dynamic_cast(pMinecraft->getScreen()) != nullptr); bool anyVisible = false; if(pMinecraft->localplayers[m_iPad]!= nullptr) { Gui *pGui = pMinecraft->gui; - //DWORD messagesToDisplay = min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) ); - for( unsigned int i = 0; i < CHAT_LINES_COUNT; ++i ) + DWORD totalMessages = pGui->getMessagesCount(m_iPad); + DWORD messagesToDisplay = min( CHAT_LINES_COUNT, totalMessages); + DWORD maxScroll = max(0, totalMessages - messagesToDisplay); + + bool canScroll = messagesToDisplay < totalMessages; + int startIndex = (canScroll && isChatOpen ? ChatScreen::getChatIndex() : 0); + + if (startIndex > maxScroll) { + ChatScreen::correctChatIndex(maxScroll); + startIndex = maxScroll; + } + + app.DebugPrintf("handleTimerComplete: %d | %d | %d\n", maxScroll, startIndex, totalMessages); + + for( unsigned int i = 0; i < messagesToDisplay; ++i ) { - float opacity = pGui->getOpacity(m_iPad, i); - if( opacity > 0 ) + unsigned int msgIndex = startIndex + i; + float opacity = pGui->getOpacity(m_iPad, msgIndex); + if( opacity > 0 || isChatOpen) { #if 0 // def _WINDOWS64 // Use Iggy chat until Gui::render has visual parity // Chat drawn by Gui::render with color codes. Hides Iggy chat to avoid double chats. @@ -780,9 +796,10 @@ void UIScene_HUD::handleTimerComplete(int id) m_labelChatText[i].setOpacity(0); m_labelChatText[i].setLabel(L""); #else - m_controlLabelBackground[i].setOpacity(opacity); - m_labelChatText[i].setOpacity(opacity); - m_labelChatText[i].setLabel( pGui->getMessagesCount(m_iPad) ? pGui->getMessage(m_iPad,i) : L"" ); + + m_controlLabelBackground[i].setOpacity((isChatOpen ? 1 : opacity)); + m_labelChatText[i].setOpacity((isChatOpen ? 1 : opacity)); + m_labelChatText[i].setLabel(pGui->getMessage(m_iPad, msgIndex)); #endif anyVisible = true; } diff --git a/Minecraft.Client/EntityTracker.cpp b/Minecraft.Client/EntityTracker.cpp index 087227e77..6f482b608 100644 --- a/Minecraft.Client/EntityTracker.cpp +++ b/Minecraft.Client/EntityTracker.cpp @@ -81,7 +81,7 @@ void EntityTracker::addEntity(shared_ptr e, int range, int updateInterva { assert(false); // Entity already tracked } - if( e->entityId >= 2048 ) + if( e->entityId >= 16384 ) { __debugbreak(); } diff --git a/Minecraft.Client/Font.cpp b/Minecraft.Client/Font.cpp index 1040eaa08..ff5b7ef2d 100644 --- a/Minecraft.Client/Font.cpp +++ b/Minecraft.Client/Font.cpp @@ -310,6 +310,8 @@ void Font::draw(const wstring &str, bool dropShadow, int initialColor) t->begin(); t->color(currentColor & 0x00ffffff, (currentColor >> 24) & 255); + bool prev = t->setMipmapEnable(false); // Disable mipmapping for fonts, and save previous enabled value to be restored later - Botch + for (int i = 0; i < static_cast(cleanStr.length()); ++i) { // Map character @@ -371,6 +373,8 @@ void Font::draw(const wstring &str, bool dropShadow, int initialColor) addCharacterQuad(c); } + t->setMipmapEnable(prev); //Reinstates previously used enabled value - Botch + t->end(); } diff --git a/Minecraft.Client/Gui.cpp b/Minecraft.Client/Gui.cpp index 103bfb7bf..18257ba48 100644 --- a/Minecraft.Client/Gui.cpp +++ b/Minecraft.Client/Gui.cpp @@ -1208,7 +1208,20 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) // Disable the depth test so the text shows on top of the paperdoll glDisable(GL_DEPTH_TEST); +#ifdef _WINDOWS64 + float scaleWidth = (g_rScreenWidth / 1920.0f); + float scaleHeight = (g_rScreenHeight / 1080.0f); + float scale = min(scaleWidth, scaleHeight); //stop stretching + + if (scale < 0.5f) scale = 0.5f; // force minimum scale + if (scale > 1.2f) // resolutions over 1296 pixels tall + { + scale = scale - 0.33f; // tame overscaling on 1440p + } + + glScalef(scale, scale, 1); +#endif // Loop through the lines and draw them all on screen int yPos = debugTop; for (const auto &line : lines) @@ -1217,6 +1230,9 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) yPos += 10; } +#ifdef _WINDOWS64 + glScalef(1, 1, 1); +#endif // Restore the depth test glEnable(GL_DEPTH_TEST); diff --git a/Minecraft.Client/Gui.h b/Minecraft.Client/Gui.h index 5397823bc..527b0237e 100644 --- a/Minecraft.Client/Gui.h +++ b/Minecraft.Client/Gui.h @@ -17,6 +17,7 @@ private: static const int m_iMaxMessageWidth = 280; static ItemRenderer *itemRenderer; vector guiMessages[XUSER_MAX_COUNT]; + int chatIndex = 0; Random *random; Minecraft *minecraft; diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 1ba432fd0..10167f955 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -1537,8 +1537,12 @@ void Minecraft::run_middle() // Utility keys always work regardless of KBM active state if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_PAUSE) && !ui.GetMenuDisplayed(i)) { - localplayers[i]->ullButtonsPressed|=1LL<(getScreen()) != nullptr) { + setScreen(nullptr); + } else { + localplayers[i]->ullButtonsPressed|=1LL< _sheep, int layer, floa int c2 = (value + 1) % Sheep::COLOR_LENGTH; float subStep = ((sheep->tickCount % colorDuration) + a) / static_cast(colorDuration); - glColor3f(Sheep::COLOR[c1][0] * (1.0f - subStep) + Sheep::COLOR[c2][0] * subStep, Sheep::COLOR[c1][1] * (1.0f - subStep) + Sheep::COLOR[c2][1] * subStep, Sheep::COLOR[c1][2] - * (1.0f - subStep) + Sheep::COLOR[c2][2] * subStep); + glColor3f( + Sheep::COLOR[c1][0] * (1.0f - subStep) + Sheep::COLOR[c2][0] * subStep, + Sheep::COLOR[c1][1] * (1.0f - subStep) + Sheep::COLOR[c2][1] * subStep, + Sheep::COLOR[c1][2] * (1.0f - subStep) + Sheep::COLOR[c2][2] * subStep); } else { - int color = sheep->getColor(); - glColor3f(Sheep::COLOR[color][0], Sheep::COLOR[color][1], Sheep::COLOR[color][2]); + float brightness = SharedConstants::TEXTURE_LIGHTING ? 1.0f : sheep->getBrightness(a); + int color = sheep->getColor(); + glColor3f(brightness * Sheep::COLOR[color][0], brightness * Sheep::COLOR[color][1], brightness * Sheep::COLOR[color][2]); + } // 4J - change brought forward from 1.8.2 - float brightness = SharedConstants::TEXTURE_LIGHTING ? 1.0f : sheep->getBrightness(a); - int color = sheep->getColor(); - glColor3f(brightness * Sheep::COLOR[color][0], brightness * Sheep::COLOR[color][1], brightness * Sheep::COLOR[color][2]); + + + /* Fix; this code originally completely overrided the _jeb and normal textures so i just commented it out and updated the part that should have worked. + + float brightness = SharedConstants::TEXTURE_LIGHTING ? 1.0f : sheep->getBrightness(a); + int color = sheep->getColor(); + glColor3f(brightness * Sheep::COLOR[color][0], brightness * Sheep::COLOR[color][1], brightness * Sheep::COLOR[color][2]); */ + + return 1; } return -1; diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index bee49df0e..3019c6f2a 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -57,6 +57,13 @@ extern Renderer InternalRenderManager; #include "Xbox/resource.h" +// request use of dedicated GPU from AMD and Nvidia drivers +extern "C" +{ + __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; + __declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001; +} + #ifdef _MSC_VER #pragma comment(lib, "legacy_stdio_definitions.lib") #endif diff --git a/Minecraft.Server/cmake/sources/Common.cmake b/Minecraft.Server/cmake/sources/Common.cmake index 1eaceee16..58ae26ce2 100644 --- a/Minecraft.Server/cmake/sources/Common.cmake +++ b/Minecraft.Server/cmake/sources/Common.cmake @@ -494,6 +494,7 @@ set(_MINECRAFT_SERVER_COMMON_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/iob_shim.asm" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/stdafx.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/stubs.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.World/Entity.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.World/ConsoleSaveFileOriginal.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.World/ConsoleSaveFileOriginal.h" "${CMAKE_CURRENT_SOURCE_DIR}/../include/lce_filesystem/lce_filesystem.cpp" diff --git a/Minecraft.World/Entity.cpp b/Minecraft.World/Entity.cpp index 924312e59..6e275a2c3 100644 --- a/Minecraft.World/Entity.cpp +++ b/Minecraft.World/Entity.cpp @@ -27,13 +27,17 @@ const wstring Entity::RIDING_TAG = L"Riding"; -int Entity::entityCounter = 2048; // 4J - changed initialiser to 2048, as we are using range 0 - 2047 as special unique smaller ids for things that need network tracked +//int Entity::entityCounter = 2048; // 4J - changed initialiser to 2048, as we are using range 0 - 2047 as special unique smaller ids for things that need network tracked +int Entity::entityCounter = 16384; //now using full range of 0 - 16383, limit is 32k but we shouldnt need that yet DWORD Entity::tlsIdx = TlsAlloc(); // 4J - added getSmallId & freeSmallId methods -unsigned int Entity::entityIdUsedFlags[2048/32] = {0}; -unsigned int Entity::entityIdWanderFlags[2048/32] = {0}; -unsigned int Entity::entityIdRemovingFlags[2048/32] = {0}; +//unsigned int Entity::entityIdUsedFlags[2048/32] = {0}; +//unsigned int Entity::entityIdWanderFlags[2048/32] = {0}; +//unsigned int Entity::entityIdRemovingFlags[2048/32] = {0}; +unsigned int Entity::entityIdUsedFlags[16384/32] = {0}; +unsigned int Entity::entityIdWanderFlags[16384/32] = {0}; +unsigned int Entity::entityIdRemovingFlags[16384/32] = {0}; int Entity::extraWanderIds[EXTRA_WANDER_MAX] = {0}; int Entity::extraWanderTicks = 0; int Entity::extraWanderCount = 0; @@ -65,7 +69,7 @@ int Entity::getSmallId() } } - for( int i = 0; i < (2048 / 32 ); i++ ) + for( int i = 0; i < (16384 / 32 ); i++ ) { unsigned int uiFlags = *puiUsedFlags; if( uiFlags != 0xffffffff ) @@ -102,7 +106,7 @@ int Entity::getSmallId() if (entityCounter == 0x7ffffff) { - entityCounter = 2048; + entityCounter = 16384; } return fallbackId; #else @@ -116,7 +120,7 @@ void Entity::countFlagsForPIX() { int freecount = 0; unsigned int *puiUsedFlags = entityIdUsedFlags; - for( int i = 0; i < (2048 / 32 ); i++ ) + for( int i = 0; i < (16384 / 32 ); i++ ) { unsigned int uiFlags = *puiUsedFlags; if( uiFlags != 0xffffffff ) @@ -134,7 +138,7 @@ void Entity::countFlagsForPIX() puiUsedFlags++; } PIXAddNamedCounter(freecount,"Small Ids free"); - PIXAddNamedCounter(2048 - freecount,"Small Ids used"); + PIXAddNamedCounter(16384 - freecount,"Small Ids used"); } void Entity::resetSmallId() @@ -149,7 +153,7 @@ void Entity::resetSmallId() void Entity::freeSmallId(int index) { if( ( (size_t)TlsGetValue(tlsIdx) ) == 0 ) return; // Don't do anything with small ids if this isn't the server thread - if( index >= 2048 ) return; // Don't do anything if this isn't a short id + if( index >= 16384 ) return; // Don't do anything if this isn't a short id unsigned int i = index / 32; unsigned int j = index % 32; @@ -172,7 +176,7 @@ void Entity::useSmallIds() void Entity::considerForExtraWandering(bool enable) { if( ( (size_t)TlsGetValue(tlsIdx) ) == 0 ) return; // Don't do anything with small ids if this isn't the server thread - if( entityId >= 2048 ) return; // Don't do anything if this isn't a short id + if( entityId >= 16384 ) return; // Don't do anything if this isn't a short id unsigned int i = entityId / 32; unsigned int j = entityId % 32; @@ -192,7 +196,7 @@ void Entity::considerForExtraWandering(bool enable) bool Entity::isExtraWanderingEnabled() { if( ( (size_t)TlsGetValue(tlsIdx) ) == 0 ) return false; // Don't do anything with small ids if this isn't the server thread - if( entityId >= 2048 ) return false; // Don't do anything if this isn't a short id + if( entityId >= 16384 ) return false; // Don't do anything if this isn't a short id for( int i = 0; i < extraWanderCount; i++ ) { @@ -224,12 +228,12 @@ void Entity::tickExtraWandering() int entityId = 0; if( extraWanderCount ) { - entityId = ( extraWanderIds[ extraWanderCount - 1 ] + 1 ) % 2048; + entityId = ( extraWanderIds[ extraWanderCount - 1 ] + 1 ) % 16384; } extraWanderCount = 0; - for( int k = 0; ( k < 2048 ) && ( extraWanderCount < EXTRA_WANDER_MAX); k++ ) + for( int k = 0; ( k < 16384 ) && ( extraWanderCount < EXTRA_WANDER_MAX); k++ ) { unsigned int i = entityId / 32; unsigned int j = entityId % 32; @@ -241,7 +245,7 @@ void Entity::tickExtraWandering() // printf("%d, ", entityId); } - entityId = ( entityId + 1 ) % 2048; + entityId = ( entityId + 1 ) % 16384; } // printf("\n"); } @@ -261,7 +265,7 @@ void Entity::_init(bool useSmallId, Level *level) else { entityId = Entity::entityCounter++; - if(entityCounter == 0x7ffffff ) entityCounter = 2048; + if(entityCounter == 0x7ffffff ) entityCounter = 16384; } viewScale = 1.0; diff --git a/Minecraft.World/Entity.h b/Minecraft.World/Entity.h index a738c2ba7..9fb0f5489 100644 --- a/Minecraft.World/Entity.h +++ b/Minecraft.World/Entity.h @@ -382,9 +382,12 @@ private: int getSmallId(); void freeSmallId(int index); - static unsigned int entityIdUsedFlags[2048/32]; - static unsigned int entityIdWanderFlags[2048/32]; - static unsigned int entityIdRemovingFlags[2048/32]; + //static unsigned int entityIdUsedFlags[2048/32]; + //static unsigned int entityIdWanderFlags[2048/32]; + //static unsigned int entityIdRemovingFlags[2048/32]; + static unsigned int entityIdUsedFlags[16384/32]; + static unsigned int entityIdWanderFlags[16384/32]; + static unsigned int entityIdRemovingFlags[16384/32]; static int extraWanderIds[EXTRA_WANDER_MAX]; static int extraWanderCount; static int extraWanderTicks; diff --git a/Minecraft.World/MoveEntityPacket.cpp b/Minecraft.World/MoveEntityPacket.cpp index cae28e912..aef9e6217 100644 --- a/Minecraft.World/MoveEntityPacket.cpp +++ b/Minecraft.World/MoveEntityPacket.cpp @@ -35,7 +35,7 @@ void MoveEntityPacket::read(DataInputStream *dis) //throws IOException void MoveEntityPacket::write(DataOutputStream *dos) //throws IOException { - if( (id < 0 ) || (id >= 2048 ) ) + if( (id < 0 ) || (id >= 16384 ) ) { // We shouln't be tracking an entity that doesn't have a short type of id __debugbreak(); diff --git a/Minecraft.World/MoveEntityPacketSmall.cpp b/Minecraft.World/MoveEntityPacketSmall.cpp index ec67f37f2..7d91a15d5 100644 --- a/Minecraft.World/MoveEntityPacketSmall.cpp +++ b/Minecraft.World/MoveEntityPacketSmall.cpp @@ -19,7 +19,7 @@ MoveEntityPacketSmall::MoveEntityPacketSmall() MoveEntityPacketSmall::MoveEntityPacketSmall(int id) { - if( (id < 0 ) || (id >= 2048 ) ) + if( (id < 0 ) || (id >= 16384 ) ) { // We shouln't be tracking an entity that doesn't have a short type of id __debugbreak(); @@ -42,7 +42,7 @@ void MoveEntityPacketSmall::read(DataInputStream *dis) //throws IOException void MoveEntityPacketSmall::write(DataOutputStream *dos) //throws IOException { - if( (id < 0 ) || (id >= 2048 ) ) + if( (id < 0 ) || (id >= 16384 ) ) { // We shouln't be tracking an entity that doesn't have a short type of id __debugbreak(); @@ -99,7 +99,7 @@ void MoveEntityPacketSmall::PosRot::read(DataInputStream *dis) //throws IOExcept void MoveEntityPacketSmall::PosRot::write(DataOutputStream *dos) //throws IOException { - if( (id < 0 ) || (id >= 2048 ) ) + if( (id < 0 ) || (id >= 16384 ) ) { // We shouln't be tracking an entity that doesn't have a short type of id __debugbreak(); @@ -138,7 +138,7 @@ void MoveEntityPacketSmall::Pos::read(DataInputStream *dis) //throws IOException void MoveEntityPacketSmall::Pos::write(DataOutputStream *dos) //throws IOException { - if( (id < 0 ) || (id >= 2048 ) ) + if( (id < 0 ) || (id >= 16384 ) ) { // We shouln't be tracking an entity that doesn't have a short type of id __debugbreak(); @@ -176,7 +176,7 @@ void MoveEntityPacketSmall::Rot::read(DataInputStream *dis) //throws IOException void MoveEntityPacketSmall::Rot::write(DataOutputStream *dos) //throws IOException { - if( (id < 0 ) || (id >= 2048 ) ) + if( (id < 0 ) || (id >= 16384 ) ) { // We shouln't be tracking an entity that doesn't have a short type of id __debugbreak(); diff --git a/README.md b/README.md index db750d388..560a798a5 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,9 @@ See our our [Contributor's Guide](./CONTRIBUTING.md) for more information on the ## Download ### Client -Windows users can download our [Nightly Build](https://github.com/smartcmd/MinecraftConsoles/releases/tag/nightly)! Simply download the `.zip` file and extract it to a folder where you'd like to keep the game. You can set your username in `username.txt` (you'll have to make this file) +Windows users can download our [Nightly Build](https://github.com/MCLCE/MinecraftConsoles/releases/tag/nightly)! Simply download the `.zip` file and extract it to a folder where you'd like to keep the game. You can set your username in `username.txt` (you'll have to make this file) ### Server -If you're looking for Dedicated Server software, download its [Nightly Build here](https://github.com/smartcmd/MinecraftConsoles/releases/tag/nightly-dedicated-server). Similar instructions to the client more or less, though see further down in this README for more info on that. +If you're looking for Dedicated Server software, download its [Nightly Build here](https://github.com/MCLCE/MinecraftConsoles/releases/tag/nightly-dedicated-server). Similar instructions to the client more or less, though see further down in this README for more info on that. ## Platform Support @@ -228,4 +228,4 @@ For more information, see [COMPILE.md](COMPILE.md). ## Star History -[![Star History Chart](https://api.star-history.com/svg?repos=smartcmd/MinecraftConsoles&type=date&legend=top-left)](https://www.star-history.com/?spm=a2c6h.12873639.article-detail.7.7b9d7fabjNxTRk#smartcmd/MinecraftConsoles&type=date&legend=top-left) +[![Star History Chart](https://api.star-history.com/svg?repos=MCLCE/MinecraftConsoles&type=date&legend=top-left)](https://www.star-history.com/?spm=a2c6h.12873639.article-detail.7.7b9d7fabjNxTRk#MCLCE/MinecraftConsoles&type=date&legend=top-left)