mirror of
https://github.com/neoStudiosLCE/neoLegacy.git
synced 2026-08-20 09:57:09 +00:00
Merge branch 'patch' of https://github.com/Firebladedoge229/neoLegacy-recrafted into patch
This commit is contained in:
commit
c237286ec8
BIN
.github/roadmap.png
vendored
BIN
.github/roadmap.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 198 KiB |
32
.github/workflows/stable.yml
vendored
32
.github/workflows/stable.yml
vendored
|
|
@ -4,6 +4,7 @@ on:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- 'BUMP' #neo: this is a file. edit it. contains version number
|
- 'BUMP' #neo: this is a file. edit it. contains version number
|
||||||
|
#neo: DO NOT ADD NOTES.md HERE.
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
|
|
@ -274,35 +275,6 @@ jobs:
|
||||||
git tag -f $VERSION -m "Stable release $VERSION"
|
git tag -f $VERSION -m "Stable release $VERSION"
|
||||||
git push origin $VERSION --force
|
git push origin $VERSION --force
|
||||||
|
|
||||||
- name: Write release notes
|
|
||||||
run: |
|
|
||||||
cat > notes.md <<'NOTES'
|
|
||||||
# Instructions:
|
|
||||||
**Newcomers:**
|
|
||||||
- If this is your first time, download `neoLegacyWindows64.zip` and extract it wherever you would like to keep it.
|
|
||||||
- I would recommend to set your username prior to launch (create a file called `username.txt`, put your desired username into the file, and save).
|
|
||||||
- To play, simply run `Minecraft.Client.exe`.
|
|
||||||
|
|
||||||
**Steam Deck & Linux:**
|
|
||||||
- Y'all know the drill. Download the `neoLegacyWindows64.zip`, extract it, add the `Minecraft.Client.exe` as a "Non-Steam Game" within the Steam library, turn on compatibility mode with Proton Experimental, and then run it!
|
|
||||||
|
|
||||||
# Multiplayer instructions:
|
|
||||||
LAN games are natively supported, and any LAN games will appear automatically on the right. However, if you'd like to play with your friends online (and if you don't want to require them to setup a vpn, and/or if you don't want to port forward), I would recommend the following setup. Please keep in mind, you do NOT need to do this to enjoy the game. This is just how I have it setup for me so my friends can join without any hassle:
|
|
||||||
|
|
||||||
Prerequisites:
|
|
||||||
- Premium playit.gg account, costs about $3 USD per month. This is for setting up the tunnel.
|
|
||||||
- playit.gg agent installed on host PC.
|
|
||||||
|
|
||||||
How-to:
|
|
||||||
- Ensure your playit.gg agent is connected to your playit.gg account
|
|
||||||
- On the playit.gg website, setup a new tunnel (choose TCP). Ensure the configurable settings are set to the below values, assuming your agent is installed on the same computer as your online neoLegacyMinecraft game is hosted from.
|
|
||||||
- Configurable settings:
|
|
||||||
- Local IP: `127.0.0.1`
|
|
||||||
- Local Port: `25565`
|
|
||||||
- Proxy Protocol: `None`
|
|
||||||
- After creating your tunnel, navigate to the "Tunnels" main page. You'll see the IP address and port for your tunnel. This is what your friends will input when adding your server in order to join your online game!
|
|
||||||
NOTES
|
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
@ -310,7 +282,7 @@ jobs:
|
||||||
VERSION=v$(cat BUMP)
|
VERSION=v$(cat BUMP)
|
||||||
gh release create $VERSION artifacts/* \
|
gh release create $VERSION artifacts/* \
|
||||||
--title "$VERSION" \
|
--title "$VERSION" \
|
||||||
--notes-file notes.md
|
--notes-file NOTES.md
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
needs: [release-client, release-server]
|
needs: [release-client, release-server]
|
||||||
|
|
|
||||||
|
|
@ -234,6 +234,34 @@ if(TARGET Minecraft.Server)
|
||||||
add_dependencies(Minecraft.Server GenerateStringIdLookup)
|
add_dependencies(Minecraft.Server GenerateStringIdLookup)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(_item_map_inputs
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World/Tile.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World/Item.h"
|
||||||
|
)
|
||||||
|
|
||||||
|
#neo: added ItemNameMap generation
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${CMAKE_BINARY_DIR}/generated/ItemNameMap.h"
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
"-DINPUT_FILES=${_item_map_inputs}"
|
||||||
|
"-DOUTPUT_FILE=${CMAKE_BINARY_DIR}/generated/ItemNameMap.h"
|
||||||
|
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/GenerateItemNameMap.cmake"
|
||||||
|
DEPENDS
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World/Tile.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World/Item.h"
|
||||||
|
COMMENT "Generating ItemNameMap.h"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(GenerateItemNameMap ALL
|
||||||
|
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/generated/ItemNameMap.h"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_dependencies(Minecraft.Client GenerateItemNameMap)
|
||||||
|
add_dependencies(Minecraft.World GenerateItemNameMap)
|
||||||
|
if(PLATFORM_NAME STREQUAL "Windows64")
|
||||||
|
add_dependencies(Minecraft.Server GenerateItemNameMap)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(Minecraft.Client PRIVATE
|
target_include_directories(Minecraft.Client PRIVATE
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/generated"
|
"${CMAKE_CURRENT_BINARY_DIR}/generated"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -438,6 +438,7 @@ static bool Win64_DeleteSaveDirectory(const wchar_t* wPath)
|
||||||
// This function performs the meat of exiting from a level. It should be called from a thread other than the main thread.
|
// This function performs the meat of exiting from a level. It should be called from a thread other than the main thread.
|
||||||
void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter)
|
void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter)
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||||
|
|
||||||
// 4J Added: Capture hardcore delete info before the server is destroyed
|
// 4J Added: Capture hardcore delete info before the server is destroyed
|
||||||
|
|
@ -724,6 +725,7 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter)
|
||||||
// Make sure we don't think saving is disabled in the menus
|
// Make sure we don't think saving is disabled in the menus
|
||||||
StorageManager.SetSaveDisabled(false);
|
StorageManager.SetSaveDisabled(false);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -780,4 +782,4 @@ int IUIScene_PauseMenu::DisableAutosaveDialogReturned(void *pParam,int iPad,C4JS
|
||||||
app.SetAction(iPad,eAppAction_SaveGame);
|
app.SetAction(iPad,eAppAction_SaveGame);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,8 +141,9 @@ LevelRenderer::LevelRenderer(Minecraft *mc, Textures *textures)
|
||||||
culledEntities = 0;
|
culledEntities = 0;
|
||||||
chunkFixOffs = 0;
|
chunkFixOffs = 0;
|
||||||
frame = 0;
|
frame = 0;
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
repeatList = MemoryTracker::genLists(1);
|
repeatList = MemoryTracker::genLists(1);
|
||||||
|
#endif
|
||||||
destroyProgress = 0.0f;
|
destroyProgress = 0.0f;
|
||||||
|
|
||||||
totalChunks= offscreenChunks= occludedChunks= renderedChunks= emptyChunks = 0;
|
totalChunks= offscreenChunks= occludedChunks= renderedChunks= emptyChunks = 0;
|
||||||
|
|
@ -171,7 +172,7 @@ LevelRenderer::LevelRenderer(Minecraft *mc, Textures *textures)
|
||||||
|
|
||||||
this->mc = mc;
|
this->mc = mc;
|
||||||
this->textures = textures;
|
this->textures = textures;
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
chunkLists = MemoryTracker::genLists(getGlobalChunkCount() * CHUNK_RENDER_LAYERS); // One render list per chunk render layer.
|
chunkLists = MemoryTracker::genLists(getGlobalChunkCount() * CHUNK_RENDER_LAYERS); // One render list per chunk render layer.
|
||||||
globalChunkFlags = new unsigned char[getGlobalChunkCount()];
|
globalChunkFlags = new unsigned char[getGlobalChunkCount()];
|
||||||
memset(globalChunkFlags, 0, getGlobalChunkCount());
|
memset(globalChunkFlags, 0, getGlobalChunkCount());
|
||||||
|
|
@ -261,6 +262,7 @@ LevelRenderer::LevelRenderer(Minecraft *mc, Textures *textures)
|
||||||
t->end();
|
t->end();
|
||||||
glEndList();
|
glEndList();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Chunk::levelRenderer = this;
|
Chunk::levelRenderer = this;
|
||||||
|
|
||||||
|
|
@ -536,6 +538,7 @@ void LevelRenderer::allChanged(int playerIndex)
|
||||||
|
|
||||||
void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
|
void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
if (mc == nullptr || mc->player == nullptr)
|
if (mc == nullptr || mc->player == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -662,6 +665,7 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
|
||||||
LeaveCriticalSection(&m_csRenderableTileEntities);
|
LeaveCriticalSection(&m_csRenderableTileEntities);
|
||||||
|
|
||||||
mc->gameRenderer->turnOffLightLayer(a); // 4J - brought forward from 1.8.2
|
mc->gameRenderer->turnOffLightLayer(a); // 4J - brought forward from 1.8.2
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring LevelRenderer::gatherStats1()
|
wstring LevelRenderer::gatherStats1()
|
||||||
|
|
@ -3960,7 +3964,9 @@ int LevelRenderer::rebuildChunkThreadProc(LPVOID lpParam)
|
||||||
AABB::CreateNewThreadStorage();
|
AABB::CreateNewThreadStorage();
|
||||||
IntCache::CreateNewThreadStorage();
|
IntCache::CreateNewThreadStorage();
|
||||||
Tesselator::CreateNewThreadStorage(1024*1024);
|
Tesselator::CreateNewThreadStorage(1024*1024);
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
RenderManager.InitialiseContext();
|
RenderManager.InitialiseContext();
|
||||||
|
#endif
|
||||||
Chunk::CreateNewThreadStorage();
|
Chunk::CreateNewThreadStorage();
|
||||||
Tile::CreateNewThreadStorage();
|
Tile::CreateNewThreadStorage();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,8 +141,10 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet
|
||||||
user = nullptr;
|
user = nullptr;
|
||||||
parent = nullptr;
|
parent = nullptr;
|
||||||
pause = false;
|
pause = false;
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
textures = nullptr;
|
textures = nullptr;
|
||||||
font = nullptr;
|
font = nullptr;
|
||||||
|
#endif
|
||||||
screen = nullptr;
|
screen = nullptr;
|
||||||
localPlayerIdx = 0;
|
localPlayerIdx = 0;
|
||||||
rightClickDelay = 0;
|
rightClickDelay = 0;
|
||||||
|
|
@ -151,8 +153,9 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet
|
||||||
InitializeCriticalSection( &ProgressRenderer::s_progress );
|
InitializeCriticalSection( &ProgressRenderer::s_progress );
|
||||||
InitializeCriticalSection(&m_setLevelCS);
|
InitializeCriticalSection(&m_setLevelCS);
|
||||||
//m_hPlayerRespawned = CreateEvent(nullptr, FALSE, FALSE, nullptr);
|
//m_hPlayerRespawned = CreateEvent(nullptr, FALSE, FALSE, nullptr);
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
progressRenderer = nullptr;
|
progressRenderer = nullptr;
|
||||||
|
#endif
|
||||||
gameRenderer = nullptr;
|
gameRenderer = nullptr;
|
||||||
bgLoader = nullptr;
|
bgLoader = nullptr;
|
||||||
|
|
||||||
|
|
@ -166,8 +169,12 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet
|
||||||
orgWidth = orgHeight = 0;
|
orgWidth = orgHeight = 0;
|
||||||
achievementPopup = new AchievementPopup(this);
|
achievementPopup = new AchievementPopup(this);
|
||||||
gui = nullptr;
|
gui = nullptr;
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
noRender = false;
|
noRender = false;
|
||||||
humanoidModel = new HumanoidModel(0);
|
humanoidModel = new HumanoidModel(0);
|
||||||
|
#else
|
||||||
|
noRender = true;
|
||||||
|
#endif
|
||||||
hitResult = nullptr;
|
hitResult = nullptr;
|
||||||
options = nullptr;
|
options = nullptr;
|
||||||
soundEngine = new SoundEngine();
|
soundEngine = new SoundEngine();
|
||||||
|
|
@ -338,12 +345,13 @@ void Minecraft::init()
|
||||||
options = new Options(this, workingDirectory);
|
options = new Options(this, workingDirectory);
|
||||||
skins = new TexturePackRepository(workingDirectory, this);
|
skins = new TexturePackRepository(workingDirectory, this);
|
||||||
skins->addDebugPacks();
|
skins->addDebugPacks();
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
textures = new Textures(skins, options);
|
textures = new Textures(skins, options);
|
||||||
//renderLoadingScreen();
|
//renderLoadingScreen();
|
||||||
|
|
||||||
font = new Font(options, L"font/Default.png", textures, false, &DEFAULT_FONT_LOCATION, 23, 20, 8, 8, SFontData::Codepoints);
|
font = new Font(options, L"font/Default.png", textures, false, &DEFAULT_FONT_LOCATION, 23, 20, 8, 8, SFontData::Codepoints);
|
||||||
altFont = new Font(options, L"font/alternate.png", textures, false, &ALT_FONT_LOCATION, 16, 16, 8, 8);
|
altFont = new Font(options, L"font/alternate.png", textures, false, &ALT_FONT_LOCATION, 16, 16, 8, 8);
|
||||||
|
#endif
|
||||||
//if (options.languageCode != null) {
|
//if (options.languageCode != null) {
|
||||||
// Language.getInstance().loadLanguage(options.languageCode);
|
// Language.getInstance().loadLanguage(options.languageCode);
|
||||||
// // font.setEnforceUnicodeSheet("true".equalsIgnoreCase(I18n.get("language.enforceUnicode")));
|
// // font.setEnforceUnicodeSheet("true".equalsIgnoreCase(I18n.get("language.enforceUnicode")));
|
||||||
|
|
@ -357,7 +365,9 @@ void Minecraft::init()
|
||||||
//FoliageColor::init(textures->loadTexturePixels(L"misc/foliagecolor.png"));
|
//FoliageColor::init(textures->loadTexturePixels(L"misc/foliagecolor.png"));
|
||||||
|
|
||||||
gameRenderer = new GameRenderer(this);
|
gameRenderer = new GameRenderer(this);
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
EntityRenderDispatcher::instance->itemInHandRenderer = new ItemInHandRenderer(this,false);
|
EntityRenderDispatcher::instance->itemInHandRenderer = new ItemInHandRenderer(this,false);
|
||||||
|
#endif
|
||||||
|
|
||||||
for( int i=0 ; i<4 ; ++i )
|
for( int i=0 ; i<4 ; ++i )
|
||||||
stats[i] = new StatsCounter();
|
stats[i] = new StatsCounter();
|
||||||
|
|
@ -384,6 +394,7 @@ void Minecraft::init()
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
|
|
||||||
MemSect(31);
|
MemSect(31);
|
||||||
checkGlError(L"Pre startup");
|
checkGlError(L"Pre startup");
|
||||||
|
|
@ -407,12 +418,17 @@ void Minecraft::init()
|
||||||
MemSect(31);
|
MemSect(31);
|
||||||
checkGlError(L"Startup");
|
checkGlError(L"Startup");
|
||||||
MemSect(0);
|
MemSect(0);
|
||||||
|
#endif
|
||||||
// openGLCapabilities = new OpenGLCapabilities(); // 4J - removed
|
// openGLCapabilities = new OpenGLCapabilities(); // 4J - removed
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
levelRenderer = new LevelRenderer(this, textures);
|
levelRenderer = new LevelRenderer(this, textures);
|
||||||
|
#else
|
||||||
|
levelRenderer = new LevelRenderer(this, nullptr);
|
||||||
|
#endif
|
||||||
//textures->register(&TextureAtlas::LOCATION_BLOCKS, new TextureAtlas(Icon::TYPE_TERRAIN, TN_TERRAIN));
|
//textures->register(&TextureAtlas::LOCATION_BLOCKS, new TextureAtlas(Icon::TYPE_TERRAIN, TN_TERRAIN));
|
||||||
//textures->register(&TextureAtlas::LOCATION_ITEMS, new TextureAtlas(Icon::TYPE_ITEM, TN_GUI_ITEMS));
|
//textures->register(&TextureAtlas::LOCATION_ITEMS, new TextureAtlas(Icon::TYPE_ITEM, TN_GUI_ITEMS));
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
|
|
||||||
textures->stitch();
|
textures->stitch();
|
||||||
|
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
|
|
@ -424,6 +440,7 @@ void Minecraft::init()
|
||||||
MemSect(0);
|
MemSect(0);
|
||||||
gui = new Gui(this);
|
gui = new Gui(this);
|
||||||
|
|
||||||
|
|
||||||
if (connectToIp != L"") // 4J - was nullptr comparison
|
if (connectToIp != L"") // 4J - was nullptr comparison
|
||||||
{
|
{
|
||||||
// setScreen(new ConnectScreen(this, connectToIp, connectToPort)); // 4J TODO - put back in
|
// setScreen(new ConnectScreen(this, connectToIp, connectToPort)); // 4J TODO - put back in
|
||||||
|
|
@ -435,6 +452,7 @@ void Minecraft::init()
|
||||||
progressRenderer = new ProgressRenderer(this);
|
progressRenderer = new ProgressRenderer(this);
|
||||||
|
|
||||||
RenderManager.CBuffLockStaticCreations();
|
RenderManager.CBuffLockStaticCreations();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Minecraft::renderLoadingScreen()
|
void Minecraft::renderLoadingScreen()
|
||||||
|
|
@ -1262,11 +1280,14 @@ void Minecraft::run_middle()
|
||||||
|
|
||||||
if(running)
|
if(running)
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
if (reloadTextures)
|
if (reloadTextures)
|
||||||
{
|
{
|
||||||
reloadTextures = false;
|
reloadTextures = false;
|
||||||
textures->reloadAll();
|
textures->reloadAll();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//while (running)
|
//while (running)
|
||||||
{
|
{
|
||||||
|
|
@ -2340,13 +2361,18 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
// soundEngine.playMusicTick();
|
// soundEngine.playMusicTick();
|
||||||
|
|
||||||
if (!pause && level != nullptr) gameMode->tick();
|
if (!pause && level != nullptr) gameMode->tick();
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
MemSect(31);
|
MemSect(31);
|
||||||
glBindTexture(GL_TEXTURE_2D, textures->loadTexture(TN_TERRAIN)); //L"/terrain.png"));
|
glBindTexture(GL_TEXTURE_2D, textures->loadTexture(TN_TERRAIN)); //L"/terrain.png"));
|
||||||
MemSect(0);
|
MemSect(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
if( bFirst )
|
if( bFirst )
|
||||||
{
|
{
|
||||||
PIXBeginNamedEvent(0,"Texture tick");
|
PIXBeginNamedEvent(0,"Texture tick");
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
if (!pause) textures->tick(bUpdateTextures);
|
if (!pause) textures->tick(bUpdateTextures);
|
||||||
|
#endif
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4360,12 +4386,13 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
|
||||||
EnterCriticalSection(&m_setLevelCS);
|
EnterCriticalSection(&m_setLevelCS);
|
||||||
bool playerAdded = false;
|
bool playerAdded = false;
|
||||||
this->cameraTargetPlayer = nullptr;
|
this->cameraTargetPlayer = nullptr;
|
||||||
|
#ifdef MINECRAFT_SERVER_BUILD
|
||||||
if(progressRenderer != nullptr)
|
if(progressRenderer != nullptr)
|
||||||
{
|
{
|
||||||
this->progressRenderer->progressStart(message);
|
this->progressRenderer->progressStart(message);
|
||||||
this->progressRenderer->progressStage(-1);
|
this->progressRenderer->progressStage(-1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Stop menu music and transition to game music for the new level
|
// Stop menu music and transition to game music for the new level
|
||||||
soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);
|
soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);
|
||||||
|
|
@ -4588,11 +4615,14 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
|
||||||
|
|
||||||
void Minecraft::prepareLevel(int title)
|
void Minecraft::prepareLevel(int title)
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
if(progressRenderer != nullptr)
|
if(progressRenderer != nullptr)
|
||||||
{
|
{
|
||||||
this->progressRenderer->progressStart(title);
|
this->progressRenderer->progressStart(title);
|
||||||
this->progressRenderer->progressStage(IDS_PROGRESS_BUILDING_TERRAIN);
|
this->progressRenderer->progressStage(IDS_PROGRESS_BUILDING_TERRAIN);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int r = 128;
|
int r = 128;
|
||||||
if (gameMode->isCutScene()) r = 64;
|
if (gameMode->isCutScene()) r = 64;
|
||||||
int pp = 0;
|
int pp = 0;
|
||||||
|
|
@ -4616,7 +4646,7 @@ void Minecraft::prepareLevel(int title)
|
||||||
spcc->centerOn(spawnPos->x >> 4, spawnPos->z >> 4);
|
spcc->centerOn(spawnPos->x >> 4, spawnPos->z >> 4);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
for (int x = -r; x <= r; x += 16)
|
for (int x = -r; x <= r; x += 16)
|
||||||
{
|
{
|
||||||
for (int z = -r; z <= r; z += 16)
|
for (int z = -r; z <= r; z += 16)
|
||||||
|
|
@ -4632,7 +4662,8 @@ void Minecraft::prepareLevel(int title)
|
||||||
{
|
{
|
||||||
if(progressRenderer != nullptr) this->progressRenderer->progressStage(IDS_PROGRESS_SIMULATING_WORLD);
|
if(progressRenderer != nullptr) this->progressRenderer->progressStage(IDS_PROGRESS_SIMULATING_WORLD);
|
||||||
max = 2000;
|
max = 2000;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring Minecraft::gatherStats1()
|
wstring Minecraft::gatherStats1()
|
||||||
|
|
@ -4892,8 +4923,10 @@ void Minecraft::main()
|
||||||
useLomp = true;
|
useLomp = true;
|
||||||
|
|
||||||
MinecraftWorld_RunStaticCtors();
|
MinecraftWorld_RunStaticCtors();
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
EntityRenderDispatcher::staticCtor();
|
EntityRenderDispatcher::staticCtor();
|
||||||
TileEntityRenderDispatcher::staticCtor();
|
TileEntityRenderDispatcher::staticCtor();
|
||||||
|
#endif
|
||||||
User::staticCtor();
|
User::staticCtor();
|
||||||
Tutorial::staticCtor();
|
Tutorial::staticCtor();
|
||||||
ColourTable::staticCtor();
|
ColourTable::staticCtor();
|
||||||
|
|
|
||||||
|
|
@ -559,8 +559,10 @@ MinecraftServer::MinecraftServer()
|
||||||
m_bLoaded = false;
|
m_bLoaded = false;
|
||||||
stopped = false;
|
stopped = false;
|
||||||
tickCount = 0;
|
tickCount = 0;
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
wstring progressStatus;
|
wstring progressStatus;
|
||||||
progress = 0;
|
progress = 0;
|
||||||
|
#endif
|
||||||
motd = L"";
|
motd = L"";
|
||||||
|
|
||||||
m_isServerPaused = false;
|
m_isServerPaused = false;
|
||||||
|
|
@ -736,8 +738,10 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData *initData, DW
|
||||||
pLevelType = LevelType::lvl_normal;
|
pLevelType = LevelType::lvl_normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
ProgressRenderer *mcprogress = Minecraft::GetInstance()->progressRenderer;
|
ProgressRenderer *mcprogress = Minecraft::GetInstance()->progressRenderer;
|
||||||
mcprogress->progressStart(IDS_PROGRESS_INITIALISING_SERVER);
|
mcprogress->progressStart(IDS_PROGRESS_INITIALISING_SERVER);
|
||||||
|
#endif
|
||||||
|
|
||||||
if( findSeed )
|
if( findSeed )
|
||||||
{
|
{
|
||||||
|
|
@ -876,7 +880,9 @@ void MinecraftServer::postProcessTerminate(ProgressRenderer *mcprogress)
|
||||||
|
|
||||||
if( postProcessItemCount )
|
if( postProcessItemCount )
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
mcprogress->progressStagePercentage((postProcessItemCount - postProcessItemRemaining) * 100 / postProcessItemCount);
|
mcprogress->progressStagePercentage((postProcessItemCount - postProcessItemRemaining) * 100 / postProcessItemCount);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
CompressedTileStorage::tick();
|
CompressedTileStorage::tick();
|
||||||
SparseLightStorage::tick();
|
SparseLightStorage::tick();
|
||||||
|
|
@ -1030,7 +1036,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
||||||
|
|
||||||
players->setLevel(levels);
|
players->setLevel(levels);
|
||||||
}
|
}
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
if( levels[0]->isNew )
|
if( levels[0]->isNew )
|
||||||
{
|
{
|
||||||
mcprogress->progressStage(IDS_PROGRESS_GENERATING_SPAWN_AREA);
|
mcprogress->progressStage(IDS_PROGRESS_GENERATING_SPAWN_AREA);
|
||||||
|
|
@ -1039,6 +1045,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
||||||
{
|
{
|
||||||
mcprogress->progressStage(IDS_PROGRESS_LOADING_SPAWN_AREA);
|
mcprogress->progressStage(IDS_PROGRESS_LOADING_SPAWN_AREA);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
app.SetGameHostOption( eGameHostOption_HasBeenInCreative, gameType == GameType::CREATIVE || levels[0]->getHasBeenInCreative() );
|
app.SetGameHostOption( eGameHostOption_HasBeenInCreative, gameType == GameType::CREATIVE || levels[0]->getHasBeenInCreative() );
|
||||||
app.SetGameHostOption( eGameHostOption_Structures, levels[0]->isGenerateMapFeatures() );
|
app.SetGameHostOption( eGameHostOption_Structures, levels[0]->isGenerateMapFeatures() );
|
||||||
|
|
||||||
|
|
@ -1151,7 +1158,12 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
||||||
{
|
{
|
||||||
delete spawnPos;
|
delete spawnPos;
|
||||||
m_postUpdateTerminate = true;
|
m_postUpdateTerminate = true;
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
postProcessTerminate(mcprogress);
|
postProcessTerminate(mcprogress);
|
||||||
|
#else
|
||||||
|
postProcessTerminate(nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// printf(">>>%d %d %d\n",i,x,z);
|
// printf(">>>%d %d %d\n",i,x,z);
|
||||||
|
|
@ -1161,7 +1173,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
||||||
{
|
{
|
||||||
int pos = (x + r) * twoRPlusOne + (z + 1);
|
int pos = (x + r) * twoRPlusOne + (z + 1);
|
||||||
// setProgress(L"Preparing spawn area", (pos) * 100 / total);
|
// setProgress(L"Preparing spawn area", (pos) * 100 / total);
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
mcprogress->progressStagePercentage((pos+r) * 100 / total);
|
mcprogress->progressStagePercentage((pos+r) * 100 / total);
|
||||||
|
#endif
|
||||||
// lastTime = now;
|
// lastTime = now;
|
||||||
}
|
}
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
|
|
@ -1203,7 +1217,11 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
||||||
// Wait for post processing, then lighting threads, to end (post-processing may make more lighting changes)
|
// Wait for post processing, then lighting threads, to end (post-processing may make more lighting changes)
|
||||||
m_postUpdateTerminate = true;
|
m_postUpdateTerminate = true;
|
||||||
|
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
postProcessTerminate(mcprogress);
|
postProcessTerminate(mcprogress);
|
||||||
|
#else
|
||||||
|
postProcessTerminate(nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// stronghold position?
|
// stronghold position?
|
||||||
|
|
@ -1245,14 +1263,22 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
||||||
|
|
||||||
if( levels[1]->isNew )
|
if( levels[1]->isNew )
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
levels[1]->save(true, mcprogress);
|
levels[1]->save(true, mcprogress);
|
||||||
|
#else
|
||||||
|
levels[1]->save(true, nullptr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if( s_bServerHalted || !g_NetworkManager.IsInSession() ) return false;
|
if( s_bServerHalted || !g_NetworkManager.IsInSession() ) return false;
|
||||||
|
|
||||||
if( levels[2]->isNew )
|
if( levels[2]->isNew )
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
levels[2]->save(true, mcprogress);
|
levels[2]->save(true, mcprogress);
|
||||||
|
#else
|
||||||
|
levels[2]->save(true, nullptr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if( s_bServerHalted || !g_NetworkManager.IsInSession() ) return false;
|
if( s_bServerHalted || !g_NetworkManager.IsInSession() ) return false;
|
||||||
|
|
@ -1264,7 +1290,11 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
||||||
|
|
||||||
if( levels[0]->isNew )
|
if( levels[0]->isNew )
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
levels[0]->save(true, mcprogress);
|
levels[0]->save(true, mcprogress);
|
||||||
|
#else
|
||||||
|
levels[0]->save(true, nullptr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if( s_bServerHalted || !g_NetworkManager.IsInSession() ) return false;
|
if( s_bServerHalted || !g_NetworkManager.IsInSession() ) return false;
|
||||||
|
|
@ -1366,15 +1396,19 @@ void MinecraftServer::overwriteHellBordersForNewWorldSize(ServerLevel* level, in
|
||||||
|
|
||||||
void MinecraftServer::setProgress(const wstring& status, int progress)
|
void MinecraftServer::setProgress(const wstring& status, int progress)
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
progressStatus = status;
|
progressStatus = status;
|
||||||
this->progress = progress;
|
this->progress = progress;
|
||||||
|
#endif
|
||||||
// logger.info(status + ": " + progress + "%");
|
// logger.info(status + ": " + progress + "%");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinecraftServer::endProgress()
|
void MinecraftServer::endProgress()
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
progressStatus = L"";
|
progressStatus = L"";
|
||||||
this->progress = 0;
|
this->progress = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinecraftServer::saveAllChunks()
|
void MinecraftServer::saveAllChunks()
|
||||||
|
|
@ -1392,8 +1426,11 @@ void MinecraftServer::saveAllChunks()
|
||||||
ServerLevel *level = levels[levels.length - 1 - i];
|
ServerLevel *level = levels[levels.length - 1 - i];
|
||||||
if( level ) // 4J - added check as level can be nullptr if we end up in stopServer really early on due to network failure
|
if( level ) // 4J - added check as level can be nullptr if we end up in stopServer really early on due to network failure
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
level->save(true, Minecraft::GetInstance()->progressRenderer);
|
level->save(true, Minecraft::GetInstance()->progressRenderer);
|
||||||
|
#else
|
||||||
|
level->save(true, nullptr);
|
||||||
|
#endif
|
||||||
// Only close the level storage when we have saved the last level, otherwise we need to recreate the region files
|
// Only close the level storage when we have saved the last level, otherwise we need to recreate the region files
|
||||||
// when saving the next levels
|
// when saving the next levels
|
||||||
if( i == (levels.length - 1))
|
if( i == (levels.length - 1))
|
||||||
|
|
@ -1524,7 +1561,11 @@ void MinecraftServer::stopServer(bool didInit)
|
||||||
{
|
{
|
||||||
if (players != nullptr)
|
if (players != nullptr)
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
players->saveAll(Minecraft::GetInstance()->progressRenderer, true);
|
players->saveAll(Minecraft::GetInstance()->progressRenderer, true);
|
||||||
|
#else
|
||||||
|
players->saveAll(nullptr, true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// 4J Stu - Save the levels in reverse order so we don't overwrite the level.dat
|
// 4J Stu - Save the levels in reverse order so we don't overwrite the level.dat
|
||||||
// with the data from the nethers leveldata.
|
// with the data from the nethers leveldata.
|
||||||
|
|
@ -1542,7 +1583,11 @@ void MinecraftServer::stopServer(bool didInit)
|
||||||
app.m_gameRules.unloadCurrentGameRules();
|
app.m_gameRules.unloadCurrentGameRules();
|
||||||
if( levels[0] != nullptr ) // This can be null if stopServer happens very quickly due to network error
|
if( levels[0] != nullptr ) // This can be null if stopServer happens very quickly due to network error
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, false);
|
levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, false);
|
||||||
|
#else
|
||||||
|
levels[0]->saveToDisc(nullptr, false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2005,7 +2050,11 @@ void MinecraftServer::run(int64_t seed, void *lpParameter)
|
||||||
app.EnterSaveNotificationSection();
|
app.EnterSaveNotificationSection();
|
||||||
if (players != nullptr)
|
if (players != nullptr)
|
||||||
{
|
{
|
||||||
players->saveAll(Minecraft::GetInstance()->progressRenderer);
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
|
players->saveAll(Minecraft::GetInstance()->progressRenderer);
|
||||||
|
#else
|
||||||
|
players->saveAll(nullptr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
players->broadcastAll(std::make_shared<UpdateProgressPacket>(20));
|
players->broadcastAll(std::make_shared<UpdateProgressPacket>(20));
|
||||||
|
|
@ -2017,7 +2066,11 @@ void MinecraftServer::run(int64_t seed, void *lpParameter)
|
||||||
// with the data from the nethers leveldata.
|
// with the data from the nethers leveldata.
|
||||||
// Fix for #7418 - Functional: Gameplay: Saving after sleeping in a bed will place player at nighttime when restarting.
|
// Fix for #7418 - Functional: Gameplay: Saving after sleeping in a bed will place player at nighttime when restarting.
|
||||||
ServerLevel *level = levels[levels.length - 1 - j];
|
ServerLevel *level = levels[levels.length - 1 - j];
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
level->save(true, Minecraft::GetInstance()->progressRenderer, (eAction==eXuiServerAction_AutoSaveGame));
|
level->save(true, Minecraft::GetInstance()->progressRenderer, (eAction==eXuiServerAction_AutoSaveGame));
|
||||||
|
#else
|
||||||
|
level->save(true, nullptr, (eAction == eXuiServerAction_AutoSaveGame));
|
||||||
|
#endif
|
||||||
|
|
||||||
players->broadcastAll(std::make_shared<UpdateProgressPacket>(33 + (j * 33)));
|
players->broadcastAll(std::make_shared<UpdateProgressPacket>(33 + (j * 33)));
|
||||||
}
|
}
|
||||||
|
|
@ -2025,7 +2078,11 @@ void MinecraftServer::run(int64_t seed, void *lpParameter)
|
||||||
{
|
{
|
||||||
saveGameRules();
|
saveGameRules();
|
||||||
|
|
||||||
levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, (eAction==eXuiServerAction_AutoSaveGame));
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
|
levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, (eAction == eXuiServerAction_AutoSaveGame));
|
||||||
|
#else
|
||||||
|
levels[0]->saveToDisc(nullptr, (eAction == eXuiServerAction_AutoSaveGame));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
app.LeaveSaveNotificationSection();
|
app.LeaveSaveNotificationSection();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,18 @@
|
||||||
#include "../Minecraft.World/net.minecraft.world.level.saveddata.h"
|
#include "../Minecraft.World/net.minecraft.world.level.saveddata.h"
|
||||||
#include "../Minecraft.World/net.minecraft.world.level.material.h"
|
#include "../Minecraft.World/net.minecraft.world.level.material.h"
|
||||||
|
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
#ifdef __ORBIS__
|
#ifdef __ORBIS__
|
||||||
short Minimap::LUT[256]; // 4J added
|
short Minimap::LUT[256]; // 4J added
|
||||||
#else
|
#else
|
||||||
int Minimap::LUT[256]; // 4J added
|
int Minimap::LUT[256]; // 4J added
|
||||||
#endif
|
#endif
|
||||||
bool Minimap::genLUT = true; // 4J added
|
bool Minimap::genLUT = true; // 4J added
|
||||||
|
#endif
|
||||||
|
|
||||||
Minimap::Minimap(Font *font, Options *options, Textures *textures, bool optimised)
|
Minimap::Minimap(Font *font, Options *options, Textures *textures, bool optimised)
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
// we're using the RSX now to upload textures to vram, so we need the main ram textures allocated from io space
|
// we're using the RSX now to upload textures to vram, so we need the main ram textures allocated from io space
|
||||||
this->pixels = intArray((int*)RenderManager.allocIOMem(w*h*sizeof(int)), 16*16);
|
this->pixels = intArray((int*)RenderManager.allocIOMem(w*h*sizeof(int)), 16*16);
|
||||||
|
|
@ -39,7 +42,6 @@ Minimap::Minimap(Font *font, Options *options, Textures *textures, bool optimise
|
||||||
{
|
{
|
||||||
pixels[i] = 0x00000000;
|
pixels[i] = 0x00000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J added - generate the colour mapping that we'll be needing as a LUT to minimise processing we actually need to do during normal rendering
|
// 4J added - generate the colour mapping that we'll be needing as a LUT to minimise processing we actually need to do during normal rendering
|
||||||
if( genLUT )
|
if( genLUT )
|
||||||
{
|
{
|
||||||
|
|
@ -47,10 +49,13 @@ Minimap::Minimap(Font *font, Options *options, Textures *textures, bool optimise
|
||||||
}
|
}
|
||||||
renderCount = 0; // 4J added
|
renderCount = 0; // 4J added
|
||||||
m_optimised = optimised;
|
m_optimised = optimised;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Minimap::reloadColours()
|
void Minimap::reloadColours()
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
|
|
||||||
ColourTable *colourTable = Minecraft::GetInstance()->getColourTable();
|
ColourTable *colourTable = Minecraft::GetInstance()->getColourTable();
|
||||||
// 4J note that this code has been extracted pretty much as it was in Minimap::render, although with some byte order changes
|
// 4J note that this code has been extracted pretty much as it was in Minimap::render, although with some byte order changes
|
||||||
for( int i = 0; i < (14 * 4); i++ ) // 14 material colours currently, 4 brightnesses of each
|
for( int i = 0; i < (14 * 4); i++ ) // 14 material colours currently, 4 brightnesses of each
|
||||||
|
|
@ -95,11 +100,13 @@ void Minimap::reloadColours()
|
||||||
|
|
||||||
}
|
}
|
||||||
genLUT = false;
|
genLUT = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J added entityId
|
// 4J added entityId
|
||||||
void Minimap::render(shared_ptr<Player> player, Textures *textures, shared_ptr<MapItemSavedData> data, int entityId)
|
void Minimap::render(shared_ptr<Player> player, Textures *textures, shared_ptr<MapItemSavedData> data, int entityId)
|
||||||
{
|
{
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
// 4J - only update every 8 renders, as an optimisation
|
// 4J - only update every 8 renders, as an optimisation
|
||||||
// We don't want to use this for ItemFrame renders of maps, as then we can't have different maps together
|
// We don't want to use this for ItemFrame renders of maps, as then we can't have different maps together
|
||||||
if( !m_optimised || ( renderCount & 7 ) == 0 )
|
if( !m_optimised || ( renderCount & 7 ) == 0 )
|
||||||
|
|
@ -252,5 +259,6 @@ void Minimap::render(shared_ptr<Player> player, Textures *textures, shared_ptr<M
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ class Minimap
|
||||||
private:
|
private:
|
||||||
static const int w = MapItem::IMAGE_WIDTH;
|
static const int w = MapItem::IMAGE_WIDTH;
|
||||||
static const int h = MapItem::IMAGE_HEIGHT;
|
static const int h = MapItem::IMAGE_HEIGHT;
|
||||||
|
#ifndef MINECRAFT_SERVER_BUILD
|
||||||
|
|
||||||
#ifdef __ORBIS__
|
#ifdef __ORBIS__
|
||||||
static short LUT[256]; // 4J added
|
static short LUT[256]; // 4J added
|
||||||
#else
|
#else
|
||||||
|
|
@ -19,6 +21,7 @@ private:
|
||||||
static bool genLUT; // 4J added
|
static bool genLUT; // 4J added
|
||||||
int renderCount; // 4J added
|
int renderCount; // 4J added
|
||||||
bool m_optimised; // 4J Added
|
bool m_optimised; // 4J Added
|
||||||
|
|
||||||
#ifdef __ORBIS__
|
#ifdef __ORBIS__
|
||||||
shortArray pixels;
|
shortArray pixels;
|
||||||
#else
|
#else
|
||||||
|
|
@ -27,6 +30,7 @@ private:
|
||||||
int mapTexture;
|
int mapTexture;
|
||||||
Options *options;
|
Options *options;
|
||||||
Font *font;
|
Font *font;
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Minimap(Font *font, Options *options, Textures *textures, bool optimised = true); // 4J Added optimised param
|
Minimap(Font *font, Options *options, Textures *textures, bool optimised = true); // 4J Added optimised param
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,17 @@
|
||||||
// 4J Added
|
// 4J Added
|
||||||
#include "../Minecraft.World/net.minecraft.world.item.crafting.h"
|
#include "../Minecraft.World/net.minecraft.world.item.crafting.h"
|
||||||
#include "Options.h"
|
#include "Options.h"
|
||||||
|
|
||||||
|
//neo: Command Includes
|
||||||
|
#include "TeleportCommand.h"
|
||||||
|
#include "../Minecraft.World/GiveItemCommand.h"
|
||||||
|
#include "../Minecraft.World/TimeCommand.h"
|
||||||
|
#include "../Minecraft.World/KillCommand.h"
|
||||||
|
#include "../Minecraft.World/GameModeCommand.h"
|
||||||
|
#include "../Minecraft.World/ToggleDownfallCommand.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
|
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
|
||||||
#include "../Minecraft.Server/ServerLogManager.h"
|
#include "../Minecraft.Server/ServerLogManager.h"
|
||||||
#include "../Minecraft.Server/Access/Access.h"
|
#include "../Minecraft.Server/Access/Access.h"
|
||||||
|
|
@ -48,6 +59,10 @@
|
||||||
extern bool g_Win64DedicatedServer;
|
extern bool g_Win64DedicatedServer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//neo: added
|
||||||
|
#include "ItemNameMap.h"
|
||||||
|
#include "../Minecraft.World/ByteArrayOutputStream.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// Anti-cheat thresholds. Keep server-side checks authoritative even in host mode.
|
// Anti-cheat thresholds. Keep server-side checks authoritative even in host mode.
|
||||||
|
|
@ -1026,10 +1041,319 @@ void PlayerConnection::handleCommand(const wstring& message)
|
||||||
if (FourKitBridge::HandlePlayerCommand(player->entityId, commandLine))
|
if (FourKitBridge::HandlePlayerCommand(player->entityId, commandLine))
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
// 4J - TODO
|
wstringstream ss(message.substr(1));
|
||||||
#if 0
|
wstring cmd;
|
||||||
server.getCommandDispatcher().performCommand(player, message);
|
ss >> cmd;
|
||||||
#endif
|
if (cmd == L"tp" || cmd == L"teleport")
|
||||||
|
{
|
||||||
|
if (!player->hasPermission(eGameCommand_Teleport))
|
||||||
|
{
|
||||||
|
warn(L"You do not have permission to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wstring arg1, arg2, arg3, arg4, arg5, arg6;
|
||||||
|
ss >> arg1 >> arg2 >> arg3 >> arg4 >> arg5 >> arg6;
|
||||||
|
shared_ptr<ServerPlayer> target;
|
||||||
|
shared_ptr<ServerPlayer> destination;
|
||||||
|
if (arg1.empty())
|
||||||
|
{
|
||||||
|
warn(L"Usage: /tp [player] <target_player>");
|
||||||
|
warn(L"Usage: /tp [player] <x> <y> <z> [y_rot] [x_rot]");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto isCoord = [](const wstring& s) -> bool {
|
||||||
|
if (s.empty()) return false;
|
||||||
|
for (size_t i = 0; i < s.size(); i++)
|
||||||
|
if (!iswdigit(s[i]) && s[i] != L'-' && s[i] != L'.') return false;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool arg2IsCoord = isCoord(arg2);
|
||||||
|
if (!arg2IsCoord && !arg2.empty())
|
||||||
|
{
|
||||||
|
target = server->getPlayers()->getPlayer(arg1);
|
||||||
|
destination = server->getPlayers()->getPlayer(arg2);
|
||||||
|
if (target && destination)
|
||||||
|
{
|
||||||
|
shared_ptr<GameCommandPacket> packet = TeleportCommand::preparePacket(
|
||||||
|
target->getXuid(), destination->getXuid());
|
||||||
|
server->getCommandDispatcher()->performCommand(
|
||||||
|
player, eGameCommand_Teleport, packet->data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
warn(L"Player not found.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wstring sx, sy, sz, sYRot, sXRot;
|
||||||
|
shared_ptr<ServerPlayer> tpTarget;
|
||||||
|
if (arg2IsCoord)
|
||||||
|
{
|
||||||
|
tpTarget = player;
|
||||||
|
sx = arg1;
|
||||||
|
sy = arg2;
|
||||||
|
sz = arg3;
|
||||||
|
sYRot = arg4;
|
||||||
|
sXRot = arg5;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tpTarget = server->getPlayers()->getPlayer(arg1);
|
||||||
|
sx = arg2;
|
||||||
|
sy = arg3;
|
||||||
|
sz = arg4;
|
||||||
|
sYRot = arg5;
|
||||||
|
sXRot = arg6;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tpTarget)
|
||||||
|
{
|
||||||
|
warn(L"Player not found.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sx.empty() || sy.empty() || sz.empty())
|
||||||
|
{
|
||||||
|
warn(L"Usage: /tp [player] <x> <y> <z> [y_rot] [x_rot]");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float x = stof(sx);
|
||||||
|
float y = stof(sy);
|
||||||
|
float z = stof(sz);
|
||||||
|
byte yRot = sYRot.empty()
|
||||||
|
? static_cast<byte>(tpTarget->yRot)
|
||||||
|
: static_cast<byte>(stoi(sYRot) & 0xFF);
|
||||||
|
byte xRot = sXRot.empty()
|
||||||
|
? static_cast<byte>(tpTarget->xRot)
|
||||||
|
: static_cast<byte>(stoi(sXRot) & 0xFF);
|
||||||
|
|
||||||
|
shared_ptr<GameCommandPacket> gamePacket = TeleportCommand::preparePacket(
|
||||||
|
tpTarget->getXuid(), x, y, z, yRot, xRot);
|
||||||
|
server->getCommandDispatcher()->performCommand(tpTarget, eGameCommand_Teleport, gamePacket->data);
|
||||||
|
}
|
||||||
|
} else if (cmd == L"time")
|
||||||
|
{
|
||||||
|
if (!player->hasPermission(eGameCommand_Time))
|
||||||
|
{
|
||||||
|
warn(L"You do not have permission to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wstring action;
|
||||||
|
ss >> action;
|
||||||
|
if (action.empty())
|
||||||
|
{
|
||||||
|
warn(L"Usage: /time <set|add|query> ...");
|
||||||
|
warn(L" /time set <day|night|noon|midnight|sunrise|sunset|0-24000>");
|
||||||
|
warn(L" /time add <amount>");
|
||||||
|
warn(L" /time query <daytime|gametime|day>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (action == L"set")
|
||||||
|
{
|
||||||
|
wstring timeVal;
|
||||||
|
ss >> timeVal;
|
||||||
|
if (timeVal.empty())
|
||||||
|
{
|
||||||
|
warn(L"Usage: /time set <day|night|noon|midnight|sunrise|sunset|0-24000>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const unordered_map<wstring, int> namedTimes = {
|
||||||
|
{ L"day", 1000 },
|
||||||
|
{ L"noon", 6000 },
|
||||||
|
{ L"sunset", 12000 },
|
||||||
|
{ L"night", 13000 },
|
||||||
|
{ L"midnight", 18000 },
|
||||||
|
{ L"sunrise", 23000 },
|
||||||
|
};
|
||||||
|
|
||||||
|
int ticks = -1;
|
||||||
|
auto it = namedTimes.find(timeVal);
|
||||||
|
if (it != namedTimes.end())
|
||||||
|
{
|
||||||
|
ticks = it->second;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
size_t pos;
|
||||||
|
ticks = stoi(timeVal, &pos);
|
||||||
|
if (pos != timeVal.size() || ticks < 0 || ticks > 24000)
|
||||||
|
{
|
||||||
|
warn(L"Time value must be between 0 and 24000, or a named time.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
warn(L"Unknown time value: " + timeVal);
|
||||||
|
warn(L"Usage: /time set <day|night|noon|midnight|sunrise|sunset|0-24000>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_ptr<GameCommandPacket> packet = TimeCommand::preparePacket(ticks);
|
||||||
|
server->getCommandDispatcher()->performCommand(player, eGameCommand_Time, packet->data);
|
||||||
|
info(L"Time set to " + timeVal + L" (" + to_wstring(ticks) + L" ticks).");
|
||||||
|
}
|
||||||
|
else if (action == L"add")
|
||||||
|
{
|
||||||
|
wstring amountStr;
|
||||||
|
ss >> amountStr;
|
||||||
|
if (amountStr.empty())
|
||||||
|
{
|
||||||
|
warn(L"Usage: /time add <amount>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
size_t pos;
|
||||||
|
int amount = stoi(amountStr, &pos);
|
||||||
|
if (pos != amountStr.size() || amount < 1)
|
||||||
|
{
|
||||||
|
warn(L"Amount must be a positive integer.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int currentTicks = server->getCommandSenderWorld()->getTimeOfDay(0) * 1000;
|
||||||
|
int newTicks = (currentTicks + amount) % 24000;
|
||||||
|
shared_ptr<GameCommandPacket> packet = TimeCommand::preparePacket(newTicks);
|
||||||
|
server->getCommandDispatcher()->performCommand(player, eGameCommand_Time, packet->data);
|
||||||
|
info(L"Added " + to_wstring(amount) + L" ticks. Time is now " + to_wstring(newTicks) + L".");
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
warn(L"Invalid amount: " + amountStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (action == L"query")
|
||||||
|
{
|
||||||
|
wstring queryType;
|
||||||
|
ss >> queryType;
|
||||||
|
if (queryType.empty())
|
||||||
|
{
|
||||||
|
warn(L"Usage: /time query <daytime|gametime|day>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int currentTicks = server->getCommandSenderWorld()->getTimeOfDay(0) * 1000;
|
||||||
|
if (queryType == L"daytime")
|
||||||
|
{
|
||||||
|
info(L"The current daytime is " + to_wstring(currentTicks % 24000) + L" ticks.");
|
||||||
|
}
|
||||||
|
else if (queryType == L"gametime")
|
||||||
|
{
|
||||||
|
info(L"The total game time is " + to_wstring(currentTicks) + L" ticks.");
|
||||||
|
}
|
||||||
|
else if (queryType == L"day")
|
||||||
|
{
|
||||||
|
info(L"The current day is " + to_wstring(currentTicks / 24000) + L".");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
warn(L"Unknown query type: " + queryType);
|
||||||
|
warn(L"Usage: /time query <daytime|gametime|day>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
warn(L"Unknown action: " + action);
|
||||||
|
warn(L"Usage: /time <set|add|query> ...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cmd == L"kill")
|
||||||
|
{
|
||||||
|
if (!player->hasPermission(eGameCommand_Kill))
|
||||||
|
{
|
||||||
|
warn(L"You do not have permission to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
server->getCommandDispatcher()->performCommand(player, eGameCommand_Kill, byteArray());
|
||||||
|
}
|
||||||
|
else if (cmd == L"toggledownfall")
|
||||||
|
{
|
||||||
|
if (!player->hasPermission(eGameCommand_ToggleDownfall))
|
||||||
|
{
|
||||||
|
warn(L"You do not have permission to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
shared_ptr<GameCommandPacket> packet = ToggleDownfallCommand::preparePacket();
|
||||||
|
server->getCommandDispatcher()->performCommand(player, eGameCommand_ToggleDownfall, packet->data);
|
||||||
|
} else if (cmd == L"gamemode") {
|
||||||
|
if (!player->hasPermission(eGameCommand_GameMode))
|
||||||
|
{
|
||||||
|
warn(L"You do not have permission to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wstring modeStr, targetName;
|
||||||
|
ss >> modeStr >> targetName;
|
||||||
|
if (modeStr.empty()) {
|
||||||
|
warn(L"Usage: /gamemode <mode> [player]");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mode = -1;
|
||||||
|
if (modeStr == L"0" || modeStr == L"s" || modeStr == L"survival")
|
||||||
|
mode = 0;
|
||||||
|
else if (modeStr == L"1" || modeStr == L"c" || modeStr == L"creative")
|
||||||
|
mode = 1;
|
||||||
|
else if (modeStr == L"2" || modeStr == L"a" || modeStr == L"adventure")
|
||||||
|
mode = 2;
|
||||||
|
else {
|
||||||
|
warn(L"Unknown game mode: " + modeStr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_ptr<ServerPlayer> target;
|
||||||
|
if (targetName.empty()) {
|
||||||
|
target = player;
|
||||||
|
} else {
|
||||||
|
target = server->getPlayers()->getPlayer(targetName);
|
||||||
|
if (!target) {
|
||||||
|
warn(L"Player not found: " + targetName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_ptr<GameCommandPacket> packet = GameModeCommand::preparePacket(target, mode);
|
||||||
|
server->getCommandDispatcher()->performCommand(player, eGameCommand_GameMode, packet->data);
|
||||||
|
} else if (cmd == L"give") {
|
||||||
|
if (!player->hasPermission(eGameCommand_Give))
|
||||||
|
{
|
||||||
|
warn(L"You do not have permission to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wstring targetName, itemStr, amountStr, auxStr;
|
||||||
|
ss >> targetName >> itemStr >> amountStr >> auxStr;
|
||||||
|
if (targetName.empty() || itemStr.empty()) {
|
||||||
|
warn(L"Usage: /give <player> <item_id>|minecraft:<item_name> [amount] [data]");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_ptr<ServerPlayer> target = server->getPlayers()->getPlayer(targetName);
|
||||||
|
if (!target) {
|
||||||
|
warn(L"Player not found: " + targetName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int item = 0;
|
||||||
|
int amount = 1, aux = 0;
|
||||||
|
try {
|
||||||
|
item = itemStr.find(L"minecraft:") == 0 ? GetItemIdByName(itemStr.substr(10)) : std::stoi(itemStr);
|
||||||
|
if (!amountStr.empty()) amount = std::stoi(amountStr);
|
||||||
|
if (!auxStr.empty()) aux = std::stoi(auxStr);
|
||||||
|
} catch (...) {
|
||||||
|
warn(L"Invalid item ID/Name or amount");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_ptr<GameCommandPacket> packet = GiveItemCommand::preparePacket(target, item, amount, aux);
|
||||||
|
server->getCommandDispatcher()->performCommand(player, eGameCommand_Give, packet->data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerConnection::handleAnimate(shared_ptr<AnimatePacket> packet)
|
void PlayerConnection::handleAnimate(shared_ptr<AnimatePacket> packet)
|
||||||
|
|
@ -1127,14 +1451,12 @@ int PlayerConnection::countDelayedPackets()
|
||||||
|
|
||||||
void PlayerConnection::info(const wstring& string)
|
void PlayerConnection::info(const wstring& string)
|
||||||
{
|
{
|
||||||
// 4J-PB - removed, since it needs to be localised in the language the client is in
|
send( shared_ptr<ChatPacket>( new ChatPacket(L"§7" + string) ) );
|
||||||
//send( shared_ptr<ChatPacket>( new ChatPacket(L"<22>7" + string) ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerConnection::warn(const wstring& string)
|
void PlayerConnection::warn(const wstring& string)
|
||||||
{
|
{
|
||||||
// 4J-PB - removed, since it needs to be localised in the language the client is in
|
send( shared_ptr<ChatPacket>( new ChatPacket(L"§c" + string) ) );
|
||||||
//send( shared_ptr<ChatPacket>( new ChatPacket(L"<22>9" + string) ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring PlayerConnection::getConsoleName()
|
wstring PlayerConnection::getConsoleName()
|
||||||
|
|
|
||||||
|
|
@ -19,89 +19,95 @@ EGameCommand TeleportCommand::getId()
|
||||||
|
|
||||||
void TeleportCommand::execute(shared_ptr<CommandSender> source, byteArray commandData)
|
void TeleportCommand::execute(shared_ptr<CommandSender> source, byteArray commandData)
|
||||||
{
|
{
|
||||||
ByteArrayInputStream bais(commandData);
|
ByteArrayInputStream bais(commandData);
|
||||||
DataInputStream dis(&bais);
|
DataInputStream dis(&bais);
|
||||||
|
byte flag = dis.readByte();
|
||||||
|
PlayerUID subjectID = dis.readPlayerUID();
|
||||||
|
PlayerList *players = MinecraftServer::getInstance()->getPlayerList();
|
||||||
|
shared_ptr<ServerPlayer> subject = players->getPlayer(subjectID);
|
||||||
|
if (subject == nullptr || !subject->isAlive())
|
||||||
|
return;
|
||||||
|
|
||||||
PlayerUID subjectID = dis.readPlayerUID();
|
if (flag == 1)
|
||||||
PlayerUID destinationID = dis.readPlayerUID();
|
{
|
||||||
|
float x = dis.readFloat();
|
||||||
bais.reset();
|
float y = dis.readFloat();
|
||||||
|
float z = dis.readFloat();
|
||||||
|
byte yRot = dis.readByte();
|
||||||
|
byte xRot = dis.readByte();
|
||||||
|
|
||||||
PlayerList *players = MinecraftServer::getInstance()->getPlayerList();
|
subject->ride(nullptr);
|
||||||
|
|
||||||
shared_ptr<ServerPlayer> subject = players->getPlayer(subjectID);
|
|
||||||
shared_ptr<ServerPlayer> destination = players->getPlayer(destinationID);
|
|
||||||
|
|
||||||
if(subject != nullptr && destination != nullptr && subject->level->dimension->id == destination->level->dimension->id && subject->isAlive() )
|
|
||||||
{
|
|
||||||
subject->ride(nullptr);
|
|
||||||
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
|
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
|
||||||
{
|
{
|
||||||
double outX, outY, outZ;
|
double outX, outY, outZ;
|
||||||
bool cancelled = FourKitBridge::FirePlayerTeleport(subject->entityId,
|
bool cancelled = FourKitBridge::FirePlayerTeleport(subject->entityId,
|
||||||
subject->x, subject->y, subject->z, subject->dimension,
|
subject->x, subject->y, subject->z, subject->dimension,
|
||||||
destination->x, destination->y, destination->z, destination->dimension,
|
x, y, z, subject->dimension,
|
||||||
1 /* COMMAND */,
|
1, &outX, &outY, &outZ);
|
||||||
&outX, &outY, &outZ);
|
if (cancelled)
|
||||||
if (cancelled)
|
return;
|
||||||
return;
|
subject->connection->teleport(outX, outY, outZ, yRot, xRot);
|
||||||
subject->connection->teleport(outX, outY, outZ, destination->yRot, destination->xRot);
|
}
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
subject->connection->teleport(destination->x, destination->y, destination->z, destination->yRot, destination->xRot);
|
subject->connection->teleport(x, y, z, yRot, xRot);
|
||||||
#endif
|
#endif
|
||||||
//logAdminAction(source, "commands.tp.success", subject->getAName(), destination->getAName());
|
logAdminAction(source, ChatPacket::e_ChatCommandTeleportSuccess, subject->getName(), eTYPE_SERVERPLAYER, subject->getName());
|
||||||
logAdminAction(source, ChatPacket::e_ChatCommandTeleportSuccess, subject->getName(), eTYPE_SERVERPLAYER, destination->getName());
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PlayerUID destinationID = dis.readPlayerUID();
|
||||||
|
shared_ptr<ServerPlayer> destination = players->getPlayer(destinationID);
|
||||||
|
if (destination == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
if(subject == source)
|
if (subject->level->dimension->id != destination->level->dimension->id)
|
||||||
{
|
return;
|
||||||
destination->sendMessage(subject->getName(), ChatPacket::e_ChatCommandTeleportToMe);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
subject->sendMessage(destination->getName(), ChatPacket::e_ChatCommandTeleportMe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//if (args.length >= 1) {
|
subject->ride(nullptr);
|
||||||
// MinecraftServer server = MinecraftServer.getInstance();
|
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
|
||||||
// ServerPlayer victim;
|
{
|
||||||
|
double outX, outY, outZ;
|
||||||
// if (args.length == 2 || args.length == 4) {
|
bool cancelled = FourKitBridge::FirePlayerTeleport(subject->entityId,
|
||||||
// victim = server.getPlayers().getPlayer(args[0]);
|
subject->x, subject->y, subject->z, subject->dimension,
|
||||||
// if (victim == null) throw new PlayerNotFoundException();
|
destination->x, destination->y, destination->z, destination->dimension,
|
||||||
// } else {
|
1, &outX, &outY, &outZ);
|
||||||
// victim = (ServerPlayer) convertSourceToPlayer(source);
|
if (cancelled)
|
||||||
// }
|
return;
|
||||||
|
subject->connection->teleport(outX, outY, outZ, destination->yRot, destination->xRot);
|
||||||
// if (args.length == 3 || args.length == 4) {
|
}
|
||||||
// if (victim.level != null) {
|
#else
|
||||||
// int pos = args.length - 3;
|
subject->connection->teleport(destination->x, destination->y, destination->z, destination->yRot, destination->xRot);
|
||||||
// int maxPos = Level.MAX_LEVEL_SIZE;
|
#endif
|
||||||
// int x = convertArgToInt(source, args[pos++], -maxPos, maxPos);
|
logAdminAction(source, ChatPacket::e_ChatCommandTeleportSuccess, subject->getName(), eTYPE_SERVERPLAYER, destination->getName());
|
||||||
// int y = convertArgToInt(source, args[pos++], Level.minBuildHeight, Level.maxBuildHeight);
|
if (subject == source)
|
||||||
// int z = convertArgToInt(source, args[pos++], -maxPos, maxPos);
|
destination->sendMessage(subject->getName(), ChatPacket::e_ChatCommandTeleportToMe);
|
||||||
|
else
|
||||||
// victim.teleportTo(x + 0.5f, y, z + 0.5f);
|
subject->sendMessage(destination->getName(), ChatPacket::e_ChatCommandTeleportMe);
|
||||||
// logAdminAction(source, "commands.tp.coordinates", victim.getAName(), x, y, z);
|
}
|
||||||
// }
|
|
||||||
// } else if (args.length == 1 || args.length == 2) {
|
|
||||||
// ServerPlayer destination = server.getPlayers().getPlayer(args[args.length - 1]);
|
|
||||||
// if (destination == null) throw new PlayerNotFoundException();
|
|
||||||
|
|
||||||
// victim.connection.teleport(destination.x, destination.y, destination.z, destination.yRot, destination.xRot);
|
|
||||||
// logAdminAction(source, "commands.tp.success", victim.getAName(), destination.getAName());
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<GameCommandPacket> TeleportCommand::preparePacket(PlayerUID subject, PlayerUID destination)
|
shared_ptr<GameCommandPacket> TeleportCommand::preparePacket(PlayerUID subject, PlayerUID destination)
|
||||||
{
|
{
|
||||||
ByteArrayOutputStream baos;
|
ByteArrayOutputStream baos;
|
||||||
DataOutputStream dos(&baos);
|
DataOutputStream dos(&baos);
|
||||||
|
dos.writeByte(0);
|
||||||
|
dos.writePlayerUID(subject);
|
||||||
|
dos.writePlayerUID(destination);
|
||||||
|
return std::make_shared<GameCommandPacket>(eGameCommand_Teleport, baos.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
dos.writePlayerUID(subject);
|
|
||||||
dos.writePlayerUID(destination);
|
|
||||||
|
|
||||||
return std::make_shared<GameCommandPacket>(eGameCommand_Teleport, baos.toByteArray());
|
//neo: added
|
||||||
|
shared_ptr<GameCommandPacket> TeleportCommand::preparePacket(PlayerUID subject, float x, float y, float z, byte yRot, byte xRot)
|
||||||
|
{
|
||||||
|
ByteArrayOutputStream baos;
|
||||||
|
DataOutputStream dos(&baos);
|
||||||
|
dos.writeByte(1);
|
||||||
|
dos.writePlayerUID(subject);
|
||||||
|
dos.writeFloat(x);
|
||||||
|
dos.writeFloat(y);
|
||||||
|
dos.writeFloat(z);
|
||||||
|
dos.writeByte(yRot);
|
||||||
|
dos.writeByte(xRot);
|
||||||
|
return std::make_shared<GameCommandPacket>(eGameCommand_Teleport, baos.toByteArray());
|
||||||
}
|
}
|
||||||
|
|
@ -9,4 +9,7 @@ public:
|
||||||
virtual void execute(shared_ptr<CommandSender> source, byteArray commandData);
|
virtual void execute(shared_ptr<CommandSender> source, byteArray commandData);
|
||||||
|
|
||||||
static shared_ptr<GameCommandPacket> preparePacket(PlayerUID subject, PlayerUID destination);
|
static shared_ptr<GameCommandPacket> preparePacket(PlayerUID subject, PlayerUID destination);
|
||||||
|
|
||||||
|
//neo: added
|
||||||
|
static shared_ptr<GameCommandPacket> preparePacket(PlayerUID subject, float x, float y, float z, byte yRot, byte xRot);
|
||||||
};
|
};
|
||||||
|
|
@ -803,7 +803,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE); // adjust the size
|
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE); // adjust the size
|
||||||
|
|
||||||
g_hWnd = CreateWindowW( L"MinecraftClass",
|
g_hWnd = CreateWindowW( L"MinecraftClass",
|
||||||
L"Minecraft",
|
L"Minecraft: neoLegacy",
|
||||||
WS_OVERLAPPEDWINDOW,
|
WS_OVERLAPPEDWINDOW,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
|
|
@ -488,39 +488,11 @@ int main(int argc, char **argv)
|
||||||
config.worldHellScale);
|
config.worldHellScale);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LogStartupStep("registering hidden window class");
|
|
||||||
HINSTANCE hInstance = GetModuleHandle(NULL);
|
|
||||||
MyRegisterClass(hInstance);
|
|
||||||
|
|
||||||
LogStartupStep("creating hidden window");
|
|
||||||
if (!InitInstance(hInstance, SW_HIDE))
|
|
||||||
{
|
|
||||||
LogError("startup", "Failed to create window instance.");
|
|
||||||
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
ShowWindow(g_hWnd, SW_HIDE);
|
|
||||||
|
|
||||||
LogStartupStep("initializing graphics device wrappers");
|
|
||||||
if (FAILED(InitDevice()))
|
|
||||||
{
|
|
||||||
LogError("startup", "Failed to initialize D3D device.");
|
|
||||||
CleanupDevice();
|
|
||||||
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
LogStartupStep("loading media/string tables");
|
LogStartupStep("loading media/string tables");
|
||||||
app.loadMediaArchive();
|
app.loadMediaArchive();
|
||||||
RenderManager.Initialise(g_pd3dDevice, g_pSwapChain);
|
|
||||||
app.loadStringTable();
|
app.loadStringTable();
|
||||||
ui.init(g_pd3dDevice, g_pImmediateContext, g_pRenderTargetView, g_pDepthStencilView, g_iScreenWidth, g_iScreenHeight);
|
|
||||||
|
|
||||||
InputManager.Initialise(1, 3, MINECRAFT_ACTION_MAX, ACTION_MAX_MENU);
|
InputManager.Initialise(1, 3, MINECRAFT_ACTION_MAX, ACTION_MAX_MENU);
|
||||||
g_KBMInput.Init();
|
|
||||||
DefineActions();
|
|
||||||
InputManager.SetJoypadMapVal(0, 0);
|
|
||||||
InputManager.SetKeyRepeatRate(0.3f, 0.2f);
|
|
||||||
|
|
||||||
ProfileManager.Initialise(
|
ProfileManager.Initialise(
|
||||||
TITLEID_MINECRAFT,
|
TITLEID_MINECRAFT,
|
||||||
|
|
|
||||||
|
|
@ -273,4 +273,10 @@ void DataOutputStream::writePlayerUID(PlayerUID player)
|
||||||
#else
|
#else
|
||||||
writeLong(player);
|
writeLong(player);
|
||||||
#endif // PS3
|
#endif // PS3
|
||||||
|
}
|
||||||
|
|
||||||
|
//neo: added
|
||||||
|
OutputStream* DataOutputStream::getChildOutputStream()
|
||||||
|
{
|
||||||
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
@ -35,4 +35,7 @@ public:
|
||||||
virtual void writeUTF(const wstring& a);
|
virtual void writeUTF(const wstring& a);
|
||||||
virtual void writePlayerUID(PlayerUID player);
|
virtual void writePlayerUID(PlayerUID player);
|
||||||
virtual void flush();
|
virtual void flush();
|
||||||
|
|
||||||
|
//neo: added for future use cases, dont ask.
|
||||||
|
virtual OutputStream* getChildOutputStream();
|
||||||
};
|
};
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "net.minecraft.commands.h"
|
#include "net.minecraft.commands.h"
|
||||||
#include "GameModeCommand.h"
|
#include "GameModeCommand.h"
|
||||||
|
#include "../Minecraft.Client/MinecraftServer.h"
|
||||||
|
#include "../Minecraft.Client/ServerPlayer.h"
|
||||||
|
#include "../Minecraft.Client/PlayerList.h"
|
||||||
|
#include "LevelSettings.h"
|
||||||
|
#include "net.minecraft.network.packet.h"
|
||||||
|
|
||||||
EGameCommand GameModeCommand::getId()
|
EGameCommand GameModeCommand::getId()
|
||||||
{
|
{
|
||||||
|
|
@ -14,37 +19,34 @@ int GameModeCommand::getPermissionLevel()
|
||||||
|
|
||||||
void GameModeCommand::execute(shared_ptr<CommandSender> source, byteArray commandData)
|
void GameModeCommand::execute(shared_ptr<CommandSender> source, byteArray commandData)
|
||||||
{
|
{
|
||||||
//if (args.length > 0) {
|
ByteArrayInputStream bais(commandData);
|
||||||
// GameType newMode = getModeForString(source, args[0]);
|
DataInputStream dis(&bais);
|
||||||
// Player player = args.length >= 2 ? convertToPlayer(source, args[1]) : convertSourceToPlayer(source);
|
PlayerUID uid = dis.readPlayerUID();
|
||||||
|
int modeId = dis.readInt();
|
||||||
|
shared_ptr<ServerPlayer> player = MinecraftServer::getInstance()->getPlayers()->getPlayer(uid);
|
||||||
|
if (player != nullptr)
|
||||||
|
{
|
||||||
|
GameType *newMode = GameType::byId(modeId);
|
||||||
|
if (newMode != nullptr)
|
||||||
|
{
|
||||||
|
player->setGameMode(newMode);
|
||||||
|
player->resetLastActionTime();
|
||||||
|
source->sendMessage(L"Set " + player->getName() + L"'s game mode to " + newMode->getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// player.setGameMode(newMode);
|
shared_ptr<GameCommandPacket> GameModeCommand::preparePacket(shared_ptr<Player> player, int gameMode)
|
||||||
// player.fallDistance = 0; // reset falldistance so flying people do not die :P
|
{
|
||||||
|
if (player == nullptr) return nullptr;
|
||||||
// ChatMessageComponent mode = ChatMessageComponent.forTranslation("gameMode." + newMode.getName());
|
ByteArrayOutputStream baos;
|
||||||
|
DataOutputStream dos(&baos);
|
||||||
// if (player != source) {
|
dos.writePlayerUID(player->getXuid());
|
||||||
// logAdminAction(source, AdminLogCommand.LOGTYPE_DONT_SHOW_TO_SELF, "commands.gamemode.success.other", player.getAName(), mode);
|
dos.writeInt(gameMode);
|
||||||
// } else {
|
return std::make_shared<GameCommandPacket>(eGameCommand_GameMode, baos.toByteArray());
|
||||||
// logAdminAction(source, AdminLogCommand.LOGTYPE_DONT_SHOW_TO_SELF, "commands.gamemode.success.self", mode);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//throw new UsageException("commands.gamemode.usage");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GameType *GameModeCommand::getModeForString(shared_ptr<CommandSender> source, const wstring &name)
|
GameType *GameModeCommand::getModeForString(shared_ptr<CommandSender> source, const wstring &name)
|
||||||
{
|
{
|
||||||
return nullptr;
|
return GameType::byName(name);
|
||||||
//if (name.equalsIgnoreCase(GameType.SURVIVAL.getName()) || name.equalsIgnoreCase("s")) {
|
|
||||||
// return GameType.SURVIVAL;
|
|
||||||
//} else if (name.equalsIgnoreCase(GameType.CREATIVE.getName()) || name.equalsIgnoreCase("c")) {
|
|
||||||
// return GameType.CREATIVE;
|
|
||||||
//} else if (name.equalsIgnoreCase(GameType.ADVENTURE.getName()) || name.equalsIgnoreCase("a")) {
|
|
||||||
// return GameType.ADVENTURE;
|
|
||||||
//} else {
|
|
||||||
// return LevelSettings.validateGameType(convertArgToInt(source, name, 0, GameType.values().length - 2));
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Command.h"
|
#include "Command.h"
|
||||||
|
|
||||||
class GameType;
|
class GameType;
|
||||||
|
class GameCommandPacket;
|
||||||
|
|
||||||
class GameModeCommand : public Command
|
class GameModeCommand : public Command
|
||||||
{
|
{
|
||||||
|
|
@ -10,6 +10,7 @@ public:
|
||||||
virtual EGameCommand getId();
|
virtual EGameCommand getId();
|
||||||
int getPermissionLevel();
|
int getPermissionLevel();
|
||||||
virtual void execute(shared_ptr<CommandSender> source, byteArray commandData);
|
virtual void execute(shared_ptr<CommandSender> source, byteArray commandData);
|
||||||
|
static shared_ptr<GameCommandPacket> preparePacket(shared_ptr<Player> player, int gameMode);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GameType *getModeForString(shared_ptr<CommandSender> source, const wstring &name);
|
GameType *getModeForString(shared_ptr<CommandSender> source, const wstring &name);
|
||||||
|
|
|
||||||
|
|
@ -81,5 +81,15 @@ shared_ptr<GameCommandPacket> TimeCommand::preparePacket(bool night)
|
||||||
|
|
||||||
dos.writeBoolean(night);
|
dos.writeBoolean(night);
|
||||||
|
|
||||||
|
return std::make_shared<GameCommandPacket>(eGameCommand_Time, baos.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_ptr<GameCommandPacket> TimeCommand::preparePacket(int ticks)
|
||||||
|
{
|
||||||
|
ByteArrayOutputStream baos;
|
||||||
|
DataOutputStream dos(&baos);
|
||||||
|
|
||||||
|
dos.writeInt(ticks);
|
||||||
|
|
||||||
return std::make_shared<GameCommandPacket>(eGameCommand_Time, baos.toByteArray());
|
return std::make_shared<GameCommandPacket>(eGameCommand_Time, baos.toByteArray());
|
||||||
}
|
}
|
||||||
|
|
@ -15,4 +15,5 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static shared_ptr<GameCommandPacket> preparePacket(bool night);
|
static shared_ptr<GameCommandPacket> preparePacket(bool night);
|
||||||
|
static shared_ptr<GameCommandPacket> preparePacket(int ticks);
|
||||||
};
|
};
|
||||||
17
NOTES.md
Normal file
17
NOTES.md
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|

|
||||||
|
|
||||||
|
# neoLegacy v1.0.1b
|
||||||
|
|
||||||
|
- Classic Crafting
|
||||||
|
- Commands support!
|
||||||
|
- /give
|
||||||
|
- /tp - /teleport
|
||||||
|
- /gamemode
|
||||||
|
- ....
|
||||||
|
|
||||||
|
<img width="784" height="410" alt="image" src="https://github.com/user-attachments/assets/3731d5b4-b2d6-4c62-ab52-2e241fb7dcb4" />
|
||||||
|
|
||||||
|
# Download
|
||||||
|
Get the latest build from [LCE Emerald Launcher](https://github.com/LCE-Hub/LCE-Emerald-Launcher/releases) or the upcoming LC Launcher.
|
||||||
|
|
||||||
|
<!--neo: this is very barebones lmao -->
|
||||||
73
cmake/GenerateItemNameMap.cmake
Normal file
73
cmake/GenerateItemNameMap.cmake
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
if(NOT INPUT_FILES)
|
||||||
|
message(FATAL_ERROR "INPUT_FILES must be set.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT OUTPUT_FILE)
|
||||||
|
message(FATAL_ERROR "OUTPUT_FILE must be set.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_entries "")
|
||||||
|
|
||||||
|
foreach(_file IN LISTS INPUT_FILES)
|
||||||
|
if(NOT EXISTS "${_file}")
|
||||||
|
message(FATAL_ERROR "Input file does not exist: ${_file}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(READ "${_file}" _raw)
|
||||||
|
string(REPLACE "\r\n" "\n" _raw "${_raw}")
|
||||||
|
string(REPLACE "\r" "\n" _raw "${_raw}")
|
||||||
|
string(REPLACE "\n" ";" _lines "${_raw}")
|
||||||
|
|
||||||
|
foreach(_line IN LISTS _lines)
|
||||||
|
if(_line MATCHES "static const int ([A-Za-z_][A-Za-z0-9_]*_Id)[ \t]*=[ \t]*([0-9]+)")
|
||||||
|
set(_var "${CMAKE_MATCH_1}")
|
||||||
|
set(_id "${CMAKE_MATCH_2}")
|
||||||
|
string(REGEX REPLACE "_Id$" "" _name "${_var}")
|
||||||
|
if(_entries)
|
||||||
|
string(APPEND _entries ",\n { \"${_name}\", ${_id} }")
|
||||||
|
else()
|
||||||
|
set(_entries " { \"${_name}\", ${_id} }")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(_tmp "${OUTPUT_FILE}.tmp")
|
||||||
|
file(WRITE "${_tmp}"
|
||||||
|
"#pragma once\n"
|
||||||
|
"\n"
|
||||||
|
"#include <string>\n"
|
||||||
|
"#include <unordered_map>\n"
|
||||||
|
"\n"
|
||||||
|
"inline const std::unordered_map<std::string, int> g_ItemNameMap =\n"
|
||||||
|
"{\n"
|
||||||
|
"${_entries}\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"inline int GetItemIdByName(const std::string& name)\n"
|
||||||
|
"{\n"
|
||||||
|
" auto it = g_ItemNameMap.find(name);\n"
|
||||||
|
" return (it != g_ItemNameMap.end()) ? it->second : -1;\n"
|
||||||
|
"}\n"
|
||||||
|
"inline int GetItemIdByName(const std::wstring& name)\n"
|
||||||
|
"{\n"
|
||||||
|
" return GetItemIdByName(std::string(name.begin(), name.end()));\n"
|
||||||
|
"}\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(EXISTS "${OUTPUT_FILE}")
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E compare_files "${OUTPUT_FILE}" "${_tmp}"
|
||||||
|
RESULT_VARIABLE _changed
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(_changed 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(_changed)
|
||||||
|
file(RENAME "${_tmp}" "${OUTPUT_FILE}")
|
||||||
|
message(STATUS "GenerateItemNameMap: wrote ${OUTPUT_FILE}")
|
||||||
|
else()
|
||||||
|
file(REMOVE "${_tmp}")
|
||||||
|
message(STATUS "GenerateItemNameMap: ${OUTPUT_FILE} is up-to-date")
|
||||||
|
endif()
|
||||||
Loading…
Reference in a new issue