mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-13 09:21:57 +00:00
fix: resolve all build warnings and notes
This commit is contained in:
parent
7a35d1caa2
commit
fed9cf2d95
|
|
@ -523,7 +523,7 @@ bool MultiPlayerLevel::setData(
|
|||
// better to early out here
|
||||
int d = getData(x, y, z);
|
||||
|
||||
if ((d == data)) {
|
||||
if (d == data) {
|
||||
// If we early-out, its important that we still do a checkLight here
|
||||
// (which would otherwise have happened as part of
|
||||
// Level::setTileAndDataNoUpdate) This is because since we are
|
||||
|
|
|
|||
|
|
@ -583,7 +583,6 @@ void Minecraft::setScreen(Screen* screen) {
|
|||
gui->clearMessages();
|
||||
}
|
||||
|
||||
this->screen = screen;
|
||||
if (screen != NULL) {
|
||||
// releaseMouse(); // 4J - removed
|
||||
ScreenSizeCalculator ssc(options, width, height);
|
||||
|
|
@ -668,7 +667,6 @@ void Minecraft::destroy() {
|
|||
gui->clearMessages();
|
||||
}
|
||||
|
||||
this->screen = screen;
|
||||
if (screen != NULL) {
|
||||
// releaseMouse(); // 4J - removed
|
||||
ScreenSizeCalculator ssc(options, width, height);
|
||||
|
|
@ -1921,7 +1919,7 @@ void Minecraft::run_middle() {
|
|||
timer->advanceTime();
|
||||
}
|
||||
|
||||
//int64_t beforeTickTime = System::nanoTime();
|
||||
// int64_t beforeTickTime = System::nanoTime();
|
||||
for (int i = 0; i < timer->ticks; i++) {
|
||||
bool bLastTimerTick = (i == (timer->ticks - 1));
|
||||
// 4J-PB - the tick here can run more than once, and this is a
|
||||
|
|
@ -2010,7 +2008,7 @@ void Minecraft::run_middle() {
|
|||
// SparseDataStorage::tick();
|
||||
// // 4J added
|
||||
}
|
||||
//int64_t tickDuraction = System::nanoTime() - beforeTickTime;
|
||||
// int64_t tickDuraction = System::nanoTime() - beforeTickTime;
|
||||
MemSect(31);
|
||||
checkGlError(L"Pre render");
|
||||
MemSect(0);
|
||||
|
|
@ -2090,11 +2088,9 @@ void Minecraft::run_middle() {
|
|||
// If there's an unoccupied quadrant, then clear that to black
|
||||
if (unoccupiedQuadrant > -1) {
|
||||
// render a logo
|
||||
RenderManager.StateSetViewport((
|
||||
C4JRender::
|
||||
eViewportType)(C4JRender::
|
||||
VIEWPORT_TYPE_QUADRANT_TOP_LEFT +
|
||||
unoccupiedQuadrant));
|
||||
RenderManager.StateSetViewport((C4JRender::eViewportType)(
|
||||
C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT +
|
||||
unoccupiedQuadrant));
|
||||
glClearColor(0, 0, 0, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
|
|
@ -2612,8 +2608,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
|
|||
if (player->isRiding()) {
|
||||
std::shared_ptr<Entity> mount = player->riding;
|
||||
|
||||
if (mount->instanceof(eTYPE_MINECART) ||
|
||||
mount->instanceof(eTYPE_BOAT)) {
|
||||
if (mount->instanceof (eTYPE_MINECART) || mount->instanceof
|
||||
(eTYPE_BOAT)) {
|
||||
*piAlt = IDS_TOOLTIPS_EXIT;
|
||||
} else {
|
||||
*piAlt = IDS_TOOLTIPS_DISMOUNT;
|
||||
|
|
@ -3639,7 +3635,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
|
|||
break;
|
||||
|
||||
default:
|
||||
if (hitResult->entity->instanceof(eTYPE_MOB)) {
|
||||
if (hitResult->entity->instanceof (eTYPE_MOB)) {
|
||||
std::shared_ptr<Mob> mob =
|
||||
std::dynamic_pointer_cast<Mob>(
|
||||
hitResult->entity);
|
||||
|
|
@ -4529,7 +4525,8 @@ void Minecraft::setLevel(MultiPlayerLevel* level, int message /*=-1*/,
|
|||
player->setXuid(playerXUIDOffline);
|
||||
player->setOnlineXuid(playerXUIDOnline);
|
||||
|
||||
player->m_displayName = ProfileManager.GetDisplayName(iPrimaryPlayer);
|
||||
player->m_displayName =
|
||||
ProfileManager.GetDisplayName(iPrimaryPlayer);
|
||||
|
||||
player->resetPos();
|
||||
gameMode->initPlayer(player);
|
||||
|
|
|
|||
|
|
@ -365,14 +365,10 @@ bool DLCPack::hasPurchasedFile(DLCManager::EDLCType type,
|
|||
|
||||
void DLCPack::UpdateLanguage() {
|
||||
// find the language file
|
||||
DLCManager::e_DLCType_LocalisationData;
|
||||
DLCFile* file = NULL;
|
||||
|
||||
if (m_files[DLCManager::e_DLCType_LocalisationData].size() > 0) {
|
||||
file = m_files[DLCManager::e_DLCType_LocalisationData][0];
|
||||
DLCLocalisationFile* localisationFile = (DLCLocalisationFile*)getFile(
|
||||
DLCManager::e_DLCType_LocalisationData, L"languages.loc");
|
||||
StringTable* strTable = localisationFile->getStringTable();
|
||||
strTable->ReloadStringTable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
|
|||
// add this to the skin's vector of parts
|
||||
m_AdditionalBoxes.push_back(pSkinBox);
|
||||
} break;
|
||||
case DLCManager::e_DLCParamType_Anim:
|
||||
case DLCManager::e_DLCParamType_Anim: {
|
||||
#ifdef __PS3__
|
||||
// 4J Stu - The Xbox version used swscanf_s which isn't available in
|
||||
// GCC.
|
||||
|
|
@ -147,6 +147,9 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type,
|
|||
DWORD skinId = app.getSkinIdFromPath(m_path);
|
||||
app.SetAnimOverrideBitmask(skinId, m_uiAnimOverrideBitmask);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -675,6 +675,8 @@ std::wstring LevelGenerationOptions::getDefaultSaveName() {
|
|||
return getString(info()->getDefaultSaveName());
|
||||
case eSrc_tutorial:
|
||||
return app.GetString(IDS_TUTORIALSAVENAME);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
|
@ -686,6 +688,8 @@ LPCWSTR LevelGenerationOptions::getWorldName() {
|
|||
return getString(info()->getWorldName());
|
||||
case eSrc_tutorial:
|
||||
return app.GetString(IDS_PLAY_TUTORIAL);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
|
@ -697,6 +701,8 @@ LPCWSTR LevelGenerationOptions::getDisplayName() {
|
|||
return getString(info()->getDisplayName());
|
||||
case eSrc_tutorial:
|
||||
return L"";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2533,7 +2533,7 @@ bool Tutorial::setMessage(PopupMessageDetails* message) {
|
|||
} else if ((m_lastMessage != NULL &&
|
||||
m_lastMessage->m_messageId !=
|
||||
-1)) //&& (lastMessageTime + m_iTutorialReminderTime ) >
|
||||
//GetTickCount() )
|
||||
// GetTickCount() )
|
||||
{
|
||||
// This should cause the popup to dissappear
|
||||
TutorialPopupInfo popupInfo;
|
||||
|
|
@ -2819,8 +2819,8 @@ void Tutorial::onLookAtEntity(std::shared_ptr<Entity> entity) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((m_CurrentState == e_Tutorial_State_Gameplay) &&
|
||||
entity->instanceof(eTYPE_HORSE)) {
|
||||
if ((m_CurrentState == e_Tutorial_State_Gameplay) && entity->instanceof
|
||||
(eTYPE_HORSE)) {
|
||||
changeTutorialState(e_Tutorial_State_Horse);
|
||||
}
|
||||
|
||||
|
|
@ -2839,6 +2839,8 @@ void Tutorial::onRideEntity(std::shared_ptr<Entity> entity) {
|
|||
case eTYPE_BOAT:
|
||||
changeTutorialState(e_Tutorial_State_Riding_Boat);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -192,6 +192,8 @@ bool IUIScene_BeaconMenu::IsSectionSlotList(ESceneSection eSection) {
|
|||
case eSectionBeaconInventory:
|
||||
case eSectionBeaconUsing:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -238,7 +240,7 @@ void IUIScene_BeaconMenu::handleOtherClicked(int iPad, ESceneSection eSection,
|
|||
case eSectionBeaconPrimaryTierTwoTwo:
|
||||
case eSectionBeaconPrimaryTierThree:
|
||||
case eSectionBeaconSecondaryOne:
|
||||
case eSectionBeaconSecondaryTwo:
|
||||
case eSectionBeaconSecondaryTwo: {
|
||||
if (IsPowerButtonSelected(eSection)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -254,6 +256,9 @@ void IUIScene_BeaconMenu::handleOtherClicked(int iPad, ESceneSection eSection,
|
|||
}
|
||||
SetPowerButtonSelected(eSection);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -364,6 +369,8 @@ std::vector<HtmlString>* IUIScene_BeaconMenu::GetSectionHoverText(
|
|||
eHTMLColor_White);
|
||||
desc->push_back(string);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
|
@ -375,6 +382,8 @@ bool IUIScene_BeaconMenu::IsVisible(ESceneSection eSection) {
|
|||
// This isn't visible
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,6 +168,8 @@ bool IUIScene_HorseInventoryMenu::IsSectionSlotList(ESceneSection eSection) {
|
|||
case eSectionHorseInventory:
|
||||
case eSectionHorseUsing:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -188,6 +190,8 @@ bool IUIScene_HorseInventoryMenu::IsVisible(ESceneSection eSection) {
|
|||
case eSectionHorseInventory:
|
||||
case eSectionHorseUsing:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
UIControl_Base::UIControl_Base() {
|
||||
m_bLabelChanged = false;
|
||||
m_label;
|
||||
m_id = 0;
|
||||
}
|
||||
|
||||
|
|
@ -29,7 +28,8 @@ void UIControl_Base::tick() {
|
|||
// app.DebugPrintf("Calling SetLabel - '%ls'\n", m_label.c_str());
|
||||
m_bLabelChanged = false;
|
||||
|
||||
const std::u16string convLabel = wstring_to_u16string(m_label.getString());
|
||||
const std::u16string convLabel =
|
||||
wstring_to_u16string(m_label.getString());
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
|
|
@ -57,7 +57,8 @@ void UIControl_Base::setLabel(UIString label, bool instant, bool force) {
|
|||
if (m_bLabelChanged && instant) {
|
||||
m_bLabelChanged = false;
|
||||
|
||||
const std::u16string convLabel = wstring_to_u16string(m_label.getString());
|
||||
const std::u16string convLabel =
|
||||
wstring_to_u16string(m_label.getString());
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
|
|
|
|||
|
|
@ -373,10 +373,10 @@ void UIScene::getDebugMemoryUseRecursive(const std::wstring& moviePath,
|
|||
rrbool res;
|
||||
IggyMemoryUseInfo internalMemoryInfo;
|
||||
int internalIteration = 0;
|
||||
while (res = IggyDebugGetMemoryUseInfo(swf, NULL, memoryInfo.subcategory,
|
||||
memoryInfo.subcategory_stringlen,
|
||||
internalIteration,
|
||||
&internalMemoryInfo)) {
|
||||
while ((res = IggyDebugGetMemoryUseInfo(swf, 0, memoryInfo.subcategory,
|
||||
memoryInfo.subcategory_stringlen,
|
||||
internalIteration,
|
||||
&internalMemoryInfo))) {
|
||||
app.DebugPrintf(
|
||||
app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n",
|
||||
moviePath.c_str(), internalMemoryInfo.subcategory_stringlen,
|
||||
|
|
@ -401,8 +401,8 @@ void UIScene::PrintTotalMemoryUsage(int64_t& totalStatic,
|
|||
int iteration = 0;
|
||||
int64_t sceneStatic = 0;
|
||||
int64_t sceneDynamic = 0;
|
||||
while (res = IggyDebugGetMemoryUseInfo(swf, NULL, "", 0, iteration,
|
||||
&memoryInfo)) {
|
||||
while ((res = IggyDebugGetMemoryUseInfo(swf, 0, "", 0, iteration,
|
||||
&memoryInfo))) {
|
||||
sceneStatic += memoryInfo.static_allocation_bytes;
|
||||
sceneDynamic += memoryInfo.dynamic_allocation_bytes;
|
||||
totalStatic += memoryInfo.static_allocation_bytes;
|
||||
|
|
@ -771,7 +771,7 @@ void UIScene::_customDrawSlotControl(CustomDrawData* region, int iPad,
|
|||
// if(m_parentLayer == NULL)
|
||||
// {
|
||||
// app.DebugPrintf("A scene is trying to navigate forwards, but
|
||||
//it's parent layer is NULL!\n"); #ifndef _CONTENT_PACKAGE
|
||||
// it's parent layer is NULL!\n"); #ifndef _CONTENT_PACKAGE
|
||||
// __debugbreak();
|
||||
// #endif
|
||||
// }
|
||||
|
|
@ -789,7 +789,7 @@ void UIScene::navigateBack() {
|
|||
|
||||
if (m_parentLayer == NULL) {
|
||||
// app.DebugPrintf("A scene is trying to navigate back, but it's
|
||||
//parent layer is NULL!\n");
|
||||
// parent layer is NULL!\n");
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
// __debugbreak();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -419,6 +419,8 @@ int UIScene_BeaconMenu::GetPowerButtonId(ESceneSection eSection) {
|
|||
case eSectionBeaconSecondaryTwo:
|
||||
return m_buttonsPowers[eControl_Secondary2].GetData();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -446,6 +448,8 @@ bool UIScene_BeaconMenu::IsPowerButtonSelected(ESceneSection eSection) {
|
|||
case eSectionBeaconSecondaryTwo:
|
||||
return m_buttonsPowers[eControl_Secondary2].IsButtonSelected();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
return false;
|
||||
}
|
||||
|
|
@ -468,6 +472,8 @@ void UIScene_BeaconMenu::SetPowerButtonSelected(ESceneSection eSection) {
|
|||
m_buttonsPowers[eControl_Secondary1].SetButtonSelected(false);
|
||||
m_buttonsPowers[eControl_Secondary2].SetButtonSelected(false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
switch (eSection) {
|
||||
|
|
@ -492,5 +498,7 @@ void UIScene_BeaconMenu::SetPowerButtonSelected(ESceneSection eSection) {
|
|||
case eSectionBeaconSecondaryTwo:
|
||||
return m_buttonsPowers[eControl_Secondary2].SetButtonSelected(true);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -730,6 +730,8 @@ void UIScene_CraftingMenu::HandleMessage(EUIMessage message, void* data) {
|
|||
case eUIMessage_InventoryUpdated:
|
||||
handleInventoryUpdated(data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -163,11 +163,11 @@ UIScene_HowToPlay::UIScene_HowToPlay(int iPad, void* initData,
|
|||
|
||||
// Extract pad and required page from init data. We just put the data into
|
||||
// the pointer rather than using it as an address.
|
||||
size_t uiInitData = (size_t)(initData);
|
||||
uintptr_t uiInitData = reinterpret_cast<uintptr_t>(initData);
|
||||
|
||||
EHowToPlayPage eStartPage =
|
||||
(EHowToPlayPage)((uiInitData >> 16) &
|
||||
0xFFF); // Ignores MSB which is set to 1!
|
||||
0xFFFu); // Ignores MSB which is set to 1!
|
||||
|
||||
TelemetryManager->RecordMenuShown(
|
||||
m_iPad, eUIScene_HowToPlay, (ETelemetry_HowToPlay_SubMenuId)eStartPage);
|
||||
|
|
@ -342,7 +342,8 @@ void UIScene_HowToPlay::StartPage(EHowToPlayPage ePage) {
|
|||
value[0].number = gs_pageToFlashMapping[(int)ePage];
|
||||
|
||||
for (unsigned int i = 0; i < paragraphs.size(); ++i) {
|
||||
const std::u16string convParagraph = wstring_to_u16string(paragraphs[i]);
|
||||
const std::u16string convParagraph =
|
||||
wstring_to_u16string(paragraphs[i]);
|
||||
|
||||
stringVal[i].string = convParagraph.c_str();
|
||||
stringVal[i].length = convParagraph.length();
|
||||
|
|
|
|||
|
|
@ -129,9 +129,7 @@ void UIScene_HowToPlayMenu::handleReload() {
|
|||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
m_buttonListHowTo.addItem(app.GetString(m_uiHTPButtonNameA[i]), i);
|
||||
}
|
||||
{ m_buttonListHowTo.addItem(app.GetString(m_uiHTPButtonNameA[i]), i); }
|
||||
}
|
||||
|
||||
doHorizontalResizeCheck();
|
||||
|
|
@ -174,6 +172,8 @@ void UIScene_HowToPlayMenu::handlePress(F64 controlId, F64 childId) {
|
|||
unsigned int uiInitData;
|
||||
uiInitData =
|
||||
((1 << 31) | (m_uiHTPSceneA[(int)childId] << 16) | (short)(m_iPad));
|
||||
ui.NavigateToScene(m_iPad, eUIScene_HowToPlay, (void*)(uiInitData));
|
||||
ui.NavigateToScene(
|
||||
m_iPad, eUIScene_HowToPlay,
|
||||
reinterpret_cast<void*>(static_cast<uintptr_t>(uiInitData)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -383,29 +383,22 @@ void UIScene_JoinMenu::StartSharedLaunchFlow() {
|
|||
|
||||
int UIScene_JoinMenu::StartGame_SignInReturned(void* pParam, bool bContinue,
|
||||
int iPad) {
|
||||
UIScene_JoinMenu* pClass = (UIScene_JoinMenu*)pParam;
|
||||
|
||||
if (bContinue == true) {
|
||||
// It's possible that the player has not signed in - they can back out
|
||||
UIScene_JoinMenu* pClass =
|
||||
(UIScene_JoinMenu*)ui.GetSceneFromCallbackId((size_t)pParam);
|
||||
|
||||
if (pClass) {
|
||||
if (bContinue == true) {
|
||||
// It's possible that the player has not signed in - they can
|
||||
// back out
|
||||
if (ProfileManager.IsSignedIn(iPad)) {
|
||||
JoinGame(pClass);
|
||||
} else {
|
||||
pClass->m_bIgnoreInput = false;
|
||||
}
|
||||
} else {
|
||||
pClass->m_bIgnoreInput = false;
|
||||
}
|
||||
pClass->m_bIgnoreInput = false;
|
||||
}
|
||||
return 0;
|
||||
UIScene_JoinMenu* pClass = (UIScene_JoinMenu*)ui.GetSceneFromCallbackId(
|
||||
reinterpret_cast<size_t>(pParam));
|
||||
if (pClass == NULL) {
|
||||
pClass = (UIScene_JoinMenu*)pParam;
|
||||
}
|
||||
|
||||
if (bContinue == true && pClass != NULL &&
|
||||
ProfileManager.IsSignedIn(iPad)) {
|
||||
JoinGame(pClass);
|
||||
}
|
||||
|
||||
if (pClass != NULL) {
|
||||
pClass->m_bIgnoreInput = false;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Shared function to join the game that is the same whether we used the
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ const int UIScene_LeaderboardsMenu::TitleIcons
|
|||
[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][7] = {
|
||||
{UIControl_LeaderboardList::e_ICON_TYPE_WALKED,
|
||||
UIControl_LeaderboardList::e_ICON_TYPE_FALLEN, Item::minecart_Id,
|
||||
Item::boat_Id, NULL},
|
||||
Item::boat_Id, 0},
|
||||
{Tile::dirt_Id, Tile::cobblestone_Id, Tile::sand_Id, Tile::stone_Id,
|
||||
Tile::gravel_Id, Tile::clay_Id, Tile::obsidian_Id},
|
||||
{Item::egg_Id, Item::wheat_Id, Tile::mushroom_brown_Id, Tile::reeds_Id,
|
||||
Item::bucket_milk_Id, Tile::pumpkin_Id, NULL},
|
||||
Item::bucket_milk_Id, Tile::pumpkin_Id, 0},
|
||||
{UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIE,
|
||||
UIControl_LeaderboardList::e_ICON_TYPE_SKELETON,
|
||||
UIControl_LeaderboardList::e_ICON_TYPE_CREEPER,
|
||||
|
|
|
|||
|
|
@ -256,8 +256,9 @@ void UIScene_TradingMenu::setTradeRedBox(int index, bool show) {
|
|||
m_slotListTrades.showSlotRedBox(index, show);
|
||||
}
|
||||
|
||||
void UIScene_TradingMenu::setOfferDescription(std::vector<HtmlString>* description) {
|
||||
std::wstring descriptionStr = HtmlString::Compose(description);
|
||||
void UIScene_TradingMenu::setOfferDescription(
|
||||
std::vector<HtmlString>* description) {
|
||||
std::wstring descriptionStr = HtmlString::Compose(description);
|
||||
const std::u16string conv = wstring_to_u16string(descriptionStr);
|
||||
|
||||
IggyDataValue result;
|
||||
|
|
@ -279,9 +280,11 @@ void UIScene_TradingMenu::HandleMessage(EUIMessage message, void* data) {
|
|||
case eUIMessage_InventoryUpdated:
|
||||
handleInventoryUpdated(data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
void UIScene_TradingMenu::handleInventoryUpdated(LPVOID data) {
|
||||
HandleInventoryUpdated();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,6 +351,8 @@ void MultiplayerLocalPlayer::ride(std::shared_ptr<Entity> e) {
|
|||
case eTYPE_PIG:
|
||||
eventType = eTelemetryInGame_Ride_Pig;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
TelemetryManager->RecordEnemyKilledOrOvercome(GetXboxPad(), 0, y, 0, 0,
|
||||
|
|
@ -480,4 +482,4 @@ void MultiplayerLocalPlayer::StressTestMove(double* tempX, double* tempY,
|
|||
absMoveTo(nx, ny, nz, yRot, xRot);
|
||||
stressTestCount++;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ ServerPlayer::ServerPlayer(MinecraftServer* server, Level* level,
|
|||
lastMoveX = lastMoveZ = 0;
|
||||
spewTimer = 0;
|
||||
lastRecordedHealthAndAbsorption = FLT_MIN;
|
||||
lastSentHealth = -99999999;
|
||||
lastSentHealth = -99999999.0f;
|
||||
lastSentFood = -99999999;
|
||||
lastFoodSaturationZero = true;
|
||||
lastSentExp = -99999999;
|
||||
lastSentExp = -99999999.0f;
|
||||
invulnerableTime = 20 * 3;
|
||||
containerCounter = 0;
|
||||
ignoreSlotUpdateHack = false;
|
||||
|
|
@ -656,19 +656,20 @@ bool ServerPlayer::hurt(DamageSource* dmgSource, float dmg) {
|
|||
// sometimes NULL.
|
||||
std::shared_ptr<Entity> source = dmgSource->getDirectEntity();
|
||||
|
||||
if (source->instanceof(eTYPE_PLAYER) &&
|
||||
!std::dynamic_pointer_cast<Player>(source)->canHarmPlayer(
|
||||
std::dynamic_pointer_cast<Player>(shared_from_this()))) {
|
||||
if (source->instanceof
|
||||
(eTYPE_PLAYER) &&
|
||||
!std::dynamic_pointer_cast<Player>(source)->canHarmPlayer(
|
||||
std::dynamic_pointer_cast<Player>(shared_from_this()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((source != NULL) && source->instanceof(eTYPE_ARROW)) {
|
||||
if ((source != NULL) && source->instanceof (eTYPE_ARROW)) {
|
||||
std::shared_ptr<Arrow> arrow =
|
||||
std::dynamic_pointer_cast<Arrow>(source);
|
||||
if ((arrow->owner != NULL) &&
|
||||
arrow->owner->instanceof(eTYPE_PLAYER) &&
|
||||
!canHarmPlayer(
|
||||
std::dynamic_pointer_cast<Player>(arrow->owner))) {
|
||||
if ((arrow->owner != NULL) && arrow->owner->instanceof
|
||||
(eTYPE_PLAYER) &&
|
||||
!canHarmPlayer(
|
||||
std::dynamic_pointer_cast<Player>(arrow->owner))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1353,7 +1354,7 @@ void ServerPlayer::disconnect() {
|
|||
}
|
||||
}
|
||||
|
||||
void ServerPlayer::resetSentInfo() { lastSentHealth = -99999999; }
|
||||
void ServerPlayer::resetSentInfo() { lastSentHealth = -99999999.0f; }
|
||||
|
||||
void ServerPlayer::displayClientMessage(int messageId) {
|
||||
ChatPacket::EChatPacketMessage messageType = ChatPacket::e_ChatCustom;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
class Chunk;
|
||||
class Mob;
|
||||
|
||||
class DirtyChunkSorter
|
||||
: public std::binary_function<const Chunk*, const Chunk*, bool> {
|
||||
class DirtyChunkSorter {
|
||||
private:
|
||||
std::shared_ptr<LivingEntity> cameraEntity;
|
||||
int playerIndex; // 4J added
|
||||
|
|
@ -12,4 +11,4 @@ public:
|
|||
DirtyChunkSorter(std::shared_ptr<LivingEntity> cameraEntity,
|
||||
int playerIndex); // 4J - added player index
|
||||
bool operator()(const Chunk* a, const Chunk* b) const;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,12 +2,11 @@
|
|||
class Entity;
|
||||
class Chunk;
|
||||
|
||||
class DistanceChunkSorter
|
||||
: public std::binary_function<const Chunk*, const Chunk*, bool> {
|
||||
class DistanceChunkSorter {
|
||||
private:
|
||||
double ix, iy, iz;
|
||||
|
||||
public:
|
||||
DistanceChunkSorter(std::shared_ptr<Entity> player);
|
||||
bool operator()(const Chunk* a, const Chunk* b) const;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -331,7 +331,11 @@ void GameRenderer::pick(float a) {
|
|||
}
|
||||
} else if (p != NULL) {
|
||||
double dd = from->distanceTo(p->pos);
|
||||
if (e == mc->cameraTargetPlayer->riding != NULL) {
|
||||
std::shared_ptr<Entity> ridingEntity =
|
||||
mc->cameraTargetPlayer->riding;
|
||||
// 4jcraft: compare the mounted entity explicitly so riding the hit
|
||||
// target does not get collapsed into a boolean/null comparison.
|
||||
if (ridingEntity != nullptr && e == ridingEntity) {
|
||||
if (nearest == 0) {
|
||||
hovered = e;
|
||||
}
|
||||
|
|
@ -347,7 +351,7 @@ void GameRenderer::pick(float a) {
|
|||
if (nearest < dist || (mc->hitResult == NULL)) {
|
||||
if (mc->hitResult != NULL) delete mc->hitResult;
|
||||
mc->hitResult = new HitResult(hovered);
|
||||
if (hovered->instanceof(eTYPE_LIVINGENTITY)) {
|
||||
if (hovered->instanceof (eTYPE_LIVINGENTITY)) {
|
||||
mc->crosshairPickMob =
|
||||
std::dynamic_pointer_cast<LivingEntity>(hovered);
|
||||
}
|
||||
|
|
@ -420,7 +424,7 @@ void GameRenderer::bobHurt(float a) {
|
|||
}
|
||||
|
||||
void GameRenderer::bobView(float a) {
|
||||
if (!mc->cameraTargetPlayer->instanceof(eTYPE_LIVINGENTITY)) return;
|
||||
if (!mc->cameraTargetPlayer->instanceof (eTYPE_LIVINGENTITY)) return;
|
||||
|
||||
std::shared_ptr<Player> player =
|
||||
std::dynamic_pointer_cast<Player>(mc->cameraTargetPlayer);
|
||||
|
|
@ -669,7 +673,8 @@ void GameRenderer::renderItemInHand(float a, int eye) {
|
|||
// 4J-JEV: I'm fairly confident this method would crash if the cameratarget
|
||||
// isnt a local player anyway, but oh well.
|
||||
std::shared_ptr<LocalPlayer> localplayer =
|
||||
mc->cameraTargetPlayer->instanceof(eTYPE_LOCALPLAYER)
|
||||
mc->cameraTargetPlayer->instanceof
|
||||
(eTYPE_LOCALPLAYER)
|
||||
? std::dynamic_pointer_cast<LocalPlayer>(mc->cameraTargetPlayer)
|
||||
: nullptr;
|
||||
|
||||
|
|
@ -1215,9 +1220,7 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
|||
|
||||
// if (mc->cameraTargetPlayer == NULL) // 4J - removed condition as we
|
||||
// want to update this is mc->player changes for different local players
|
||||
{
|
||||
mc->cameraTargetPlayer = mc->player;
|
||||
}
|
||||
{ mc->cameraTargetPlayer = mc->player; }
|
||||
pick(a);
|
||||
|
||||
std::shared_ptr<LivingEntity> cameraEntity = mc->cameraTargetPlayer;
|
||||
|
|
@ -1357,9 +1360,9 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
|||
turnOffLightLayer(a); // 4J - brought forward from 1.8.2
|
||||
|
||||
if ((mc->hitResult != NULL) &&
|
||||
cameraEntity->isUnderLiquid(Material::water) &&
|
||||
cameraEntity->instanceof(
|
||||
eTYPE_PLAYER)) //&& !mc->options.hideGui)
|
||||
cameraEntity->isUnderLiquid(Material::water) &&
|
||||
cameraEntity->instanceof
|
||||
(eTYPE_PLAYER)) //&& !mc->options.hideGui)
|
||||
{
|
||||
std::shared_ptr<Player> player =
|
||||
std::dynamic_pointer_cast<Player>(cameraEntity);
|
||||
|
|
@ -1435,8 +1438,8 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
|||
glEnable(GL_CULL_FACE);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
if ((zoom == 1) &&
|
||||
cameraEntity->instanceof(eTYPE_PLAYER)) //&& !mc->options.hideGui)
|
||||
if ((zoom == 1) && cameraEntity->instanceof
|
||||
(eTYPE_PLAYER)) //&& !mc->options.hideGui)
|
||||
{
|
||||
if (mc->hitResult != NULL &&
|
||||
!cameraEntity->isUnderLiquid(Material::water)) {
|
||||
|
|
@ -1975,7 +1978,7 @@ void GameRenderer::setupFog(int i, float alpha) {
|
|||
|
||||
// 4J - check for creative mode brought forward from 1.2.3
|
||||
bool creative = false;
|
||||
if (player->instanceof(eTYPE_PLAYER)) {
|
||||
if (player->instanceof (eTYPE_PLAYER)) {
|
||||
creative =
|
||||
(std::dynamic_pointer_cast<Player>(player))->abilities.instabuild;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -430,7 +430,7 @@ void LevelRenderer::allChanged(int playerIndex) {
|
|||
// called then (on 360 at least) we can get a deadlock when starting a game
|
||||
// in splitscreen.
|
||||
// EnterCriticalSection(&m_csDirtyChunks);
|
||||
if (level == NULL) {
|
||||
if (level[playerIndex] == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -506,7 +506,7 @@ void LevelRenderer::allChanged(int playerIndex) {
|
|||
}
|
||||
nonStackDirtyChunksAdded();
|
||||
|
||||
if (level != NULL) {
|
||||
if (level[playerIndex] != NULL) {
|
||||
std::shared_ptr<Entity> player = mc->cameraTargetPlayer;
|
||||
if (player != NULL) {
|
||||
this->resortChunks(Mth::floor(player->x), Mth::floor(player->y),
|
||||
|
|
@ -584,7 +584,7 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) {
|
|||
(entity->noCulling || culler->isVisible(entity->bb)));
|
||||
|
||||
// Render the mob if the mob's leash holder is within the culler
|
||||
if (!shouldRender && entity->instanceof(eTYPE_MOB)) {
|
||||
if (!shouldRender && entity->instanceof (eTYPE_MOB)) {
|
||||
std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>(entity);
|
||||
if (mob->isLeashed() && (mob->getLeashHolder() != NULL)) {
|
||||
std::shared_ptr<Entity> leashHolder = mob->getLeashHolder();
|
||||
|
|
@ -598,10 +598,10 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) {
|
|||
// !mc->options->thirdPersonView &&
|
||||
// !mc->cameraTargetPlayer->isSleeping()) continue;
|
||||
std::shared_ptr<LocalPlayer> localplayer =
|
||||
mc->cameraTargetPlayer->instanceof(eTYPE_LOCALPLAYER)
|
||||
? std::dynamic_pointer_cast<LocalPlayer>(
|
||||
mc->cameraTargetPlayer)
|
||||
: nullptr;
|
||||
mc->cameraTargetPlayer->instanceof
|
||||
(eTYPE_LOCALPLAYER) ? std::dynamic_pointer_cast<LocalPlayer>(
|
||||
mc->cameraTargetPlayer)
|
||||
: nullptr;
|
||||
|
||||
if (localplayer && entity == mc->cameraTargetPlayer &&
|
||||
!localplayer->ThirdPersonView() &&
|
||||
|
|
@ -766,8 +766,8 @@ int LevelRenderer::render(std::shared_ptr<LivingEntity> player, int layer,
|
|||
resortChunks(Mth::floor(player->x), Mth::floor(player->y),
|
||||
Mth::floor(player->z));
|
||||
// sort(sortedChunks[playerIndex]->begin(),sortedChunks[playerIndex]->end(),
|
||||
//DistanceChunkSorter(player)); // 4J - removed - not sorting our chunks
|
||||
//anymore
|
||||
// DistanceChunkSorter(player)); // 4J - removed - not sorting
|
||||
// our chunks anymore
|
||||
}
|
||||
Lighting::turnOff();
|
||||
glColor4f(1, 1, 1, 1);
|
||||
|
|
@ -2746,9 +2746,7 @@ void LevelRenderer::cull_SPU(int playerIndex, Culler* culler, float a) {
|
|||
m_jobPort_CullSPU->submitSync();
|
||||
// static int doSort = false;
|
||||
// if(doSort)
|
||||
{
|
||||
m_jobPort_CullSPU->submitJob(&sortJob);
|
||||
}
|
||||
{ m_jobPort_CullSPU->submitJob(&sortJob); }
|
||||
// doSort ^= 1;
|
||||
m_bSPUCullStarted[playerIndex] = true;
|
||||
}
|
||||
|
|
@ -3221,7 +3219,7 @@ std::shared_ptr<Particle> LevelRenderer::addParticleInternal(
|
|||
}
|
||||
|
||||
void LevelRenderer::entityAdded(std::shared_ptr<Entity> entity) {
|
||||
if (entity->instanceof(eTYPE_PLAYER)) {
|
||||
if (entity->instanceof (eTYPE_PLAYER)) {
|
||||
std::shared_ptr<Player> player =
|
||||
std::dynamic_pointer_cast<Player>(entity);
|
||||
player->prepareCustomTextures();
|
||||
|
|
@ -3239,7 +3237,7 @@ void LevelRenderer::entityAdded(std::shared_ptr<Entity> entity) {
|
|||
}
|
||||
|
||||
void LevelRenderer::entityRemoved(std::shared_ptr<Entity> entity) {
|
||||
if (entity->instanceof(eTYPE_PLAYER)) {
|
||||
if (entity->instanceof (eTYPE_PLAYER)) {
|
||||
std::shared_ptr<Player> player =
|
||||
std::dynamic_pointer_cast<Player>(entity);
|
||||
if (player->customTextureUrl != L"") {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ ModelPart* HumanoidModel::AddOrRetrievePart(SKIN_BOX* pBox) {
|
|||
ModelPart* pAttachTo = NULL;
|
||||
|
||||
switch (pBox->ePart) {
|
||||
case eBodyPart_Unknown:
|
||||
return nullptr;
|
||||
case eBodyPart_Head:
|
||||
pAttachTo = head;
|
||||
break;
|
||||
|
|
@ -243,7 +245,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot,
|
|||
leg1->yRot = 0.0f;
|
||||
|
||||
if (riding) {
|
||||
if (uiBitmaskOverrideAnim & (1 << eAnim_SmallModel) == 0) {
|
||||
if ((uiBitmaskOverrideAnim & (1 << eAnim_SmallModel)) == 0) {
|
||||
arm0->xRot += -HALF_PI * 0.4f;
|
||||
arm1->xRot += -HALF_PI * 0.4f;
|
||||
leg0->xRot = -HALF_PI * 0.8f;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "../../Platform/stdafx.h";
|
||||
#include "../../Platform/stdafx.h"
|
||||
#include "LeashKnotModel.h"
|
||||
#include "ModelPart.h"
|
||||
|
||||
|
|
@ -32,4 +32,4 @@ void LeashKnotModel::setupAnim(float time, float r, float bob, float yRot,
|
|||
|
||||
knot->yRot = yRot / (180 / PI);
|
||||
knot->xRot = xRot / (180 / PI);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -541,11 +541,11 @@ ResourceLocation* Textures::getTextureLocation(int iconType) {
|
|||
switch (iconType) {
|
||||
case Icon::TYPE_TERRAIN:
|
||||
return &TextureAtlas::LOCATION_BLOCKS;
|
||||
break;
|
||||
case Icon::TYPE_ITEM:
|
||||
return &TextureAtlas::LOCATION_ITEMS;
|
||||
break;
|
||||
}
|
||||
|
||||
return &TextureAtlas::LOCATION_ITEMS;
|
||||
}
|
||||
|
||||
void Textures::clearLastBoundId() { lastBoundId = -1; }
|
||||
|
|
@ -1425,16 +1425,16 @@ TEXTURE_NAME TUImages[] = {
|
|||
};
|
||||
|
||||
// This is for any TU textures that aren't part of our enum indexed preload set
|
||||
wchar_t* TUImagePaths[] = {L"font/Default", L"font/Mojangles_7",
|
||||
L"font/Mojangles_11",
|
||||
const wchar_t* const TUImagePaths[] = {
|
||||
L"font/Default", L"font/Mojangles_7", L"font/Mojangles_11",
|
||||
|
||||
// TU12
|
||||
L"armor/cloth_1.png", L"armor/cloth_1_b.png",
|
||||
L"armor/cloth_2.png", L"armor/cloth_2_b.png",
|
||||
// TU12
|
||||
L"armor/cloth_1.png", L"armor/cloth_1_b.png", L"armor/cloth_2.png",
|
||||
L"armor/cloth_2_b.png",
|
||||
|
||||
//
|
||||
//
|
||||
|
||||
NULL};
|
||||
nullptr};
|
||||
|
||||
bool Textures::IsTUImage(TEXTURE_NAME texId, const std::wstring& name) {
|
||||
int i = 0;
|
||||
|
|
@ -1464,9 +1464,9 @@ TEXTURE_NAME OriginalImages[] = {TN_MOB_CHAR, TN_MOB_CHAR1, TN_MOB_CHAR2,
|
|||
|
||||
TN_COUNT};
|
||||
|
||||
wchar_t* OriginalImagesPaths[] = {L"misc/watercolor.png",
|
||||
const wchar_t* const OriginalImagesPaths[] = {L"misc/watercolor.png",
|
||||
|
||||
NULL};
|
||||
nullptr};
|
||||
|
||||
bool Textures::IsOriginalImage(TEXTURE_NAME texId, const std::wstring& name) {
|
||||
int i = 0;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "../../Headers/net.minecraft.world.entity.monster.h"
|
||||
#include "../../Headers/net.minecraft.world.level.h"
|
||||
#include "../../Headers/net.minecraft.world.entity.ai.control.h"
|
||||
#include "../Navigation/Path.h"
|
||||
#include "../../Headers/net.minecraft.world.entity.ai.navigation.h"
|
||||
#include "../../Headers/net.minecraft.world.entity.ai.sensing.h"
|
||||
#include "../../Headers/net.minecraft.world.phys.h"
|
||||
|
|
@ -19,7 +20,7 @@ void MeleeAttackGoal::_init(PathfinderMob* mob, double speedModifier,
|
|||
Control::LookControlFlag);
|
||||
|
||||
attackTime = 0;
|
||||
path = NULL;
|
||||
path = nullptr;
|
||||
timeToRecalcPath = 0;
|
||||
}
|
||||
|
||||
|
|
@ -34,18 +35,16 @@ MeleeAttackGoal::MeleeAttackGoal(PathfinderMob* mob, double speedModifier,
|
|||
_init(mob, speedModifier, trackTarget);
|
||||
}
|
||||
|
||||
MeleeAttackGoal::~MeleeAttackGoal() {
|
||||
if (path != NULL) delete path;
|
||||
}
|
||||
MeleeAttackGoal::~MeleeAttackGoal() = default;
|
||||
|
||||
bool MeleeAttackGoal::canUse() {
|
||||
std::shared_ptr<LivingEntity> target = mob->getTarget();
|
||||
if (target == NULL) return false;
|
||||
if (!target->isAlive()) return false;
|
||||
if (attackType != NULL && !target->instanceof(attackType)) return false;
|
||||
delete path;
|
||||
path = mob->getNavigation()->createPath(target);
|
||||
return path != NULL;
|
||||
if (attackType != eTYPE_NOTSET && !target->instanceof (attackType))
|
||||
return false;
|
||||
path.reset(mob->getNavigation()->createPath(target));
|
||||
return path != nullptr;
|
||||
}
|
||||
|
||||
bool MeleeAttackGoal::canContinueToUse() {
|
||||
|
|
@ -60,8 +59,7 @@ bool MeleeAttackGoal::canContinueToUse() {
|
|||
}
|
||||
|
||||
void MeleeAttackGoal::start() {
|
||||
mob->getNavigation()->moveTo(path, speedModifier);
|
||||
path = NULL;
|
||||
mob->getNavigation()->moveTo(path.release(), speedModifier);
|
||||
timeToRecalcPath = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Goal.h"
|
||||
|
||||
class Level;
|
||||
|
|
@ -13,7 +15,7 @@ private:
|
|||
int attackTime;
|
||||
double speedModifier;
|
||||
bool trackTarget;
|
||||
Path* path;
|
||||
std::unique_ptr<Path> path;
|
||||
eINSTANCEOF attackType;
|
||||
int timeToRecalcPath;
|
||||
|
||||
|
|
@ -34,4 +36,4 @@ public:
|
|||
// 4J Added override to update ai elements when loading entity from
|
||||
// schematics
|
||||
virtual void setLevel(Level* level) { this->level = level; }
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -78,8 +78,10 @@ void PistonMovingPiece::spawnResources(Level* level, int x, int y, int z,
|
|||
|
||||
void PistonMovingPiece::neighborChanged(Level* level, int x, int y, int z,
|
||||
int type) {
|
||||
if (!level->isClientSide) {
|
||||
level->getTileEntity(x, y, z) == NULL;
|
||||
if (!level->isClientSide && level->getTileEntity(x, y, z) == nullptr) {
|
||||
// 4jcraft: remove orphaned moving piston blocks once their tile entity
|
||||
// has already vanished, matching the cleanup path used on interaction.
|
||||
level->removeTile(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ public:
|
|||
*/
|
||||
static DispenseItemBehavior* NOOP;
|
||||
|
||||
virtual ~DispenseItemBehavior() = default;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param source The source of this call (the dispenser that calls it)
|
||||
|
|
@ -26,4 +28,4 @@ class NoOpDispenseItemBehavior : public DispenseItemBehavior {
|
|||
public:
|
||||
std::shared_ptr<ItemInstance> dispense(
|
||||
BlockSource* source, std::shared_ptr<ItemInstance> dispensed);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
class Position {
|
||||
public:
|
||||
virtual ~Position() = default;
|
||||
virtual double getX() = 0;
|
||||
virtual double getY() = 0;
|
||||
virtual double getZ() = 0;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ public:
|
|||
static const EntitySelector* ENTITY_STILL_ALIVE;
|
||||
static const EntitySelector* CONTAINER_ENTITY_SELECTOR;
|
||||
|
||||
virtual ~EntitySelector() = default;
|
||||
virtual bool matches(std::shared_ptr<Entity> entity) const = 0;
|
||||
};
|
||||
|
||||
|
|
@ -25,4 +26,4 @@ private:
|
|||
public:
|
||||
MobCanWearArmourEntitySelector(std::shared_ptr<ItemInstance> item);
|
||||
bool matches(std::shared_ptr<Entity> entity) const;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ void Animal::aiStep() {
|
|||
|
||||
void Animal::checkHurtTarget(std::shared_ptr<Entity> target, float d) {
|
||||
// 4J-JEV: Changed from dynamic cast to use eINSTANCEOF
|
||||
if (target->instanceof(eTYPE_PLAYER)) {
|
||||
if (target->instanceof (eTYPE_PLAYER)) {
|
||||
if (d < 3) {
|
||||
double xd = target->x - x;
|
||||
double zd = target->z - z;
|
||||
|
|
@ -77,7 +77,7 @@ void Animal::checkHurtTarget(std::shared_ptr<Entity> target, float d) {
|
|||
|
||||
}
|
||||
// 4J-JEV: Changed from dynamic cast to use eINSTANCEOF
|
||||
else if (target->instanceof(eTYPE_ANIMAL)) {
|
||||
else if (target->instanceof (eTYPE_ANIMAL)) {
|
||||
std::shared_ptr<Animal> a = std::dynamic_pointer_cast<Animal>(target);
|
||||
if (getAge() > 0 && a->getAge() < 0) {
|
||||
if (d < 2.5) {
|
||||
|
|
@ -162,22 +162,22 @@ bool Animal::hurt(DamageSource* dmgSource, float dmg) {
|
|||
std::shared_ptr<Entity> source = dmgSource->getDirectEntity();
|
||||
|
||||
// 4J-JEV: Changed from dynamic cast to use eINSTANCEOF
|
||||
if (source->instanceof(eTYPE_PLAYER) &&
|
||||
!std::dynamic_pointer_cast<Player>(source)
|
||||
->isAllowedToAttackAnimals()) {
|
||||
if (source->instanceof
|
||||
(eTYPE_PLAYER) && !std::dynamic_pointer_cast<Player>(source)
|
||||
->isAllowedToAttackAnimals()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((source != NULL) && source->instanceof(eTYPE_ARROW)) {
|
||||
if ((source != NULL) && source->instanceof (eTYPE_ARROW)) {
|
||||
std::shared_ptr<Arrow> arrow =
|
||||
std::dynamic_pointer_cast<Arrow>(source);
|
||||
|
||||
// 4J: Check that the arrow's owner can attack animals (dispenser
|
||||
// arrows are not owned)
|
||||
if (arrow->owner != NULL &&
|
||||
arrow->owner->instanceof(eTYPE_PLAYER) &&
|
||||
!std::dynamic_pointer_cast<Player>(arrow->owner)
|
||||
->isAllowedToAttackAnimals()) {
|
||||
if (arrow->owner != NULL && arrow->owner->instanceof
|
||||
(eTYPE_PLAYER) &&
|
||||
!std::dynamic_pointer_cast<Player>(arrow->owner)
|
||||
->isAllowedToAttackAnimals()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -332,7 +332,7 @@ bool Animal::mobInteract(std::shared_ptr<Player> player) {
|
|||
|
||||
return false;
|
||||
}
|
||||
} else if (instanceof(eTYPE_MONSTER)) {
|
||||
} else if (instanceof (eTYPE_MONSTER)) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -371,8 +371,10 @@ bool Animal::isInLove() { return entityData->getInteger(DATA_IN_LOVE) > 0; }
|
|||
void Animal::resetLove() { entityData->set(DATA_IN_LOVE, 0); }
|
||||
|
||||
bool Animal::canMate(std::shared_ptr<Animal> partner) {
|
||||
if (partner == nullptr) return false;
|
||||
if (partner == shared_from_this()) return false;
|
||||
if (typeid(*partner) != typeid(*this)) return false;
|
||||
Animal* partnerAnimal = partner.get();
|
||||
if (typeid(*partnerAnimal) != typeid(*this)) return false;
|
||||
return isInLove() && partner->isInLove();
|
||||
}
|
||||
|
||||
|
|
@ -436,4 +438,4 @@ void Animal::setDespawnProtected() {
|
|||
m_maxWanderZ = zt;
|
||||
|
||||
m_isDespawnProtected = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ Minecart::Minecart(Level* level) : Entity(level) {
|
|||
// soundUpdater = level != NULL ? level->makeSoundUpdater(this) : NULL;
|
||||
}
|
||||
|
||||
Minecart::~Minecart() { delete soundUpdater; }
|
||||
Minecart::~Minecart() {}
|
||||
|
||||
std::shared_ptr<Minecart> Minecart::createMinecart(Level* level, double x,
|
||||
double y, double z,
|
||||
|
|
@ -129,9 +129,10 @@ bool Minecart::hurt(DamageSource* source, float hurtDamage) {
|
|||
if (dynamic_cast<EntityDamageSource*>(source) != NULL) {
|
||||
std::shared_ptr<Entity> attacker = source->getDirectEntity();
|
||||
|
||||
if (attacker->instanceof(eTYPE_PLAYER) &&
|
||||
!std::dynamic_pointer_cast<Player>(attacker)->isAllowedToHurtEntity(
|
||||
shared_from_this())) {
|
||||
if (attacker->instanceof
|
||||
(eTYPE_PLAYER) &&
|
||||
!std::dynamic_pointer_cast<Player>(attacker)
|
||||
->isAllowedToHurtEntity(shared_from_this())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -148,9 +149,9 @@ bool Minecart::hurt(DamageSource* source, float hurtDamage) {
|
|||
if (rider.lock() != NULL && rider.lock() == source->getEntity())
|
||||
hurtDamage += 1;
|
||||
|
||||
bool creativePlayer = source->getEntity() != NULL &&
|
||||
source->getEntity()->instanceof(eTYPE_PLAYER) &&
|
||||
std::dynamic_pointer_cast<Player>(source->getEntity())
|
||||
bool creativePlayer =
|
||||
source->getEntity() != NULL && source->getEntity()->instanceof
|
||||
(eTYPE_PLAYER) && std::dynamic_pointer_cast<Player>(source->getEntity())
|
||||
->abilities.instabuild;
|
||||
|
||||
if (creativePlayer || getDamage() > 20 * 2) {
|
||||
|
|
@ -309,8 +310,8 @@ void Minecart::tick() {
|
|||
AUTO_VAR(itEnd, entities->end());
|
||||
for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) {
|
||||
std::shared_ptr<Entity> e = (*it); // entities->at(i);
|
||||
if (e != rider.lock() && e->isPushable() &&
|
||||
e->instanceof(eTYPE_MINECART)) {
|
||||
if (e != rider.lock() && e->isPushable() && e->instanceof
|
||||
(eTYPE_MINECART)) {
|
||||
std::shared_ptr<Minecart> cart =
|
||||
std::dynamic_pointer_cast<Minecart>(e);
|
||||
cart->m_bHasPushedCartThisTick = false;
|
||||
|
|
@ -404,7 +405,7 @@ void Minecart::moveAlongTrack(int xt, int yt, int zt, double maxSpeed,
|
|||
xd = pow * xD / dd;
|
||||
zd = pow * zD / dd;
|
||||
|
||||
if (rider.lock() != NULL && rider.lock()->instanceof(eTYPE_LIVINGENTITY)) {
|
||||
if (rider.lock() != NULL && rider.lock()->instanceof (eTYPE_LIVINGENTITY)) {
|
||||
std::shared_ptr<LivingEntity> living =
|
||||
std::dynamic_pointer_cast<LivingEntity>(rider.lock());
|
||||
|
||||
|
|
@ -688,9 +689,10 @@ void Minecart::push(std::shared_ptr<Entity> e) {
|
|||
if (level->isClientSide) return;
|
||||
|
||||
if (e == rider.lock()) return;
|
||||
if (e->instanceof(eTYPE_LIVINGENTITY) && !e->instanceof(eTYPE_PLAYER) &&
|
||||
!e->instanceof(eTYPE_VILLAGERGOLEM) && (getType() == TYPE_RIDEABLE) &&
|
||||
(xd * xd + zd * zd > 0.01)) {
|
||||
if (e->instanceof (eTYPE_LIVINGENTITY) && !e->instanceof
|
||||
(eTYPE_PLAYER) && !e->instanceof
|
||||
(eTYPE_VILLAGERGOLEM) && (getType() == TYPE_RIDEABLE) &&
|
||||
(xd * xd + zd * zd > 0.01)) {
|
||||
if ((rider.lock() == NULL) && (e->riding == NULL)) {
|
||||
e->ride(shared_from_this());
|
||||
}
|
||||
|
|
@ -716,7 +718,7 @@ void Minecart::push(std::shared_ptr<Entity> e) {
|
|||
xa *= 0.5;
|
||||
za *= 0.5;
|
||||
|
||||
if (e->instanceof(eTYPE_MINECART)) {
|
||||
if (e->instanceof (eTYPE_MINECART)) {
|
||||
double xo = e->x - x;
|
||||
double zo = e->z - z;
|
||||
|
||||
|
|
@ -891,4 +893,4 @@ std::wstring Minecart::getAName() {
|
|||
|
||||
bool Minecart::hasCustomName() { return !name.empty(); }
|
||||
|
||||
std::wstring Minecart::getCustomName() { return name; }
|
||||
std::wstring Minecart::getCustomName() { return name; }
|
||||
|
|
|
|||
|
|
@ -17,6 +17,23 @@
|
|||
#include "../../../Minecraft.Client/Textures/Textures.h"
|
||||
#include "Villager.h"
|
||||
|
||||
namespace {
|
||||
struct VillagerShuffleRandom {
|
||||
using result_type = unsigned int;
|
||||
|
||||
explicit VillagerShuffleRandom(Random* random) : random(random) {}
|
||||
|
||||
static constexpr result_type min() { return 0; }
|
||||
static constexpr result_type max() { return 0xFFFFFFFFu; }
|
||||
|
||||
result_type operator()() {
|
||||
return static_cast<result_type>(random->nextInt());
|
||||
}
|
||||
|
||||
Random* random;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
std::unordered_map<int, std::pair<int, int> > Villager::MIN_MAX_VALUES;
|
||||
std::unordered_map<int, std::pair<int, int> > Villager::MIN_MAX_PRICES;
|
||||
|
||||
|
|
@ -217,7 +234,7 @@ void Villager::setLastHurtByMob(std::shared_ptr<LivingEntity> mob) {
|
|||
if (_village != NULL && mob != NULL) {
|
||||
_village->addAggressor(mob);
|
||||
|
||||
if (mob->instanceof(eTYPE_PLAYER)) {
|
||||
if (mob->instanceof (eTYPE_PLAYER)) {
|
||||
int amount = -1;
|
||||
if (isBaby()) {
|
||||
amount = -3;
|
||||
|
|
@ -237,11 +254,11 @@ void Villager::die(DamageSource* source) {
|
|||
if (_village != NULL) {
|
||||
std::shared_ptr<Entity> sourceEntity = source->getEntity();
|
||||
if (sourceEntity != NULL) {
|
||||
if (sourceEntity->instanceof(eTYPE_PLAYER)) {
|
||||
if (sourceEntity->instanceof (eTYPE_PLAYER)) {
|
||||
_village->modifyStanding(
|
||||
std::dynamic_pointer_cast<Player>(sourceEntity)->getName(),
|
||||
-2);
|
||||
} else if (sourceEntity->instanceof(eTYPE_ENEMY)) {
|
||||
} else if (sourceEntity->instanceof (eTYPE_ENEMY)) {
|
||||
_village->resetNoBreedTimer();
|
||||
}
|
||||
} else if (sourceEntity == NULL) {
|
||||
|
|
@ -508,7 +525,8 @@ void Villager::addOffers(int addCount) {
|
|||
}
|
||||
|
||||
// shuffle the list to make it more interesting
|
||||
std::random_shuffle(newOffers->begin(), newOffers->end());
|
||||
std::shuffle(newOffers->begin(), newOffers->end(),
|
||||
VillagerShuffleRandom(random));
|
||||
|
||||
if (offers == NULL) {
|
||||
offers = new MerchantRecipeList();
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ private:
|
|||
|
||||
public:
|
||||
BaseMobSpawner();
|
||||
~BaseMobSpawner();
|
||||
virtual ~BaseMobSpawner();
|
||||
|
||||
virtual std::wstring getEntityId();
|
||||
virtual void setEntityId(const std::wstring& entityId);
|
||||
|
|
@ -66,4 +66,4 @@ public:
|
|||
virtual int getX() = 0;
|
||||
virtual int getY() = 0;
|
||||
virtual int getZ() = 0;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -121,8 +121,6 @@ CustomLevelSource::~CustomLevelSource() {
|
|||
delete mineShaftFeature;
|
||||
delete canyonFeature;
|
||||
|
||||
this->level = level;
|
||||
|
||||
delete random;
|
||||
delete perlinNoise3;
|
||||
#endif
|
||||
|
|
@ -658,10 +656,10 @@ void CustomLevelSource::recreateLogicStructuresForChunk(int chunkX,
|
|||
int chunkZ) {
|
||||
if (generateStructures) {
|
||||
#ifdef _OVERRIDE_HEIGHTMAP
|
||||
mineShaftFeature->apply(this, level, chunkX, chunkZ, NULL);
|
||||
villageFeature->apply(this, level, chunkX, chunkZ, NULL);
|
||||
strongholdFeature->apply(this, level, chunkX, chunkZ, NULL);
|
||||
scatteredFeature->apply(this, level, chunkX, chunkZ, NULL);
|
||||
mineShaftFeature->apply(this, level, chunkX, chunkZ, byteArray());
|
||||
villageFeature->apply(this, level, chunkX, chunkZ, byteArray());
|
||||
strongholdFeature->apply(this, level, chunkX, chunkZ, byteArray());
|
||||
scatteredFeature->apply(this, level, chunkX, chunkZ, byteArray());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -499,8 +499,8 @@ void LevelChunk::recalcHeightmapOnly() {
|
|||
// value changed from -999 to 255
|
||||
|
||||
int y = Level::maxBuildHeight - 1;
|
||||
// int p = x << level->depthBitsPlusFour | z <<
|
||||
// level->depthBits; // 4J - removed
|
||||
// int p = x << level->depthBitsPlusFour | z <<
|
||||
// level->depthBits; // 4J - removed
|
||||
#ifdef __PSVITA__
|
||||
int Index = ((unsigned)x << 11) + ((unsigned)z << 7);
|
||||
int offset = Level::COMPRESSED_CHUNK_SECTION_TILES;
|
||||
|
|
@ -567,8 +567,8 @@ void LevelChunk::recalcHeightmap() {
|
|||
for (int x = 0; x < 16; x++)
|
||||
for (int z = 0; z < 16; z++) {
|
||||
int y = Level::maxBuildHeight - 1;
|
||||
// int p = x << level->depthBitsPlusFour | z <<
|
||||
// level->depthBits; // 4J - removed
|
||||
// int p = x << level->depthBitsPlusFour | z <<
|
||||
// level->depthBits; // 4J - removed
|
||||
|
||||
#ifdef __PSVITA__
|
||||
int Index = ((unsigned)x << 11) + ((unsigned)z << 7);
|
||||
|
|
@ -1747,22 +1747,23 @@ void LevelChunk::getEntitiesOfClass(const std::type_info& ec, AABB* bb,
|
|||
// our class may be derived from, otherwise do a direct comparison
|
||||
// of type_info
|
||||
if (ec == typeid(Player))
|
||||
isAssignableFrom = e->instanceof(eTYPE_PLAYER);
|
||||
isAssignableFrom = e->instanceof (eTYPE_PLAYER);
|
||||
else if (ec == typeid(Entity))
|
||||
isAssignableFrom = e->instanceof(eTYPE_ENTITY);
|
||||
isAssignableFrom = e->instanceof (eTYPE_ENTITY);
|
||||
else if (ec == typeid(Mob))
|
||||
isAssignableFrom = e->instanceof(eTYPE_MOB);
|
||||
isAssignableFrom = e->instanceof (eTYPE_MOB);
|
||||
else if (ec == typeid(LivingEntity))
|
||||
isAssignableFrom = e->instanceof(eTYPE_LIVINGENTITY);
|
||||
isAssignableFrom = e->instanceof (eTYPE_LIVINGENTITY);
|
||||
else if (ec == typeid(ItemEntity))
|
||||
isAssignableFrom = e->instanceof(eTYPE_ITEMENTITY);
|
||||
isAssignableFrom = e->instanceof (eTYPE_ITEMENTITY);
|
||||
else if (ec == typeid(Minecart))
|
||||
isAssignableFrom = e->instanceof(eTYPE_MINECART);
|
||||
isAssignableFrom = e->instanceof (eTYPE_MINECART);
|
||||
else if (ec == typeid(Monster))
|
||||
isAssignableFrom = e->instanceof(eTYPE_MONSTER);
|
||||
isAssignableFrom = e->instanceof (eTYPE_MONSTER);
|
||||
else if (ec == typeid(Zombie))
|
||||
isAssignableFrom = e->instanceof(eTYPE_ZOMBIE);
|
||||
else if (e != NULL && ec == typeid(*(e.get())))
|
||||
isAssignableFrom = e->instanceof (eTYPE_ZOMBIE);
|
||||
else if (Entity* entity = e.get();
|
||||
entity != NULL && ec == typeid(*entity))
|
||||
isAssignableFrom = true;
|
||||
if (isAssignableFrom && e->bb->intersects(bb)) {
|
||||
if (selector == NULL || selector->matches(e)) {
|
||||
|
|
|
|||
|
|
@ -73,8 +73,6 @@ RandomLevelSource::~RandomLevelSource() {
|
|||
delete scatteredFeature;
|
||||
delete canyonFeature;
|
||||
|
||||
this->level = level;
|
||||
|
||||
delete random;
|
||||
;
|
||||
delete lperlinNoise1;
|
||||
|
|
@ -906,9 +904,9 @@ TilePos* RandomLevelSource::findNearestMapFeature(
|
|||
void RandomLevelSource::recreateLogicStructuresForChunk(int chunkX,
|
||||
int chunkZ) {
|
||||
if (generateStructures) {
|
||||
mineShaftFeature->apply(this, level, chunkX, chunkZ, NULL);
|
||||
villageFeature->apply(this, level, chunkX, chunkZ, NULL);
|
||||
strongholdFeature->apply(this, level, chunkX, chunkZ, NULL);
|
||||
scatteredFeature->apply(this, level, chunkX, chunkZ, NULL);
|
||||
mineShaftFeature->apply(this, level, chunkX, chunkZ, byteArray());
|
||||
villageFeature->apply(this, level, chunkX, chunkZ, byteArray());
|
||||
strongholdFeature->apply(this, level, chunkX, chunkZ, byteArray());
|
||||
scatteredFeature->apply(this, level, chunkX, chunkZ, byteArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ void Connection::_init() {
|
|||
quitting = false;
|
||||
disconnected = false;
|
||||
disconnectReason = DisconnectPacket::eDisconnect_None;
|
||||
disconnectReasonObjects = NULL;
|
||||
noInputTicks = 0;
|
||||
estimatedRemaining = 0;
|
||||
fakeLag = 0;
|
||||
|
|
@ -375,29 +376,14 @@ e.printStackTrace();
|
|||
close("disconnect.genericReason", "Internal exception: " + e.toString());
|
||||
}*/
|
||||
|
||||
void Connection::close(DisconnectPacket::eDisconnectReason reason, ...) {
|
||||
void Connection::close(DisconnectPacket::eDisconnectReason reason) {
|
||||
// printf("Con:0x%x close\n",this);
|
||||
if (!running) return;
|
||||
// printf("Con:0x%x close doing something\n",this);
|
||||
disconnected = true;
|
||||
|
||||
va_list input;
|
||||
va_start(input, reason);
|
||||
|
||||
disconnectReason = reason; // va_arg( input, const wstring );
|
||||
|
||||
std::vector<void*> objs = std::vector<void*>();
|
||||
void* i = NULL;
|
||||
while (i != NULL) {
|
||||
i = va_arg(input, void*);
|
||||
objs.push_back(i);
|
||||
}
|
||||
|
||||
if (objs.size()) {
|
||||
disconnectReasonObjects = &objs[0];
|
||||
} else {
|
||||
disconnectReasonObjects = NULL;
|
||||
}
|
||||
disconnectReasonObjects = NULL;
|
||||
|
||||
// int count = 0, sum = 0, i = first;
|
||||
// va_list marker;
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ private:
|
|||
}*/
|
||||
|
||||
public:
|
||||
void close(DisconnectPacket::eDisconnectReason reason, ...);
|
||||
void close(DisconnectPacket::eDisconnectReason reason);
|
||||
|
||||
void tick();
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,8 @@ std::shared_ptr<ChatPacket> CombatTracker::getDeathMessagePacket() {
|
|||
|
||||
if (knockOffEntry->getSource()->equals(DamageSource::fall) ||
|
||||
knockOffEntry->getSource()->equals(DamageSource::outOfWorld)) {
|
||||
ChatPacket::EChatPacketMessage message;
|
||||
ChatPacket::EChatPacketMessage message =
|
||||
ChatPacket::e_ChatDeathFellAccidentGeneric;
|
||||
|
||||
switch (getFallLocation(knockOffEntry)) {
|
||||
case eLocation_GENERIC:
|
||||
|
|
@ -80,6 +81,8 @@ std::shared_ptr<ChatPacket> CombatTracker::getDeathMessagePacket() {
|
|||
case eLocation_WATER:
|
||||
message = ChatPacket::e_ChatDeathFellAccidentWater;
|
||||
break;
|
||||
case eLocation_COUNT:
|
||||
break;
|
||||
}
|
||||
|
||||
result = std::shared_ptr<ChatPacket>(
|
||||
|
|
@ -87,7 +90,8 @@ std::shared_ptr<ChatPacket> CombatTracker::getDeathMessagePacket() {
|
|||
} else if (attackerEntity != NULL &&
|
||||
(killingEntity == NULL || attackerEntity != killingEntity)) {
|
||||
std::shared_ptr<ItemInstance> attackerItem =
|
||||
attackerEntity->instanceof(eTYPE_LIVINGENTITY)
|
||||
attackerEntity->instanceof
|
||||
(eTYPE_LIVINGENTITY)
|
||||
? std::dynamic_pointer_cast<LivingEntity>(attackerEntity)
|
||||
->getCarriedItem()
|
||||
: nullptr;
|
||||
|
|
@ -105,8 +109,8 @@ std::shared_ptr<ChatPacket> CombatTracker::getDeathMessagePacket() {
|
|||
attackerEntity->getNetworkName()));
|
||||
}
|
||||
} else if (killingEntity != NULL) {
|
||||
std::shared_ptr<ItemInstance> killerItem =
|
||||
killingEntity->instanceof(eTYPE_LIVINGENTITY)
|
||||
std::shared_ptr<ItemInstance> killerItem = killingEntity->instanceof
|
||||
(eTYPE_LIVINGENTITY)
|
||||
? std::dynamic_pointer_cast<LivingEntity>(killingEntity)
|
||||
->getCarriedItem()
|
||||
: nullptr;
|
||||
|
|
@ -142,18 +146,20 @@ std::shared_ptr<LivingEntity> CombatTracker::getKiller() {
|
|||
for (AUTO_VAR(it, entries.begin()); it != entries.end(); ++it) {
|
||||
CombatEntry* entry = *it;
|
||||
if (entry->getSource() != NULL &&
|
||||
entry->getSource()->getEntity() != NULL &&
|
||||
entry->getSource()->getEntity()->instanceof(eTYPE_PLAYER) &&
|
||||
(bestPlayer == NULL || entry->getDamage() > bestPlayerDamage)) {
|
||||
entry->getSource()->getEntity() != NULL &&
|
||||
entry->getSource()->getEntity()->instanceof
|
||||
(eTYPE_PLAYER) &&
|
||||
(bestPlayer == NULL || entry->getDamage() > bestPlayerDamage)) {
|
||||
bestPlayerDamage = entry->getDamage();
|
||||
bestPlayer = std::dynamic_pointer_cast<Player>(
|
||||
entry->getSource()->getEntity());
|
||||
}
|
||||
|
||||
if (entry->getSource() != NULL &&
|
||||
entry->getSource()->getEntity() != NULL &&
|
||||
entry->getSource()->getEntity()->instanceof(eTYPE_LIVINGENTITY) &&
|
||||
(bestMob == NULL || entry->getDamage() > bestMobDamage)) {
|
||||
entry->getSource()->getEntity() != NULL &&
|
||||
entry->getSource()->getEntity()->instanceof
|
||||
(eTYPE_LIVINGENTITY) &&
|
||||
(bestMob == NULL || entry->getDamage() > bestMobDamage)) {
|
||||
bestMobDamage = entry->getDamage();
|
||||
bestMob = std::dynamic_pointer_cast<LivingEntity>(
|
||||
entry->getSource()->getEntity());
|
||||
|
|
@ -233,4 +239,4 @@ void CombatTracker::recheckStatus() {
|
|||
takingDamage = false;
|
||||
inCombat = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,8 +55,10 @@ std::wstring u16string_to_wstring(const std::u16string& converting) {
|
|||
std::wstring result(
|
||||
simdutf::utf32_length_from_utf16(converting.data(), converting.size()),
|
||||
L'\0');
|
||||
simdutf::convert_utf16_to_utf32(converting.data(), converting.size(),
|
||||
reinterpret_cast<char32_t*>(result.data()));
|
||||
std::size_t convertedLength = simdutf::convert_utf16_to_utf32(
|
||||
converting.data(), converting.size(),
|
||||
reinterpret_cast<char32_t*>(result.data()));
|
||||
result.resize(convertedLength);
|
||||
|
||||
return result;
|
||||
#endif
|
||||
|
|
@ -77,7 +79,9 @@ std::u16string wstring_to_u16string(const std::wstring& converting) {
|
|||
|
||||
std::u16string result(simdutf::utf16_length_from_utf32(data32, len32),
|
||||
u'\0');
|
||||
simdutf::convert_utf32_to_utf16(data32, len32, result.data());
|
||||
std::size_t convertedLength =
|
||||
simdutf::convert_utf32_to_utf16(data32, len32, result.data());
|
||||
result.resize(convertedLength);
|
||||
|
||||
return result;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -561,5 +561,5 @@ TilePos* HellRandomLevelSource::findNearestMapFeature(
|
|||
|
||||
void HellRandomLevelSource::recreateLogicStructuresForChunk(int chunkX,
|
||||
int chunkZ) {
|
||||
netherBridgeFeature->apply(this, level, chunkX, chunkZ, NULL);
|
||||
}
|
||||
netherBridgeFeature->apply(this, level, chunkX, chunkZ, byteArray());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ private:
|
|||
public:
|
||||
StructureStart();
|
||||
StructureStart(int x, int z);
|
||||
~StructureStart();
|
||||
virtual ~StructureStart();
|
||||
BoundingBox* getBoundingBox();
|
||||
std::list<StructurePiece*>* getPieces();
|
||||
void postProcess(Level* level, Random* random, BoundingBox* chunkBB);
|
||||
|
|
|
|||
Loading…
Reference in a new issue