Merge remote-tracking branch 'origin/main' into exp/worldgen

This commit is contained in:
github-actions 2026-05-25 12:47:33 +00:00
commit 24767dbb78
4 changed files with 147 additions and 162 deletions

View file

@ -82,6 +82,8 @@ UIScene_JoinMenu::UIScene_JoinMenu(int iPad, void *_initData, UILayer *parentLay
IggyValueSetBooleanRS(&path, visibleName, nullptr, false);
}
}
updateServerDescription();
}
}
}
@ -129,46 +131,46 @@ void UIScene_JoinMenu::updateTooltips()
void UIScene_JoinMenu::tick()
{
if( !m_friendInfoRequestIssued )
if (!m_friendInfoRequestIssued)
{
ui.NavigateToScene(m_iPad, eUIScene_Timer);
g_NetworkManager.GetFullFriendSessionInfo(m_selectedSession, &friendSessionUpdated, this);
m_friendInfoRequestIssued = true;
}
if( m_friendInfoUpdatedOK )
if (m_friendInfoUpdatedOK)
{
m_friendInfoUpdatedOK = false;
m_buttonJoinGame.init(app.GetString(IDS_JOIN_GAME),eControl_JoinGame);
m_buttonJoinGame.init(app.GetString(IDS_JOIN_GAME), eControl_JoinGame);
m_buttonListPlayers.init(eControl_GamePlayers);
m_buttonListPlayers.setYPos( m_buttonListPlayers.getYPos() + 300 );
m_buttonListPlayers.setYPos(m_buttonListPlayers.getYPos() + 300);
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
for( int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++ )
for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++)
{
if( m_selectedSession->data.players[i] != nullptr )
if (m_selectedSession->data.players[i] != nullptr)
{
#ifndef _CONTENT_PACKAGE
if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_DebugLeaderboards)))
#ifndef _CONTENT_PACKAGE
if (app.DebugSettingsOn() && (app.GetGameSettingsDebugMask() & (1L << eDebugSetting_DebugLeaderboards)))
{
m_buttonListPlayers.addItem(L"WWWWWWWWWWWWWWWW");
}
else
#endif
#endif
{
string playerName(m_selectedSession->data.players[i].getOnlineID());
#ifndef __PSVITA__
#ifndef __PSVITA__
// Append guest number (any players in an online game not signed into PSN are guests)
if( m_selectedSession->data.players[i].isSignedIntoPSN() == false )
if (m_selectedSession->data.players[i].isSignedIntoPSN() == false)
{
char suffix[5];
sprintf(suffix, " (%d)", m_selectedSession->data.players[i].getQuadrant() + 1);
playerName.append(suffix);
}
#endif
#endif
m_buttonListPlayers.addItem(playerName);
}
}
@ -179,9 +181,9 @@ void UIScene_JoinMenu::tick()
}
}
#elif defined(_DURANGO)
for( int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++ )
for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++)
{
if ( m_selectedSession->searchResult.m_playerNames[i].size() )
if (m_selectedSession->searchResult.m_playerNames[i].size())
{
m_buttonListPlayers.addItem(m_selectedSession->searchResult.m_playerNames[i]);
}
@ -214,74 +216,74 @@ void UIScene_JoinMenu::tick()
m_labelLabels[eLabel_FireOn].init(app.GetString(IDS_LABEL_FIRE_SPREADS));
unsigned int uiGameHostSettings = m_selectedSession->data.m_uiGameHostSettings;
switch(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_Difficulty))
switch (app.GetGameHostOption(uiGameHostSettings, eGameHostOption_Difficulty))
{
case Difficulty::EASY:
m_labelValues[eLabel_Difficulty].init( app.GetString(IDS_DIFFICULTY_TITLE_EASY) );
m_labelValues[eLabel_Difficulty].init(app.GetString(IDS_DIFFICULTY_TITLE_EASY));
break;
case Difficulty::NORMAL:
m_labelValues[eLabel_Difficulty].init( app.GetString(IDS_DIFFICULTY_TITLE_NORMAL) );
m_labelValues[eLabel_Difficulty].init(app.GetString(IDS_DIFFICULTY_TITLE_NORMAL));
break;
case Difficulty::HARD:
m_labelValues[eLabel_Difficulty].init( app.GetString(IDS_DIFFICULTY_TITLE_HARD) );
m_labelValues[eLabel_Difficulty].init(app.GetString(IDS_DIFFICULTY_TITLE_HARD));
break;
case Difficulty::PEACEFUL:
default:
m_labelValues[eLabel_Difficulty].init( app.GetString(IDS_DIFFICULTY_TITLE_PEACEFUL) );
m_labelValues[eLabel_Difficulty].init(app.GetString(IDS_DIFFICULTY_TITLE_PEACEFUL));
break;
}
int option = app.GetGameHostOption(uiGameHostSettings,eGameHostOption_GameType);
if(option == GameType::CREATIVE->getId())
int option = app.GetGameHostOption(uiGameHostSettings, eGameHostOption_GameType);
if (option == GameType::CREATIVE->getId())
{
m_labelValues[eLabel_GameType].init( app.GetString(IDS_CREATIVE) );
m_labelValues[eLabel_GameType].init(app.GetString(IDS_CREATIVE));
}
else if(option == GameType::ADVENTURE->getId())
else if (option == GameType::ADVENTURE->getId())
{
m_labelValues[eLabel_GameType].init( app.GetString(IDS_ADVENTURE) );
m_labelValues[eLabel_GameType].init(app.GetString(IDS_ADVENTURE));
}
else
{
m_labelValues[eLabel_GameType].init( app.GetString(IDS_SURVIVAL) );
m_labelValues[eLabel_GameType].init(app.GetString(IDS_SURVIVAL));
}
if(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_Gamertags)) m_labelValues[eLabel_GamertagsOn].init( app.GetString(IDS_ON) );
else m_labelValues[eLabel_GamertagsOn].init( app.GetString(IDS_OFF) );
if (app.GetGameHostOption(uiGameHostSettings, eGameHostOption_Gamertags)) m_labelValues[eLabel_GamertagsOn].init(app.GetString(IDS_ON));
else m_labelValues[eLabel_GamertagsOn].init(app.GetString(IDS_OFF));
if(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_Structures)) m_labelValues[eLabel_Structures].init( app.GetString(IDS_ON) );
else m_labelValues[eLabel_Structures].init( app.GetString(IDS_OFF) );
if (app.GetGameHostOption(uiGameHostSettings, eGameHostOption_Structures)) m_labelValues[eLabel_Structures].init(app.GetString(IDS_ON));
else m_labelValues[eLabel_Structures].init(app.GetString(IDS_OFF));
if(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_LevelType)) m_labelValues[eLabel_LevelType].init( app.GetString(IDS_LEVELTYPE_SUPERFLAT) );
else m_labelValues[eLabel_LevelType].init( app.GetString(IDS_LEVELTYPE_NORMAL) );
if (app.GetGameHostOption(uiGameHostSettings, eGameHostOption_LevelType)) m_labelValues[eLabel_LevelType].init(app.GetString(IDS_LEVELTYPE_SUPERFLAT));
else m_labelValues[eLabel_LevelType].init(app.GetString(IDS_LEVELTYPE_NORMAL));
if(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_PvP))m_labelValues[eLabel_PVP].init( app.GetString(IDS_ON) );
else m_labelValues[eLabel_PVP].init( app.GetString(IDS_OFF) );
if (app.GetGameHostOption(uiGameHostSettings, eGameHostOption_PvP))m_labelValues[eLabel_PVP].init(app.GetString(IDS_ON));
else m_labelValues[eLabel_PVP].init(app.GetString(IDS_OFF));
if(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_TrustPlayers)) m_labelValues[eLabel_Trust].init( app.GetString(IDS_ON) );
else m_labelValues[eLabel_Trust].init( app.GetString(IDS_OFF) );
if (app.GetGameHostOption(uiGameHostSettings, eGameHostOption_TrustPlayers)) m_labelValues[eLabel_Trust].init(app.GetString(IDS_ON));
else m_labelValues[eLabel_Trust].init(app.GetString(IDS_OFF));
if(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_TNT)) m_labelValues[eLabel_TNTOn].init( app.GetString(IDS_ON) );
else m_labelValues[eLabel_TNTOn].init( app.GetString(IDS_OFF) );
if (app.GetGameHostOption(uiGameHostSettings, eGameHostOption_TNT)) m_labelValues[eLabel_TNTOn].init(app.GetString(IDS_ON));
else m_labelValues[eLabel_TNTOn].init(app.GetString(IDS_OFF));
if(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_FireSpreads)) m_labelValues[eLabel_FireOn].init( app.GetString(IDS_ON) );
else m_labelValues[eLabel_FireOn].init( app.GetString(IDS_OFF) );
if (app.GetGameHostOption(uiGameHostSettings, eGameHostOption_FireSpreads)) m_labelValues[eLabel_FireOn].init(app.GetString(IDS_ON));
else m_labelValues[eLabel_FireOn].init(app.GetString(IDS_OFF));
m_bIgnoreInput = false;
// Alert the app the we want to be informed of ethernet connections
app.SetLiveLinkRequired( true );
app.SetLiveLinkRequired(true);
TelemetryManager->RecordMenuShown(m_iPad, eUIScene_JoinMenu, 0);
addTimer(UPDATE_PLAYERS_TIMER_ID,UPDATE_PLAYERS_TIMER_TIME);
addTimer(UPDATE_PLAYERS_TIMER_ID, UPDATE_PLAYERS_TIMER_TIME);
}
if( m_friendInfoUpdatedERROR )
if (m_friendInfoUpdatedERROR)
{
m_buttonJoinGame.init(app.GetString(IDS_JOIN_GAME),eControl_JoinGame);
m_buttonJoinGame.init(app.GetString(IDS_JOIN_GAME), eControl_JoinGame);
m_buttonListPlayers.init(eControl_GamePlayers);
m_buttonListPlayers.setYPos( m_buttonListPlayers.getYPos() + 300 );
m_buttonListPlayers.setYPos(m_buttonListPlayers.getYPos() + 300);
m_labelLabels[eLabel_Difficulty].init(app.GetString(IDS_LABEL_DIFFICULTY));
m_labelLabels[eLabel_GameType].init(app.GetString(IDS_LABEL_GAME_TYPE));
@ -294,14 +296,14 @@ void UIScene_JoinMenu::tick()
m_labelLabels[eLabel_FireOn].init(app.GetString(IDS_LABEL_FIRE_SPREADS));
m_labelValues[eLabel_Difficulty].init(app.GetString(IDS_DIFFICULTY_TITLE_PEACEFUL));
m_labelValues[eLabel_GameType].init( app.GetString(IDS_CREATIVE) );
m_labelValues[eLabel_GamertagsOn].init( app.GetString(IDS_OFF) );
m_labelValues[eLabel_Structures].init( app.GetString(IDS_OFF) );
m_labelValues[eLabel_LevelType].init( app.GetString(IDS_LEVELTYPE_NORMAL) );
m_labelValues[eLabel_PVP].init( app.GetString(IDS_OFF) );
m_labelValues[eLabel_Trust].init( app.GetString(IDS_OFF) );
m_labelValues[eLabel_TNTOn].init( app.GetString(IDS_OFF) );
m_labelValues[eLabel_FireOn].init( app.GetString(IDS_OFF) );
m_labelValues[eLabel_GameType].init(app.GetString(IDS_CREATIVE));
m_labelValues[eLabel_GamertagsOn].init(app.GetString(IDS_OFF));
m_labelValues[eLabel_Structures].init(app.GetString(IDS_OFF));
m_labelValues[eLabel_LevelType].init(app.GetString(IDS_LEVELTYPE_NORMAL));
m_labelValues[eLabel_PVP].init(app.GetString(IDS_OFF));
m_labelValues[eLabel_Trust].init(app.GetString(IDS_OFF));
m_labelValues[eLabel_TNTOn].init(app.GetString(IDS_OFF));
m_labelValues[eLabel_FireOn].init(app.GetString(IDS_OFF));
m_friendInfoUpdatedERROR = false;
@ -310,9 +312,9 @@ void UIScene_JoinMenu::tick()
UINT uiIDA[1];
uiIDA[0] = IDS_CONFIRM_OK;
#ifdef _XBOX_ONE
ui.RequestErrorMessage( IDS_CONNECTION_FAILED, IDS_DISCONNECTED_SERVER_QUIT, uiIDA,1,m_iPad,ErrorDialogReturned,this);
ui.RequestErrorMessage(IDS_CONNECTION_FAILED, IDS_DISCONNECTED_SERVER_QUIT, uiIDA, 1, m_iPad, ErrorDialogReturned, this);
#else
ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA,1,m_iPad,ErrorDialogReturned,this);
ui.RequestErrorMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, m_iPad, ErrorDialogReturned, this);
#endif
}
@ -323,84 +325,7 @@ void UIScene_JoinMenu::tick()
{
IggyPlayerTickRS(s_movieServerDesc);
IggyValuePath *root = IggyPlayerRootPath(s_movieServerDesc);
if (root)
{
// scale the size before Iggy reads it
IggyValuePath textPath;
if (IggyValuePathMakeNameRef(&textPath, root, "HowToPlayText_0"))
{
IggyName nameX = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"x", -1);
IggyName nameY = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"y", -1);
IggyName nameW = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"width", -1);
IggyName nameH = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"height", -1);
if (m_loadedResolution == eSceneResolution_1080)
{
IggyValueSetF64RS(&textPath, nameX, nullptr, 333.0);// horizontal
IggyValueSetF64RS(&textPath, nameY, nullptr, 340.0);// vertical
IggyValueSetF64RS(&textPath, nameW, nullptr, 580.0);
IggyValueSetF64RS(&textPath, nameH, nullptr, 270.0);
}
else //720
{
IggyValueSetF64RS(&textPath, nameX, nullptr, 252.0);
IggyValueSetF64RS(&textPath, nameY, nullptr, 285.0);
IggyValueSetF64RS(&textPath, nameW, nullptr, 440.0);
IggyValueSetF64RS(&textPath, nameH, nullptr, 220.0);
}
}
// harcoded text for test it, later im gonna delete this and
// and convert it so that people can add their description when adding the server
if (!s_textInjected && s_funcLoadPage != 0)
{
IggyDataValue result;
IggyDataValue args[2];
args[0].type = IGGY_DATATYPE_number;
args[0].number = 0; // 0 is the what's new page on howtoplay don't change it
wstring testText = L"\nNothing yet...";
IggyStringUTF16 iggyStr;
wstring formattedText = app.FormatChatMessage(testText);
iggyStr.string = (IggyUTF16*)formattedText.c_str();
iggyStr.length = (unsigned int)formattedText.length();
args[1].type = IGGY_DATATYPE_string_UTF16;
args[1].string16 = iggyStr;
IggyResult res = IggyPlayerCallMethodRS(s_movieServerDesc, &result, root, s_funcLoadPage, 2, args);
if (res == IGGY_RESULT_SUCCESS)
{
s_textInjected = true;
}
}
// keeps the text fixed so it doesn't move from its place
IggyValuePath panelPath;
if (s_textInjected && IggyValuePathMakeNameRef(&panelPath, root, "DynamicHtmlText"))
{
IggyName nameX = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"x", -1);
IggyName nameY = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"y", -1);
IggyName nameW = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"width", -1);
IggyName nameH = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"height", -1);
if (m_loadedResolution == eSceneResolution_1080)
{
IggyValueSetF64RS(&panelPath, nameX, nullptr, 332.0);// horizontal
IggyValueSetF64RS(&panelPath, nameY, nullptr, 340.0);// vertical
IggyValueSetF64RS(&panelPath, nameW, nullptr, 580.0);
IggyValueSetF64RS(&panelPath, nameH, nullptr, 270.0);
}
else //720p
{
IggyValueSetF64RS(&panelPath, nameX, nullptr, 250.0);
IggyValueSetF64RS(&panelPath, nameY, nullptr, 290.0);
IggyValueSetF64RS(&panelPath, nameW, nullptr, 400.0);
IggyValueSetF64RS(&panelPath, nameH, nullptr, 230.0);
}
}
}
updateServerDescription();
}
}
#endif
@ -408,6 +333,88 @@ void UIScene_JoinMenu::tick()
UIScene::tick();
}
void UIScene_JoinMenu::updateServerDescription() {
IggyValuePath* root = IggyPlayerRootPath(s_movieServerDesc);
if (root)
{
// scale the size before Iggy reads it
IggyValuePath textPath;
if (IggyValuePathMakeNameRef(&textPath, root, "HowToPlayText_0"))
{
IggyName nameX = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16*)L"x", -1);
IggyName nameY = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16*)L"y", -1);
IggyName nameW = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16*)L"width", -1);
IggyName nameH = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16*)L"height", -1);
if (m_loadedResolution == eSceneResolution_1080)
{
IggyValueSetF64RS(&textPath, nameX, nullptr, 333.0);// horizontal
IggyValueSetF64RS(&textPath, nameY, nullptr, 340.0);// vertical
IggyValueSetF64RS(&textPath, nameW, nullptr, 580.0);
IggyValueSetF64RS(&textPath, nameH, nullptr, 270.0);
}
else //720
{
IggyValueSetF64RS(&textPath, nameX, nullptr, 252.0);
IggyValueSetF64RS(&textPath, nameY, nullptr, 285.0);
IggyValueSetF64RS(&textPath, nameW, nullptr, 440.0);
IggyValueSetF64RS(&textPath, nameH, nullptr, 220.0);
}
}
// harcoded text for test it, later im gonna delete this and
// and convert it so that people can add their description when adding the server
if (s_funcLoadPage != 0)
{
IggyDataValue result;
IggyDataValue args[2];
args[0].type = IGGY_DATATYPE_number;
args[0].number = 0; // 0 is the what's new page on howtoplay don't change it
wstring testText = L"\nNothing yet...";
IggyStringUTF16 iggyStr;
wstring formattedText = app.EscapeHTMLString(testText);
formattedText = app.FormatChatMessage(formattedText);
iggyStr.string = (IggyUTF16*)formattedText.c_str();
iggyStr.length = (unsigned int)formattedText.length();
args[1].type = IGGY_DATATYPE_string_UTF16;
args[1].string16 = iggyStr;
IggyResult res = IggyPlayerCallMethodRS(s_movieServerDesc, &result, root, s_funcLoadPage, 2, args);
if (res == IGGY_RESULT_SUCCESS)
{
s_textInjected = true;
}
}
// keeps the text fixed so it doesn't move from its place
IggyValuePath panelPath;
if (s_textInjected && IggyValuePathMakeNameRef(&panelPath, root, "DynamicHtmlText"))
{
IggyName nameX = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16*)L"x", -1);
IggyName nameY = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16*)L"y", -1);
IggyName nameW = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16*)L"width", -1);
IggyName nameH = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16*)L"height", -1);
if (m_loadedResolution == eSceneResolution_1080)
{
IggyValueSetF64RS(&panelPath, nameX, nullptr, 332.0);// horizontal
IggyValueSetF64RS(&panelPath, nameY, nullptr, 340.0);// vertical
IggyValueSetF64RS(&panelPath, nameW, nullptr, 580.0);
IggyValueSetF64RS(&panelPath, nameH, nullptr, 270.0);
}
else //720p
{
IggyValueSetF64RS(&panelPath, nameX, nullptr, 250.0);
IggyValueSetF64RS(&panelPath, nameY, nullptr, 290.0);
IggyValueSetF64RS(&panelPath, nameW, nullptr, 400.0);
IggyValueSetF64RS(&panelPath, nameH, nullptr, 230.0);
}
}
}
}
void UIScene_JoinMenu::friendSessionUpdated(bool success, void *pParam)
{
UIScene_JoinMenu *scene = static_cast<UIScene_JoinMenu *>(pParam);

View file

@ -93,6 +93,8 @@ protected:
// TODO: This should be pure virtual in this class
virtual wstring getMoviePath();
void updateServerDescription();
public:
public:
// INPUT

View file

@ -29,21 +29,12 @@ DWORD PistonBaseTile::tlsIdx = TlsAlloc();
// For us, that means that if we create a piston next to another one, then one of them gets two events to createPush, the second of which fails, leaving the
// piston in a bad (simultaneously extended & not extended) state.
// 4J - ignoreUpdate is a static in java, implementing as TLS here to make thread safe
bool PistonBaseTile::ignoreUpdate()
{
return (TlsGetValue(tlsIdx) != nullptr);
}
void PistonBaseTile::ignoreUpdate(bool set)
{
TlsSetValue(tlsIdx,(LPVOID)(set?1:0));
}
//I removed the code for ignoreUpdate so the above comment no longer applies ^.^
PistonBaseTile::PistonBaseTile(int id, bool isSticky) : Tile(id, Material::piston, isSolidRender() )
{
// 4J - added initialiser
ignoreUpdate(false);
this->isSticky = isSticky;
setSoundType(SOUND_STONE);
setDestroyTime(0.5f);
@ -131,7 +122,7 @@ void PistonBaseTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr<L
{
int targetData = getNewFacing(level, x, y, z, dynamic_pointer_cast<Player>(by) );
level->setData(x, y, z, targetData, Tile::UPDATE_CLIENTS);
if (!level->isClientSide && !ignoreUpdate())
if (!level->isClientSide)
{
checkIfExtend(level, x, y, z);
}
@ -139,7 +130,7 @@ void PistonBaseTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr<L
void PistonBaseTile::neighborChanged(Level *level, int x, int y, int z, int type)
{
if (!level->isClientSide && !ignoreUpdate())
if (!level->isClientSide)
{
checkIfExtend(level, x, y, z);
}
@ -147,7 +138,7 @@ void PistonBaseTile::neighborChanged(Level *level, int x, int y, int z, int type
void PistonBaseTile::onPlace(Level *level, int x, int y, int z)
{
if (!level->isClientSide && level->getTileEntity(x, y, z) == nullptr && !ignoreUpdate())
if (!level->isClientSide && level->getTileEntity(x, y, z) == nullptr)
{
checkIfExtend(level, x, y, z);
}
@ -212,7 +203,6 @@ bool PistonBaseTile::getNeighborSignal(Level *level, int x, int y, int z, int fa
bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, int facing)
{
ignoreUpdate(true);
if (!level->isClientSide)
{
@ -221,12 +211,10 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1,
if (extend && param1 == TRIGGER_CONTRACT)
{
level->setData(x, y, z, facing | EXTENDED_BIT, UPDATE_CLIENTS);
ignoreUpdate(false);
return false;
}
else if (!extend && param1 == TRIGGER_EXTEND)
{
ignoreUpdate(false);
return false;
}
}
@ -253,7 +241,6 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1,
}
if (FourKitBridge::FirePistonExtend(level->dimension->id, x, y, z, facing, pushLength))
{
ignoreUpdate(false);
return false;
}
}
@ -277,7 +264,6 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1,
}
else
{
ignoreUpdate(false);
return false;
}
PIXEndNamedEvent();
@ -288,7 +274,6 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1,
if (FourKitBridge::FirePistonRetract(level->dimension->id, x, y, z, facing))
{
level->setData(x, y, z, facing | EXTENDED_BIT, UPDATE_CLIENTS);
ignoreUpdate(false);
return false;
}
#endif
@ -353,32 +338,24 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1,
level->setTileAndData(x, y, z, Tile::pistonMovingPiece_Id, blockData, Tile::UPDATE_ALL);
level->setTileEntity(x, y, z, PistonMovingPiece::newMovingPieceEntity(block, blockData, facing, false, false));
ignoreUpdate(false);
level->removeTile(twoX, twoY, twoZ);
ignoreUpdate(true);
}
else if (!pistonPiece)
{
stopSharingIfServer(level, x + Facing::STEP_X[facing], y + Facing::STEP_Y[facing], z + Facing::STEP_Z[facing]); // 4J added
ignoreUpdate(false);
level->removeTile(x + Facing::STEP_X[facing], y + Facing::STEP_Y[facing], z + Facing::STEP_Z[facing]);
ignoreUpdate(true);
}
PIXEndNamedEvent();
}
else
{
stopSharingIfServer(level, x + Facing::STEP_X[facing], y + Facing::STEP_Y[facing], z + Facing::STEP_Z[facing]); // 4J added
ignoreUpdate(false);
level->removeTile(x + Facing::STEP_X[facing], y + Facing::STEP_Y[facing], z + Facing::STEP_Z[facing]);
ignoreUpdate(true);
}
level->playSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_TILE_PISTON_IN, 0.5f, level->random->nextFloat() * 0.15f + 0.6f);
}
ignoreUpdate(false);
return true;
}

View file

@ -27,8 +27,7 @@ private:
static DWORD tlsIdx;
// 4J - was just a static but implemented with TLS for our version
static bool ignoreUpdate();
static void ignoreUpdate(bool set);
//code removed so the above comment no longer applies
public:
PistonBaseTile(int id, bool isSticky);
@ -68,4 +67,4 @@ private:
static void stopSharingIfServer(Level *level, int x, int y, int z); // 4J added
bool createPush(Level *level, int sx, int sy, int sz, int facing);
};
};