mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
from unused PIX profiler events
This commit is contained in:
parent
181b697327
commit
564959f4e9
|
|
@ -164,8 +164,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB* chunkBox,
|
||||||
if (m_completed) return;
|
if (m_completed) return;
|
||||||
if (chunk->level->dimension->id != m_dimension) return;
|
if (chunk->level->dimension->id != m_dimension) return;
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition");
|
if (m_schematic == nullptr)
|
||||||
if (m_schematic == nullptr)
|
|
||||||
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||||
|
|
||||||
if (!m_locationBox.has_value()) updateLocationBox();
|
if (!m_locationBox.has_value()) updateLocationBox();
|
||||||
|
|
@ -177,16 +176,14 @@ void ApplySchematicRuleDefinition::processSchematic(AABB* chunkBox,
|
||||||
app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n",
|
app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n",
|
||||||
m_schematicName.c_str(), chunk->x, chunk->z);
|
m_schematicName.c_str(), chunk->x, chunk->z);
|
||||||
#endif
|
#endif
|
||||||
PIXBeginNamedEvent(0, "Applying blocks and data");
|
m_totalBlocksChanged += m_schematic->applyBlocksAndData(
|
||||||
m_totalBlocksChanged += m_schematic->applyBlocksAndData(
|
|
||||||
chunk, chunkBox, &*m_locationBox, m_rotation);
|
chunk, chunkBox, &*m_locationBox, m_rotation);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// Add the tileEntities
|
// Add the tileEntities
|
||||||
PIXBeginNamedEvent(0, "Applying tile entities");
|
m_schematic->applyTileEntities(chunk, chunkBox, &*m_locationBox,
|
||||||
m_schematic->applyTileEntities(chunk, chunkBox, &*m_locationBox,
|
|
||||||
m_rotation);
|
m_rotation);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// TODO This does not take into account things that go outside the
|
// TODO This does not take into account things that go outside the
|
||||||
// bounds of the world
|
// bounds of the world
|
||||||
|
|
@ -200,7 +197,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB* chunkBox,
|
||||||
// m_schematic = nullptr;
|
// m_schematic = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox,
|
void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox,
|
||||||
|
|
@ -208,8 +205,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox,
|
||||||
if (m_completed) return;
|
if (m_completed) return;
|
||||||
if (chunk->level->dimension->id != m_dimension) return;
|
if (chunk->level->dimension->id != m_dimension) return;
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)");
|
if (m_schematic == nullptr)
|
||||||
if (m_schematic == nullptr)
|
|
||||||
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||||
|
|
||||||
if (!m_locationBox.has_value()) updateLocationBox();
|
if (!m_locationBox.has_value()) updateLocationBox();
|
||||||
|
|
@ -221,10 +217,9 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox,
|
||||||
app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n",
|
app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n",
|
||||||
m_schematicName.c_str(), chunk->x, chunk->z);
|
m_schematicName.c_str(), chunk->x, chunk->z);
|
||||||
#endif
|
#endif
|
||||||
PIXBeginNamedEvent(0, "Patching lighting");
|
m_totalBlocksChangedLighting += m_schematic->applyLighting(
|
||||||
m_totalBlocksChangedLighting += m_schematic->applyLighting(
|
|
||||||
chunk, chunkBox, &*m_locationBox, m_rotation);
|
chunk, chunkBox, &*m_locationBox, m_rotation);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// TODO This does not take into account things that go outside the
|
// TODO This does not take into account things that go outside the
|
||||||
// bounds of the world
|
// bounds of the world
|
||||||
|
|
@ -238,7 +233,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox,
|
||||||
// m_schematic = nullptr;
|
// m_schematic = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApplySchematicRuleDefinition::checkIntersects(int x0, int y0, int z0,
|
bool ApplySchematicRuleDefinition::checkIntersects(int x0, int y0, int z0,
|
||||||
|
|
|
||||||
|
|
@ -227,13 +227,11 @@ int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk* chunk,
|
||||||
int totalBlockCount = getXSize() * rowBlockCount;
|
int totalBlockCount = getXSize() * rowBlockCount;
|
||||||
|
|
||||||
std::vector<uint8_t> blockData = std::vector<uint8_t>(Level::CHUNK_TILE_COUNT);
|
std::vector<uint8_t> blockData = std::vector<uint8_t>(Level::CHUNK_TILE_COUNT);
|
||||||
PIXBeginNamedEvent(0, "Getting block data");
|
chunk->getBlockData(blockData);
|
||||||
chunk->getBlockData(blockData);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
std::vector<uint8_t> dataData = std::vector<uint8_t>(Level::HALF_CHUNK_TILE_COUNT);
|
std::vector<uint8_t> dataData = std::vector<uint8_t>(Level::HALF_CHUNK_TILE_COUNT);
|
||||||
PIXBeginNamedEvent(0, "Getting Data data");
|
chunk->getDataData(dataData);
|
||||||
chunk->getDataData(dataData);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// Ignore light data
|
// Ignore light data
|
||||||
int blockLightP = -1;
|
int blockLightP = -1;
|
||||||
|
|
@ -305,13 +303,11 @@ int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk* chunk,
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Setting Block data");
|
chunk->setBlockData(blockData);
|
||||||
chunk->setBlockData(blockData);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
chunk->recalcHeightmapOnly();
|
chunk->recalcHeightmapOnly();
|
||||||
PIXBeginNamedEvent(0, "Setting Data data");
|
chunk->setDataData(dataData);
|
||||||
chunk->setDataData(dataData);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// A basic pass through to roughly do the lighting. At this point of
|
// A basic pass through to roughly do the lighting. At this point of
|
||||||
// post-processing, we don't have all the neighbouring chunks loaded in, so
|
// post-processing, we don't have all the neighbouring chunks loaded in, so
|
||||||
|
|
@ -966,8 +962,7 @@ void ConsoleSchematicFile::setBlocksAndData(
|
||||||
upperY1 = y1 - Level::COMPRESSED_CHUNK_SECTION_HEIGHT;
|
upperY1 = y1 - Level::COMPRESSED_CHUNK_SECTION_HEIGHT;
|
||||||
bHasUpper = true;
|
bHasUpper = true;
|
||||||
}
|
}
|
||||||
PIXBeginNamedEvent(0, "Applying block data");
|
for (int x = x0; x < x1; x++)
|
||||||
for (int x = x0; x < x1; x++)
|
|
||||||
for (int z = z0; z < z1; z++) {
|
for (int z = z0; z < z1; z++) {
|
||||||
if (bHasLower) {
|
if (bHasLower) {
|
||||||
int slot = x << Level::genDepthBitsPlusFour |
|
int slot = x << Level::genDepthBitsPlusFour |
|
||||||
|
|
@ -985,10 +980,9 @@ void ConsoleSchematicFile::setBlocksAndData(
|
||||||
blocksP += len;
|
blocksP += len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Applying Data data");
|
for (int x = x0; x < x1; x++)
|
||||||
for (int x = x0; x < x1; x++)
|
|
||||||
for (int z = z0; z < z1; z++) {
|
for (int z = z0; z < z1; z++) {
|
||||||
if (bHasLower) {
|
if (bHasLower) {
|
||||||
int slot = (x << Level::genDepthBitsPlusFour |
|
int slot = (x << Level::genDepthBitsPlusFour |
|
||||||
|
|
@ -1008,7 +1002,7 @@ void ConsoleSchematicFile::setBlocksAndData(
|
||||||
dataP += len;
|
dataP += len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
// 4J Stu - Allow ignoring light data
|
// 4J Stu - Allow ignoring light data
|
||||||
if (blockLightP > -1) {
|
if (blockLightP > -1) {
|
||||||
std::vector<uint8_t> blockLightData = std::vector<uint8_t>(Level::HALF_CHUNK_TILE_COUNT);
|
std::vector<uint8_t> blockLightData = std::vector<uint8_t>(Level::HALF_CHUNK_TILE_COUNT);
|
||||||
|
|
|
||||||
|
|
@ -253,8 +253,6 @@ void LevelGenerationOptions::addAttribute(const std::wstring& attributeName,
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevelGenerationOptions::processSchematics(LevelChunk* chunk) {
|
void LevelGenerationOptions::processSchematics(LevelChunk* chunk) {
|
||||||
PIXBeginNamedEvent(0, "Processing schematics for chunk (%d,%d)", chunk->x,
|
|
||||||
chunk->z);
|
|
||||||
AABB chunkBox(chunk->x * 16, 0, chunk->z * 16, chunk->x * 16 + 16,
|
AABB chunkBox(chunk->x * 16, 0, chunk->z * 16, chunk->x * 16 + 16,
|
||||||
Level::maxBuildHeight, chunk->z * 16 + 16);
|
Level::maxBuildHeight, chunk->z * 16 + 16);
|
||||||
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
|
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
|
||||||
|
|
@ -277,12 +275,10 @@ void LevelGenerationOptions::processSchematics(LevelChunk* chunk) {
|
||||||
delete bb;
|
delete bb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevelGenerationOptions::processSchematicsLighting(LevelChunk* chunk) {
|
void LevelGenerationOptions::processSchematicsLighting(LevelChunk* chunk) {
|
||||||
PIXBeginNamedEvent(0, "Processing schematics (lighting) for chunk (%d,%d)",
|
|
||||||
chunk->x, chunk->z);
|
|
||||||
AABB chunkBox(chunk->x * 16, 0, chunk->z * 16, chunk->x * 16 + 16,
|
AABB chunkBox(chunk->x * 16, 0, chunk->z * 16, chunk->x * 16 + 16,
|
||||||
Level::maxBuildHeight, chunk->z * 16 + 16);
|
Level::maxBuildHeight, chunk->z * 16 + 16);
|
||||||
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
|
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
|
||||||
|
|
@ -290,13 +286,12 @@ void LevelGenerationOptions::processSchematicsLighting(LevelChunk* chunk) {
|
||||||
ApplySchematicRuleDefinition* rule = *it;
|
ApplySchematicRuleDefinition* rule = *it;
|
||||||
rule->processSchematicLighting(&chunkBox, chunk);
|
rule->processSchematicLighting(&chunkBox, chunk);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1,
|
bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1,
|
||||||
int y1, int z1) {
|
int y1, int z1) {
|
||||||
PIXBeginNamedEvent(0, "Check Intersects");
|
|
||||||
|
|
||||||
// As an optimisation, we can quickly discard things below a certain y which
|
// As an optimisation, we can quickly discard things below a certain y which
|
||||||
// makes most ore checks faster due to a) ores generally being below
|
// makes most ore checks faster due to a) ores generally being below
|
||||||
// ground/sea level and b) tutorial world additions generally being above
|
// ground/sea level and b) tutorial world additions generally being above
|
||||||
|
|
@ -340,7 +335,7 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1,
|
||||||
if (intersects) break;
|
if (intersects) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
return intersects;
|
return intersects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -303,9 +303,8 @@ void UIScene_MainMenu::RunAction(int iPad) {
|
||||||
|
|
||||||
void UIScene_MainMenu::customDraw(IggyCustomDrawCallbackRegion* region) {
|
void UIScene_MainMenu::customDraw(IggyCustomDrawCallbackRegion* region) {
|
||||||
if (std::char_traits<char16_t>::compare(region->name, u"Splash", 6) == 0) {
|
if (std::char_traits<char16_t>::compare(region->name, u"Splash", 6) == 0) {
|
||||||
PIXBeginNamedEvent(0, "Custom draw splash");
|
customDrawSplash(region);
|
||||||
customDrawSplash(region);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -795,23 +795,20 @@ UIController::ExternalFunctionCallback(void* user_callback_data, Iggy* player,
|
||||||
|
|
||||||
// RENDERING
|
// RENDERING
|
||||||
void UIController::renderScenes() {
|
void UIController::renderScenes() {
|
||||||
PIXBeginNamedEvent(0, "Rendering Iggy scenes");
|
// Only render player scenes if the game is started
|
||||||
// Only render player scenes if the game is started
|
|
||||||
if (app.GetGameStarted() &&
|
if (app.GetGameStarted() &&
|
||||||
!m_groups[eUIGroup_Fullscreen]->hidesLowerScenes()) {
|
!m_groups[eUIGroup_Fullscreen]->hidesLowerScenes()) {
|
||||||
for (int i = eUIGroup_Player1; i < eUIGroup_COUNT; ++i) {
|
for (int i = eUIGroup_Player1; i < eUIGroup_COUNT; ++i) {
|
||||||
PIXBeginNamedEvent(0, "Rendering layer %d scenes", i);
|
m_groups[i]->render();
|
||||||
m_groups[i]->render();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always render the fullscreen group
|
// Always render the fullscreen group
|
||||||
PIXBeginNamedEvent(0, "Rendering fullscreen scenes");
|
m_groups[eUIGroup_Fullscreen]->render();
|
||||||
m_groups[eUIGroup_Fullscreen]->render();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
#if defined(ENABLE_IGGY_PERFMON)
|
#if defined(ENABLE_IGGY_PERFMON)
|
||||||
if (m_iggyPerfmonEnabled) {
|
if (m_iggyPerfmonEnabled) {
|
||||||
|
|
@ -942,9 +939,8 @@ void UIController::setupCustomDrawGameState() {
|
||||||
m_customRenderingClearRect.bottom = LONG_MIN;
|
m_customRenderingClearRect.bottom = LONG_MIN;
|
||||||
|
|
||||||
#if defined(_WINDOWS64)
|
#if defined(_WINDOWS64)
|
||||||
PIXBeginNamedEvent(0, "StartFrame");
|
RenderManager.StartFrame();
|
||||||
RenderManager.StartFrame();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
gdraw_D3D11_setViewport_4J();
|
gdraw_D3D11_setViewport_4J();
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
RenderManager.StartFrame();
|
RenderManager.StartFrame();
|
||||||
|
|
@ -957,8 +953,7 @@ void UIController::setupCustomDrawGameState() {
|
||||||
// RenderManager.Clear(GL_DEPTH_BUFFER_BIT, &m_customRenderingClearRect);
|
// RenderManager.Clear(GL_DEPTH_BUFFER_BIT, &m_customRenderingClearRect);
|
||||||
// glClear(GL_DEPTH_BUFFER_BIT);
|
// glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Final setup");
|
glMatrixMode(GL_PROJECTION);
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glOrtho(0, m_fScreenWidth, m_fScreenHeight, 0, 1000, 3000);
|
glOrtho(0, m_fScreenWidth, m_fScreenHeight, 0, 1000, 3000);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
@ -967,7 +962,7 @@ void UIController::setupCustomDrawGameState() {
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glDepthFunc(GL_LEQUAL);
|
glDepthFunc(GL_LEQUAL);
|
||||||
glDepthMask(true);
|
glDepthMask(true);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIController::setupCustomDrawMatrices(UIScene* scene,
|
void UIController::setupCustomDrawMatrices(UIScene* scene,
|
||||||
|
|
|
||||||
|
|
@ -142,10 +142,8 @@ void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport) {
|
||||||
auto itRef = m_componentRefCount.find((*it)->getSceneType());
|
auto itRef = m_componentRefCount.find((*it)->getSceneType());
|
||||||
if (itRef != m_componentRefCount.end() && itRef->second.second) {
|
if (itRef != m_componentRefCount.end() && itRef->second.second) {
|
||||||
if ((*it)->isVisible()) {
|
if ((*it)->isVisible()) {
|
||||||
PIXBeginNamedEvent(0, "Rendering component %d",
|
|
||||||
(*it)->getSceneType());
|
|
||||||
(*it)->render(width, height, viewport);
|
(*it)->render(width, height, viewport);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -161,11 +159,8 @@ void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport) {
|
||||||
(!ui.IsExpectingOrReloadingSkin() ||
|
(!ui.IsExpectingOrReloadingSkin() ||
|
||||||
m_sceneStack[lowestRenderable]->getSceneType() ==
|
m_sceneStack[lowestRenderable]->getSceneType() ==
|
||||||
eUIScene_Timer)) {
|
eUIScene_Timer)) {
|
||||||
PIXBeginNamedEvent(
|
|
||||||
0, "Rendering scene %d",
|
|
||||||
m_sceneStack[lowestRenderable]->getSceneType());
|
|
||||||
m_sceneStack[lowestRenderable]->render(width, height, viewport);
|
m_sceneStack[lowestRenderable]->render(width, height, viewport);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -545,8 +545,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region,
|
||||||
// Setup GDraw, normal game render states and matrices
|
// Setup GDraw, normal game render states and matrices
|
||||||
// CustomDrawData *customDrawRegion =
|
// CustomDrawData *customDrawRegion =
|
||||||
// ui.setupCustomDraw(this,region);
|
// ui.setupCustomDraw(this,region);
|
||||||
PIXBeginNamedEvent(0, "Starting Iggy custom draw\n");
|
CustomDrawData* customDrawRegion =
|
||||||
CustomDrawData* customDrawRegion =
|
|
||||||
ui.calculateCustomDraw(region);
|
ui.calculateCustomDraw(region);
|
||||||
ui.beginIggyCustomDraw4J(region, customDrawRegion);
|
ui.beginIggyCustomDraw4J(region, customDrawRegion);
|
||||||
ui.setupCustomDrawGameState();
|
ui.setupCustomDrawGameState();
|
||||||
|
|
@ -557,16 +556,14 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region,
|
||||||
|
|
||||||
if (!useCommandBuffers || m_needsCacheRendered) {
|
if (!useCommandBuffers || m_needsCacheRendered) {
|
||||||
if (useCommandBuffers) RenderManager.CBuffStart(list, true);
|
if (useCommandBuffers) RenderManager.CBuffStart(list, true);
|
||||||
PIXBeginNamedEvent(0, "Draw uncached");
|
ui.setupCustomDrawMatrices(this, customDrawRegion);
|
||||||
ui.setupCustomDrawMatrices(this, customDrawRegion);
|
|
||||||
_customDrawSlotControl(customDrawRegion, iPad, item, fAlpha,
|
_customDrawSlotControl(customDrawRegion, iPad, item, fAlpha,
|
||||||
isFoil, bDecorations,
|
isFoil, bDecorations,
|
||||||
useCommandBuffers);
|
useCommandBuffers);
|
||||||
delete customDrawRegion;
|
delete customDrawRegion;
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Draw all cache");
|
// Draw all the cached slots
|
||||||
// Draw all the cached slots
|
|
||||||
for (auto it = m_cachedSlotDraw.begin();
|
for (auto it = m_cachedSlotDraw.begin();
|
||||||
it != m_cachedSlotDraw.end(); ++it) {
|
it != m_cachedSlotDraw.end(); ++it) {
|
||||||
CachedSlotDrawData* drawData = *it;
|
CachedSlotDrawData* drawData = *it;
|
||||||
|
|
@ -579,7 +576,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region,
|
||||||
delete drawData->customDrawRegion;
|
delete drawData->customDrawRegion;
|
||||||
delete drawData;
|
delete drawData;
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
if (useCommandBuffers) RenderManager.CBuffEnd();
|
if (useCommandBuffers) RenderManager.CBuffEnd();
|
||||||
}
|
}
|
||||||
m_cachedSlotDraw.clear();
|
m_cachedSlotDraw.clear();
|
||||||
|
|
@ -591,8 +588,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region,
|
||||||
|
|
||||||
pMinecraft->player = oldPlayer;
|
pMinecraft->player = oldPlayer;
|
||||||
} else {
|
} else {
|
||||||
PIXBeginNamedEvent(0, "Caching region");
|
CachedSlotDrawData* drawData = new CachedSlotDrawData();
|
||||||
CachedSlotDrawData* drawData = new CachedSlotDrawData();
|
|
||||||
drawData->item = item;
|
drawData->item = item;
|
||||||
drawData->fAlpha = fAlpha;
|
drawData->fAlpha = fAlpha;
|
||||||
drawData->isFoil = isFoil;
|
drawData->isFoil = isFoil;
|
||||||
|
|
@ -600,7 +596,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region,
|
||||||
drawData->customDrawRegion = ui.calculateCustomDraw(region);
|
drawData->customDrawRegion = ui.calculateCustomDraw(region);
|
||||||
|
|
||||||
m_cachedSlotDraw.push_back(drawData);
|
m_cachedSlotDraw.push_back(drawData);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Setup GDraw, normal game render states and matrices
|
// Setup GDraw, normal game render states and matrices
|
||||||
|
|
@ -678,12 +674,11 @@ void UIScene::_customDrawSlotControl(CustomDrawData* region, int iPad,
|
||||||
glTranslatef((float)-(sx + sxoffs), (float)-(sy + syoffs), 0);
|
glTranslatef((float)-(sx + sxoffs), (float)-(sy + syoffs), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Render and decorate");
|
if (m_pItemRenderer == nullptr) m_pItemRenderer = new ItemRenderer();
|
||||||
if (m_pItemRenderer == nullptr) m_pItemRenderer = new ItemRenderer();
|
|
||||||
m_pItemRenderer->renderAndDecorateItem(
|
m_pItemRenderer->renderAndDecorateItem(
|
||||||
pMinecraft->font, pMinecraft->textures, item, x, y, scaleX, scaleY,
|
pMinecraft->font, pMinecraft->textures, item, x, y, scaleX, scaleY,
|
||||||
fAlpha, isFoil, false, !usingCommandBuffer);
|
fAlpha, isFoil, false, !usingCommandBuffer);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
if (pop > 0) {
|
if (pop > 0) {
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
|
||||||
|
|
@ -763,32 +763,25 @@ int main(int argc, const char* argv[]) {
|
||||||
ui.setScreenSize(fbw, fbh);
|
ui.setScreenSize(fbw, fbh);
|
||||||
}
|
}
|
||||||
app.UpdateTime();
|
app.UpdateTime();
|
||||||
PIXBeginNamedEvent(0, "Input manager tick");
|
InputManager.Tick();
|
||||||
InputManager.Tick();
|
|
||||||
PIXEndNamedEvent();
|
ProfileManager.Tick();
|
||||||
PIXBeginNamedEvent(0, "Profile manager tick");
|
|
||||||
ProfileManager.Tick();
|
StorageManager.Tick();
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Storage manager tick");
|
RenderManager.Tick();
|
||||||
StorageManager.Tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Render manager tick");
|
|
||||||
RenderManager.Tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// Tick the social networking manager.
|
// Tick the social networking manager.
|
||||||
PIXBeginNamedEvent(0, "Social network manager tick");
|
// CSocialManager::Instance()->Tick();
|
||||||
// CSocialManager::Instance()->Tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// Tick sentient.
|
// Tick sentient.
|
||||||
PIXBeginNamedEvent(0, "Sentient tick");
|
// SentientManager.Tick();
|
||||||
// SentientManager.Tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Network manager do work #1");
|
g_NetworkManager.DoWork();
|
||||||
g_NetworkManager.DoWork();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
// Render game graphics.
|
// Render game graphics.
|
||||||
#if defined(ENABLE_JAVA_GUIS)
|
#if defined(ENABLE_JAVA_GUIS)
|
||||||
pMinecraft->run_middle();
|
pMinecraft->run_middle();
|
||||||
|
|
@ -831,8 +824,7 @@ int main(int argc, const char* argv[]) {
|
||||||
RenderManager.Present();
|
RenderManager.Present();
|
||||||
|
|
||||||
ui.CheckMenuDisplayed();
|
ui.CheckMenuDisplayed();
|
||||||
PIXBeginNamedEvent(0, "Profile load check");
|
// has the game defined profile data been changed (by a profile load)
|
||||||
// has the game defined profile data been changed (by a profile load)
|
|
||||||
if (app.uiGameDefinedDataChangedBitmask != 0) {
|
if (app.uiGameDefinedDataChangedBitmask != 0) {
|
||||||
void* pData;
|
void* pData;
|
||||||
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
||||||
|
|
@ -863,11 +855,10 @@ int main(int argc, const char* argv[]) {
|
||||||
// clear the flag
|
// clear the flag
|
||||||
app.uiGameDefinedDataChangedBitmask = 0;
|
app.uiGameDefinedDataChangedBitmask = 0;
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Network manager do work #2");
|
g_NetworkManager.DoWork();
|
||||||
g_NetworkManager.DoWork();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// Any threading type things to deal with from the xui side?
|
// Any threading type things to deal with from the xui side?
|
||||||
app.HandleXuiActions();
|
app.HandleXuiActions();
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,4 @@ int CMinecraftApp::GetTPConfigVal(wchar_t* pwchDataFile) { return 0; }
|
||||||
|
|
||||||
#include "Minecraft.World/x64headers/extraX64.h"
|
#include "Minecraft.World/x64headers/extraX64.h"
|
||||||
|
|
||||||
void PIXSetMarkerDeprecated(int a, const char* b, ...) {}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -44,51 +44,6 @@ uint32_t XContentGetThumbnail(uint32_t dwUserIndex,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PIXAddNamedCounter(int a, const char* b, ...) {}
|
|
||||||
// #define PS3_USE_PIX_EVENTS
|
|
||||||
// #define PS4_USE_PIX_EVENTS
|
|
||||||
void PIXBeginNamedEvent(int a, const char* b, ...) {
|
|
||||||
#if defined(PS4_USE_PIX_EVENTS)
|
|
||||||
char buf[512];
|
|
||||||
va_list args;
|
|
||||||
va_start(args, b);
|
|
||||||
vsprintf(buf, b, args);
|
|
||||||
sceRazorCpuPushMarker(buf, 0xffffffff, SCE_RAZOR_MARKER_ENABLE_HUD);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#if defined(PS3_USE_PIX_EVENTS)
|
|
||||||
char buf[256];
|
|
||||||
wchar_t wbuf[256];
|
|
||||||
va_list args;
|
|
||||||
va_start(args, b);
|
|
||||||
vsprintf(buf, b, args);
|
|
||||||
snPushMarker(buf);
|
|
||||||
|
|
||||||
// mbstowcs(wbuf,buf,256);
|
|
||||||
// RenderManager.BeginEvent(wbuf);
|
|
||||||
va_end(args);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void PIXEndNamedEvent() {
|
|
||||||
#if defined(PS4_USE_PIX_EVENTS)
|
|
||||||
sceRazorCpuPopMarker();
|
|
||||||
#endif
|
|
||||||
#if defined(PS3_USE_PIX_EVENTS)
|
|
||||||
snPopMarker();
|
|
||||||
// RenderManager.EndEvent();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
void PIXSetMarkerDeprecated(int a, char* b, ...) {}
|
|
||||||
|
|
||||||
// void *D3DXBUFFER::GetBufferPointer() { return nullptr; }
|
|
||||||
// int D3DXBUFFER::GetBufferSize() { return 0; }
|
|
||||||
// void D3DXBUFFER::Release() {}
|
|
||||||
|
|
||||||
// #if 0
|
|
||||||
// void GetLocalTime(SYSTEMTIME *time) {}
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
bool IsEqualXUID(PlayerUID a, PlayerUID b) { return false; }
|
bool IsEqualXUID(PlayerUID a, PlayerUID b) { return false; }
|
||||||
|
|
||||||
void XMemCpy(void* a, const void* b, size_t s) { memcpy(a, b, s); }
|
void XMemCpy(void* a, const void* b, size_t s) { memcpy(a, b, s); }
|
||||||
|
|
|
||||||
|
|
@ -789,32 +789,25 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||||
// }
|
// }
|
||||||
|
|
||||||
app.UpdateTime();
|
app.UpdateTime();
|
||||||
PIXBeginNamedEvent(0, "Input manager tick");
|
InputManager.Tick();
|
||||||
InputManager.Tick();
|
|
||||||
PIXEndNamedEvent();
|
// ProfileManager.Tick();
|
||||||
PIXBeginNamedEvent(0, "Profile manager tick");
|
|
||||||
// ProfileManager.Tick();
|
StorageManager.Tick();
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Storage manager tick");
|
RenderManager.Tick();
|
||||||
StorageManager.Tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Render manager tick");
|
|
||||||
RenderManager.Tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// Tick the social networking manager.
|
// Tick the social networking manager.
|
||||||
PIXBeginNamedEvent(0, "Social network manager tick");
|
// CSocialManager::Instance()->Tick();
|
||||||
// CSocialManager::Instance()->Tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// Tick sentient.
|
// Tick sentient.
|
||||||
PIXBeginNamedEvent(0, "Sentient tick");
|
// SentientManager.Tick();
|
||||||
// SentientManager.Tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Network manager do work #1");
|
// g_NetworkManager.DoWork();
|
||||||
// g_NetworkManager.DoWork();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// LeaderboardManager::Instance()->Tick();
|
// LeaderboardManager::Instance()->Tick();
|
||||||
// Render game graphics.
|
// Render game graphics.
|
||||||
|
|
|
||||||
|
|
@ -97,13 +97,11 @@ void ConsoleUIController::render() {
|
||||||
|
|
||||||
void ConsoleUIController::beginIggyCustomDraw4J(
|
void ConsoleUIController::beginIggyCustomDraw4J(
|
||||||
IggyCustomDrawCallbackRegion* region, CustomDrawData* customDrawRegion) {
|
IggyCustomDrawCallbackRegion* region, CustomDrawData* customDrawRegion) {
|
||||||
PIXBeginNamedEvent(0, "Starting Iggy custom draw\n");
|
|
||||||
|
// get the correct object-to-world matrix from GDraw, and set the render
|
||||||
PIXBeginNamedEvent(0, "Gdraw setup");
|
|
||||||
// get the correct object-to-world matrix from GDraw, and set the render
|
|
||||||
// state to a normal state
|
// state to a normal state
|
||||||
gdraw_D3D11_BeginCustomDraw_4J(region, customDrawRegion->mat);
|
gdraw_D3D11_BeginCustomDraw_4J(region, customDrawRegion->mat);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomDrawData* ConsoleUIController::setupCustomDraw(
|
CustomDrawData* ConsoleUIController::setupCustomDraw(
|
||||||
|
|
@ -114,8 +112,7 @@ CustomDrawData* ConsoleUIController::setupCustomDraw(
|
||||||
customDrawRegion->y0 = region->y0;
|
customDrawRegion->y0 = region->y0;
|
||||||
customDrawRegion->y1 = region->y1;
|
customDrawRegion->y1 = region->y1;
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Starting Iggy custom draw\n");
|
// get the correct object-to-world matrix from GDraw, and set the render
|
||||||
// get the correct object-to-world matrix from GDraw, and set the render
|
|
||||||
// state to a normal state
|
// state to a normal state
|
||||||
gdraw_D3D11_BeginCustomDraw_4J(region, customDrawRegion->mat);
|
gdraw_D3D11_BeginCustomDraw_4J(region, customDrawRegion->mat);
|
||||||
|
|
||||||
|
|
@ -141,7 +138,7 @@ void ConsoleUIController::endCustomDraw(IggyCustomDrawCallbackRegion* region) {
|
||||||
endCustomDrawGameStateAndMatrices();
|
endCustomDrawGameStateAndMatrices();
|
||||||
|
|
||||||
gdraw_D3D11_EndCustomDraw(region);
|
gdraw_D3D11_EndCustomDraw(region);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleUIController::setTileOrigin(S32 xPos, S32 yPos) {
|
void ConsoleUIController::setTileOrigin(S32 xPos, S32 yPos) {
|
||||||
|
|
|
||||||
|
|
@ -1577,17 +1577,15 @@ void Minecraft::run_middle() {
|
||||||
|
|
||||||
// if (pause) timer.a = 1;
|
// if (pause) timer.a = 1;
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Sound engine update");
|
soundEngine->tick((std::shared_ptr<Mob>*)localplayers,
|
||||||
soundEngine->tick((std::shared_ptr<Mob>*)localplayers,
|
|
||||||
timer->a);
|
timer->a);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Light update");
|
|
||||||
|
|
||||||
|
|
||||||
// if (level != nullptr) level->updateLights();
|
// if (level != nullptr) level->updateLights();
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// if (!Keyboard::isKeyDown(Keyboard.KEY_F7))
|
// if (!Keyboard::isKeyDown(Keyboard.KEY_F7))
|
||||||
// Display.update(); // 4J - removed
|
// Display.update(); // 4J - removed
|
||||||
|
|
@ -1603,14 +1601,12 @@ void Minecraft::run_middle() {
|
||||||
int iPrimaryPad = InputManager.GetPrimaryPad();
|
int iPrimaryPad = InputManager.GetPrimaryPad();
|
||||||
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
||||||
if (setLocalPlayerIdx(i)) {
|
if (setLocalPlayerIdx(i)) {
|
||||||
PIXBeginNamedEvent(0, "Game render player idx %d",
|
|
||||||
i);
|
|
||||||
RenderManager.StateSetViewport(
|
RenderManager.StateSetViewport(
|
||||||
(C4JRender::eViewportType)
|
(C4JRender::eViewportType)
|
||||||
player->m_iScreenSection);
|
player->m_iScreenSection);
|
||||||
gameRenderer->render(timer->a, bFirst);
|
gameRenderer->render(timer->a, bFirst);
|
||||||
bFirst = false;
|
bFirst = false;
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
if (i == iPrimaryPad) {
|
if (i == iPrimaryPad) {
|
||||||
// check to see if we need to capture a
|
// check to see if we need to capture a
|
||||||
|
|
@ -1698,19 +1694,17 @@ void Minecraft::run_middle() {
|
||||||
|
|
||||||
achievementPopup->render();
|
achievementPopup->render();
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Sleeping");
|
std::this_thread::yield(); // 4jcraft added now that we have
|
||||||
std::this_thread::yield(); // 4jcraft added now that we have
|
|
||||||
// portable thread yield.
|
// portable thread yield.
|
||||||
// std::this_thread::sleep_for(
|
// std::this_thread::sleep_for(
|
||||||
// std::chrono::milliseconds(0)); // 4J - was
|
// std::chrono::milliseconds(0)); // 4J - was
|
||||||
// Thread.yield())
|
// Thread.yield())
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// if (Keyboard::isKeyDown(Keyboard::KEY_F7))
|
// if (Keyboard::isKeyDown(Keyboard::KEY_F7))
|
||||||
// Display.update(); // 4J - removed condition
|
// Display.update(); // 4J - removed condition
|
||||||
PIXBeginNamedEvent(0, "Display update");
|
Display::update();
|
||||||
Display::update();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// checkScreenshot(); // 4J - removed
|
// checkScreenshot(); // 4J - removed
|
||||||
|
|
||||||
|
|
@ -1986,9 +1980,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
|
||||||
glBindTexture(GL_TEXTURE_2D,
|
glBindTexture(GL_TEXTURE_2D,
|
||||||
textures->loadTexture(TN_TERRAIN)); // L"/terrain.png"));
|
textures->loadTexture(TN_TERRAIN)); // L"/terrain.png"));
|
||||||
if (bFirst) {
|
if (bFirst) {
|
||||||
PIXBeginNamedEvent(0, "Texture tick");
|
if (!pause) textures->tick(bUpdateTextures);
|
||||||
if (!pause) textures->tick(bUpdateTextures);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -3528,9 +3521,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
|
||||||
level->difficulty = options->difficulty;
|
level->difficulty = options->difficulty;
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Game renderer tick");
|
if (!pause) gameRenderer->tick(bFirst);
|
||||||
if (!pause) gameRenderer->tick(bFirst);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// 4J - we want to tick each level once only per frame, and do it when a
|
// 4J - we want to tick each level once only per frame, and do it when a
|
||||||
// player that is actually in that level happens to be active. This is
|
// player that is actually in that level happens to be active. This is
|
||||||
|
|
@ -3543,9 +3535,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
|
||||||
levelsTickedFlags = 0;
|
levelsTickedFlags = 0;
|
||||||
|
|
||||||
#if !defined(DISABLE_LEVELTICK_THREAD)
|
#if !defined(DISABLE_LEVELTICK_THREAD)
|
||||||
PIXBeginNamedEvent(0, "levelTickEventQueue waitForFinish");
|
levelTickEventQueue->waitForFinish();
|
||||||
levelTickEventQueue->waitForFinish();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
#endif
|
#endif
|
||||||
SparseLightStorage::tick(); // 4J added
|
SparseLightStorage::tick(); // 4J added
|
||||||
CompressedTileStorage::tick(); // 4J added
|
CompressedTileStorage::tick(); // 4J added
|
||||||
|
|
@ -3571,9 +3562,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
|
||||||
// level this frame
|
// level this frame
|
||||||
levelsTickedFlags |= (1 << i);
|
levelsTickedFlags |= (1 << i);
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Level renderer tick");
|
if (!pause) levelRenderer->tick();
|
||||||
if (!pause) levelRenderer->tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
// if (!pause && player!=null) {
|
// if (!pause && player!=null) {
|
||||||
// if (player != null && !level.entities.contains(player)) {
|
// if (player != null && !level.entities.contains(player)) {
|
||||||
// level.addEntity(player);
|
// level.addEntity(player);
|
||||||
|
|
@ -3582,9 +3572,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
|
||||||
if (levels[i] != nullptr) {
|
if (levels[i] != nullptr) {
|
||||||
if (!pause) {
|
if (!pause) {
|
||||||
if (levels[i]->skyFlashTime > 0) levels[i]->skyFlashTime--;
|
if (levels[i]->skyFlashTime > 0) levels[i]->skyFlashTime--;
|
||||||
PIXBeginNamedEvent(0, "Level entity tick");
|
levels[i]->tickEntities();
|
||||||
levels[i]->tickEntities();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// optimisation to set the culling off early, in parallel with
|
// optimisation to set the culling off early, in parallel with
|
||||||
|
|
@ -3596,21 +3585,19 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
|
||||||
// app.DebugPrintf("Minecraft::tick spawn settings -
|
// app.DebugPrintf("Minecraft::tick spawn settings -
|
||||||
// Difficulty = %d",options->difficulty);
|
// Difficulty = %d",options->difficulty);
|
||||||
levels[i]->setSpawnSettings(level->difficulty > 0, true);
|
levels[i]->setSpawnSettings(level->difficulty > 0, true);
|
||||||
PIXBeginNamedEvent(0, "Level tick");
|
#if defined(DISABLE_LEVELTICK_THREAD)
|
||||||
#if defined(DISABLE_LEVELTICK_THREAD)
|
|
||||||
levels[i]->tick();
|
levels[i]->tick();
|
||||||
#else
|
#else
|
||||||
levelTickEventQueue->sendEvent(levels[i]);
|
levelTickEventQueue->sendEvent(levels[i]);
|
||||||
#endif
|
#endif
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bFirst) {
|
if (bFirst) {
|
||||||
PIXBeginNamedEvent(0, "Particle tick");
|
if (!pause) particleEngine->tick();
|
||||||
if (!pause) particleEngine->tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J Stu - Keep ticking the connections if paused so that they don't
|
// 4J Stu - Keep ticking the connections if paused so that they don't
|
||||||
|
|
|
||||||
|
|
@ -990,8 +990,7 @@ void ClientConnection::handleChunkTilesUpdate(
|
||||||
MultiPlayerLevel* dimensionLevel =
|
MultiPlayerLevel* dimensionLevel =
|
||||||
(MultiPlayerLevel*)minecraft->levels[packet->levelIdx];
|
(MultiPlayerLevel*)minecraft->levels[packet->levelIdx];
|
||||||
if (dimensionLevel) {
|
if (dimensionLevel) {
|
||||||
PIXBeginNamedEvent(0, "Handle chunk tiles update");
|
LevelChunk* lc = dimensionLevel->getChunk(packet->xc, packet->zc);
|
||||||
LevelChunk* lc = dimensionLevel->getChunk(packet->xc, packet->zc);
|
|
||||||
int xo = packet->xc * 16;
|
int xo = packet->xc * 16;
|
||||||
int zo = packet->zc * 16;
|
int zo = packet->zc * 16;
|
||||||
// 4J Stu - Unshare before we make any changes incase the server is
|
// 4J Stu - Unshare before we make any changes incase the server is
|
||||||
|
|
@ -1012,9 +1011,8 @@ void ClientConnection::handleChunkTilesUpdate(
|
||||||
// If this is going to actually change a tile, we'll need to unshare
|
// If this is going to actually change a tile, we'll need to unshare
|
||||||
int prevTile = lc->getTile(x, y, z);
|
int prevTile = lc->getTile(x, y, z);
|
||||||
if ((tile != prevTile && !forcedUnshare)) {
|
if ((tile != prevTile && !forcedUnshare)) {
|
||||||
PIXBeginNamedEvent(0, "Chunk data unsharing\n");
|
dimensionLevel->unshareChunkAt(xo, zo);
|
||||||
dimensionLevel->unshareChunkAt(xo, zo);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
forcedUnshare = true;
|
forcedUnshare = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1058,13 +1056,12 @@ void ClientConnection::handleChunkTilesUpdate(
|
||||||
dimensionLevel->removeUnusedTileEntitiesInRegion(
|
dimensionLevel->removeUnusedTileEntitiesInRegion(
|
||||||
xo + x, y, zo + z, xo + x + 1, y + 1, zo + z + 1);
|
xo + x, y, zo + z, xo + x + 1, y + 1, zo + z + 1);
|
||||||
}
|
}
|
||||||
PIXBeginNamedEvent(0, "Chunk data sharing\n");
|
dimensionLevel->shareChunkAt(xo,
|
||||||
dimensionLevel->shareChunkAt(xo,
|
|
||||||
zo); // 4J - added - only shares if chunks
|
zo); // 4J - added - only shares if chunks
|
||||||
// are same on server & client
|
// are same on server & client
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1074,37 +1071,32 @@ void ClientConnection::handleBlockRegionUpdate(
|
||||||
MultiPlayerLevel* dimensionLevel =
|
MultiPlayerLevel* dimensionLevel =
|
||||||
(MultiPlayerLevel*)minecraft->levels[packet->levelIdx];
|
(MultiPlayerLevel*)minecraft->levels[packet->levelIdx];
|
||||||
if (dimensionLevel) {
|
if (dimensionLevel) {
|
||||||
PIXBeginNamedEvent(0, "Handle block region update");
|
|
||||||
|
|
||||||
int y1 = packet->y + packet->ys;
|
int y1 = packet->y + packet->ys;
|
||||||
if (packet->bIsFullChunk) {
|
if (packet->bIsFullChunk) {
|
||||||
y1 = Level::maxBuildHeight;
|
y1 = Level::maxBuildHeight;
|
||||||
if (packet->buffer.size() > 0) {
|
if (packet->buffer.size() > 0) {
|
||||||
PIXBeginNamedEvent(0, "Reordering to XZY");
|
LevelChunk::reorderBlocksAndDataToXZY(packet->y, packet->xs,
|
||||||
LevelChunk::reorderBlocksAndDataToXZY(packet->y, packet->xs,
|
|
||||||
packet->ys, packet->zs,
|
packet->ys, packet->zs,
|
||||||
&packet->buffer);
|
&packet->buffer);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXBeginNamedEvent(0, "Clear rest region");
|
dimensionLevel->clearResetRegion(packet->x, packet->y, packet->z,
|
||||||
dimensionLevel->clearResetRegion(packet->x, packet->y, packet->z,
|
|
||||||
packet->x + packet->xs - 1, y1 - 1,
|
packet->x + packet->xs - 1, y1 - 1,
|
||||||
packet->z + packet->zs - 1);
|
packet->z + packet->zs - 1);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "setBlocksAndData");
|
// Only full chunks send lighting information now - added flag to end of
|
||||||
// Only full chunks send lighting information now - added flag to end of
|
|
||||||
// this call
|
// this call
|
||||||
dimensionLevel->setBlocksAndData(packet->x, packet->y, packet->z,
|
dimensionLevel->setBlocksAndData(packet->x, packet->y, packet->z,
|
||||||
packet->xs, packet->ys, packet->zs,
|
packet->xs, packet->ys, packet->zs,
|
||||||
packet->buffer, packet->bIsFullChunk);
|
packet->buffer, packet->bIsFullChunk);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// OutputDebugString("END BRU\n");
|
// OutputDebugString("END BRU\n");
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "removeUnusedTileEntitiesInRegion");
|
// 4J - remove any tite entities in this region which are associated
|
||||||
// 4J - remove any tite entities in this region which are associated
|
|
||||||
// with a tile that is now no longer a tile entity. Without doing this
|
// with a tile that is now no longer a tile entity. Without doing this
|
||||||
// we end up with stray tile entities kicking round, which leads to a
|
// we end up with stray tile entities kicking round, which leads to a
|
||||||
// bug where chests can't be properly placed again in a location after
|
// bug where chests can't be properly placed again in a location after
|
||||||
|
|
@ -1112,19 +1104,18 @@ void ClientConnection::handleBlockRegionUpdate(
|
||||||
dimensionLevel->removeUnusedTileEntitiesInRegion(
|
dimensionLevel->removeUnusedTileEntitiesInRegion(
|
||||||
packet->x, packet->y, packet->z, packet->x + packet->xs, y1,
|
packet->x, packet->y, packet->z, packet->x + packet->xs, y1,
|
||||||
packet->z + packet->zs);
|
packet->z + packet->zs);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// If this is a full packet for a chunk, make sure that the cache now
|
// If this is a full packet for a chunk, make sure that the cache now
|
||||||
// considers that it has data for this chunk - this is used to determine
|
// considers that it has data for this chunk - this is used to determine
|
||||||
// whether to bother rendering mobs or not, so we don't have them in
|
// whether to bother rendering mobs or not, so we don't have them in
|
||||||
// crazy positions before the data is there
|
// crazy positions before the data is there
|
||||||
if (packet->bIsFullChunk) {
|
if (packet->bIsFullChunk) {
|
||||||
PIXBeginNamedEvent(0, "dateReceivedForChunk");
|
dimensionLevel->dataReceivedForChunk(packet->x >> 4,
|
||||||
dimensionLevel->dataReceivedForChunk(packet->x >> 4,
|
|
||||||
packet->z >> 4);
|
packet->z >> 4);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1144,8 +1135,7 @@ void ClientConnection::handleTileUpdate(
|
||||||
MultiPlayerLevel* dimensionLevel =
|
MultiPlayerLevel* dimensionLevel =
|
||||||
(MultiPlayerLevel*)minecraft->levels[packet->levelIdx];
|
(MultiPlayerLevel*)minecraft->levels[packet->levelIdx];
|
||||||
if (dimensionLevel) {
|
if (dimensionLevel) {
|
||||||
PIXBeginNamedEvent(0, "Handle tile update");
|
|
||||||
|
|
||||||
if (g_NetworkManager.IsHost()) {
|
if (g_NetworkManager.IsHost()) {
|
||||||
// 4J Stu - Unshare before we make any changes incase the server is
|
// 4J Stu - Unshare before we make any changes incase the server is
|
||||||
// already another step ahead of us Fix for #7904 - Gameplay:
|
// already another step ahead of us Fix for #7904 - Gameplay:
|
||||||
|
|
@ -1157,9 +1147,8 @@ void ClientConnection::handleTileUpdate(
|
||||||
int prevData =
|
int prevData =
|
||||||
dimensionLevel->getData(packet->x, packet->y, packet->z);
|
dimensionLevel->getData(packet->x, packet->y, packet->z);
|
||||||
if (packet->block != prevTile || packet->data != prevData) {
|
if (packet->block != prevTile || packet->data != prevData) {
|
||||||
PIXBeginNamedEvent(0, "Chunk data unsharing\n");
|
dimensionLevel->unshareChunkAt(packet->x, packet->z);
|
||||||
dimensionLevel->unshareChunkAt(packet->x, packet->z);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1172,11 +1161,10 @@ void ClientConnection::handleTileUpdate(
|
||||||
dimensionLevel, packet->x, packet->y, packet->z);
|
dimensionLevel, packet->x, packet->y, packet->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Setting data\n");
|
bool tileWasSet = dimensionLevel->doSetTileAndData(
|
||||||
bool tileWasSet = dimensionLevel->doSetTileAndData(
|
|
||||||
packet->x, packet->y, packet->z, packet->block, packet->data);
|
packet->x, packet->y, packet->z, packet->block, packet->data);
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// 4J - remove any tite entities in this region which are associated
|
// 4J - remove any tite entities in this region which are associated
|
||||||
// with a tile that is now no longer a tile entity. Without doing this
|
// with a tile that is now no longer a tile entity. Without doing this
|
||||||
|
|
@ -1187,13 +1175,12 @@ void ClientConnection::handleTileUpdate(
|
||||||
packet->x, packet->y, packet->z, packet->x + 1, packet->y + 1,
|
packet->x, packet->y, packet->z, packet->x + 1, packet->y + 1,
|
||||||
packet->z + 1);
|
packet->z + 1);
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Sharing data\n");
|
dimensionLevel->shareChunkAt(
|
||||||
dimensionLevel->shareChunkAt(
|
|
||||||
packet->x, packet->z); // 4J - added - only shares if chunks are
|
packet->x, packet->z); // 4J - added - only shares if chunks are
|
||||||
// same on server & client
|
// same on server & client
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2451,11 +2438,9 @@ void ClientConnection::handleRespawn(std::shared_ptr<RespawnPacket> packet) {
|
||||||
void ClientConnection::handleExplosion(std::shared_ptr<ExplodePacket> packet) {
|
void ClientConnection::handleExplosion(std::shared_ptr<ExplodePacket> packet) {
|
||||||
if (!packet->m_bKnockbackOnly) {
|
if (!packet->m_bKnockbackOnly) {
|
||||||
// app.DebugPrintf("Received ExplodePacket with explosion data\n");
|
// app.DebugPrintf("Received ExplodePacket with explosion data\n");
|
||||||
PIXBeginNamedEvent(0, "Handling explosion");
|
Explosion* e = new Explosion(minecraft->level, nullptr, packet->x,
|
||||||
Explosion* e = new Explosion(minecraft->level, nullptr, packet->x,
|
|
||||||
packet->y, packet->z, packet->r);
|
packet->y, packet->z, packet->r);
|
||||||
PIXBeginNamedEvent(0, "Finalizing");
|
|
||||||
|
|
||||||
// Fix for #81758 - TCR 006 BAS Non-Interactive Pause: TU9: Performance:
|
// Fix for #81758 - TCR 006 BAS Non-Interactive Pause: TU9: Performance:
|
||||||
// Gameplay: After detonating bunch of TNT, game enters unresponsive
|
// Gameplay: After detonating bunch of TNT, game enters unresponsive
|
||||||
// state for couple of seconds. The changes we are making here have been
|
// state for couple of seconds. The changes we are making here have been
|
||||||
|
|
@ -2468,8 +2453,8 @@ void ClientConnection::handleExplosion(std::shared_ptr<ExplodePacket> packet) {
|
||||||
// rather than copying around
|
// rather than copying around
|
||||||
e->finalizeExplosion(true, &packet->toBlow);
|
e->finalizeExplosion(true, &packet->toBlow);
|
||||||
mpLevel->enableResetChanges(true);
|
mpLevel->enableResetChanges(true);
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
delete e;
|
delete e;
|
||||||
} else {
|
} else {
|
||||||
// app.DebugPrintf("Received ExplodePacket with knockback only data\n");
|
// app.DebugPrintf("Received ExplodePacket with knockback only data\n");
|
||||||
|
|
@ -2848,10 +2833,9 @@ void ClientConnection::handleContainerClose(
|
||||||
|
|
||||||
void ClientConnection::handleTileEvent(
|
void ClientConnection::handleTileEvent(
|
||||||
std::shared_ptr<TileEventPacket> packet) {
|
std::shared_ptr<TileEventPacket> packet) {
|
||||||
PIXBeginNamedEvent(0, "Handle tile event\n");
|
minecraft->level->tileEvent(packet->x, packet->y, packet->z, packet->tile,
|
||||||
minecraft->level->tileEvent(packet->x, packet->y, packet->z, packet->tile,
|
|
||||||
packet->b0, packet->b1);
|
packet->b0, packet->b1);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::handleTileDestruction(
|
void ClientConnection::handleTileDestruction(
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,7 @@ void MultiPlayerLevel::shareChunkAt(int x, int z) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiPlayerLevel::tick() {
|
void MultiPlayerLevel::tick() {
|
||||||
PIXBeginNamedEvent(0, "Sky color changing");
|
setGameTime(getGameTime() + 1);
|
||||||
setGameTime(getGameTime() + 1);
|
|
||||||
if (getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)) {
|
if (getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)) {
|
||||||
// 4J: Debug setting added to keep it at day time
|
// 4J: Debug setting added to keep it at day time
|
||||||
#if !defined(_FINAL_BUILD)
|
#if !defined(_FINAL_BUILD)
|
||||||
|
|
@ -139,10 +138,9 @@ void MultiPlayerLevel::tick() {
|
||||||
listeners[i]->skyColorChanged();
|
listeners[i]->skyColorChanged();
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Entity re-entry");
|
{
|
||||||
{
|
|
||||||
std::lock_guard<std::recursive_mutex> lock(m_entitiesCS);
|
std::lock_guard<std::recursive_mutex> lock(m_entitiesCS);
|
||||||
for (int i = 0; i < 10 && !reEntries.empty(); i++) {
|
for (int i = 0; i < 10 && !reEntries.empty(); i++) {
|
||||||
std::shared_ptr<Entity> e = *(reEntries.begin());
|
std::shared_ptr<Entity> e = *(reEntries.begin());
|
||||||
|
|
@ -151,20 +149,18 @@ void MultiPlayerLevel::tick() {
|
||||||
addEntity(e);
|
addEntity(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Connection ticking");
|
// 4J HEG - Copy the connections vector to prevent crash when moving to
|
||||||
// 4J HEG - Copy the connections vector to prevent crash when moving to
|
|
||||||
// Nether
|
// Nether
|
||||||
std::vector<ClientConnection*> connectionsTemp = connections;
|
std::vector<ClientConnection*> connectionsTemp = connections;
|
||||||
for (auto connection = connectionsTemp.begin();
|
for (auto connection = connectionsTemp.begin();
|
||||||
connection < connectionsTemp.end(); ++connection) {
|
connection < connectionsTemp.end(); ++connection) {
|
||||||
(*connection)->tick();
|
(*connection)->tick();
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Updating resets");
|
unsigned int lastIndexToRemove = 0;
|
||||||
unsigned int lastIndexToRemove = 0;
|
|
||||||
bool eraseElements = false;
|
bool eraseElements = false;
|
||||||
for (unsigned int i = 0; i < updatesToReset.size(); i++) {
|
for (unsigned int i = 0; i < updatesToReset.size(); i++) {
|
||||||
ResetInfo& r = updatesToReset[i];
|
ResetInfo& r = updatesToReset[i];
|
||||||
|
|
@ -187,7 +183,7 @@ void MultiPlayerLevel::tick() {
|
||||||
updatesToReset.erase(updatesToReset.begin(),
|
updatesToReset.erase(updatesToReset.begin(),
|
||||||
updatesToReset.begin() + lastIndexToRemove);
|
updatesToReset.begin() + lastIndexToRemove);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
chunkCache->tick();
|
chunkCache->tick();
|
||||||
tickTiles();
|
tickTiles();
|
||||||
|
|
@ -411,13 +407,10 @@ void MultiPlayerLevel::tickTiles() {
|
||||||
// resets in buildAndPrepareChunksToPoll rather than
|
// resets in buildAndPrepareChunksToPoll rather than
|
||||||
// the calling functions
|
// the calling functions
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Ticking tiles (multiplayer)");
|
Level::tickTiles();
|
||||||
PIXBeginNamedEvent(0, "buildAndPrepareChunksToPoll");
|
|
||||||
Level::tickTiles();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Ticking client side tiles");
|
auto itEndCtp = chunksToPoll.end();
|
||||||
auto itEndCtp = chunksToPoll.end();
|
|
||||||
for (auto it = chunksToPoll.begin(); it != itEndCtp; it++) {
|
for (auto it = chunksToPoll.begin(); it != itEndCtp; it++) {
|
||||||
ChunkPos cp = *it;
|
ChunkPos cp = *it;
|
||||||
int xo = cp.x * 16;
|
int xo = cp.x * 16;
|
||||||
|
|
@ -427,8 +420,8 @@ void MultiPlayerLevel::tickTiles() {
|
||||||
|
|
||||||
tickClientSideTiles(xo, zo, lc);
|
tickClientSideTiles(xo, zo, lc);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiPlayerLevel::setChunkVisible(int x, int z, bool visible) {
|
void MultiPlayerLevel::setChunkVisible(int x, int z, bool visible) {
|
||||||
|
|
@ -917,11 +910,10 @@ void MultiPlayerLevel::removeClientConnection(ClientConnection* c,
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiPlayerLevel::tickAllConnections() {
|
void MultiPlayerLevel::tickAllConnections() {
|
||||||
PIXBeginNamedEvent(0, "Connection ticking");
|
for (auto it = connections.begin(); it < connections.end(); ++it) {
|
||||||
for (auto it = connections.begin(); it < connections.end(); ++it) {
|
|
||||||
(*it)->tick();
|
(*it)->tick();
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiPlayerLevel::dataReceivedForChunk(int x, int z) {
|
void MultiPlayerLevel::dataReceivedForChunk(int x, int z) {
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,6 @@ void Chunk::setPos(int x, int y, int z) {
|
||||||
// itself have been made dirty.
|
// itself have been made dirty.
|
||||||
levelRenderer->setGlobalChunkFlag(x, y, z, level,
|
levelRenderer->setGlobalChunkFlag(x, y, z, level,
|
||||||
LevelRenderer::CHUNK_FLAG_DIRTY);
|
LevelRenderer::CHUNK_FLAG_DIRTY);
|
||||||
PIXSetMarkerDeprecated(0, "Non-stack event pushed");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -221,11 +220,9 @@ void Chunk::makeCopyForRebuild(Chunk* source) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chunk::rebuild() {
|
void Chunk::rebuild() {
|
||||||
PIXBeginNamedEvent(0, "Rebuilding chunk %d, %d, %d", x, y, z);
|
|
||||||
|
|
||||||
// if (!dirty) return;
|
// if (!dirty) return;
|
||||||
PIXBeginNamedEvent(0, "Rebuild section A");
|
|
||||||
|
|
||||||
#if defined(_LARGE_WORLDS)
|
#if defined(_LARGE_WORLDS)
|
||||||
Tesselator* t = Tesselator::getInstance();
|
Tesselator* t = Tesselator::getInstance();
|
||||||
#else
|
#else
|
||||||
|
|
@ -258,10 +255,9 @@ void Chunk::rebuild() {
|
||||||
2;
|
2;
|
||||||
lists += levelRenderer->chunkLists;
|
lists += levelRenderer->chunkLists;
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Rebuild section B");
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// 4J - optimisation begins.
|
// 4J - optimisation begins.
|
||||||
|
|
||||||
// Get the data for the level chunk that this render chunk is it (level
|
// Get the data for the level chunk that this render chunk is it (level
|
||||||
|
|
@ -406,7 +402,7 @@ void Chunk::rebuild() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
// Nothing at all to do for this chunk?
|
// Nothing at all to do for this chunk?
|
||||||
if (empty) {
|
if (empty) {
|
||||||
// 4J - added - clear any renderer data associated with this
|
// 4J - added - clear any renderer data associated with this
|
||||||
|
|
@ -430,8 +426,7 @@ void Chunk::rebuild() {
|
||||||
// 4J - optimisation ends
|
// 4J - optimisation ends
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Rebuild section C");
|
Tesselator::Bounds bounds; // 4J MGH - added
|
||||||
Tesselator::Bounds bounds; // 4J MGH - added
|
|
||||||
{
|
{
|
||||||
// this was the old default clip bounds for the chunk, set in
|
// this was the old default clip bounds for the chunk, set in
|
||||||
// Chunk::setPos.
|
// Chunk::setPos.
|
||||||
|
|
@ -549,9 +544,8 @@ void Chunk::rebuild() {
|
||||||
delete tileRenderer;
|
delete tileRenderer;
|
||||||
delete region;
|
delete region;
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Rebuild section D");
|
|
||||||
|
|
||||||
// 4J - have rewritten the way that tile entities are stored globally to
|
// 4J - have rewritten the way that tile entities are stored globally to
|
||||||
// make it work more easily with split screen. Chunks are now stored
|
// make it work more easily with split screen. Chunks are now stored
|
||||||
// globally in the levelrenderer, in a hashmap with a special key made up
|
// globally in the levelrenderer, in a hashmap with a special key made up
|
||||||
|
|
@ -561,7 +555,7 @@ void Chunk::rebuild() {
|
||||||
std::lock_guard<std::mutex> lock(*globalRenderableTileEntities_cs);
|
std::lock_guard<std::mutex> lock(*globalRenderableTileEntities_cs);
|
||||||
reconcileRenderableTileEntities(renderableTileEntities);
|
reconcileRenderableTileEntities(renderableTileEntities);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// 4J - These removed items are now also removed from
|
// 4J - These removed items are now also removed from
|
||||||
// globalRenderableTileEntities
|
// globalRenderableTileEntities
|
||||||
|
|
@ -575,7 +569,7 @@ void Chunk::rebuild() {
|
||||||
}
|
}
|
||||||
levelRenderer->setGlobalChunkFlag(x, y, z, level,
|
levelRenderer->setGlobalChunkFlag(x, y, z, level,
|
||||||
LevelRenderer::CHUNK_FLAG_COMPILED);
|
LevelRenderer::CHUNK_FLAG_COMPILED);
|
||||||
PIXEndNamedEvent();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -252,9 +252,8 @@ void GameRenderer::tick(bool first) // 4J - add bFirst
|
||||||
|
|
||||||
itemInHandRenderer->tick();
|
itemInHandRenderer->tick();
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Rain tick");
|
tickRain();
|
||||||
tickRain();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
darkenWorldAmountO = darkenWorldAmount;
|
darkenWorldAmountO = darkenWorldAmount;
|
||||||
if (BossMobGuiInfo::darkenWorld) {
|
if (BossMobGuiInfo::darkenWorld) {
|
||||||
|
|
@ -767,9 +766,8 @@ void GameRenderer::renderItemInHand(float a, int eye) {
|
||||||
!mc->cameraTargetPlayer->isSleeping()) {
|
!mc->cameraTargetPlayer->isSleeping()) {
|
||||||
if (!mc->options->hideGui && !mc->gameMode->isCutScene()) {
|
if (!mc->options->hideGui && !mc->gameMode->isCutScene()) {
|
||||||
turnOnLightLayer(a, true);
|
turnOnLightLayer(a, true);
|
||||||
PIXBeginNamedEvent(0, "Item in hand render");
|
itemInHandRenderer->render(a);
|
||||||
itemInHandRenderer->render(a);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
turnOffLightLayer(a);
|
turnOffLightLayer(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1119,9 +1117,6 @@ int GameRenderer::runUpdate(void* lpParam) {
|
||||||
|
|
||||||
m_updateEvents->set(eUpdateCanRun);
|
m_updateEvents->set(eUpdateCanRun);
|
||||||
|
|
||||||
// PIXBeginNamedEvent(0,"Updating dirty chunks
|
|
||||||
//%d",(count++)&7);
|
|
||||||
|
|
||||||
// Update chunks atomically until there aren't any very near ones left -
|
// Update chunks atomically until there aren't any very near ones left -
|
||||||
// they will be deferred for rendering until the call to
|
// they will be deferred for rendering until the call to
|
||||||
// CBuffDeferredModeEnd if we have anything near to render here Now
|
// CBuffDeferredModeEnd if we have anything near to render here Now
|
||||||
|
|
@ -1168,7 +1163,7 @@ int GameRenderer::runUpdate(void* lpParam) {
|
||||||
m_deleteStackSparseDataStorage.clear();
|
m_deleteStackSparseDataStorage.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// PIXEndNamedEvent();
|
//
|
||||||
|
|
||||||
m_updateEvents->set(eUpdateEventIsFinished);
|
m_updateEvents->set(eUpdateEventIsFinished);
|
||||||
}
|
}
|
||||||
|
|
@ -1281,8 +1276,7 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
||||||
GL11::glShadeModel(GL11::GL_SMOOTH);
|
GL11::glShadeModel(GL11::GL_SMOOTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Culling");
|
// Culler *frustum = new FrustumCuller();
|
||||||
// Culler *frustum = new FrustumCuller();
|
|
||||||
FrustumCuller frustObj;
|
FrustumCuller frustObj;
|
||||||
Culler* frustum = &frustObj;
|
Culler* frustum = &frustObj;
|
||||||
frustum->prepare(xOff, yOff, zOff);
|
frustum->prepare(xOff, yOff, zOff);
|
||||||
|
|
@ -1291,19 +1285,16 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
||||||
FRAME_PROFILE_SCOPE(ChunkCull);
|
FRAME_PROFILE_SCOPE(ChunkCull);
|
||||||
mc->levelRenderer->cull(frustum, a);
|
mc->levelRenderer->cull(frustum, a);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
#if !defined(MULTITHREAD_ENABLE)
|
#if !defined(MULTITHREAD_ENABLE)
|
||||||
if ((i == 0) && updateChunks) // 4J - added updateChunks condition
|
if ((i == 0) && updateChunks) // 4J - added updateChunks condition
|
||||||
{
|
{
|
||||||
int PIXPass = 0;
|
int PIXPass = 0;
|
||||||
PIXBeginNamedEvent(0, "Updating dirty chunks");
|
do {
|
||||||
do {
|
|
||||||
PIXBeginNamedEvent(0, "Updating dirty chunks pass %d",
|
|
||||||
PIXPass++);
|
|
||||||
bool retval =
|
bool retval =
|
||||||
mc->levelRenderer->updateDirtyChunks(cameraEntity, false);
|
mc->levelRenderer->updateDirtyChunks(cameraEntity, false);
|
||||||
PIXEndNamedEvent();
|
|
||||||
if (retval) break;
|
if (retval) break;
|
||||||
|
|
||||||
if (until == 0) break;
|
if (until == 0) break;
|
||||||
|
|
@ -1312,7 +1303,7 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
||||||
if (diff < 0) break;
|
if (diff < 0) break;
|
||||||
if (diff > 1000000000) break;
|
if (diff > 1000000000) break;
|
||||||
} while (true);
|
} while (true);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1330,16 +1321,14 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
||||||
mc->textures->bindTexture(
|
mc->textures->bindTexture(
|
||||||
&TextureAtlas::LOCATION_BLOCKS); // 4J was L"/terrain.png"
|
&TextureAtlas::LOCATION_BLOCKS); // 4J was L"/terrain.png"
|
||||||
Lighting::turnOff();
|
Lighting::turnOff();
|
||||||
PIXBeginNamedEvent(0, "Level render");
|
levelRenderer->render(cameraEntity, 0, a, updateChunks);
|
||||||
levelRenderer->render(cameraEntity, 0, a, updateChunks);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
GL11::glShadeModel(GL11::GL_FLAT);
|
GL11::glShadeModel(GL11::GL_FLAT);
|
||||||
|
|
||||||
if (cameraFlip == 0) {
|
if (cameraFlip == 0) {
|
||||||
Lighting::turnOn();
|
Lighting::turnOn();
|
||||||
PIXBeginNamedEvent(0, "Entity render");
|
// 4J - for entities, don't include the "a" factor that interpolates
|
||||||
// 4J - for entities, don't include the "a" factor that interpolates
|
|
||||||
// from the old to new position, as the AABBs for the entities are
|
// from the old to new position, as the AABBs for the entities are
|
||||||
// already fully at the new position This fixes flickering
|
// already fully at the new position This fixes flickering
|
||||||
// minecarts, and pigs that you are riding on
|
// minecarts, and pigs that you are riding on
|
||||||
|
|
@ -1358,9 +1347,8 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
||||||
FRAME_PROFILE_SCOPE(Entity);
|
FRAME_PROFILE_SCOPE(Entity);
|
||||||
levelRenderer->renderEntities(&cameraPos, frustum, a);
|
levelRenderer->renderEntities(&cameraPos, frustum, a);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Particle render");
|
turnOnLightLayer(a); // 4J - brought forward from 1.8.2
|
||||||
turnOnLightLayer(a); // 4J - brought forward from 1.8.2
|
|
||||||
{
|
{
|
||||||
FRAME_PROFILE_SCOPE(Particle);
|
FRAME_PROFILE_SCOPE(Particle);
|
||||||
particleEngine->renderLit(cameraEntity, a,
|
particleEngine->renderLit(cameraEntity, a,
|
||||||
|
|
@ -1373,7 +1361,7 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
||||||
particleEngine->render(cameraEntity, a,
|
particleEngine->render(cameraEntity, a,
|
||||||
ParticleEngine::OPAQUE_LIST);
|
ParticleEngine::OPAQUE_LIST);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
turnOffLightLayer(a); // 4J - brought forward from 1.8.2
|
turnOffLightLayer(a); // 4J - brought forward from 1.8.2
|
||||||
|
|
||||||
if ((mc->hitResult != nullptr) &&
|
if ((mc->hitResult != nullptr) &&
|
||||||
|
|
@ -1411,33 +1399,29 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
||||||
}
|
}
|
||||||
|
|
||||||
glBlendFunc(GL_ZERO, GL_ONE);
|
glBlendFunc(GL_ZERO, GL_ONE);
|
||||||
PIXBeginNamedEvent(0, "Fancy second pass - writing z");
|
int visibleWaterChunks =
|
||||||
int visibleWaterChunks =
|
|
||||||
levelRenderer->render(cameraEntity, 1, a, updateChunks);
|
levelRenderer->render(cameraEntity, 1, a, updateChunks);
|
||||||
PIXEndNamedEvent();
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
if (visibleWaterChunks > 0) {
|
if (visibleWaterChunks > 0) {
|
||||||
PIXBeginNamedEvent(0, "Fancy second pass - actual rendering");
|
levelRenderer->render(
|
||||||
levelRenderer->render(
|
|
||||||
cameraEntity, 1, a,
|
cameraEntity, 1, a,
|
||||||
updateChunks); // 4J - chanaged, used to be
|
updateChunks); // 4J - chanaged, used to be
|
||||||
// renderSameAsLast but we don't support
|
// renderSameAsLast but we don't support
|
||||||
// that anymore
|
// that anymore
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11::glShadeModel(GL11::GL_FLAT);
|
GL11::glShadeModel(GL11::GL_FLAT);
|
||||||
} else {
|
} else {
|
||||||
PIXBeginNamedEvent(0, "Second pass level render");
|
levelRenderer->render(cameraEntity, 1, a, updateChunks);
|
||||||
levelRenderer->render(cameraEntity, 1, a, updateChunks);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J - added - have split out translucent particle rendering so that it
|
// 4J - added - have split out translucent particle rendering so that it
|
||||||
// happens after the water is rendered, primarily for fireworks
|
// happens after the water is rendered, primarily for fireworks
|
||||||
PIXBeginNamedEvent(0, "Particle render (translucent)");
|
Lighting::turnOn();
|
||||||
Lighting::turnOn();
|
|
||||||
turnOnLightLayer(a); // 4J - brought forward from 1.8.2
|
turnOnLightLayer(a); // 4J - brought forward from 1.8.2
|
||||||
{
|
{
|
||||||
FRAME_PROFILE_SCOPE(Particle);
|
FRAME_PROFILE_SCOPE(Particle);
|
||||||
|
|
@ -1451,7 +1435,7 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
||||||
particleEngine->render(cameraEntity, a,
|
particleEngine->render(cameraEntity, a,
|
||||||
ParticleEngine::TRANSLUCENT_LIST);
|
ParticleEngine::TRANSLUCENT_LIST);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
turnOffLightLayer(a); // 4J - brought forward from 1.8.2
|
turnOffLightLayer(a); // 4J - brought forward from 1.8.2
|
||||||
////////////////////////// End of 4J added section
|
////////////////////////// End of 4J added section
|
||||||
|
|
||||||
|
|
@ -1473,9 +1457,8 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 4J - moved rain rendering to after clouds so that it alpha blends
|
/* 4J - moved rain rendering to after clouds so that it alpha blends
|
||||||
onto them properly PIXBeginNamedEvent(0,"Rendering snow and rain");
|
onto them properly renderSnowAndRain(a);
|
||||||
renderSnowAndRain(a);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
glDisable(GL_FOG);
|
glDisable(GL_FOG);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -1498,12 +1481,11 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
||||||
// blend properly onto them
|
// blend properly onto them
|
||||||
setupFog(0, a);
|
setupFog(0, a);
|
||||||
glEnable(GL_FOG);
|
glEnable(GL_FOG);
|
||||||
PIXBeginNamedEvent(0, "Rendering snow and rain");
|
{
|
||||||
{
|
|
||||||
FRAME_PROFILE_SCOPE(WeatherSky);
|
FRAME_PROFILE_SCOPE(WeatherSky);
|
||||||
renderSnowAndRain(a);
|
renderSnowAndRain(a);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
glDisable(GL_FOG);
|
glDisable(GL_FOG);
|
||||||
|
|
||||||
if (zoom == 1) {
|
if (zoom == 1) {
|
||||||
|
|
@ -1524,9 +1506,8 @@ void GameRenderer::prepareAndRenderClouds(LevelRenderer* levelRenderer,
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
setupFog(0, a);
|
setupFog(0, a);
|
||||||
glEnable(GL_FOG);
|
glEnable(GL_FOG);
|
||||||
PIXBeginNamedEvent(0, "Rendering clouds");
|
levelRenderer->renderClouds(a);
|
||||||
levelRenderer->renderClouds(a);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
glDisable(GL_FOG);
|
glDisable(GL_FOG);
|
||||||
setupFog(1, a);
|
setupFog(1, a);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
|
||||||
|
|
@ -595,11 +595,10 @@ void ItemInHandRenderer::render(float a) {
|
||||||
|
|
||||||
std::shared_ptr<MapItemSavedData> data =
|
std::shared_ptr<MapItemSavedData> data =
|
||||||
Item::map->getSavedData(item, minecraft->level);
|
Item::map->getSavedData(item, minecraft->level);
|
||||||
PIXBeginNamedEvent(0, "Minimap render");
|
if (data != nullptr)
|
||||||
if (data != nullptr)
|
|
||||||
minimap->render(minecraft->player, minecraft->textures, data,
|
minimap->render(minecraft->player, minecraft->textures, data,
|
||||||
minecraft->player->entityId);
|
minecraft->player->entityId);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
} else if (item != nullptr) {
|
} else if (item != nullptr) {
|
||||||
|
|
|
||||||
|
|
@ -1749,8 +1749,6 @@ bool LevelRenderer::updateDirtyChunks() {
|
||||||
}
|
}
|
||||||
throttle++;
|
throttle++;
|
||||||
*/
|
*/
|
||||||
PIXAddNamedCounter(((float)memAlloc) / (1024.0f * 1024.0f),
|
|
||||||
"Command buffer allocations");
|
|
||||||
bool onlyRebuild = (memAlloc >= MAX_COMMANDBUFFER_ALLOCATIONS);
|
bool onlyRebuild = (memAlloc >= MAX_COMMANDBUFFER_ALLOCATIONS);
|
||||||
|
|
||||||
// Move any dirty chunks stored in the lock free stack into global flags
|
// Move any dirty chunks stored in the lock free stack into global flags
|
||||||
|
|
@ -1800,8 +1798,7 @@ bool LevelRenderer::updateDirtyChunks() {
|
||||||
// chunk(s)
|
// chunk(s)
|
||||||
if (dirtyChunkPresent) {
|
if (dirtyChunkPresent) {
|
||||||
lastDirtyChunkFound = System::currentTimeMillis();
|
lastDirtyChunkFound = System::currentTimeMillis();
|
||||||
PIXBeginNamedEvent(0, "Finding nearest chunk\n");
|
|
||||||
|
|
||||||
// Find nearest chunk that is dirty
|
// Find nearest chunk that is dirty
|
||||||
for (int p = 0; p < XUSER_MAX_COUNT; p++) {
|
for (int p = 0; p < XUSER_MAX_COUNT; p++) {
|
||||||
// It's possible that the localplayers member can be set to
|
// It's possible that the localplayers member can be set to
|
||||||
|
|
@ -1937,7 +1934,7 @@ bool LevelRenderer::updateDirtyChunks() {
|
||||||
}
|
}
|
||||||
// app.DebugPrintf("[%d,%d,%d]\n",nearestClipChunks.empty(),considered,wouldBeNearButEmpty);
|
// app.DebugPrintf("[%d,%d,%d]\n",nearestClipChunks.empty(),considered,wouldBeNearButEmpty);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2019,7 +2016,7 @@ bool LevelRenderer::updateDirtyChunks() {
|
||||||
// totalTime += (endTime - startTime);
|
// totalTime += (endTime - startTime);
|
||||||
// countTime++;
|
// countTime++;
|
||||||
// printf("%d : %f\n", countTime, (float)totalTime
|
// printf("%d : %f\n", countTime, (float)totalTime
|
||||||
/// (float)countTime); PIXEndNamedEvent();
|
/// (float)countTime);
|
||||||
}
|
}
|
||||||
// 4J Stu - Ignore this path when in constrained mode on Xbox One
|
// 4J Stu - Ignore this path when in constrained mode on Xbox One
|
||||||
else {
|
else {
|
||||||
|
|
@ -2038,8 +2035,6 @@ bool LevelRenderer::updateDirtyChunks() {
|
||||||
#else
|
#else
|
||||||
if (nearChunk) {
|
if (nearChunk) {
|
||||||
chunk = nearChunk->chunk;
|
chunk = nearChunk->chunk;
|
||||||
PIXBeginNamedEvent(0, "Rebuilding near chunk %d %d %d", chunk->x,
|
|
||||||
chunk->y, chunk->z);
|
|
||||||
static Chunk permaChunk;
|
static Chunk permaChunk;
|
||||||
{
|
{
|
||||||
FRAME_PROFILE_SCOPE(ChunkRebuildSchedule);
|
FRAME_PROFILE_SCOPE(ChunkRebuildSchedule);
|
||||||
|
|
@ -2078,7 +2073,7 @@ bool LevelRenderer::updateDirtyChunks() {
|
||||||
// countTime++;
|
// countTime++;
|
||||||
// printf("%d : %f\n", countTime, (float)totalTime /
|
// printf("%d : %f\n", countTime, (float)totalTime /
|
||||||
//(float)countTime);
|
//(float)countTime);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
|
|
@ -2397,8 +2392,6 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1,
|
||||||
(int*)(intptr_t)(uintptr_t)(index + 2));
|
(int*)(intptr_t)(uintptr_t)(index + 2));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PIXSetMarkerDeprecated(0, "Setting chunk %d %d %d dirty",
|
|
||||||
x * 16, y * 16, z * 16);
|
|
||||||
}
|
}
|
||||||
// setGlobalChunkFlag(x * 16, y *
|
// setGlobalChunkFlag(x * 16, y *
|
||||||
// 16, z * 16, level, CHUNK_FLAG_DIRTY);
|
// 16, z * 16, level, CHUNK_FLAG_DIRTY);
|
||||||
|
|
|
||||||
|
|
@ -362,8 +362,7 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures,
|
||||||
|
|
||||||
if (item->getIconType() == Icon::TYPE_TERRAIN &&
|
if (item->getIconType() == Icon::TYPE_TERRAIN &&
|
||||||
TileRenderer::canRender(Tile::tiles[itemId]->getRenderShape())) {
|
TileRenderer::canRender(Tile::tiles[itemId]->getRenderShape())) {
|
||||||
PIXBeginNamedEvent(0, "3D gui item render %d\n", itemId);
|
textures->bindTexture(&TextureAtlas::LOCATION_BLOCKS);
|
||||||
textures->bindTexture(&TextureAtlas::LOCATION_BLOCKS);
|
|
||||||
|
|
||||||
Tile* tile = Tile::tiles[itemId];
|
Tile* tile = Tile::tiles[itemId];
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
@ -385,10 +384,9 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures,
|
||||||
tileRenderer->renderTile(tile, itemAuxValue, 1, fAlpha, useCompiled);
|
tileRenderer->renderTile(tile, itemAuxValue, 1, fAlpha, useCompiled);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
PIXEndNamedEvent();
|
|
||||||
} else if (Item::items[itemId]->hasMultipleSpriteLayers()) {
|
} else if (Item::items[itemId]->hasMultipleSpriteLayers()) {
|
||||||
PIXBeginNamedEvent(0, "Potion gui item render %d\n", itemIcon);
|
// special double-layered
|
||||||
// special double-layered
|
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
|
|
||||||
ResourceLocation* location = getTextureLocation(item->getIconType());
|
ResourceLocation* location = getTextureLocation(item->getIconType());
|
||||||
|
|
@ -412,10 +410,9 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
PIXEndNamedEvent();
|
|
||||||
} else {
|
} else {
|
||||||
PIXBeginNamedEvent(0, "2D gui item render %d\n", itemIcon);
|
glDisable(GL_LIGHTING);
|
||||||
glDisable(GL_LIGHTING);
|
|
||||||
if (item->getIconType() == Icon::TYPE_TERRAIN) {
|
if (item->getIconType() == Icon::TYPE_TERRAIN) {
|
||||||
textures->bindTexture(
|
textures->bindTexture(
|
||||||
&TextureAtlas::LOCATION_BLOCKS); // L"/terrain.png"));
|
&TextureAtlas::LOCATION_BLOCKS); // L"/terrain.png"));
|
||||||
|
|
@ -442,7 +439,7 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures,
|
||||||
blit((int)x, (int)y, itemIcon, 16, 16);
|
blit((int)x, (int)y, itemIcon, 16, 16);
|
||||||
}
|
}
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -255,10 +255,9 @@ int MinecraftServer::runPostUpdate(void* lpParam) {
|
||||||
server->m_postProcessRequests.pop_back();
|
server->m_postProcessRequests.pop_back();
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
PIXBeginNamedEvent(0, "Post processing %d ", (count++) % 8);
|
request.chunkSource->postProcess(request.chunkSource, request.x,
|
||||||
request.chunkSource->postProcess(request.chunkSource, request.x,
|
|
||||||
request.z);
|
request.z);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
|
|
@ -583,12 +582,11 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
|
||||||
// lastTime = now;
|
// lastTime = now;
|
||||||
}
|
}
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
PIXBeginNamedEvent(0, "Creating %d ", (count++) % 8);
|
level->cache->create((spawnPos->x + x) >> 4,
|
||||||
level->cache->create((spawnPos->x + x) >> 4,
|
|
||||||
(spawnPos->z + z) >> 4,
|
(spawnPos->z + z) >> 4,
|
||||||
true); // 4J - added parameter to
|
true); // 4J - added parameter to
|
||||||
// disable postprocessing here
|
// disable postprocessing here
|
||||||
PIXEndNamedEvent();
|
|
||||||
// while (level->updateLights() &&
|
// while (level->updateLights() &&
|
||||||
// running)
|
// running)
|
||||||
// ;
|
// ;
|
||||||
|
|
@ -831,8 +829,7 @@ void MinecraftServer::saveGameRules() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinecraftServer::Suspend() {
|
void MinecraftServer::Suspend() {
|
||||||
PIXBeginNamedEvent(0, "Suspending server");
|
m_suspending = true;
|
||||||
m_suspending = true;
|
|
||||||
// Get the frequency of the timer
|
// Get the frequency of the timer
|
||||||
float fElapsedTime = 0.0f;
|
float fElapsedTime = 0.0f;
|
||||||
// Save the start time
|
// Save the start time
|
||||||
|
|
@ -862,7 +859,7 @@ void MinecraftServer::Suspend() {
|
||||||
|
|
||||||
m_suspending = false;
|
m_suspending = false;
|
||||||
app.DebugPrintf("Suspend server: Elapsed time %f\n", fElapsedTime);
|
app.DebugPrintf("Suspend server: Elapsed time %f\n", fElapsedTime);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MinecraftServer::IsSuspending() { return m_suspending; }
|
bool MinecraftServer::IsSuspending() { return m_suspending; }
|
||||||
|
|
@ -1444,16 +1441,13 @@ void MinecraftServer::tick() {
|
||||||
// #ifndef 0
|
// #ifndef 0
|
||||||
static int64_t stc = 0;
|
static int64_t stc = 0;
|
||||||
int64_t st0 = System::currentTimeMillis();
|
int64_t st0 = System::currentTimeMillis();
|
||||||
PIXBeginNamedEvent(0, "Level tick %d", i);
|
((Level*)level)->tick();
|
||||||
((Level*)level)->tick();
|
|
||||||
int64_t st1 = System::currentTimeMillis();
|
int64_t st1 = System::currentTimeMillis();
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Update lights %d", i);
|
|
||||||
|
|
||||||
int64_t st2 = System::currentTimeMillis();
|
int64_t st2 = System::currentTimeMillis();
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Entity tick %d", i);
|
// 4J added to stop ticking entities in levels when players are not
|
||||||
// 4J added to stop ticking entities in levels when players are not
|
|
||||||
// in those levels. Note: now changed so that we also tick if there
|
// in those levels. Note: now changed so that we also tick if there
|
||||||
// are entities to be removed, as this also happens as a result of
|
// are entities to be removed, as this also happens as a result of
|
||||||
// calling tickEntities. If we don't do this, then the entities get
|
// calling tickEntities. If we don't do this, then the entities get
|
||||||
|
|
@ -1466,11 +1460,10 @@ void MinecraftServer::tick() {
|
||||||
(level->hasEntitiesToRemove())) {
|
(level->hasEntitiesToRemove())) {
|
||||||
level->tickEntities();
|
level->tickEntities();
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Entity tracker tick");
|
level->getTracker()->tick();
|
||||||
level->getTracker()->tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
int64_t st3 = System::currentTimeMillis();
|
int64_t st3 = System::currentTimeMillis();
|
||||||
// printf(">>>>>>>>>>>>>>>>>>>>>> Tick %d %d %d :
|
// printf(">>>>>>>>>>>>>>>>>>>>>> Tick %d %d %d :
|
||||||
|
|
@ -1481,12 +1474,10 @@ void MinecraftServer::tick() {
|
||||||
}
|
}
|
||||||
Entity::tickExtraWandering(); // 4J added
|
Entity::tickExtraWandering(); // 4J added
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Connection tick");
|
connection->tick();
|
||||||
connection->tick();
|
|
||||||
PIXEndNamedEvent();
|
players->tick();
|
||||||
PIXBeginNamedEvent(0, "Players tick");
|
|
||||||
players->tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// 4J - removed
|
// 4J - removed
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -544,8 +544,7 @@ void ServerChunkCache::flagPostProcessComplete(short flag, int x, int z) {
|
||||||
if ((lc->terrainPopulated & LevelChunk::sTerrainPopulatedAllAffecting) ==
|
if ((lc->terrainPopulated & LevelChunk::sTerrainPopulatedAllAffecting) ==
|
||||||
LevelChunk::sTerrainPopulatedAllAffecting) {
|
LevelChunk::sTerrainPopulatedAllAffecting) {
|
||||||
// Do the compression of data & lighting at this point
|
// Do the compression of data & lighting at this point
|
||||||
PIXBeginNamedEvent(0, "Compressing lighting/blocks");
|
|
||||||
|
|
||||||
// Check, using lower blocks as a reference, if we've already compressed
|
// Check, using lower blocks as a reference, if we've already compressed
|
||||||
// - no point doing this multiple times, which otherwise we will do as
|
// - no point doing this multiple times, which otherwise we will do as
|
||||||
// we aren't checking for the flags transitioning in the if statement
|
// we aren't checking for the flags transitioning in the if statement
|
||||||
|
|
@ -554,7 +553,7 @@ void ServerChunkCache::flagPostProcessComplete(short flag, int x, int z) {
|
||||||
if (!lc->isLowerBlockLightStorageCompressed()) lc->compressLighting();
|
if (!lc->isLowerBlockLightStorageCompressed()) lc->compressLighting();
|
||||||
if (!lc->isLowerDataStorageCompressed()) lc->compressData();
|
if (!lc->isLowerDataStorageCompressed()) lc->compressData();
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Are all neighbouring chunks And this one now post-processed?
|
// Are all neighbouring chunks And this one now post-processed?
|
||||||
|
|
@ -564,16 +563,14 @@ void ServerChunkCache::flagPostProcessComplete(short flag, int x, int z) {
|
||||||
|
|
||||||
// This would be a good time to fix up any lighting for this chunk since
|
// This would be a good time to fix up any lighting for this chunk since
|
||||||
// all the geometry that could affect it should now be in place
|
// all the geometry that could affect it should now be in place
|
||||||
PIXBeginNamedEvent(0, "Recheck gaps");
|
if (lc->level->dimension->id != 1) {
|
||||||
if (lc->level->dimension->id != 1) {
|
|
||||||
lc->recheckGaps(true);
|
lc->recheckGaps(true);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// Do a checkLight on any tiles which are lava.
|
// Do a checkLight on any tiles which are lava.
|
||||||
PIXBeginNamedEvent(0, "Light lava (this)");
|
lc->lightLava();
|
||||||
lc->lightLava();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// Flag as now having this post-post-processing stage completed
|
// Flag as now having this post-post-processing stage completed
|
||||||
lc->terrainPopulated |= LevelChunk::sTerrainPostPostProcessed;
|
lc->terrainPopulated |= LevelChunk::sTerrainPostPostProcessed;
|
||||||
|
|
@ -585,9 +582,8 @@ void ServerChunkCache::postProcess(ChunkSource* parent, int x, int z) {
|
||||||
if ((chunk->terrainPopulated & LevelChunk::sTerrainPopulatedFromHere) ==
|
if ((chunk->terrainPopulated & LevelChunk::sTerrainPopulatedFromHere) ==
|
||||||
0) {
|
0) {
|
||||||
if (source != nullptr) {
|
if (source != nullptr) {
|
||||||
PIXBeginNamedEvent(0, "Main post processing");
|
source->postProcess(parent, x, z);
|
||||||
source->postProcess(parent, x, z);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
chunk->markUnsaved();
|
chunk->markUnsaved();
|
||||||
}
|
}
|
||||||
|
|
@ -650,23 +646,20 @@ void ServerChunkCache::postProcess(ChunkSource* parent, int x, int z) {
|
||||||
|
|
||||||
// 4J Added for suspend
|
// 4J Added for suspend
|
||||||
bool ServerChunkCache::saveAllEntities() {
|
bool ServerChunkCache::saveAllEntities() {
|
||||||
PIXBeginNamedEvent(0, "Save all entities");
|
|
||||||
|
{
|
||||||
PIXBeginNamedEvent(0, "saving to NBT");
|
|
||||||
{
|
|
||||||
std::lock_guard<std::recursive_mutex> lock(m_csLoadCreate);
|
std::lock_guard<std::recursive_mutex> lock(m_csLoadCreate);
|
||||||
for (auto it = m_loadedChunkList.begin(); it != m_loadedChunkList.end();
|
for (auto it = m_loadedChunkList.begin(); it != m_loadedChunkList.end();
|
||||||
++it) {
|
++it) {
|
||||||
storage->saveEntities(level, *it);
|
storage->saveEntities(level, *it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Flushing");
|
storage->flush();
|
||||||
storage->flush();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -871,19 +864,16 @@ int ServerChunkCache::runSaveThreadProc(void* lpParam) {
|
||||||
// app.DebugPrintf("Save thread has started\n");
|
// app.DebugPrintf("Save thread has started\n");
|
||||||
|
|
||||||
while (params->chunkToSave != nullptr) {
|
while (params->chunkToSave != nullptr) {
|
||||||
PIXBeginNamedEvent(0, "Saving entities");
|
// app.DebugPrintf("Save thread has started processing a chunk\n");
|
||||||
// app.DebugPrintf("Save thread has started processing a chunk\n");
|
|
||||||
if (params->saveEntities)
|
if (params->saveEntities)
|
||||||
params->cache->saveEntities(params->chunkToSave);
|
params->cache->saveEntities(params->chunkToSave);
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Saving chunk");
|
|
||||||
|
|
||||||
params->cache->save(params->chunkToSave);
|
params->cache->save(params->chunkToSave);
|
||||||
params->chunkToSave->setUnsaved(false);
|
params->chunkToSave->setUnsaved(false);
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Notifying and waiting for next chunk");
|
|
||||||
|
|
||||||
// Inform the producer thread that we are done with this chunk
|
// Inform the producer thread that we are done with this chunk
|
||||||
params->notificationEvent
|
params->notificationEvent
|
||||||
->set(); // SetEvent(params->notificationEvent);
|
->set(); // SetEvent(params->notificationEvent);
|
||||||
|
|
@ -895,7 +885,7 @@ int ServerChunkCache::runSaveThreadProc(void* lpParam) {
|
||||||
params->wakeEvent->waitForSignal(
|
params->wakeEvent->waitForSignal(
|
||||||
C4JThread::
|
C4JThread::
|
||||||
kInfiniteTimeout); // WaitForSingleObject(params->wakeEvent,INFINITE);
|
kInfiniteTimeout); // WaitForSingleObject(params->wakeEvent,INFINITE);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// app.DebugPrintf("Thread is exiting as it has no chunk to process\n");
|
// app.DebugPrintf("Thread is exiting as it has no chunk to process\n");
|
||||||
|
|
|
||||||
|
|
@ -238,8 +238,7 @@ void ServerLevel::tick() {
|
||||||
awakenAllPlayers();
|
awakenAllPlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Mob spawner tick");
|
// for Minecraft 1.8, spawn friendlies really rarely - 4J - altered
|
||||||
// for Minecraft 1.8, spawn friendlies really rarely - 4J - altered
|
|
||||||
// from once every 400 ticks to 40 ticks as we depend on this a more than
|
// from once every 400 ticks to 40 ticks as we depend on this a more than
|
||||||
// the original since we don't have chunk post-process spawning
|
// the original since we don't have chunk post-process spawning
|
||||||
if (getGameRules()->getBoolean(GameRules::RULE_DOMOBSPAWNING)) {
|
if (getGameRules()->getBoolean(GameRules::RULE_DOMOBSPAWNING)) {
|
||||||
|
|
@ -262,10 +261,9 @@ void ServerLevel::tick() {
|
||||||
mobSpawner->tick(this, finalSpawnEnemies, finalSpawnFriendlies,
|
mobSpawner->tick(this, finalSpawnEnemies, finalSpawnFriendlies,
|
||||||
finalSpawnPersistent);
|
finalSpawnPersistent);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Chunk source tick");
|
chunkSource->tick();
|
||||||
chunkSource->tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
int newDark = getOldSkyDarken(1);
|
int newDark = getOldSkyDarken(1);
|
||||||
if (newDark != skyDarken) {
|
if (newDark != skyDarken) {
|
||||||
skyDarken = newDark;
|
skyDarken = newDark;
|
||||||
|
|
@ -293,9 +291,8 @@ void ServerLevel::tick() {
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// app.DebugPrintf("Incremental save\n");
|
// app.DebugPrintf("Incremental save\n");
|
||||||
PIXBeginNamedEvent(0, "Incremental save");
|
save(false, nullptr);
|
||||||
save(false, nullptr);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J : WESTY : Changed so that time update goes through stats tracking
|
// 4J : WESTY : Changed so that time update goes through stats tracking
|
||||||
|
|
@ -316,30 +313,25 @@ void ServerLevel::tick() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Tick pending ticks");
|
// if (tickCount % 5 == 0) {
|
||||||
// if (tickCount % 5 == 0) {
|
|
||||||
tickPendingTicks(false);
|
tickPendingTicks(false);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Tick tiles");
|
tickTiles();
|
||||||
tickTiles();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
chunkMap->tick();
|
chunkMap->tick();
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Tick villages");
|
villages->tick();
|
||||||
villages->tick();
|
|
||||||
villageSiege->tick();
|
villageSiege->tick();
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Tick portal forcer");
|
portalForcer->tick(getGameTime());
|
||||||
portalForcer->tick(getGameTime());
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// repeat after tile ticks
|
// repeat after tile ticks
|
||||||
PIXBeginNamedEvent(0, "runTileEvents");
|
runTileEvents();
|
||||||
runTileEvents();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// 4J Added
|
// 4J Added
|
||||||
runQueuedSendTileUpdates();
|
runQueuedSendTileUpdates();
|
||||||
|
|
@ -936,9 +928,8 @@ void ServerLevel::save(bool force, ProgressListener* progressListener,
|
||||||
progressListener->progressStartNoAbort(IDS_PROGRESS_SAVING_LEVEL);
|
progressListener->progressStartNoAbort(IDS_PROGRESS_SAVING_LEVEL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXBeginNamedEvent(0, "Saving level data");
|
saveLevelData();
|
||||||
saveLevelData();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
if (progressListener != nullptr)
|
if (progressListener != nullptr)
|
||||||
progressListener->progressStage(IDS_PROGRESS_SAVING_CHUNKS);
|
progressListener->progressStage(IDS_PROGRESS_SAVING_CHUNKS);
|
||||||
|
|
@ -1425,8 +1416,7 @@ int ServerLevel::runUpdate(void* lpParam) {
|
||||||
if (!ShutdownManager::ShouldRun(ShutdownManager::eRunUpdateThread))
|
if (!ShutdownManager::ShouldRun(ShutdownManager::eRunUpdateThread))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Updating tiles to be ticked");
|
// 4J Stu - Grass and Lava ticks currently take up the majority of all
|
||||||
// 4J Stu - Grass and Lava ticks currently take up the majority of all
|
|
||||||
// tile updates, so I am limiting them
|
// tile updates, so I am limiting them
|
||||||
int grassTicks = 0;
|
int grassTicks = 0;
|
||||||
int lavaTicks = 0;
|
int lavaTicks = 0;
|
||||||
|
|
@ -1522,7 +1512,7 @@ int ServerLevel::runUpdate(void* lpParam) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShutdownManager::HasFinished(ShutdownManager::eRunUpdateThread);
|
ShutdownManager::HasFinished(ShutdownManager::eRunUpdateThread);
|
||||||
|
|
|
||||||
|
|
@ -437,8 +437,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) {
|
||||||
connection->getNetworkPlayer(), flagIndex)) {
|
connection->getNetworkPlayer(), flagIndex)) {
|
||||||
// app.DebugPrintf("Creating
|
// app.DebugPrintf("Creating
|
||||||
// BRUP for %d %d\n",nearest.x, nearest.z);
|
// BRUP for %d %d\n",nearest.x, nearest.z);
|
||||||
PIXBeginNamedEvent(0, "Creation BRUP for sending\n");
|
int64_t before = System::currentTimeMillis();
|
||||||
int64_t before = System::currentTimeMillis();
|
|
||||||
std::shared_ptr<BlockRegionUpdatePacket> packet =
|
std::shared_ptr<BlockRegionUpdatePacket> packet =
|
||||||
std::shared_ptr<BlockRegionUpdatePacket>(
|
std::shared_ptr<BlockRegionUpdatePacket>(
|
||||||
new BlockRegionUpdatePacket(
|
new BlockRegionUpdatePacket(
|
||||||
|
|
@ -447,7 +446,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) {
|
||||||
int64_t after = System::currentTimeMillis();
|
int64_t after = System::currentTimeMillis();
|
||||||
// app.DebugPrintf(">>><<<
|
// app.DebugPrintf(">>><<<
|
||||||
//%d ms\n",after-before);
|
//%d ms\n",after-before);
|
||||||
PIXEndNamedEvent();
|
|
||||||
if (dontDelayChunks) packet->shouldDelay = false;
|
if (dontDelayChunks) packet->shouldDelay = false;
|
||||||
|
|
||||||
if (packet->shouldDelay == true) {
|
if (packet->shouldDelay == true) {
|
||||||
|
|
|
||||||
|
|
@ -597,8 +597,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) {
|
||||||
compLength = 0;
|
compLength = 0;
|
||||||
|
|
||||||
// Pre-calculate the buffer size required for the compressed data
|
// Pre-calculate the buffer size required for the compressed data
|
||||||
PIXBeginNamedEvent(0, "Pre-calc save compression");
|
// Save the start time
|
||||||
// Save the start time
|
|
||||||
const auto startTime = std::chrono::steady_clock::now();
|
const auto startTime = std::chrono::steady_clock::now();
|
||||||
Compression::getCompression()->Compress(nullptr, &compLength, pvSaveMem,
|
Compression::getCompression()->Compress(nullptr, &compLength, pvSaveMem,
|
||||||
fileSize);
|
fileSize);
|
||||||
|
|
@ -607,7 +606,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) {
|
||||||
.count();
|
.count();
|
||||||
|
|
||||||
app.DebugPrintf("Check buffer size: Elapsed time %f\n", fElapsedTime);
|
app.DebugPrintf("Check buffer size: Elapsed time %f\n", fElapsedTime);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// We add 4 bytes to the start so that we can signal compressed data
|
// We add 4 bytes to the start so that we can signal compressed data
|
||||||
// And another 4 bytes to store the decompressed data size
|
// And another 4 bytes to store the decompressed data size
|
||||||
|
|
@ -619,8 +618,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) {
|
||||||
|
|
||||||
if (compData != nullptr) {
|
if (compData != nullptr) {
|
||||||
// Re-compress all save data before we save it to disk
|
// Re-compress all save data before we save it to disk
|
||||||
PIXBeginNamedEvent(0, "Actual save compression");
|
// Save the start time
|
||||||
// Save the start time
|
|
||||||
const auto startTime = std::chrono::steady_clock::now();
|
const auto startTime = std::chrono::steady_clock::now();
|
||||||
Compression::getCompression()->Compress(compData + 8, &compLength,
|
Compression::getCompression()->Compress(compData + 8, &compLength,
|
||||||
pvSaveMem, fileSize);
|
pvSaveMem, fileSize);
|
||||||
|
|
@ -629,7 +627,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) {
|
||||||
.count();
|
.count();
|
||||||
|
|
||||||
app.DebugPrintf("Compress: Elapsed time %f\n", fElapsedTime);
|
app.DebugPrintf("Compress: Elapsed time %f\n", fElapsedTime);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
std::fill_n(compData, 8, std::uint8_t{0});
|
std::fill_n(compData, 8, std::uint8_t{0});
|
||||||
int saveVer = 0;
|
int saveVer = 0;
|
||||||
|
|
|
||||||
|
|
@ -688,9 +688,8 @@ void ConsoleSaveFileSplit::PrepareForWrite(FileEntry* file,
|
||||||
// bytesToGrowBy = 1024;
|
// bytesToGrowBy = 1024;
|
||||||
|
|
||||||
// Move all the data beyond us
|
// Move all the data beyond us
|
||||||
PIXBeginNamedEvent(0, "Growing file by %d bytes", bytesToGrowBy);
|
MoveDataBeyond(file, bytesToGrowBy);
|
||||||
MoveDataBeyond(file, bytesToGrowBy);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// Update our length
|
// Update our length
|
||||||
if (file->data.length < 0) file->data.length = 0;
|
if (file->data.length < 0) file->data.length = 0;
|
||||||
|
|
@ -1313,8 +1312,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) {
|
||||||
compLength = 0;
|
compLength = 0;
|
||||||
|
|
||||||
// Pre-calculate the buffer size required for the compressed data
|
// Pre-calculate the buffer size required for the compressed data
|
||||||
PIXBeginNamedEvent(0, "Pre-calc save compression");
|
// Save the start time
|
||||||
// Save the start time
|
|
||||||
qwTime = PlatformTime::QueryPerformanceCounter();
|
qwTime = PlatformTime::QueryPerformanceCounter();
|
||||||
Compression::getCompression()->Compress(nullptr, &compLength, pvSaveMem,
|
Compression::getCompression()->Compress(nullptr, &compLength, pvSaveMem,
|
||||||
fileSize);
|
fileSize);
|
||||||
|
|
@ -1323,7 +1321,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) {
|
||||||
fElapsedTime = static_cast<float>(PlatformTime::ElapsedSeconds(qwTime, qwNewTime));
|
fElapsedTime = static_cast<float>(PlatformTime::ElapsedSeconds(qwTime, qwNewTime));
|
||||||
|
|
||||||
app.DebugPrintf("Check buffer size: Elapsed time %f\n", fElapsedTime);
|
app.DebugPrintf("Check buffer size: Elapsed time %f\n", fElapsedTime);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// We add 4 bytes to the start so that we can signal compressed data
|
// We add 4 bytes to the start so that we can signal compressed data
|
||||||
// And another 4 bytes to store the decompressed data size
|
// And another 4 bytes to store the decompressed data size
|
||||||
|
|
@ -1335,8 +1333,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) {
|
||||||
|
|
||||||
if (compData != nullptr) {
|
if (compData != nullptr) {
|
||||||
// Re-compress all save data before we save it to disk
|
// Re-compress all save data before we save it to disk
|
||||||
PIXBeginNamedEvent(0, "Actual save compression");
|
// Save the start time
|
||||||
// Save the start time
|
|
||||||
qwTime = PlatformTime::QueryPerformanceCounter();
|
qwTime = PlatformTime::QueryPerformanceCounter();
|
||||||
Compression::getCompression()->Compress(compData + 8, &compLength,
|
Compression::getCompression()->Compress(compData + 8, &compLength,
|
||||||
pvSaveMem, fileSize);
|
pvSaveMem, fileSize);
|
||||||
|
|
@ -1345,7 +1342,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) {
|
||||||
fElapsedTime = static_cast<float>(PlatformTime::ElapsedSeconds(qwTime, qwNewTime));
|
fElapsedTime = static_cast<float>(PlatformTime::ElapsedSeconds(qwTime, qwNewTime));
|
||||||
|
|
||||||
app.DebugPrintf("Compress: Elapsed time %f\n", fElapsedTime);
|
app.DebugPrintf("Compress: Elapsed time %f\n", fElapsedTime);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
memset(compData, 0, 8);
|
memset(compData, 0, 8);
|
||||||
int saveVer = 0;
|
int saveVer = 0;
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,7 @@ int32_t Compression::CompressLZXRLE(void* pDestination, unsigned int* pDestSize,
|
||||||
// 0 - 254 - encodes a single byte
|
// 0 - 254 - encodes a single byte
|
||||||
// 255 followed by 0, 1, 2 - encodes a 1, 2, or 3 255s
|
// 255 followed by 0, 1, 2 - encodes a 1, 2, or 3 255s
|
||||||
// 255 followed by 3-255, followed by a byte - encodes a run of n + 1 bytes
|
// 255 followed by 3-255, followed by a byte - encodes a run of n + 1 bytes
|
||||||
PIXBeginNamedEvent(0, "RLE compression");
|
do {
|
||||||
do {
|
|
||||||
unsigned char thisOne = *pucIn++;
|
unsigned char thisOne = *pucIn++;
|
||||||
|
|
||||||
unsigned int count = 1;
|
unsigned int count = 1;
|
||||||
|
|
@ -88,11 +87,10 @@ int32_t Compression::CompressLZXRLE(void* pDestination, unsigned int* pDestSize,
|
||||||
}
|
}
|
||||||
} while (pucIn != pucEnd);
|
} while (pucIn != pucEnd);
|
||||||
unsigned int rleSize = (unsigned int)(pucOut - rleCompressBuf);
|
unsigned int rleSize = (unsigned int)(pucOut - rleCompressBuf);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Secondary compression");
|
Compress(pDestination, pDestSize, rleCompressBuf, rleSize);
|
||||||
Compress(pDestination, pDestSize, rleCompressBuf, rleSize);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
// printf("Compressed from %d to %d to %d\n",SrcSize,rleSize,*pDestSize);
|
// printf("Compressed from %d to %d to %d\n",SrcSize,rleSize,*pDestSize);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -114,8 +112,7 @@ int32_t Compression::CompressRLE(void* pDestination, unsigned int* pDestSize,
|
||||||
// 255 followed by 0, 1, 2 - encodes a 1, 2, or 3 255s
|
// 255 followed by 0, 1, 2 - encodes a 1, 2, or 3 255s
|
||||||
// 255 followed by 3-255, followed by a byte - encodes a run of n + 1
|
// 255 followed by 3-255, followed by a byte - encodes a run of n + 1
|
||||||
// bytes
|
// bytes
|
||||||
PIXBeginNamedEvent(0, "RLE compression");
|
do {
|
||||||
do {
|
|
||||||
unsigned char thisOne = *pucIn++;
|
unsigned char thisOne = *pucIn++;
|
||||||
|
|
||||||
unsigned int count = 1;
|
unsigned int count = 1;
|
||||||
|
|
@ -140,7 +137,7 @@ int32_t Compression::CompressRLE(void* pDestination, unsigned int* pDestSize,
|
||||||
}
|
}
|
||||||
} while (pucIn != pucEnd);
|
} while (pucIn != pucEnd);
|
||||||
rleSize = (unsigned int)(pucOut - rleCompressBuf);
|
rleSize = (unsigned int)(pucOut - rleCompressBuf);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
|
|
|
||||||
|
|
@ -483,10 +483,8 @@ void Connection::tick() {
|
||||||
// MGH - moved the packet handling outside of the incoming_cs block, as it
|
// MGH - moved the packet handling outside of the incoming_cs block, as it
|
||||||
// was locking up sometimes when disconnecting
|
// was locking up sometimes when disconnecting
|
||||||
for (int i = 0; i < packetsToHandle.size(); i++) {
|
for (int i = 0; i < packetsToHandle.size(); i++) {
|
||||||
PIXBeginNamedEvent(0, "Handling packet %d\n",
|
|
||||||
packetsToHandle[i]->getId());
|
|
||||||
packetsToHandle[i]->handle(packetListener);
|
packetsToHandle[i]->handle(packetListener);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
flush();
|
flush();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,8 +145,6 @@ void Entity::countFlagsForPIX() {
|
||||||
}
|
}
|
||||||
puiUsedFlags++;
|
puiUsedFlags++;
|
||||||
}
|
}
|
||||||
PIXAddNamedCounter(freecount, "Small Ids free");
|
|
||||||
PIXAddNamedCounter(2048 - freecount, "Small Ids used");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::resetSmallId() {
|
void Entity::resetSmallId() {
|
||||||
|
|
|
||||||
|
|
@ -422,43 +422,32 @@ void Mob::checkDespawn() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mob::newServerAiStep() {
|
void Mob::newServerAiStep() {
|
||||||
PIXBeginNamedEvent(0, "Tick target selector for %d", GetType());
|
noActionTime++;
|
||||||
noActionTime++;
|
checkDespawn();
|
||||||
PIXBeginNamedEvent(0, "Check despawn");
|
|
||||||
checkDespawn();
|
sensing->tick();
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Tick sensing");
|
targetSelector.tick();
|
||||||
sensing->tick();
|
|
||||||
PIXEndNamedEvent();
|
goalSelector.tick();
|
||||||
PIXBeginNamedEvent(0, "Tick target selector");
|
|
||||||
targetSelector.tick();
|
navigation->tick();
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Tick goal selectors");
|
serverAiMobStep();
|
||||||
goalSelector.tick();
|
|
||||||
PIXEndNamedEvent();
|
moveControl->tick();
|
||||||
PIXBeginNamedEvent(0, "Tick navigation");
|
|
||||||
navigation->tick();
|
lookControl->tick();
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Tick server ai mob step");
|
jumpControl->tick();
|
||||||
serverAiMobStep();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Tick move");
|
|
||||||
moveControl->tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Tick look");
|
|
||||||
lookControl->tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Tick jump");
|
|
||||||
jumpControl->tick();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
// Consider this for extra strolling if it is protected against despawning.
|
// Consider this for extra strolling if it is protected against despawning.
|
||||||
// We aren't interested in ones that aren't protected as the whole point of
|
// We aren't interested in ones that aren't protected as the whole point of
|
||||||
// this extra wandering is to potentially transition from protected to not
|
// this extra wandering is to potentially transition from protected to not
|
||||||
// protected.
|
// protected.
|
||||||
PIXBeginNamedEvent(0, "Consider extra wandering");
|
considerForExtraWandering(isDespawnProtected());
|
||||||
considerForExtraWandering(isDespawnProtected());
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mob::serverAiStep() {
|
void Mob::serverAiStep() {
|
||||||
|
|
|
||||||
|
|
@ -202,8 +202,7 @@ void Explosion::finalizeExplosion(
|
||||||
if (destroyBlocks) {
|
if (destroyBlocks) {
|
||||||
// toBlowArray.addAll(toBlow);
|
// toBlowArray.addAll(toBlow);
|
||||||
// TODO 4J Stu - Reverse iterator
|
// TODO 4J Stu - Reverse iterator
|
||||||
PIXBeginNamedEvent(0, "Finalizing explosion size %d", toBlow.size());
|
app.DebugPrintf("Finalizing explosion size %d\n", toBlow.size());
|
||||||
app.DebugPrintf("Finalizing explosion size %d\n", toBlow.size());
|
|
||||||
static const int MAX_EXPLODE_PARTICLES = 50;
|
static const int MAX_EXPLODE_PARTICLES = 50;
|
||||||
// 4J - try and make at most MAX_EXPLODE_PARTICLES pairs of particles
|
// 4J - try and make at most MAX_EXPLODE_PARTICLES pairs of particles
|
||||||
int fraction = (int)toBlowArray->size() / MAX_EXPLODE_PARTICLES;
|
int fraction = (int)toBlowArray->size() / MAX_EXPLODE_PARTICLES;
|
||||||
|
|
@ -282,7 +281,7 @@ void Explosion::finalizeExplosion(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
if (toBlowDirect == nullptr) delete toBlowArray;
|
if (toBlowDirect == nullptr) delete toBlowArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -847,14 +847,9 @@ bool Level::setTileAndData(int x, int y, int z, int tile, int data,
|
||||||
#endif
|
#endif
|
||||||
result = c->setTileAndData(x & 15, y, z & 15, tile, data);
|
result = c->setTileAndData(x & 15, y, z & 15, tile, data);
|
||||||
if (updateFlags != Tile::UPDATE_INVISIBLE_NO_LIGHT) {
|
if (updateFlags != Tile::UPDATE_INVISIBLE_NO_LIGHT) {
|
||||||
#if !defined(_CONTENT_PACKAGE)
|
|
||||||
PIXBeginNamedEvent(0, "Checking light %d %d %d", x, y, z);
|
|
||||||
PIXBeginNamedEvent(0, "was %d, %d now %d, %d", old, olddata, tile,
|
|
||||||
data);
|
|
||||||
#endif
|
|
||||||
checkLight(x, y, z);
|
checkLight(x, y, z);
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
if (result) {
|
if (result) {
|
||||||
if ((updateFlags & Tile::UPDATE_CLIENTS) != 0 &&
|
if ((updateFlags & Tile::UPDATE_CLIENTS) != 0 &&
|
||||||
|
|
@ -987,26 +982,22 @@ void Level::tileUpdated(int x, int y, int z, int tile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level::lightColumnChanged(int x, int z, int y0, int y1) {
|
void Level::lightColumnChanged(int x, int z, int y0, int y1) {
|
||||||
PIXBeginNamedEvent(0, "LightColumnChanged (%d,%d) %d to %d", x, z, y0, y1);
|
if (y0 > y1) {
|
||||||
if (y0 > y1) {
|
|
||||||
int tmp = y1;
|
int tmp = y1;
|
||||||
y1 = y0;
|
y1 = y0;
|
||||||
y0 = tmp;
|
y0 = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dimension->hasCeiling) {
|
if (!dimension->hasCeiling) {
|
||||||
PIXBeginNamedEvent(0, "Checking lights");
|
for (int y = y0; y <= y1; y++) {
|
||||||
for (int y = y0; y <= y1; y++) {
|
checkLight(LightLayer::Sky, x, y, z);
|
||||||
PIXBeginNamedEvent(0, "Checking light %d", y);
|
|
||||||
checkLight(LightLayer::Sky, x, y, z);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
PIXBeginNamedEvent(0, "Setting tiles dirty");
|
setTilesDirty(x, y0, z, x, y1, z);
|
||||||
setTilesDirty(x, y0, z, x, y1, z);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level::setTileDirty(int x, int y, int z) {
|
void Level::setTileDirty(int x, int y, int z) {
|
||||||
|
|
@ -2806,9 +2797,8 @@ void Level::setSpawnSettings(bool spawnEnemies, bool spawnFriendlies) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level::tick() {
|
void Level::tick() {
|
||||||
PIXBeginNamedEvent(0, "Weather tick");
|
tickWeather();
|
||||||
tickWeather();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level::prepareWeather() {
|
void Level::prepareWeather() {
|
||||||
|
|
@ -3848,9 +3838,8 @@ void Level::setBlocksAndData(int x, int y, int z, int xs, int ys, int zs,
|
||||||
}
|
}
|
||||||
if (forceUnshare) {
|
if (forceUnshare) {
|
||||||
int size = (x1 - x0) * (y1 - y0) * (z1 - z0);
|
int size = (x1 - x0) * (y1 - y0) * (z1 - z0);
|
||||||
PIXBeginNamedEvent(0, "Chunk data unsharing %d\n", size);
|
lc->stopSharingTilesAndData();
|
||||||
lc->stopSharingTilesAndData();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
if (p < data.size())
|
if (p < data.size())
|
||||||
p = lc->setBlocksAndData(data, x0, y0, z0, x1, y1, z1, p,
|
p = lc->setBlocksAndData(data, x0, y0, z0, x1, y1, z1, p,
|
||||||
|
|
@ -3858,11 +3847,10 @@ void Level::setBlocksAndData(int x, int y, int z, int xs, int ys, int zs,
|
||||||
setTilesDirty(xc * 16 + x0, y0, zc * 16 + z0, xc * 16 + x1, y1,
|
setTilesDirty(xc * 16 + x0, y0, zc * 16 + z0, xc * 16 + x1, y1,
|
||||||
zc * 16 + z1);
|
zc * 16 + z1);
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Chunk data sharing\n");
|
if (g_NetworkManager.IsHost() && isClientSide) {
|
||||||
if (g_NetworkManager.IsHost() && isClientSide) {
|
|
||||||
lc->startSharingTilesAndData();
|
lc->startSharingTilesAndData();
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,12 +88,10 @@ void BiomeDecorator::_init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BiomeDecorator::decorate() {
|
void BiomeDecorator::decorate() {
|
||||||
PIXBeginNamedEvent(0, "Decorate ores");
|
decorateOres();
|
||||||
decorateOres();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Decorate sand/clay/gravel");
|
for (int i = 0; i < sandCount; i++) {
|
||||||
for (int i = 0; i < sandCount; i++) {
|
|
||||||
int x = xo + random->nextInt(16) + 8;
|
int x = xo + random->nextInt(16) + 8;
|
||||||
int z = zo + random->nextInt(16) + 8;
|
int z = zo + random->nextInt(16) + 8;
|
||||||
sandFeature->place(level, random, x, level->getTopSolidBlock(x, z), z);
|
sandFeature->place(level, random, x, level->getTopSolidBlock(x, z), z);
|
||||||
|
|
@ -110,10 +108,9 @@ void BiomeDecorator::decorate() {
|
||||||
int z = zo + random->nextInt(16) + 8;
|
int z = zo + random->nextInt(16) + 8;
|
||||||
sandFeature->place(level, random, x, level->getTopSolidBlock(x, z), z);
|
sandFeature->place(level, random, x, level->getTopSolidBlock(x, z), z);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Decorate forests");
|
int forests = treeCount;
|
||||||
int forests = treeCount;
|
|
||||||
if (random->nextInt(10) == 0) forests += 1;
|
if (random->nextInt(10) == 0) forests += 1;
|
||||||
|
|
||||||
for (int i = 0; i < forests; i++) {
|
for (int i = 0; i < forests; i++) {
|
||||||
|
|
@ -124,10 +121,9 @@ void BiomeDecorator::decorate() {
|
||||||
tree->place(level, random, x, level->getHeightmap(x, z), z);
|
tree->place(level, random, x, level->getHeightmap(x, z), z);
|
||||||
delete tree;
|
delete tree;
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Decorate mushrooms/flowers/grass");
|
for (int i = 0; i < hugeMushrooms; i++) {
|
||||||
for (int i = 0; i < hugeMushrooms; i++) {
|
|
||||||
int x = xo + random->nextInt(16) + 8;
|
int x = xo + random->nextInt(16) + 8;
|
||||||
int z = zo + random->nextInt(16) + 8;
|
int z = zo + random->nextInt(16) + 8;
|
||||||
hugeMushroomFeature->place(level, random, x, level->getHeightmap(x, z),
|
hugeMushroomFeature->place(level, random, x, level->getHeightmap(x, z),
|
||||||
|
|
@ -158,10 +154,7 @@ void BiomeDecorator::decorate() {
|
||||||
grassFeature->place(level, random, x, y, z);
|
grassFeature->place(level, random, x, y, z);
|
||||||
delete grassFeature;
|
delete grassFeature;
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(
|
|
||||||
0, "Decorate bush/waterlily/mushroom/reeds/pumpkins/cactuses");
|
|
||||||
|
|
||||||
// 4J Stu - For some reason this was created each time round in the loop
|
// 4J Stu - For some reason this was created each time round in the loop
|
||||||
// I assume there is a case where deadBushCount could be 0
|
// I assume there is a case where deadBushCount could be 0
|
||||||
DeadBushFeature* deadBushFeature = nullptr;
|
DeadBushFeature* deadBushFeature = nullptr;
|
||||||
|
|
@ -245,9 +238,8 @@ void BiomeDecorator::decorate() {
|
||||||
cactusFeature->place(level, random, x, y, z);
|
cactusFeature->place(level, random, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Decorate liquids");
|
|
||||||
|
|
||||||
if (liquids) {
|
if (liquids) {
|
||||||
// 4J Stu - For some reason this was created each time round in the loop
|
// 4J Stu - For some reason this was created each time round in the loop
|
||||||
SpringFeature* waterSpringFeature = new SpringFeature(Tile::water_Id);
|
SpringFeature* waterSpringFeature = new SpringFeature(Tile::water_Id);
|
||||||
|
|
@ -270,7 +262,7 @@ void BiomeDecorator::decorate() {
|
||||||
}
|
}
|
||||||
delete lavaSpringFeature;
|
delete lavaSpringFeature;
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BiomeDecorator::decorate(int count, Feature* feature) {
|
void BiomeDecorator::decorate(int count, Feature* feature) {
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,7 @@ Feature* JungleBiome::getGrassFeature(Random* random) {
|
||||||
void JungleBiome::decorate(Level* level, Random* random, int xo, int zo) {
|
void JungleBiome::decorate(Level* level, Random* random, int xo, int zo) {
|
||||||
Biome::decorate(level, random, xo, zo);
|
Biome::decorate(level, random, xo, zo);
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Adding vines");
|
VinesFeature* vines = new VinesFeature();
|
||||||
VinesFeature* vines = new VinesFeature();
|
|
||||||
|
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++) {
|
||||||
int x = xo + random->nextInt(16) + 8;
|
int x = xo + random->nextInt(16) + 8;
|
||||||
|
|
@ -67,5 +66,5 @@ void JungleBiome::decorate(Level* level, Random* random, int xo, int zo) {
|
||||||
int z = zo + random->nextInt(16) + 8;
|
int z = zo + random->nextInt(16) + 8;
|
||||||
vines->place(level, random, x, y, z);
|
vines->place(level, random, x, y, z);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
@ -830,13 +830,12 @@ void LevelChunk::recalcHeight(int x, int yStart, int z) {
|
||||||
}
|
}
|
||||||
if (height < lowestHeightmap) lowestHeightmap = height;
|
if (height < lowestHeightmap) lowestHeightmap = height;
|
||||||
if (!level->dimension->hasCeiling) {
|
if (!level->dimension->hasCeiling) {
|
||||||
PIXBeginNamedEvent(0, "Light gaps");
|
lightGap(xOffs - 1, zOffs, y1, y2);
|
||||||
lightGap(xOffs - 1, zOffs, y1, y2);
|
|
||||||
lightGap(xOffs + 1, zOffs, y1, y2);
|
lightGap(xOffs + 1, zOffs, y1, y2);
|
||||||
lightGap(xOffs, zOffs - 1, y1, y2);
|
lightGap(xOffs, zOffs - 1, y1, y2);
|
||||||
lightGap(xOffs, zOffs + 1, y1, y2);
|
lightGap(xOffs, zOffs + 1, y1, y2);
|
||||||
lightGap(xOffs, zOffs, y1, y2);
|
lightGap(xOffs, zOffs, y1, y2);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->setUnsaved(true);
|
this->setUnsaved(true);
|
||||||
|
|
@ -895,9 +894,8 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) {
|
||||||
if (old != 0 && !level->isClientSide) {
|
if (old != 0 && !level->isClientSide) {
|
||||||
Tile::tiles[old]->onRemoving(level, xOffs, y, zOffs, oldData);
|
Tile::tiles[old]->onRemoving(level, xOffs, y, zOffs, oldData);
|
||||||
}
|
}
|
||||||
PIXBeginNamedEvent(0, "Chunk setting tile");
|
blocks->set(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z, tile);
|
||||||
blocks->set(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z, tile);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
if (old != 0) {
|
if (old != 0) {
|
||||||
if (!level->isClientSide) {
|
if (!level->isClientSide) {
|
||||||
Tile::tiles[old]->onRemove(level, xOffs, y, zOffs, old, oldData);
|
Tile::tiles[old]->onRemove(level, xOffs, y, zOffs, old, oldData);
|
||||||
|
|
@ -905,9 +903,8 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) {
|
||||||
level->removeTileEntity(xOffs, y, zOffs);
|
level->removeTileEntity(xOffs, y, zOffs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXBeginNamedEvent(0, "Chunk setting data");
|
data->set(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z, _data);
|
||||||
data->set(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z, _data);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// 4J added - flag if something emissive is being added. This is used during
|
// 4J added - flag if something emissive is being added. This is used during
|
||||||
// level creation to determine what chunks need extra lighting processing
|
// level creation to determine what chunks need extra lighting processing
|
||||||
|
|
@ -915,34 +912,30 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) {
|
||||||
emissiveAdded = true;
|
emissiveAdded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Updating lighting");
|
// 4J - There isn't any point in recalculating heights or updating sky
|
||||||
// 4J - There isn't any point in recalculating heights or updating sky
|
|
||||||
// lighting if this tile has the same light-blocking capabilities as the one
|
// lighting if this tile has the same light-blocking capabilities as the one
|
||||||
// it is replacing
|
// it is replacing
|
||||||
if (Tile::lightBlock[tile & 0xff] != Tile::lightBlock[old & 0xff]) {
|
if (Tile::lightBlock[tile & 0xff] != Tile::lightBlock[old & 0xff]) {
|
||||||
if (!level->dimension->hasCeiling) {
|
if (!level->dimension->hasCeiling) {
|
||||||
if (Tile::lightBlock[tile & 0xff] != 0) {
|
if (Tile::lightBlock[tile & 0xff] != 0) {
|
||||||
if (y >= oldHeight) {
|
if (y >= oldHeight) {
|
||||||
PIXBeginNamedEvent(0, "Recalc height 1");
|
recalcHeight(x, y + 1, z);
|
||||||
recalcHeight(x, y + 1, z);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (y == oldHeight - 1) {
|
if (y == oldHeight - 1) {
|
||||||
PIXBeginNamedEvent(0, "Recalc height 2");
|
recalcHeight(x, y, z);
|
||||||
recalcHeight(x, y, z);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// level.updateLight(LightLayer.Carried, xOffs, y, zOffs, xOffs, y,
|
// level.updateLight(LightLayer.Carried, xOffs, y, zOffs, xOffs, y,
|
||||||
// zOffs);
|
// zOffs);
|
||||||
PIXBeginNamedEvent(0, "Lighting gaps");
|
lightGaps(x, z);
|
||||||
lightGaps(x, z);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
data->set(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z, _data);
|
data->set(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z, _data);
|
||||||
if (_tile != 0) {
|
if (_tile != 0) {
|
||||||
if (!level->isClientSide) {
|
if (!level->isClientSide) {
|
||||||
|
|
@ -1455,8 +1448,7 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter
|
||||||
// 4J Stu - Save out entities to a cached format that won't
|
// 4J Stu - Save out entities to a cached format that won't
|
||||||
// interfere with other systems
|
// interfere with other systems
|
||||||
m_unloadedEntitiesTag = new CompoundTag();
|
m_unloadedEntitiesTag = new CompoundTag();
|
||||||
PIXBeginNamedEvent(0, "Saving entities");
|
ListTag<CompoundTag>* entityTags = new ListTag<CompoundTag>();
|
||||||
ListTag<CompoundTag>* entityTags = new ListTag<CompoundTag>();
|
|
||||||
|
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock(m_csEntities);
|
std::lock_guard<std::recursive_mutex> lock(m_csEntities);
|
||||||
|
|
@ -1478,10 +1470,9 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter
|
||||||
}
|
}
|
||||||
|
|
||||||
m_unloadedEntitiesTag->put(L"Entities", entityTags);
|
m_unloadedEntitiesTag->put(L"Entities", entityTags);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Saving tile entities");
|
ListTag<CompoundTag>* tileEntityTags = new ListTag<CompoundTag>();
|
||||||
ListTag<CompoundTag>* tileEntityTags = new ListTag<CompoundTag>();
|
|
||||||
|
|
||||||
auto itEnd = tileEntities.end();
|
auto itEnd = tileEntities.end();
|
||||||
for (std::unordered_map<TilePos, std::shared_ptr<TileEntity>,
|
for (std::unordered_map<TilePos, std::shared_ptr<TileEntity>,
|
||||||
|
|
@ -1497,7 +1488,7 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter
|
||||||
tileEntities.clear();
|
tileEntities.clear();
|
||||||
|
|
||||||
m_unloadedEntitiesTag->put(L"TileEntities", tileEntityTags);
|
m_unloadedEntitiesTag->put(L"TileEntities", tileEntityTags);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -200,52 +200,45 @@ void McRegionChunkStorage::save(Level* level, LevelChunk* levelChunk) {
|
||||||
// running saves on multiple threads these sections have a lot of
|
// running saves on multiple threads these sections have a lot of
|
||||||
// contention. Better to let each thread have its turn at a higher level of
|
// contention. Better to let each thread have its turn at a higher level of
|
||||||
// granularity.
|
// granularity.
|
||||||
PIXBeginNamedEvent(0, "Getting output stream\n");
|
DataOutputStream* output = RegionFileCache::getChunkDataOutputStream(
|
||||||
DataOutputStream* output = RegionFileCache::getChunkDataOutputStream(
|
|
||||||
m_saveFile, m_prefix, levelChunk->x, levelChunk->z);
|
m_saveFile, m_prefix, levelChunk->x, levelChunk->z);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
if (m_saveFile->getOriginalSaveVersion() >=
|
if (m_saveFile->getOriginalSaveVersion() >=
|
||||||
SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE) {
|
SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE) {
|
||||||
PIXBeginNamedEvent(0, "Writing chunk data");
|
OldChunkStorage::save(levelChunk, level, output);
|
||||||
OldChunkStorage::save(levelChunk, level, output);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Updating chunk queue");
|
{
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(cs_memory);
|
std::lock_guard<std::mutex> lock(cs_memory);
|
||||||
s_chunkDataQueue.push_back(output);
|
s_chunkDataQueue.push_back(output);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
} else {
|
} else {
|
||||||
CompoundTag* tag;
|
CompoundTag* tag;
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(cs_memory);
|
std::lock_guard<std::mutex> lock(cs_memory);
|
||||||
PIXBeginNamedEvent(0, "Creating tags\n");
|
tag = new CompoundTag();
|
||||||
tag = new CompoundTag();
|
|
||||||
CompoundTag* levelData = new CompoundTag();
|
CompoundTag* levelData = new CompoundTag();
|
||||||
tag->put(L"Level", levelData);
|
tag->put(L"Level", levelData);
|
||||||
OldChunkStorage::save(levelChunk, level, levelData);
|
OldChunkStorage::save(levelChunk, level, levelData);
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "NbtIo writing\n");
|
NbtIo::write(tag, output);
|
||||||
NbtIo::write(tag, output);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
PIXBeginNamedEvent(0, "Output closing\n");
|
output->close();
|
||||||
output->close();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// 4J Stu - getChunkDataOutputStream makes a new DataOutputStream that
|
// 4J Stu - getChunkDataOutputStream makes a new DataOutputStream that
|
||||||
// points to a new ChunkBuffer( ByteArrayOutputStream ) We should clean
|
// points to a new ChunkBuffer( ByteArrayOutputStream ) We should clean
|
||||||
// these up when we are done
|
// these up when we are done
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(cs_memory);
|
std::lock_guard<std::mutex> lock(cs_memory);
|
||||||
PIXBeginNamedEvent(0, "Cleaning up\n");
|
output->deleteChildStream();
|
||||||
output->deleteChildStream();
|
|
||||||
delete output;
|
delete output;
|
||||||
delete tag;
|
delete tag;
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LevelData* levelInfo = level->getLevelData();
|
LevelData* levelInfo = level->getLevelData();
|
||||||
|
|
@ -263,8 +256,7 @@ void McRegionChunkStorage::save(Level* level, LevelChunk* levelChunk) {
|
||||||
|
|
||||||
void McRegionChunkStorage::saveEntities(Level* level, LevelChunk* levelChunk) {
|
void McRegionChunkStorage::saveEntities(Level* level, LevelChunk* levelChunk) {
|
||||||
#if defined(SPLIT_SAVES)
|
#if defined(SPLIT_SAVES)
|
||||||
PIXBeginNamedEvent(0, "Saving entities");
|
// 4j added cast to unsigned and changed index to u
|
||||||
// 4j added cast to unsigned and changed index to u
|
|
||||||
uint64_t index = ((uint64_t)(uint32_t)(levelChunk->x) << 32) |
|
uint64_t index = ((uint64_t)(uint32_t)(levelChunk->x) << 32) |
|
||||||
(((uint64_t)(uint32_t)(levelChunk->z)));
|
(((uint64_t)(uint32_t)(levelChunk->z)));
|
||||||
|
|
||||||
|
|
@ -289,7 +281,7 @@ void McRegionChunkStorage::saveEntities(Level* level, LevelChunk* levelChunk) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete newTag;
|
delete newTag;
|
||||||
PIXEndNamedEvent();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -314,24 +306,22 @@ void McRegionChunkStorage::tick() { m_saveFile->tick(); }
|
||||||
|
|
||||||
void McRegionChunkStorage::flush() {
|
void McRegionChunkStorage::flush() {
|
||||||
#if defined(SPLIT_SAVES)
|
#if defined(SPLIT_SAVES)
|
||||||
PIXBeginNamedEvent(0, "Flushing entity data");
|
ConsoleSavePath currentFile =
|
||||||
ConsoleSavePath currentFile =
|
|
||||||
ConsoleSavePath(m_prefix + std::wstring(L"entities.dat"));
|
ConsoleSavePath(m_prefix + std::wstring(L"entities.dat"));
|
||||||
ConsoleSaveFileOutputStream fos =
|
ConsoleSaveFileOutputStream fos =
|
||||||
ConsoleSaveFileOutputStream(m_saveFile, currentFile);
|
ConsoleSaveFileOutputStream(m_saveFile, currentFile);
|
||||||
BufferedOutputStream bos(&fos, 1024 * 1024);
|
BufferedOutputStream bos(&fos, 1024 * 1024);
|
||||||
DataOutputStream dos(&bos);
|
DataOutputStream dos(&bos);
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Writing to stream");
|
dos.writeInt(m_entityData.size());
|
||||||
dos.writeInt(m_entityData.size());
|
|
||||||
|
|
||||||
for (auto it = m_entityData.begin(); it != m_entityData.end(); ++it) {
|
for (auto it = m_entityData.begin(); it != m_entityData.end(); ++it) {
|
||||||
dos.writeLong(it->first);
|
dos.writeLong(it->first);
|
||||||
dos.write(it->second, 0, it->second.size());
|
dos.write(it->second, 0, it->second.size());
|
||||||
}
|
}
|
||||||
bos.flush();
|
bos.flush();
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -381,12 +371,11 @@ int McRegionChunkStorage::runSaveThreadProc(void* lpParam) {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
if (dos) {
|
if (dos) {
|
||||||
PIXBeginNamedEvent(0, "Saving chunk");
|
// app.DebugPrintf("Compressing chunk data (%d left)\n",
|
||||||
// app.DebugPrintf("Compressing chunk data (%d left)\n",
|
|
||||||
// lastQueueSize - 1);
|
// lastQueueSize - 1);
|
||||||
dos->close();
|
dos->close();
|
||||||
dos->deleteChildStream();
|
dos->deleteChildStream();
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
delete dos;
|
delete dos;
|
||||||
dos = nullptr;
|
dos = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -244,31 +244,26 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level,
|
||||||
dos->writeLong(level->getGameTime());
|
dos->writeLong(level->getGameTime());
|
||||||
dos->writeLong(lc->inhabitedTime);
|
dos->writeLong(lc->inhabitedTime);
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Getting block data");
|
lc->writeCompressedBlockData(dos);
|
||||||
lc->writeCompressedBlockData(dos);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Getting data data");
|
lc->writeCompressedDataData(dos);
|
||||||
lc->writeCompressedDataData(dos);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Getting sky and block light data");
|
lc->writeCompressedSkyLightData(dos);
|
||||||
lc->writeCompressedSkyLightData(dos);
|
|
||||||
lc->writeCompressedBlockLightData(dos);
|
lc->writeCompressedBlockLightData(dos);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
dos->write(lc->heightmap);
|
dos->write(lc->heightmap);
|
||||||
dos->writeShort(lc->terrainPopulated);
|
dos->writeShort(lc->terrainPopulated);
|
||||||
dos->write(lc->getBiomes());
|
dos->write(lc->getBiomes());
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Saving entities");
|
CompoundTag* tag = new CompoundTag();
|
||||||
CompoundTag* tag = new CompoundTag();
|
|
||||||
#if !defined(SPLIT_SAVES)
|
#if !defined(SPLIT_SAVES)
|
||||||
saveEntities(lc, level, tag);
|
saveEntities(lc, level, tag);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Saving tile entities");
|
ListTag<CompoundTag>* tileEntityTags = new ListTag<CompoundTag>();
|
||||||
ListTag<CompoundTag>* tileEntityTags = new ListTag<CompoundTag>();
|
|
||||||
|
|
||||||
auto itEnd = lc->tileEntities.end();
|
auto itEnd = lc->tileEntities.end();
|
||||||
for (std::unordered_map<TilePos, std::shared_ptr<TileEntity>,
|
for (std::unordered_map<TilePos, std::shared_ptr<TileEntity>,
|
||||||
|
|
@ -281,10 +276,9 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level,
|
||||||
tileEntityTags->add(teTag);
|
tileEntityTags->add(teTag);
|
||||||
}
|
}
|
||||||
tag->put(L"TileEntities", tileEntityTags);
|
tag->put(L"TileEntities", tileEntityTags);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Saving tile tick data");
|
std::vector<TickNextTickData>* ticksInChunk =
|
||||||
std::vector<TickNextTickData>* ticksInChunk =
|
|
||||||
level->fetchTicksInChunk(lc, false);
|
level->fetchTicksInChunk(lc, false);
|
||||||
if (ticksInChunk != nullptr) {
|
if (ticksInChunk != nullptr) {
|
||||||
int64_t levelTime = level->getGameTime();
|
int64_t levelTime = level->getGameTime();
|
||||||
|
|
@ -304,11 +298,11 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level,
|
||||||
tag->put(L"TileTicks", tickTags);
|
tag->put(L"TileTicks", tickTags);
|
||||||
}
|
}
|
||||||
delete ticksInChunk;
|
delete ticksInChunk;
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
NbtIo::write(tag, dos);
|
NbtIo::write(tag, dos);
|
||||||
delete tag;
|
delete tag;
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) {
|
void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) {
|
||||||
|
|
@ -331,26 +325,23 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) {
|
||||||
// moved to TLS
|
// moved to TLS
|
||||||
ThreadStorage* tls = m_tlsStorage;
|
ThreadStorage* tls = m_tlsStorage;
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Getting block data");
|
// static std::vector<uint8_t> blockData = std::vector<uint8_t>(32768);
|
||||||
// static std::vector<uint8_t> blockData = std::vector<uint8_t>(32768);
|
|
||||||
lc->getBlockData(tls->blockData);
|
lc->getBlockData(tls->blockData);
|
||||||
tag->putByteArray(L"Blocks", tls->blockData);
|
tag->putByteArray(L"Blocks", tls->blockData);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Getting data data");
|
// static std::vector<uint8_t> dataData = std::vector<uint8_t>(16384);
|
||||||
// static std::vector<uint8_t> dataData = std::vector<uint8_t>(16384);
|
|
||||||
lc->getDataData(tls->dataData);
|
lc->getDataData(tls->dataData);
|
||||||
tag->putByteArray(L"Data", tls->dataData);
|
tag->putByteArray(L"Data", tls->dataData);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Getting sky and block light data");
|
// static std::vector<uint8_t> skyLightData = std::vector<uint8_t>(16384);
|
||||||
// static std::vector<uint8_t> skyLightData = std::vector<uint8_t>(16384);
|
|
||||||
// static std::vector<uint8_t> blockLightData = std::vector<uint8_t>(16384);
|
// static std::vector<uint8_t> blockLightData = std::vector<uint8_t>(16384);
|
||||||
lc->getSkyLightData(tls->skyLightData);
|
lc->getSkyLightData(tls->skyLightData);
|
||||||
lc->getBlockLightData(tls->blockLightData);
|
lc->getBlockLightData(tls->blockLightData);
|
||||||
tag->putByteArray(L"SkyLight", tls->skyLightData);
|
tag->putByteArray(L"SkyLight", tls->skyLightData);
|
||||||
tag->putByteArray(L"BlockLight", tls->blockLightData);
|
tag->putByteArray(L"BlockLight", tls->blockLightData);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
tag->putByteArray(L"HeightMap", lc->heightmap);
|
tag->putByteArray(L"HeightMap", lc->heightmap);
|
||||||
tag->putShort(
|
tag->putShort(
|
||||||
|
|
@ -361,13 +352,11 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) {
|
||||||
std::vector<uint8_t> biomeData = lc->getBiomes();
|
std::vector<uint8_t> biomeData = lc->getBiomes();
|
||||||
tag->putByteArray(L"Biomes", biomeData);
|
tag->putByteArray(L"Biomes", biomeData);
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Saving entities");
|
#if !defined(SPLIT_SAVES)
|
||||||
#if !defined(SPLIT_SAVES)
|
|
||||||
saveEntities(lc, level, tag);
|
saveEntities(lc, level, tag);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Saving tile entities");
|
ListTag<CompoundTag>* tileEntityTags = new ListTag<CompoundTag>();
|
||||||
ListTag<CompoundTag>* tileEntityTags = new ListTag<CompoundTag>();
|
|
||||||
|
|
||||||
auto itEnd = lc->tileEntities.end();
|
auto itEnd = lc->tileEntities.end();
|
||||||
for (std::unordered_map<TilePos, std::shared_ptr<TileEntity>,
|
for (std::unordered_map<TilePos, std::shared_ptr<TileEntity>,
|
||||||
|
|
@ -380,10 +369,9 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) {
|
||||||
tileEntityTags->add(teTag);
|
tileEntityTags->add(teTag);
|
||||||
}
|
}
|
||||||
tag->put(L"TileEntities", tileEntityTags);
|
tag->put(L"TileEntities", tileEntityTags);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Saving tile tick data");
|
std::vector<TickNextTickData>* ticksInChunk =
|
||||||
std::vector<TickNextTickData>* ticksInChunk =
|
|
||||||
level->fetchTicksInChunk(lc, false);
|
level->fetchTicksInChunk(lc, false);
|
||||||
if (ticksInChunk != nullptr) {
|
if (ticksInChunk != nullptr) {
|
||||||
int64_t levelTime = level->getGameTime();
|
int64_t levelTime = level->getGameTime();
|
||||||
|
|
@ -404,8 +392,8 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) {
|
||||||
tag->put(L"TileTicks", tickTags);
|
tag->put(L"TileTicks", tickTags);
|
||||||
}
|
}
|
||||||
delete ticksInChunk;
|
delete ticksInChunk;
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OldChunkStorage::loadEntities(LevelChunk* lc, Level* level,
|
void OldChunkStorage::loadEntities(LevelChunk* lc, Level* level,
|
||||||
|
|
@ -437,8 +425,7 @@ void OldChunkStorage::loadEntities(LevelChunk* lc, Level* level,
|
||||||
}
|
}
|
||||||
|
|
||||||
LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) {
|
LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) {
|
||||||
PIXBeginNamedEvent(0, "Loading chunk");
|
short version = dis->readShort();
|
||||||
short version = dis->readShort();
|
|
||||||
int x = dis->readInt();
|
int x = dis->readInt();
|
||||||
int z = dis->readInt();
|
int z = dis->readInt();
|
||||||
int time = dis->readLong();
|
int time = dis->readLong();
|
||||||
|
|
@ -486,8 +473,7 @@ LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) {
|
||||||
loadEntities(levelChunk, level, tag);
|
loadEntities(levelChunk, level, tag);
|
||||||
|
|
||||||
if (tag->contains(L"TileTicks")) {
|
if (tag->contains(L"TileTicks")) {
|
||||||
PIXBeginNamedEvent(0, "Loading TileTicks");
|
ListTag<CompoundTag>* tileTicks =
|
||||||
ListTag<CompoundTag>* tileTicks =
|
|
||||||
(ListTag<CompoundTag>*)tag->getList(L"TileTicks");
|
(ListTag<CompoundTag>*)tag->getList(L"TileTicks");
|
||||||
|
|
||||||
if (tileTicks != nullptr) {
|
if (tileTicks != nullptr) {
|
||||||
|
|
@ -500,12 +486,12 @@ LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) {
|
||||||
teTag->getInt(L"t"), teTag->getInt(L"p"));
|
teTag->getInt(L"t"), teTag->getInt(L"p"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete tag;
|
delete tag;
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
return levelChunk;
|
return levelChunk;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -335,8 +335,7 @@ void RegionFile::write(int x, int z, std::uint8_t* data,
|
||||||
// better compressed until it is reused
|
// better compressed until it is reused
|
||||||
zero(sectorNumber, SECTOR_BYTES * sectorsAllocated);
|
zero(sectorNumber, SECTOR_BYTES * sectorsAllocated);
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Scanning for free space\n");
|
/* scan for a free space large enough to store this chunk */
|
||||||
/* scan for a free space large enough to store this chunk */
|
|
||||||
int runStart =
|
int runStart =
|
||||||
(int)(find(sectorFree->begin(), sectorFree->end(), true) -
|
(int)(find(sectorFree->begin(), sectorFree->end(), true) -
|
||||||
sectorFree
|
sectorFree
|
||||||
|
|
@ -358,7 +357,7 @@ void RegionFile::write(int x, int z, std::uint8_t* data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
if (runLength >= sectorsNeeded) {
|
if (runLength >= sectorsNeeded) {
|
||||||
/* we found a free space large enough */
|
/* we found a free space large enough */
|
||||||
|
|
@ -370,8 +369,6 @@ void RegionFile::write(int x, int z, std::uint8_t* data,
|
||||||
}
|
}
|
||||||
write(sectorNumber, compData, length, compLength);
|
write(sectorNumber, compData, length, compLength);
|
||||||
} else {
|
} else {
|
||||||
PIXBeginNamedEvent(0, "Expanding storage for %d sectors\n",
|
|
||||||
sectorsNeeded);
|
|
||||||
/*
|
/*
|
||||||
* no free space large enough found -- we need to grow the
|
* no free space large enough found -- we need to grow the
|
||||||
* file
|
* file
|
||||||
|
|
@ -393,7 +390,7 @@ void RegionFile::write(int x, int z, std::uint8_t* data,
|
||||||
|
|
||||||
write(sectorNumber, compData, length, compLength);
|
write(sectorNumber, compData, length, compLength);
|
||||||
setOffset(x, z, (sectorNumber << 8) | sectorsNeeded);
|
setOffset(x, z, (sectorNumber << 8) | sectorsNeeded);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTimestamp(x, z, (int)(System::currentTimeMillis() / 1000L));
|
setTimestamp(x, z, (int)(System::currentTimeMillis() / 1000L));
|
||||||
|
|
|
||||||
|
|
@ -510,17 +510,15 @@ void CustomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) {
|
||||||
|
|
||||||
bool hasVillage = false;
|
bool hasVillage = false;
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Structure postprocessing");
|
if (generateStructures) {
|
||||||
if (generateStructures) {
|
|
||||||
mineShaftFeature->postProcess(level, pprandom, xt, zt);
|
mineShaftFeature->postProcess(level, pprandom, xt, zt);
|
||||||
hasVillage = villageFeature->postProcess(level, pprandom, xt, zt);
|
hasVillage = villageFeature->postProcess(level, pprandom, xt, zt);
|
||||||
strongholdFeature->postProcess(level, pprandom, xt, zt);
|
strongholdFeature->postProcess(level, pprandom, xt, zt);
|
||||||
scatteredFeature->postProcess(level, random, xt, zt);
|
scatteredFeature->postProcess(level, random, xt, zt);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Monster rooms");
|
for (int i = 0; i < 8; i++) {
|
||||||
for (int i = 0; i < 8; i++) {
|
|
||||||
int x = xo + pprandom->nextInt(16) + 8;
|
int x = xo + pprandom->nextInt(16) + 8;
|
||||||
int y = pprandom->nextInt(Level::maxBuildHeight);
|
int y = pprandom->nextInt(Level::maxBuildHeight);
|
||||||
int z = zo + pprandom->nextInt(16) + 8;
|
int z = zo + pprandom->nextInt(16) + 8;
|
||||||
|
|
@ -529,11 +527,10 @@ void CustomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) {
|
||||||
}
|
}
|
||||||
delete mrf;
|
delete mrf;
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Biome decorate");
|
biome->decorate(level, pprandom, xo, zo);
|
||||||
biome->decorate(level, pprandom, xo, zo);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
app.processSchematics(parent->getChunk(xt, zt));
|
app.processSchematics(parent->getChunk(xt, zt));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -756,17 +756,15 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) {
|
||||||
|
|
||||||
bool hasVillage = false;
|
bool hasVillage = false;
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Structure postprocessing");
|
if (generateStructures) {
|
||||||
if (generateStructures) {
|
|
||||||
mineShaftFeature->postProcess(level, pprandom, xt, zt);
|
mineShaftFeature->postProcess(level, pprandom, xt, zt);
|
||||||
hasVillage = villageFeature->postProcess(level, pprandom, xt, zt);
|
hasVillage = villageFeature->postProcess(level, pprandom, xt, zt);
|
||||||
strongholdFeature->postProcess(level, pprandom, xt, zt);
|
strongholdFeature->postProcess(level, pprandom, xt, zt);
|
||||||
scatteredFeature->postProcess(level, random, xt, zt);
|
scatteredFeature->postProcess(level, random, xt, zt);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Lakes");
|
if (biome != Biome::desert && biome != Biome::desertHills) {
|
||||||
if (biome != Biome::desert && biome != Biome::desertHills) {
|
|
||||||
if (!hasVillage && pprandom->nextInt(4) == 0) {
|
if (!hasVillage && pprandom->nextInt(4) == 0) {
|
||||||
int x = xo + pprandom->nextInt(16) + 8;
|
int x = xo + pprandom->nextInt(16) + 8;
|
||||||
int y = pprandom->nextInt(Level::genDepth);
|
int y = pprandom->nextInt(Level::genDepth);
|
||||||
|
|
@ -776,10 +774,9 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) {
|
||||||
calmWater.place(level, pprandom, x, y, z);
|
calmWater.place(level, pprandom, x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Lava");
|
if (!hasVillage && pprandom->nextInt(8) == 0) {
|
||||||
if (!hasVillage && pprandom->nextInt(8) == 0) {
|
|
||||||
int x = xo + pprandom->nextInt(16) + 8;
|
int x = xo + pprandom->nextInt(16) + 8;
|
||||||
int y = pprandom->nextInt(pprandom->nextInt(Level::genDepth - 8) + 8);
|
int y = pprandom->nextInt(pprandom->nextInt(Level::genDepth - 8) + 8);
|
||||||
int z = zo + pprandom->nextInt(16) + 8;
|
int z = zo + pprandom->nextInt(16) + 8;
|
||||||
|
|
@ -788,33 +785,28 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) {
|
||||||
calmLava.place(level, pprandom, x, y, z);
|
calmLava.place(level, pprandom, x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Monster rooms");
|
for (int i = 0; i < 8; i++) {
|
||||||
for (int i = 0; i < 8; i++) {
|
|
||||||
int x = xo + pprandom->nextInt(16) + 8;
|
int x = xo + pprandom->nextInt(16) + 8;
|
||||||
int y = pprandom->nextInt(Level::genDepth);
|
int y = pprandom->nextInt(Level::genDepth);
|
||||||
int z = zo + pprandom->nextInt(16) + 8;
|
int z = zo + pprandom->nextInt(16) + 8;
|
||||||
MonsterRoomFeature mrf;
|
MonsterRoomFeature mrf;
|
||||||
mrf.place(level, pprandom, x, y, z);
|
mrf.place(level, pprandom, x, y, z);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Biome decorate");
|
biome->decorate(level, pprandom, xo, zo);
|
||||||
biome->decorate(level, pprandom, xo, zo);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Process Schematics");
|
app.processSchematics(parent->getChunk(xt, zt));
|
||||||
app.processSchematics(parent->getChunk(xt, zt));
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Post process mobs");
|
MobSpawner::postProcessSpawnMobs(level, biome, xo + 8, zo + 8, 16, 16,
|
||||||
MobSpawner::postProcessSpawnMobs(level, biome, xo + 8, zo + 8, 16, 16,
|
|
||||||
pprandom);
|
pprandom);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Update ice and snow");
|
// 4J - brought forward from 1.2.3 to get snow back in taiga biomes
|
||||||
// 4J - brought forward from 1.2.3 to get snow back in taiga biomes
|
|
||||||
xo += 8;
|
xo += 8;
|
||||||
zo += 8;
|
zo += 8;
|
||||||
for (int x = 0; x < 16; x++) {
|
for (int x = 0; x < 16; x++) {
|
||||||
|
|
@ -831,7 +823,7 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
HeavyTile::instaFall = false;
|
HeavyTile::instaFall = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,8 +139,7 @@ void BasicTree::prepare() {
|
||||||
|
|
||||||
void BasicTree::crossection(int x, int y, int z, float radius,
|
void BasicTree::crossection(int x, int y, int z, float radius,
|
||||||
uint8_t direction, int material) {
|
uint8_t direction, int material) {
|
||||||
PIXBeginNamedEvent(0, "BasicTree crossection");
|
// Create a circular cross section.
|
||||||
// Create a circular cross section.
|
|
||||||
//
|
//
|
||||||
// Used to nearly everything in the foliage, branches, and trunk.
|
// Used to nearly everything in the foliage, branches, and trunk.
|
||||||
// This is a good target for performance optimization.
|
// This is a good target for performance optimization.
|
||||||
|
|
@ -170,24 +169,22 @@ void BasicTree::crossection(int x, int y, int z, float radius,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
position[secidx2] = center[secidx2] + offset2;
|
position[secidx2] = center[secidx2] + offset2;
|
||||||
PIXBeginNamedEvent(0, "BasicTree getting tile");
|
thismat = thisLevel->getTile(position[0], position[1], position[2]);
|
||||||
thismat = thisLevel->getTile(position[0], position[1], position[2]);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
if (!((thismat == 0) || (thismat == Tile::leaves_Id))) {
|
if (!((thismat == 0) || (thismat == Tile::leaves_Id))) {
|
||||||
// If the material of the checked block is anything other than
|
// If the material of the checked block is anything other than
|
||||||
// air or foliage, skip this tile.
|
// air or foliage, skip this tile.
|
||||||
offset2++;
|
offset2++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
PIXBeginNamedEvent(0, "BasicTree placing block");
|
placeBlock(thisLevel, position[0], position[1], position[2],
|
||||||
placeBlock(thisLevel, position[0], position[1], position[2],
|
|
||||||
material, 0);
|
material, 0);
|
||||||
PIXEndNamedEvent();
|
|
||||||
offset2++;
|
offset2++;
|
||||||
}
|
}
|
||||||
offset1++;
|
offset1++;
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float BasicTree::treeShape(int y) {
|
float BasicTree::treeShape(int y) {
|
||||||
|
|
@ -228,8 +225,7 @@ float BasicTree::foliageShape(int y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicTree::foliageCluster(int x, int y, int z) {
|
void BasicTree::foliageCluster(int x, int y, int z) {
|
||||||
PIXBeginNamedEvent(0, "BasicTree foliageCluster");
|
// Generate a cluster of foliage, with the base at x, y, z.
|
||||||
// Generate a cluster of foliage, with the base at x, y, z.
|
|
||||||
// The shape of the cluster is derived from foliageShape
|
// The shape of the cluster is derived from foliageShape
|
||||||
// crossection is called to make each level.
|
// crossection is called to make each level.
|
||||||
int topy = y + foliageHeight;
|
int topy = y + foliageHeight;
|
||||||
|
|
@ -242,7 +238,7 @@ void BasicTree::foliageCluster(int x, int y, int z) {
|
||||||
crossection(x, cury, z, radius, (uint8_t)1, Tile::leaves_Id);
|
crossection(x, cury, z, radius, (uint8_t)1, Tile::leaves_Id);
|
||||||
cury--;
|
cury--;
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicTree::limb(int* start, int* end, int material) {
|
void BasicTree::limb(int* start, int* end, int material) {
|
||||||
|
|
@ -532,26 +528,21 @@ bool BasicTree::place(Level* level, Random* random, int x, int y, int z) {
|
||||||
// System.out.println("Tree location failed");
|
// System.out.println("Tree location failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PIXBeginNamedEvent(0, "Placing BasicTree");
|
// System.out.println("The height is");
|
||||||
// System.out.println("The height is");
|
|
||||||
// System.out.println(height);
|
// System.out.println(height);
|
||||||
// System.out.println("Trunk Height check done");
|
// System.out.println("Trunk Height check done");
|
||||||
PIXBeginNamedEvent(0, "Preparing tree");
|
prepare();
|
||||||
prepare();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
// System.out.println("Prepare done");
|
// System.out.println("Prepare done");
|
||||||
PIXBeginNamedEvent(0, "Making foliage");
|
makeFoliage();
|
||||||
makeFoliage();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
// System.out.println("Foliage done");
|
// System.out.println("Foliage done");
|
||||||
PIXBeginNamedEvent(0, "Making trunk");
|
makeTrunk();
|
||||||
makeTrunk();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
// System.out.println("Trunk done");
|
// System.out.println("Trunk done");
|
||||||
PIXBeginNamedEvent(0, "Making branches");
|
makeBranches();
|
||||||
makeBranches();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
// System.out.println("Branches done");
|
// System.out.println("Branches done");
|
||||||
PIXEndNamedEvent();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -13,8 +13,7 @@ GroundBushFeature::GroundBushFeature(int trunkType, int leafType) {
|
||||||
|
|
||||||
bool GroundBushFeature::place(Level* level, Random* random, int x, int y,
|
bool GroundBushFeature::place(Level* level, Random* random, int x, int y,
|
||||||
int z) {
|
int z) {
|
||||||
PIXBeginNamedEvent(0, "Placing GroundBushFeature");
|
int t = 0;
|
||||||
int t = 0;
|
|
||||||
while (((t = level->getTile(x, y, z)) == 0 || t == Tile::leaves_Id) &&
|
while (((t = level->getTile(x, y, z)) == 0 || t == Tile::leaves_Id) &&
|
||||||
y > 0)
|
y > 0)
|
||||||
y--;
|
y--;
|
||||||
|
|
@ -41,6 +40,6 @@ bool GroundBushFeature::place(Level* level, Random* random, int x, int y,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -27,12 +27,11 @@ bool MegaTreeFeature::place(Level* level, Random* random, int x, int y, int z) {
|
||||||
// 4J Stu Added to stop tree features generating areas previously place by
|
// 4J Stu Added to stop tree features generating areas previously place by
|
||||||
// game rule generation
|
// game rule generation
|
||||||
if (app.getLevelGenerationOptions() != nullptr) {
|
if (app.getLevelGenerationOptions() != nullptr) {
|
||||||
PIXBeginNamedEvent(0, "MegaTreeFeature Checking intersects");
|
|
||||||
LevelGenerationOptions* levelGenOptions =
|
LevelGenerationOptions* levelGenOptions =
|
||||||
app.getLevelGenerationOptions();
|
app.getLevelGenerationOptions();
|
||||||
bool intersects = levelGenOptions->checkIntersects(
|
bool intersects = levelGenOptions->checkIntersects(
|
||||||
x - 2, y - 1, z - 2, x + 2, y + treeHeight, z + 2);
|
x - 2, y - 1, z - 2, x + 2, y + treeHeight, z + 2);
|
||||||
PIXEndNamedEvent();
|
|
||||||
if (intersects) {
|
if (intersects) {
|
||||||
// app.DebugPrintf("Skipping reeds feature generation as it overlaps
|
// app.DebugPrintf("Skipping reeds feature generation as it overlaps
|
||||||
// a game rule structure\n");
|
// a game rule structure\n");
|
||||||
|
|
@ -74,12 +73,8 @@ bool MegaTreeFeature::place(Level* level, Random* random, int x, int y, int z) {
|
||||||
level->setTileAndData(x + 1, y - 1, z + 1, Tile::dirt_Id, 0,
|
level->setTileAndData(x + 1, y - 1, z + 1, Tile::dirt_Id, 0,
|
||||||
Tile::UPDATE_CLIENTS);
|
Tile::UPDATE_CLIENTS);
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "MegaTree placing leaves, %d, %d, %d", x, z,
|
|
||||||
y + treeHeight);
|
|
||||||
placeLeaves(level, x, z, y + treeHeight, 2, random);
|
placeLeaves(level, x, z, y + treeHeight, 2, random);
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "MegaTree placing branches");
|
|
||||||
int branchHeight = y + treeHeight - 2 - random->nextInt(4);
|
int branchHeight = y + treeHeight - 2 - random->nextInt(4);
|
||||||
while (branchHeight > y + treeHeight / 2) {
|
while (branchHeight > y + treeHeight / 2) {
|
||||||
float angle = random->nextFloat() * std::numbers::pi * 2.0f;
|
float angle = random->nextFloat() * std::numbers::pi * 2.0f;
|
||||||
|
|
@ -96,9 +91,7 @@ bool MegaTreeFeature::place(Level* level, Random* random, int x, int y, int z) {
|
||||||
|
|
||||||
branchHeight -= 2 + random->nextInt(4);
|
branchHeight -= 2 + random->nextInt(4);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "MegaTree placing vines");
|
|
||||||
for (int hh = 0; hh < treeHeight; hh++) {
|
for (int hh = 0; hh < treeHeight; hh++) {
|
||||||
int t = level->getTile(x, y + hh, z);
|
int t = level->getTile(x, y + hh, z);
|
||||||
if (t == 0 || t == Tile::leaves_Id) {
|
if (t == 0 || t == Tile::leaves_Id) {
|
||||||
|
|
@ -170,7 +163,6 @@ bool MegaTreeFeature::place(Level* level, Random* random, int x, int y, int z) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -199,13 +191,10 @@ void MegaTreeFeature::placeLeaves(Level* level, int x, int z, int topPosition,
|
||||||
(xo * xo + zo * zo) > ((radius - 1) * (radius - 1))) {
|
(xo * xo + zo * zo) > ((radius - 1) * (radius - 1))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
PIXBeginNamedEvent(0, "Getting tile");
|
|
||||||
int t = level->getTile(xx, yy, zz);
|
int t = level->getTile(xx, yy, zz);
|
||||||
PIXEndNamedEvent();
|
|
||||||
if (t == 0 || t == Tile::leaves_Id) {
|
if (t == 0 || t == Tile::leaves_Id) {
|
||||||
PIXBeginNamedEvent(0, "Placing block");
|
|
||||||
placeBlock(level, xx, yy, zz, Tile::leaves_Id, leafType);
|
placeBlock(level, xx, yy, zz, Tile::leaves_Id, leafType);
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,7 @@ OreFeature::OreFeature(int tile, int count, int targetTile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OreFeature::place(Level* level, Random* random, int x, int y, int z) {
|
bool OreFeature::place(Level* level, Random* random, int x, int y, int z) {
|
||||||
PIXBeginNamedEvent(0, "Place Ore Feature");
|
float dir = random->nextFloat() * std::numbers::pi;
|
||||||
float dir = random->nextFloat() * std::numbers::pi;
|
|
||||||
|
|
||||||
double x0 = x + 8 + Mth::sin(dir) * count / 8;
|
double x0 = x + 8 + Mth::sin(dir) * count / 8;
|
||||||
double x1 = x + 8 - Mth::sin(dir) * count / 8;
|
double x1 = x + 8 - Mth::sin(dir) * count / 8;
|
||||||
|
|
@ -146,6 +145,6 @@ bool OreFeature::place(Level* level, Random* random, int x, int y, int z) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -35,12 +35,11 @@ bool TreeFeature::place(Level* level, Random* random, int x, int y, int z) {
|
||||||
// 4J Stu Added to stop tree features generating areas previously place by
|
// 4J Stu Added to stop tree features generating areas previously place by
|
||||||
// game rule generation
|
// game rule generation
|
||||||
if (app.getLevelGenerationOptions() != nullptr) {
|
if (app.getLevelGenerationOptions() != nullptr) {
|
||||||
PIXBeginNamedEvent(0, "TreeFeature checking intersects");
|
LevelGenerationOptions* levelGenOptions =
|
||||||
LevelGenerationOptions* levelGenOptions =
|
|
||||||
app.getLevelGenerationOptions();
|
app.getLevelGenerationOptions();
|
||||||
bool intersects = levelGenOptions->checkIntersects(
|
bool intersects = levelGenOptions->checkIntersects(
|
||||||
x - 2, y - 1, z - 2, x + 2, y + treeHeight, z + 2);
|
x - 2, y - 1, z - 2, x + 2, y + treeHeight, z + 2);
|
||||||
PIXEndNamedEvent();
|
|
||||||
if (intersects) {
|
if (intersects) {
|
||||||
// app.DebugPrintf("Skipping reeds feature generation as it overlaps
|
// app.DebugPrintf("Skipping reeds feature generation as it overlaps
|
||||||
// a game rule structure\n");
|
// a game rule structure\n");
|
||||||
|
|
@ -76,8 +75,7 @@ bool TreeFeature::place(Level* level, Random* random, int x, int y, int z) {
|
||||||
|
|
||||||
placeBlock(level, x, y - 1, z, Tile::dirt_Id, 0);
|
placeBlock(level, x, y - 1, z, Tile::dirt_Id, 0);
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Placing TreeFeature leaves");
|
int grassHeight = 3;
|
||||||
int grassHeight = 3;
|
|
||||||
int extraWidth = 0;
|
int extraWidth = 0;
|
||||||
// 4J Stu - Generate leaves from the top down to stop having to recalc
|
// 4J Stu - Generate leaves from the top down to stop having to recalc
|
||||||
// heightmaps
|
// heightmaps
|
||||||
|
|
@ -97,9 +95,8 @@ bool TreeFeature::place(Level* level, Random* random, int x, int y, int z) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
PIXBeginNamedEvent(0, "Placing TreeFeature trunks");
|
for (int hh = 0; hh < treeHeight; hh++) {
|
||||||
for (int hh = 0; hh < treeHeight; hh++) {
|
|
||||||
int t = level->getTile(x, y + hh, z);
|
int t = level->getTile(x, y + hh, z);
|
||||||
if (t == 0 || t == Tile::leaves_Id) {
|
if (t == 0 || t == Tile::leaves_Id) {
|
||||||
placeBlock(level, x, y + hh, z, Tile::treeTrunk_Id, trunkType);
|
placeBlock(level, x, y + hh, z, Tile::treeTrunk_Id, trunkType);
|
||||||
|
|
@ -127,10 +124,9 @@ bool TreeFeature::place(Level* level, Random* random, int x, int y, int z) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
if (addJungleFeatures) {
|
if (addJungleFeatures) {
|
||||||
PIXBeginNamedEvent(0, "TreeFeature adding vines");
|
for (int yy = y - 3 + treeHeight; yy <= y + treeHeight; yy++) {
|
||||||
for (int yy = y - 3 + treeHeight; yy <= y + treeHeight; yy++) {
|
|
||||||
int yo = yy - (y + treeHeight);
|
int yo = yy - (y + treeHeight);
|
||||||
int offs = 2 - yo / 2;
|
int offs = 2 - yo / 2;
|
||||||
for (int xx = x - offs; xx <= x + offs; xx++) {
|
for (int xx = x - offs; xx <= x + offs; xx++) {
|
||||||
|
|
@ -158,11 +154,10 @@ bool TreeFeature::place(Level* level, Random* random, int x, int y, int z) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
// also chance for cocoa plants around stem
|
// also chance for cocoa plants around stem
|
||||||
if (random->nextInt(5) == 0 && treeHeight > 5) {
|
if (random->nextInt(5) == 0 && treeHeight > 5) {
|
||||||
PIXBeginNamedEvent(0, "TreeFeature adding cocoa");
|
for (int rows = 0; rows < 2; rows++) {
|
||||||
for (int rows = 0; rows < 2; rows++) {
|
|
||||||
for (int dir = 0; dir < 4; dir++) {
|
for (int dir = 0; dir < 4; dir++) {
|
||||||
if (random->nextInt(4 - rows) == 0) {
|
if (random->nextInt(4 - rows) == 0) {
|
||||||
int age = random->nextInt(3);
|
int age = random->nextInt(3);
|
||||||
|
|
@ -176,7 +171,7 @@ bool TreeFeature::place(Level* level, Random* random, int x, int y, int z) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -224,8 +224,7 @@ bool PistonBaseTile::triggerEvent(Level* level, int x, int y, int z, int param1,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param1 == TRIGGER_EXTEND) {
|
if (param1 == TRIGGER_EXTEND) {
|
||||||
PIXBeginNamedEvent(0, "Create push\n");
|
if (createPush(level, x, y, z, facing)) {
|
||||||
if (createPush(level, x, y, z, facing)) {
|
|
||||||
// 4J - it is (currently) critical that this setData sends data to
|
// 4J - it is (currently) critical that this setData sends data to
|
||||||
// the client, so have added a bool to the method so that it sends
|
// the client, so have added a bool to the method so that it sends
|
||||||
// data even if the data was already set to the same value as
|
// data even if the data was already set to the same value as
|
||||||
|
|
@ -256,10 +255,9 @@ bool PistonBaseTile::triggerEvent(Level* level, int x, int y, int z, int param1,
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
} else if (param1 == TRIGGER_CONTRACT) {
|
} else if (param1 == TRIGGER_CONTRACT) {
|
||||||
PIXBeginNamedEvent(0, "Contract phase A\n");
|
std::shared_ptr<TileEntity> prevTileEntity = level->getTileEntity(
|
||||||
std::shared_ptr<TileEntity> prevTileEntity = level->getTileEntity(
|
|
||||||
x + Facing::STEP_X[facing], y + Facing::STEP_Y[facing],
|
x + Facing::STEP_X[facing], y + Facing::STEP_Y[facing],
|
||||||
z + Facing::STEP_Z[facing]);
|
z + Facing::STEP_Z[facing]);
|
||||||
if (prevTileEntity != nullptr &&
|
if (prevTileEntity != nullptr &&
|
||||||
|
|
@ -276,23 +274,21 @@ bool PistonBaseTile::triggerEvent(Level* level, int x, int y, int z, int param1,
|
||||||
PistonMovingPiece::newMovingPieceEntity(
|
PistonMovingPiece::newMovingPieceEntity(
|
||||||
id, facing, facing, false, true));
|
id, facing, facing, false, true));
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
// sticky movement
|
// sticky movement
|
||||||
if (isSticky) {
|
if (isSticky) {
|
||||||
PIXBeginNamedEvent(0, "Contract sticky phase A\n");
|
int twoX = x + Facing::STEP_X[facing] * 2;
|
||||||
int twoX = x + Facing::STEP_X[facing] * 2;
|
|
||||||
int twoY = y + Facing::STEP_Y[facing] * 2;
|
int twoY = y + Facing::STEP_Y[facing] * 2;
|
||||||
int twoZ = z + Facing::STEP_Z[facing] * 2;
|
int twoZ = z + Facing::STEP_Z[facing] * 2;
|
||||||
int block = level->getTile(twoX, twoY, twoZ);
|
int block = level->getTile(twoX, twoY, twoZ);
|
||||||
int blockData = level->getData(twoX, twoY, twoZ);
|
int blockData = level->getData(twoX, twoY, twoZ);
|
||||||
bool pistonPiece = false;
|
bool pistonPiece = false;
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
if (block == Tile::pistonMovingPiece_Id) {
|
if (block == Tile::pistonMovingPiece_Id) {
|
||||||
PIXBeginNamedEvent(0, "Contract sticky phase B\n");
|
// the block two steps away is a moving piston block piece, so
|
||||||
// the block two steps away is a moving piston block piece, so
|
|
||||||
// replace it with the real data, since it's probably this
|
// replace it with the real data, since it's probably this
|
||||||
// piston which is changing too fast
|
// piston which is changing too fast
|
||||||
std::shared_ptr<TileEntity> tileEntity =
|
std::shared_ptr<TileEntity> tileEntity =
|
||||||
|
|
@ -312,11 +308,10 @@ bool PistonBaseTile::triggerEvent(Level* level, int x, int y, int z, int param1,
|
||||||
pistonPiece = true;
|
pistonPiece = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Contract sticky phase C\n");
|
if (!pistonPiece && block > 0 &&
|
||||||
if (!pistonPiece && block > 0 &&
|
|
||||||
(isPushable(block, level, twoX, twoY, twoZ, false)) &&
|
(isPushable(block, level, twoX, twoY, twoZ, false)) &&
|
||||||
(Tile::tiles[block]->getPistonPushReaction() ==
|
(Tile::tiles[block]->getPistonPushReaction() ==
|
||||||
Material::PUSH_NORMAL ||
|
Material::PUSH_NORMAL ||
|
||||||
|
|
@ -348,7 +343,7 @@ bool PistonBaseTile::triggerEvent(Level* level, int x, int y, int z, int param1,
|
||||||
z + Facing::STEP_Z[facing]);
|
z + Facing::STEP_Z[facing]);
|
||||||
ignoreUpdate(true);
|
ignoreUpdate(true);
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
|
||||||
} else {
|
} else {
|
||||||
stopSharingIfServer(level, x + Facing::STEP_X[facing],
|
stopSharingIfServer(level, x + Facing::STEP_X[facing],
|
||||||
y + Facing::STEP_Y[facing],
|
y + Facing::STEP_Y[facing],
|
||||||
|
|
|
||||||
|
|
@ -216,11 +216,6 @@ public:
|
||||||
static IQNetPlayer m_player[4];
|
static IQNetPlayer m_player[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
void PIXAddNamedCounter(int a, const char* b, ...);
|
|
||||||
void PIXBeginNamedEvent(int a, const char* b, ...);
|
|
||||||
void PIXEndNamedEvent();
|
|
||||||
void PIXSetMarkerDeprecated(int a, const char* b, ...);
|
|
||||||
|
|
||||||
void XSetThreadProcessor(void* a, int b);
|
void XSetThreadProcessor(void* a, int b);
|
||||||
|
|
||||||
const int QNET_SENDDATA_LOW_PRIORITY = 0;
|
const int QNET_SENDDATA_LOW_PRIORITY = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue