From 41d166afed9eaf326f8174b08e33c5d6f491fa2c Mon Sep 17 00:00:00 2001 From: str1k3r <115313679+S1l3ntStr1ke87@users.noreply.github.com> Date: Sat, 26 Sep 2026 17:17:51 -0400 Subject: [PATCH] feat: remove experience --- Minecraft.Client/ClientConnection.cpp | 34 +- Minecraft.Client/ClientConnection.h | 2 - .../Common/UI/IUIScene_CreativeMenu.cpp | 1 - .../Common/UI/UIControl_EnchantmentButton.cpp | 51 --- Minecraft.Client/Common/UI/UIScene_HUD.cpp | 23 -- .../Common/UI/UIScene_HelpAndOptionsMenu.cpp | 43 ++- .../Common/UI/UIScene_HelpAndOptionsMenu.h | 26 +- .../Common/XUI/XUI_Ctrl_EnchantButton.cpp | 16 - .../XUI/XUI_Ctrl_EnchantmentButtonText.cpp | 30 -- Minecraft.Client/Common/XUI/XUI_HUD.cpp | 30 -- Minecraft.Client/Common/XUI/XUI_HUD.h | 4 - Minecraft.Client/EntityRenderDispatcher.cpp | 3 - Minecraft.Client/EntityTracker.cpp | 2 - Minecraft.Client/ExperienceOrbRenderer.cpp | 91 ----- Minecraft.Client/ExperienceOrbRenderer.h | 17 - Minecraft.Client/GameMode.h | 1 - Minecraft.Client/Gui.cpp | 80 ----- Minecraft.Client/LocalPlayer.cpp | 7 - Minecraft.Client/LocalPlayer.h | 2 - Minecraft.Client/Minecraft.Client.vcxproj | 2 - .../Minecraft.Client.vcxproj.filters | 6 - Minecraft.Client/Minecraft.cpp | 4 - Minecraft.Client/MultiPlayerGameMode.cpp | 5 - Minecraft.Client/MultiPlayerGameMode.h | 1 - Minecraft.Client/PreStitchedTextureMap.cpp | 1 - Minecraft.Client/ServerCommandDispatcher.cpp | 1 - Minecraft.Client/ServerLevel.cpp | 32 -- Minecraft.Client/ServerLevel.h | 2 - Minecraft.Client/ServerPlayer.cpp | 17 - Minecraft.Client/ServerPlayer.h | 1 - Minecraft.Client/SurvivalMode.h | 1 - Minecraft.Client/Textures.cpp | 1 - Minecraft.Client/Textures.h | 1 - Minecraft.Client/TrackedEntity.cpp | 10 - Minecraft.World/AddEntityPacket.h | 1 - Minecraft.World/AddExperienceOrbPacket.cpp | 51 --- Minecraft.World/AddExperienceOrbPacket.h | 24 -- Minecraft.World/Animal.cpp | 7 - Minecraft.World/Animal.h | 1 - Minecraft.World/BreedGoal.cpp | 3 - Minecraft.World/Class.h | 2 - Minecraft.World/CommandsEnum.h | 1 - Minecraft.World/DispenserTile.cpp | 21 -- Minecraft.World/EnchantmentMenu.cpp | 3 +- Minecraft.World/EnderDragon.cpp | 17 - Minecraft.World/EntityIO.cpp | 2 - Minecraft.World/ExperienceCommand.cpp | 41 --- Minecraft.World/ExperienceCommand.h | 15 - Minecraft.World/ExperienceItem.cpp | 32 -- Minecraft.World/ExperienceItem.h | 15 - Minecraft.World/ExperienceOrb.cpp | 330 ------------------ Minecraft.World/ExperienceOrb.h | 2 +- Minecraft.World/FishingHook.cpp | 1 - Minecraft.World/FurnaceResultSlot.cpp | 7 - Minecraft.World/Item.cpp | 6 - Minecraft.World/Item.h | 4 - Minecraft.World/Minecraft.World.vcxproj | 12 - .../Minecraft.World.vcxproj.filters | 36 -- Minecraft.World/Mob.cpp | 25 -- Minecraft.World/Mob.h | 2 - Minecraft.World/MobSpawnerTile.cpp | 6 - Minecraft.World/OreTile.cpp | 27 -- Minecraft.World/Packet.cpp | 2 - Minecraft.World/PacketListener.cpp | 10 - Minecraft.World/PacketListener.h | 4 - Minecraft.World/Player.cpp | 78 ----- Minecraft.World/Player.h | 11 - Minecraft.World/RedStoneOreTile.cpp | 7 - Minecraft.World/RepairResultSlot.cpp | 3 +- Minecraft.World/SetExperiencePacket.cpp | 59 ---- Minecraft.World/SetExperiencePacket.h | 26 -- Minecraft.World/ThrownExpBottle.cpp | 55 --- Minecraft.World/ThrownExpBottle.h | 22 -- Minecraft.World/Tile.cpp | 14 - Minecraft.World/Tile.h | 1 - Minecraft.World/Villager.cpp | 2 - Minecraft.World/WaterAnimal.cpp | 5 - Minecraft.World/WaterAnimal.h | 1 - .../net.minecraft.commands.common.h | 1 - .../net.minecraft.network.packet.h | 2 - Minecraft.World/net.minecraft.world.entity.h | 1 - .../net.minecraft.world.entity.projectile.h | 1 - Minecraft.World/net.minecraft.world.item.h | 1 - 83 files changed, 47 insertions(+), 1501 deletions(-) delete mode 100644 Minecraft.Client/ExperienceOrbRenderer.cpp delete mode 100644 Minecraft.Client/ExperienceOrbRenderer.h delete mode 100644 Minecraft.World/AddExperienceOrbPacket.cpp delete mode 100644 Minecraft.World/AddExperienceOrbPacket.h delete mode 100644 Minecraft.World/ExperienceCommand.cpp delete mode 100644 Minecraft.World/ExperienceCommand.h delete mode 100644 Minecraft.World/ExperienceItem.cpp delete mode 100644 Minecraft.World/ExperienceItem.h delete mode 100644 Minecraft.World/ExperienceOrb.cpp delete mode 100644 Minecraft.World/SetExperiencePacket.cpp delete mode 100644 Minecraft.World/SetExperiencePacket.h delete mode 100644 Minecraft.World/ThrownExpBottle.cpp delete mode 100644 Minecraft.World/ThrownExpBottle.h diff --git a/Minecraft.Client/ClientConnection.cpp b/Minecraft.Client/ClientConnection.cpp index b80eaed9..6d200516 100644 --- a/Minecraft.Client/ClientConnection.cpp +++ b/Minecraft.Client/ClientConnection.cpp @@ -499,10 +499,6 @@ void ClientConnection::handleAddEntity(shared_ptr packet) e = shared_ptr( new ThrownPotion(level, x, y, z, packet->data) ); packet->data = 0; break; - case AddEntityPacket::THROWN_EXPBOTTLE: - e = shared_ptr( new ThrownExpBottle(level, x, y, z) ); - packet->data = 0; - break; case AddEntityPacket::BOAT: e = shared_ptr( new Boat(level, x, y, z) ); break; @@ -665,18 +661,6 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } -void ClientConnection::handleAddExperienceOrb(shared_ptr packet) -{ - shared_ptr e = shared_ptr( new ExperienceOrb(level, packet->x / 32.0, packet->y / 32.0, packet->z / 32.0, packet->value) ); - e->xp = packet->x; - e->yp = packet->y; - e->zp = packet->z; - e->yRot = 0; - e->xRot = 0; - e->entityId = packet->id; - level->putEntity(packet->id, e); -} - void ClientConnection::handleAddGlobalEntity(shared_ptr packet) { double x = packet->x / 32.0; @@ -1234,18 +1218,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac if( minecraft->localgameModes[playerPad] != NULL ) { - // 4J-PB - add in the XP orb sound - if(from->GetType() == eTYPE_EXPERIENCEORB) - { - float fPitch=((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f; - app.DebugPrintf("XP Orb with pitch %f\n",fPitch); - level->playSound(from, eSoundType_RANDOM_ORB, 0.2f, fPitch); - } - else - { - level->playSound(from, eSoundType_RANDOM_POP, 0.2f, ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f); - } - + level->playSound(from, eSoundType_RANDOM_POP, 0.2f, ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f); minecraft->particleEngine->add( shared_ptr( new TakeAnimationParticle(minecraft->level, from, to, -0.5f) ) ); level->removeEntity(packet->itemId); } @@ -2212,11 +2185,6 @@ void ClientConnection::handleSetHealth(shared_ptr packet) } } -void ClientConnection::handleSetExperience(shared_ptr packet) -{ - minecraft->localplayers[m_userIndex]->setExperienceValues(packet->experienceProgress, packet->totalExperience, packet->experienceLevel); -} - void ClientConnection::handleTexture(shared_ptr packet) { // Both PlayerConnection and ClientConnection should handle this mostly the same way diff --git a/Minecraft.Client/ClientConnection.h b/Minecraft.Client/ClientConnection.h index 2ce46ce0..b6051570 100644 --- a/Minecraft.Client/ClientConnection.h +++ b/Minecraft.Client/ClientConnection.h @@ -51,7 +51,6 @@ public: INetworkPlayer *getNetworkPlayer(); virtual void handleLogin(shared_ptr packet); virtual void handleAddEntity(shared_ptr packet); - virtual void handleAddExperienceOrb(shared_ptr packet); virtual void handleAddGlobalEntity(shared_ptr packet); virtual void handleAddPainting(shared_ptr packet); virtual void handleSetEntityMotion(shared_ptr packet); @@ -93,7 +92,6 @@ private: wstring GetDisplayNameByGamertag(wstring gamertag); public: virtual void handleSetHealth(shared_ptr packet); - virtual void handleSetExperience(shared_ptr packet); virtual void handleRespawn(shared_ptr packet); virtual void handleExplosion(shared_ptr packet); virtual void handleContainerOpen(shared_ptr packet); diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp index 7ce33234..854b1ce3 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp @@ -423,7 +423,6 @@ void IUIScene_CreativeMenu::staticCtor() // Brewing (TODO) DEF(eCreativeInventory_Brewing) - ITEM(Item::expBottle_Id) // 4J Stu - Anything else added here also needs to be added to the key handler below ITEM(Item::ghastTear_Id) diff --git a/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp b/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp index e1490e0b..eeef53af 100644 --- a/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp +++ b/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp @@ -84,40 +84,6 @@ void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region) //} glColor4f(1, 1, 1, 1); - if (cost != 0) - { - glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_GREATER, 0.1f); - Minecraft *pMinecraft = Minecraft::GetInstance(); - wstring line = _toString(cost); - Font *font = pMinecraft->altFont; - //int col = 0x685E4A; - unsigned int col = m_textColour; - if (pMinecraft->localplayers[enchantingScene->getPad()]->experienceLevel < cost && !pMinecraft->localplayers[enchantingScene->getPad()]->abilities.instabuild) - { - col = m_textDisabledColour; - font->drawWordWrap(m_enchantmentString, 0, 0, (float)m_width/ss, col, (float)m_height/ss); - font = pMinecraft->font; - //col = (0x80ff20 & 0xfefefe) >> 1; - //font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col); - } - else - { - if (m_bHasFocus) - { - //col = 0xffff80; - col = m_textFocusColour; - } - font->drawWordWrap(m_enchantmentString, 0, 0, (float)m_width/ss, col, (float)m_height/ss); - font = pMinecraft->font; - //col = 0x80ff20; - //font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col); - } - glDisable(GL_ALPHA_TEST); - } - else - { - } //Lighting::turnOff(); glDisable(GL_RESCALE_NORMAL); @@ -133,23 +99,6 @@ void UIControl_EnchantmentButton::updateState() int cost = menu->costs[m_index]; Minecraft *pMinecraft = Minecraft::GetInstance(); - if(cost > pMinecraft->localplayers[enchantingScene->getPad()]->experienceLevel && !pMinecraft->localplayers[enchantingScene->getPad()]->abilities.instabuild) - { - // Dark background - state = eState_Inactive; - } - else - { - // Light background and focus background - if(m_bHasFocus) - { - state = eState_Selected; - } - else - { - state = eState_Active; - } - } if(cost != m_lastCost) { diff --git a/Minecraft.Client/Common/UI/UIScene_HUD.cpp b/Minecraft.Client/Common/UI/UIScene_HUD.cpp index 27eeb76b..ad97d7f7 100644 --- a/Minecraft.Client/Common/UI/UIScene_HUD.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HUD.cpp @@ -851,29 +851,6 @@ void UIScene_HUD::handleGameTick() #endif SetActiveSlot(pMinecraft->localplayers[m_iPad]->inventory->selected); - // Update xp progress - if (pMinecraft->localgameModes[m_iPad]->canHurtPlayer()) - { - ShowExpBar(true); - int xpNeededForNextLevel = pMinecraft->localplayers[m_iPad]->getXpNeededForNextLevel(); - int progress = (int)(pMinecraft->localplayers[m_iPad]->experienceProgress *xpNeededForNextLevel); - SetExpBarProgress((float)progress/xpNeededForNextLevel); - } - else - { - ShowExpBar(false); - } - - // Update xp level - if (pMinecraft->localgameModes[m_iPad]->hasExperience() && pMinecraft->localplayers[m_iPad]->experienceLevel > 0) - { - SetExpLevel(pMinecraft->localplayers[m_iPad]->experienceLevel); - } - else - { - SetExpLevel(0); - } - if (pMinecraft->localgameModes[m_iPad]->canHurtPlayer()) { ShowHealth(true); diff --git a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp index 3fe03325..7bc63b04 100644 --- a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp @@ -10,12 +10,12 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void *initData, m_bNotInGame=(Minecraft::GetInstance()->level==NULL); - m_buttons[BUTTON_HAO_CHANGESKIN].init(app.GetString(IDS_CHANGE_SKIN),BUTTON_HAO_CHANGESKIN); m_buttons[BUTTON_HAO_HOWTOPLAY].init(app.GetString(IDS_HOW_TO_PLAY),BUTTON_HAO_HOWTOPLAY); m_buttons[BUTTON_HAO_CONTROLS].init(app.GetString(IDS_CONTROLS),BUTTON_HAO_CONTROLS); m_buttons[BUTTON_HAO_SETTINGS].init(app.GetString(IDS_SETTINGS),BUTTON_HAO_SETTINGS); m_buttons[BUTTON_HAO_CREDITS].init(app.GetString(IDS_CREDITS),BUTTON_HAO_CREDITS); //m_buttons[BUTTON_HAO_REINSTALL].init(app.GetString(IDS_REINSTALL_CONTENT),BUTTON_HAO_REINSTALL); + m_buttons[BUTTON_HAO_RESETTODEFAULTS].init(app.GetString(IDS_RESET_TO_DEFAULTS),BUTTON_HAO_RESETTODEFAULTS); m_buttons[BUTTON_HAO_DEBUG].init(app.GetString(IDS_DEBUG_SETTINGS),BUTTON_HAO_DEBUG); /* 4J-TomK - we should never remove a control before the other buttons controls are initialised! @@ -70,11 +70,6 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void *initData, } } - if(!ProfileManager.IsFullVersion() )//|| ProfileManager.IsGuest(m_iPad)) - { - removeControl( &m_buttons[BUTTON_HAO_CHANGESKIN], false); - } - //StorageManager.TMSPP_GetUserQuotaInfo(C4JStorage::eGlobalStorage_TitleUser,iPad); //StorageManager.WebServiceRequestGetFriends(iPad); } @@ -165,11 +160,6 @@ void UIScene_HelpAndOptionsMenu::handleReload() #endif } - if(!ProfileManager.IsFullVersion() )//|| ProfileManager.IsGuest(m_iPad)) - { - removeControl( &m_buttons[BUTTON_HAO_CHANGESKIN], false); - } - doHorizontalResizeCheck(); } @@ -208,9 +198,6 @@ void UIScene_HelpAndOptionsMenu::handlePress(F64 controlId, F64 childId) { switch((int)controlId) { - case BUTTON_HAO_CHANGESKIN: - ui.NavigateToScene(m_iPad, eUIScene_SkinSelectMenu); - break; case BUTTON_HAO_HOWTOPLAY: ui.NavigateToScene(m_iPad, eUIScene_HowToPlayMenu); break; @@ -223,6 +210,15 @@ void UIScene_HelpAndOptionsMenu::handlePress(F64 controlId, F64 childId) case BUTTON_HAO_CREDITS: ui.NavigateToScene(m_iPad, eUIScene_Credits); break; + case BUTTON_HAO_RESETTODEFAULTS: + { + UINT uiIDA[2]; + uiIDA[0]=IDS_CONFIRM_CANCEL; + uiIDA[1]=IDS_CONFIRM_OK; + + ui.RequestMessageBox(IDS_DEFAULTS_TITLE, IDS_DEFAULTS_TEXT, uiIDA, 2, m_iPad,&UIScene_HelpAndOptionsMenu::ResetDefaultsDialogReturned,this, app.GetStringTable(), NULL, 0, false); + } + break; case BUTTON_HAO_REINSTALL: ui.NavigateToScene(m_iPad, eUIScene_ReinstallMenu); break; @@ -231,3 +227,22 @@ void UIScene_HelpAndOptionsMenu::handlePress(F64 controlId, F64 childId) break; } } + +int UIScene_HelpAndOptionsMenu::ResetDefaultsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) +{ + UIScene_HelpAndOptionsMenu* pClass = (UIScene_HelpAndOptionsMenu*)pParam; + + // results switched for this dialog + if(result==C4JStorage::EMessage_ResultDecline) + { +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) + app.SetDefaultOptions(StorageManager.GetDashboardProfileSettings(pClass->m_iPad),pClass->m_iPad); +#else + app.SetDefaultOptions(ProfileManager.GetDashboardProfileSettings(pClass->m_iPad),pClass->m_iPad); +#endif + // if the profile data has been changed, then force a profile write + // It seems we're allowed to break the 5 minute rule if it's the result of a user action + app.CheckGameSettingsChanged(true,iPad); + } + return 0; +} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.h b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.h index 203011d3..b69442ba 100644 --- a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.h @@ -2,12 +2,12 @@ #include "UIScene.h" -#define BUTTON_HAO_CHANGESKIN 0 -#define BUTTON_HAO_HOWTOPLAY 1 -#define BUTTON_HAO_CONTROLS 2 -#define BUTTON_HAO_SETTINGS 3 -#define BUTTON_HAO_CREDITS 4 -#define BUTTON_HAO_REINSTALL 5 +#define BUTTON_HAO_HOWTOPLAY 0 +#define BUTTON_HAO_CONTROLS 1 +#define BUTTON_HAO_SETTINGS 2 +#define BUTTON_HAO_CREDITS 3 +#define BUTTON_HAO_REINSTALL 4 +#define BUTTON_HAO_RESETTODEFAULTS 5 #define BUTTON_HAO_DEBUG 6 #define BUTTONS_HAO_MAX BUTTON_HAO_DEBUG + 1 @@ -16,12 +16,12 @@ class UIScene_HelpAndOptionsMenu : public UIScene private: UIControl_Button m_buttons[BUTTONS_HAO_MAX]; UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) - UI_MAP_ELEMENT( m_buttons[BUTTON_HAO_CHANGESKIN], "Button1") - UI_MAP_ELEMENT( m_buttons[BUTTON_HAO_HOWTOPLAY], "Button2") - UI_MAP_ELEMENT( m_buttons[BUTTON_HAO_CONTROLS], "Button3") - UI_MAP_ELEMENT( m_buttons[BUTTON_HAO_SETTINGS], "Button4") - UI_MAP_ELEMENT( m_buttons[BUTTON_HAO_CREDITS], "Button5") - UI_MAP_ELEMENT( m_buttons[BUTTON_HAO_REINSTALL], "Button6") + UI_MAP_ELEMENT( m_buttons[BUTTON_HAO_HOWTOPLAY], "Button1") + UI_MAP_ELEMENT( m_buttons[BUTTON_HAO_CONTROLS], "Button2") + UI_MAP_ELEMENT( m_buttons[BUTTON_HAO_SETTINGS], "Button3") + UI_MAP_ELEMENT( m_buttons[BUTTON_HAO_CREDITS], "Button4") + UI_MAP_ELEMENT( m_buttons[BUTTON_HAO_REINSTALL], "Button5") + UI_MAP_ELEMENT( m_buttons[BUTTON_HAO_RESETTODEFAULTS], "Button6") UI_MAP_ELEMENT( m_buttons[BUTTON_HAO_DEBUG], "Button7") UI_END_MAP_ELEMENTS_AND_NAMES() @@ -47,4 +47,6 @@ public: protected: void handlePress(F64 controlId, F64 childId); + + static int ResetDefaultsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp index dfb9b5ca..e0a5bb0b 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp @@ -56,22 +56,6 @@ HRESULT CXuiCtrlEnchantmentButton::OnGetSourceDataText(XUIMessageGetSourceText * int cost = menu->costs[m_index]; - if(cost != m_lastCost) - { - Minecraft *pMinecraft = Minecraft::GetInstance(); - if(cost > pMinecraft->localplayers[m_iPad]->experienceLevel && !pMinecraft->localplayers[m_iPad]->abilities.instabuild) - { - // Dark background - SetEnable(FALSE); - } - else - { - // Light background and focus background - SetEnable(TRUE); - } - m_costString = _toString(cost); - m_lastCost = cost; - } if(cost == 0) { // Dark background diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp index 702ef15d..9c63c3b0 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp @@ -122,36 +122,6 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnRender(XUIMessageRender *pRenderData, B } glColor4f(1, 1, 1, 1); - if (cost != 0) - { - wstring line = _toString(cost); - Font *font = pMinecraft->altFont; - //int col = 0x685E4A; - unsigned int col = m_textColour; - if (pMinecraft->localplayers[m_parentControl->m_iPad]->experienceLevel < cost && !pMinecraft->localplayers[m_parentControl->m_iPad]->abilities.instabuild) - { - col = m_textDisabledColour; - font->drawWordWrap(m_enchantmentString, 0, 0, bwidth/ss, col, bheight/ss); - font = pMinecraft->font; - //col = (0x80ff20 & 0xfefefe) >> 1; - //font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col); - } - else - { - if (m_parentControl->HasFocus()) - { - //col = 0xffff80; - col = m_textFocusColour; - } - font->drawWordWrap(m_enchantmentString, 0, 0, bwidth/ss, col, bheight/ss); - font = pMinecraft->font; - //col = 0x80ff20; - //font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col); - } - } - else - { - } //Lighting::turnOff(); glDisable(GL_RESCALE_NORMAL); diff --git a/Minecraft.Client/Common/XUI/XUI_HUD.cpp b/Minecraft.Client/Common/XUI/XUI_HUD.cpp index 286f06a7..03a0efbc 100644 --- a/Minecraft.Client/Common/XUI/XUI_HUD.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HUD.cpp @@ -141,36 +141,6 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() m_hotbarIcon[j]->SetAlpha( m_hotbarIcon[j]->m_hObj, opacity ); } - // Update xp progress - if (pMinecraft->localgameModes[m_iPad]->canHurtPlayer()) - { - int xpNeededForNextLevel = pMinecraft->localplayers[m_iPad]->getXpNeededForNextLevel(); - int progress = (int)(pMinecraft->localplayers[m_iPad]->experienceProgress *xpNeededForNextLevel); - - m_ExperienceProgress.SetShow(TRUE); - m_ExperienceProgress.SetRange(0,xpNeededForNextLevel); - m_ExperienceProgress.SetValue(progress); - } - else - { - m_ExperienceProgress.SetShow(FALSE); - } - - // Update xp level - if (pMinecraft->localgameModes[m_iPad]->hasExperience() && pMinecraft->localplayers[m_iPad]->experienceLevel > 0) - { - m_xpLevel.SetShow(TRUE); - - wchar_t formatted[10]; - swprintf(formatted, 10, L"%d",pMinecraft->localplayers[m_iPad]->experienceLevel); - - m_xpLevel.SetText(formatted); - } - else - { - m_xpLevel.SetShow(FALSE); - } - if (pMinecraft->localgameModes[m_iPad]->canHurtPlayer()) { m_random.setSeed(m_tickCount * 312871); diff --git a/Minecraft.Client/Common/XUI/XUI_HUD.h b/Minecraft.Client/Common/XUI/XUI_HUD.h index 1bf6bcbf..f91f03a5 100644 --- a/Minecraft.Client/Common/XUI/XUI_HUD.h +++ b/Minecraft.Client/Common/XUI/XUI_HUD.h @@ -16,7 +16,6 @@ protected: CXuiControl m_hudScaleGroup; // Contains all the HUD elements except crosshair CXuiControl m_hotbarGroup; CXuiCtrlSlotItem *m_hotbarIcon[9]; - CXuiProgressBar m_ExperienceProgress; CXuiControl m_healthGroup; CXuiControl m_healthIcon[10]; CXuiControl m_armourGroup; @@ -25,7 +24,6 @@ protected: CXuiControl m_foodIcon[10]; CXuiControl m_airGroup; CXuiControl m_airIcon[10]; - CXuiControl m_xpLevel; D3DXVECTOR3 m_OriginalPosition; int m_iPad; @@ -58,7 +56,6 @@ protected: MAP_OVERRIDE(IDC_Inventory8, m_hotbarIcon[7]) MAP_OVERRIDE(IDC_Inventory9, m_hotbarIcon[8]) END_MAP_CHILD_CONTROLS() - MAP_CONTROL(IDC_ExperienceProgress, m_ExperienceProgress) MAP_CONTROL(IDC_Health, m_healthGroup) BEGIN_MAP_CHILD_CONTROLS(m_healthGroup) MAP_CONTROL(IDC_Health0, m_healthIcon[0]) @@ -111,7 +108,6 @@ protected: MAP_CONTROL(IDC_Air8, m_airIcon[8]) MAP_CONTROL(IDC_Air9, m_airIcon[9]) END_MAP_CHILD_CONTROLS() - MAP_CONTROL(IDC_XPLevel, m_xpLevel) END_MAP_CHILD_CONTROLS() END_MAP_CHILD_CONTROLS() END_MAP_CHILD_CONTROLS() diff --git a/Minecraft.Client/EntityRenderDispatcher.cpp b/Minecraft.Client/EntityRenderDispatcher.cpp index dfc9a11e..fc5a7d13 100644 --- a/Minecraft.Client/EntityRenderDispatcher.cpp +++ b/Minecraft.Client/EntityRenderDispatcher.cpp @@ -41,7 +41,6 @@ #include "HumanoidMobRenderer.h" #include "DefaultRenderer.h" #include "EndermanRenderer.h" -#include "ExperienceOrbRenderer.h" #include "SilverfishRenderer.h" #include "MushroomCowRenderer.h" #include "SnowmanRenderer.h" @@ -123,12 +122,10 @@ EntityRenderDispatcher::EntityRenderDispatcher() renderers[eTYPE_EYEOFENDERSIGNAL] = new ItemSpriteRenderer(Item::eyeOfEnder); renderers[eTYPE_THROWNEGG] = new ItemSpriteRenderer(Item::egg); renderers[eTYPE_THROWNPOTION] = new ItemSpriteRenderer(Item::potion, PotionBrewing::THROWABLE_MASK); - renderers[eTYPE_THROWNEXPBOTTLE] = new ItemSpriteRenderer(Item::expBottle); renderers[eTYPE_FIREBALL] = new FireballRenderer(2.0f); renderers[eTYPE_SMALL_FIREBALL] = new FireballRenderer(0.5f); renderers[eTYPE_DRAGON_FIREBALL] = new FireballRenderer(2.0f); // 4J Added TU9 renderers[eTYPE_ITEMENTITY] = new ItemRenderer(); - renderers[eTYPE_EXPERIENCEORB] = new ExperienceOrbRenderer(); renderers[eTYPE_PRIMEDTNT] = new TntRenderer(); renderers[eTYPE_FALLINGTILE] = new FallingTileRenderer(); renderers[eTYPE_MINECART] = new MinecartRenderer(); diff --git a/Minecraft.Client/EntityTracker.cpp b/Minecraft.Client/EntityTracker.cpp index 8f1dbcd8..25ccda17 100644 --- a/Minecraft.Client/EntityTracker.cpp +++ b/Minecraft.Client/EntityTracker.cpp @@ -50,7 +50,6 @@ void EntityTracker::addEntity(shared_ptr e) else if (e->GetType() == eTYPE_EYEOFENDERSIGNAL ) addEntity(e, 16 * 4, 4, true); else if (e->GetType() == eTYPE_THROWNEGG) addEntity(e, 16 * 4, 10, true); else if (e->GetType() == eTYPE_THROWNPOTION ) addEntity(e, 16 * 4, 10, true); - else if (e->GetType() == eTYPE_THROWNEXPBOTTLE) addEntity(e, 16 * 4, 10, true); else if (e->GetType() == eTYPE_ITEMENTITY) addEntity(e, 16 * 4, 20, true); else if (e->GetType() == eTYPE_MINECART) addEntity(e, 16 * 5, 3, true); else if (e->GetType() == eTYPE_BOAT) addEntity(e, 16 * 5, 3, true); @@ -60,7 +59,6 @@ void EntityTracker::addEntity(shared_ptr e) else if (e->GetType() == eTYPE_PRIMEDTNT) addEntity(e, 16 * 10, 10, true); else if (e->GetType() == eTYPE_FALLINGTILE) addEntity(e, 16 * 10, 20, true); else if (e->GetType() == eTYPE_PAINTING) addEntity(e, 16 * 10, INT_MAX, false); - else if (e->GetType() == eTYPE_EXPERIENCEORB) addEntity(e, 16 * 10, 20, true); else if (e->GetType() == eTYPE_ENDER_CRYSTAL) addEntity(e, 16 * 16, INT_MAX, false); else if (e->GetType() == eTYPE_ITEM_FRAME) addEntity(e, 16 * 10, INT_MAX, false); } diff --git a/Minecraft.Client/ExperienceOrbRenderer.cpp b/Minecraft.Client/ExperienceOrbRenderer.cpp deleted file mode 100644 index 1771f833..00000000 --- a/Minecraft.Client/ExperienceOrbRenderer.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "stdafx.h" -#include "ExperienceOrbRenderer.h" -#include "..\Minecraft.World\net.minecraft.world.entity.h" -#include "..\Minecraft.World\net.minecraft.world.level.tile.h" -#include "..\Minecraft.World\net.minecraft.world.item.h" -#include "Tesselator.h" -#include "EntityRenderDispatcher.h" -#include "..\Minecraft.World\Mth.h" -#include "..\Minecraft.World\JavaMath.h" - -ExperienceOrbRenderer::ExperienceOrbRenderer() -{ - // 4J In class Java initialisors - tileRenderer = new TileRenderer(); - setColor = true; - - this->shadowRadius = 0.15f; - this->shadowStrength = 0.75f; -} - - -void ExperienceOrbRenderer::render(shared_ptr _orb, double x, double y, double z, float rot, float a) -{ - shared_ptr orb = dynamic_pointer_cast(_orb); - glPushMatrix(); - glTranslatef((float) x, (float) y, (float) z); - - int icon = orb->getIcon(); - bindTexture(TN_ITEM_EXPERIENCE_ORB); // 4J was L"/item/xporb.png" - Tesselator *t = Tesselator::getInstance(); - - float u0 = ((icon % 4) * 16 + 0) / 64.0f; - float u1 = ((icon % 4) * 16 + 16) / 64.0f; - float v0 = ((icon / 4) * 16 + 0) / 64.0f; - float v1 = ((icon / 4) * 16 + 16) / 64.0f; - - - float r = 1.0f; - float xo = 0.5f; - float yo = 0.25f; - - if (SharedConstants::TEXTURE_LIGHTING) - { - int col = orb->getLightColor(a); - int u = col % 65536; - int v = col / 65536; - glMultiTexCoord2f(GL_TEXTURE1, u / 1.0f, v / 1.0f); - glColor4f(1, 1, 1, 1); - } - else - { - float br = orb->getBrightness(a); - glColor4f(br, br, br, 1); - } - float br = 255.0f; - float rr = (orb->tickCount + a) / 2; - int rc = (int) ((Mth::sin(rr + 0 * PI * 2 / 3) + 1) * 0.5f * br); - int gc = (int) (br); - int bc = (int) ((Mth::sin(rr + 2 * PI * 2 / 3) + 1) * 0.1f * br); - int col = rc << 16 | gc << 8 | bc; - glRotatef(180 - entityRenderDispatcher->playerRotY, 0, 1, 0); - glRotatef(-entityRenderDispatcher->playerRotX, 1, 0, 0); - float s = 0.3f; - glScalef(s, s, s); - t->begin(); - t->color(col, 128); - t->normal(0, 1, 0); - t->vertexUV(0 - xo, 0 - yo, 0, u0, v1); - t->vertexUV(r - xo, 0 - yo, 0, u1, v1); - t->vertexUV(r - xo, 1 - yo, 0, u1, v0); - t->vertexUV(0 - xo, 1 - yo, 0, u0, v0); - t->end(); - - glDisable(GL_BLEND); - glDisable(GL_RESCALE_NORMAL); - glPopMatrix(); -} - -void ExperienceOrbRenderer::blit(int x, int y, int sx, int sy, int w, int h) -{ - float blitOffset = 0; - float us = 1 / 256.0f; - float vs = 1 / 256.0f; - Tesselator *t = Tesselator::getInstance(); - t->begin(); - t->vertexUV(x + 0, y + h, blitOffset, (sx + 0) * us, (sy + h) * vs); - t->vertexUV(x + w, y + h, blitOffset, (sx + w) * us, (sy + h) * vs); - t->vertexUV(x + w, y + 0, blitOffset, (sx + w) * us, (sy + 0) * vs); - t->vertexUV(x + 0, y + 0, blitOffset, (sx + 0) * us, (sy + 0) * vs); - t->end(); -} \ No newline at end of file diff --git a/Minecraft.Client/ExperienceOrbRenderer.h b/Minecraft.Client/ExperienceOrbRenderer.h deleted file mode 100644 index ebd166f4..00000000 --- a/Minecraft.Client/ExperienceOrbRenderer.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include "EntityRenderer.h" - -class ExperienceOrbRenderer : public EntityRenderer -{ -private: - TileRenderer *tileRenderer; - -public: - bool setColor; - - ExperienceOrbRenderer(); - - void render(shared_ptr _orb, double x, double y, double z, float rot, float a); - void blit(int x, int y, int sx, int sy, int w, int h); -}; \ No newline at end of file diff --git a/Minecraft.Client/GameMode.h b/Minecraft.Client/GameMode.h index ab9ec9d1..a181a5e4 100644 --- a/Minecraft.Client/GameMode.h +++ b/Minecraft.Client/GameMode.h @@ -41,7 +41,6 @@ public: virtual bool isCutScene(); virtual void releaseUsingItem(shared_ptr player); - virtual bool hasExperience(); virtual bool hasMissTime(); virtual bool hasInfiniteItems(); virtual bool hasFarPickRange(); diff --git a/Minecraft.Client/Gui.cpp b/Minecraft.Client/Gui.cpp index fb85cb1c..bda47430 100644 --- a/Minecraft.Client/Gui.cpp +++ b/Minecraft.Client/Gui.cpp @@ -618,48 +618,6 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) } } -#if RENDER_HUD - // Moved so the opacity blend is applied to it - if (bDisplayGui && minecraft->gameMode->hasExperience() && minecraft->player->experienceLevel > 0) - { - if (true) - { - bool blink = false; - int col = blink ? 0xffffff : 0x80ff20; - wchar_t formatted[10]; - swprintf(formatted, 10, L"%d",minecraft->player->experienceLevel); - - wstring str = formatted; - int x = iWidthOffset + (screenWidth - font->width(str)) / 2; - int y = screenHeight - iSafezoneYHalf - iTooltipsYOffset; - // If we're in creative mode, we don't need to offset the XP display so much - if (minecraft->gameMode->canHurtPlayer()) - { - y-=18; - } - else - { - y-=13; - } - - if(bTwoPlayerSplitscreen) - { - y+=iHeightOffset; - } - //int y = screenHeight - 31 - 4; - font->draw(str, x + 1, y, 0x000000); - font->draw(str, x - 1, y, 0x000000); - font->draw(str, x, y + 1, 0x000000); - font->draw(str, x, y - 1, 0x000000); - // font->draw(str, x + 1, y + 1, 0x000000); - // font->draw(str, x - 1, y + 1, 0x000000); - // font->draw(str, x + 1, y - 1, 0x000000); - // font->draw(str, x - 1, y - 1, 0x000000); - font->draw(str, x, y, col); - } - } -#endif // RENDER_HUD - // 4J - added to disable blends, which we have enabled previously to allow gui fading glDisable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -719,46 +677,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) font->drawShadow(minecraft->gatherStats3(), iSafezoneXHalf+2, 32 + 30, 0xffffff); font->drawShadow(minecraft->gatherStats4(), iSafezoneXHalf+2, 32 + 40, 0xffffff); - // TERRAIN FEATURES int iYPos=82; - if(minecraft->level->dimension->id==0) - { - wstring wfeature[eTerrainFeature_Count]; - - wfeature[eTerrainFeature_Stronghold] = L"Stronghold: "; - wfeature[eTerrainFeature_Mineshaft] = L"Mineshaft: "; - wfeature[eTerrainFeature_Village] = L"Village: "; - wfeature[eTerrainFeature_Ravine] = L"Ravine: "; - - for(int i=0;i( pFeatureData->x*16 ) + L", " + _toString( pFeatureData->z*16 ) + L"] "; - wfeature[pFeatureData->eTerrainFeature] += itemInfo; - } - - for( int i = eTerrainFeature_Stronghold; i < (int) eTerrainFeature_Count; i++ ) - { - font->drawShadow(wfeature[i], iSafezoneXHalf + 2, iYPos, 0xffffff); - iYPos+=10; - } - } - - //font->drawShadow(minecraft->gatherStats5(), iSafezoneXHalf+2, 32 + 10, 0xffffff); - { - /* 4J - removed - long max = Runtime.getRuntime().maxMemory(); - long total = Runtime.getRuntime().totalMemory(); - long free = Runtime.getRuntime().freeMemory(); - long used = total - free; - String msg = "Used memory: " + (used * 100 / max) + "% (" + (used / 1024 / 1024) + "MB) of " + (max / 1024 / 1024) + "MB"; - drawString(font, msg, screenWidth - font.width(msg) - 2, 2, 0xe0e0e0); - msg = "Allocated memory: " + (total * 100 / max) + "% (" + (total / 1024 / 1024) + "MB)"; - drawString(font, msg, screenWidth - font.width(msg) - 2, 12, 0xe0e0e0); - */ - } // 4J Stu - Moved these so that they don't overlap double xBlockPos = floor(minecraft->player->x); double yBlockPos = floor(minecraft->player->y); diff --git a/Minecraft.Client/LocalPlayer.cpp b/Minecraft.Client/LocalPlayer.cpp index a78813d9..b287bacf 100644 --- a/Minecraft.Client/LocalPlayer.cpp +++ b/Minecraft.Client/LocalPlayer.cpp @@ -1044,13 +1044,6 @@ bool LocalPlayer::checkInTile(double x, double y, double z) } -void LocalPlayer::setExperienceValues(float experienceProgress, int totalExp, int experienceLevel) -{ - this->experienceProgress = experienceProgress; - this->totalExperience = totalExp; - this->experienceLevel = experienceLevel; -} - bool LocalPlayer::hasPermission(EGameCommand command) { return level->getLevelData()->getAllowCommands(); diff --git a/Minecraft.Client/LocalPlayer.h b/Minecraft.Client/LocalPlayer.h index 0c52502f..daf7066e 100644 --- a/Minecraft.Client/LocalPlayer.h +++ b/Minecraft.Client/LocalPlayer.h @@ -171,8 +171,6 @@ protected: bool checkInTile(double x, double y, double z); public: - void setExperienceValues(float experienceProgress, int totalExp, int experienceLevel); - bool hasPermission(EGameCommand command); void updateRichPresence(); diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj index 83c0671b..84e4cf1f 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj +++ b/Minecraft.Client/Minecraft.Client.vcxproj @@ -8043,7 +8043,6 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU - @@ -25398,7 +25397,6 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU - true diff --git a/Minecraft.Client/Minecraft.Client.vcxproj.filters b/Minecraft.Client/Minecraft.Client.vcxproj.filters index 21b93eca..aca34fc8 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj.filters +++ b/Minecraft.Client/Minecraft.Client.vcxproj.filters @@ -1756,9 +1756,6 @@ net\minecraft\client\renderer\entity - - net\minecraft\client\renderer\entity - net\minecraft\client\renderer\entity @@ -4359,9 +4356,6 @@ net\minecraft\client\renderer\entity - - net\minecraft\client\renderer\entity - net\minecraft\client\renderer\entity diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 00d64070..94058563 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -2436,10 +2436,6 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) *piUse=IDS_TOOLTIPS_THROW; } break; - - case Item::expBottle_Id: - if (bUseItem) *piUse=IDS_TOOLTIPS_THROW; - break; } } diff --git a/Minecraft.Client/MultiPlayerGameMode.cpp b/Minecraft.Client/MultiPlayerGameMode.cpp index 7de59803..ba2fbedd 100644 --- a/Minecraft.Client/MultiPlayerGameMode.cpp +++ b/Minecraft.Client/MultiPlayerGameMode.cpp @@ -442,11 +442,6 @@ void MultiPlayerGameMode::releaseUsingItem(shared_ptr player) player->releaseUsingItem(); } -bool MultiPlayerGameMode::hasExperience() -{ - return true; -} - bool MultiPlayerGameMode::hasMissTime() { return !localPlayerMode->isCreative(); diff --git a/Minecraft.Client/MultiPlayerGameMode.h b/Minecraft.Client/MultiPlayerGameMode.h index c84410fa..c431eff0 100644 --- a/Minecraft.Client/MultiPlayerGameMode.h +++ b/Minecraft.Client/MultiPlayerGameMode.h @@ -51,7 +51,6 @@ public: virtual void handleCreativeModeItemAdd(shared_ptr clicked, int slot); virtual void handleCreativeModeItemDrop(shared_ptr clicked); virtual void releaseUsingItem(shared_ptr player); - virtual bool hasExperience(); virtual bool hasMissTime(); virtual bool hasInfiniteItems(); virtual bool hasFarPickRange(); diff --git a/Minecraft.Client/PreStitchedTextureMap.cpp b/Minecraft.Client/PreStitchedTextureMap.cpp index b6c22223..3b1006b7 100644 --- a/Minecraft.Client/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/PreStitchedTextureMap.cpp @@ -484,7 +484,6 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"minecartFurnace",new SimpleIcon(L"minecartFurnace",slotSize*7,slotSize*10,slotSize*(7+1),slotSize*(10+1)))); texturesByName.insert(stringIconMap::value_type(L"monsterPlacer_overlay",new SimpleIcon(L"monsterPlacer_overlay",slotSize*9,slotSize*10,slotSize*(9+1),slotSize*(10+1)))); texturesByName.insert(stringIconMap::value_type(L"ruby",new SimpleIcon(L"ruby",slotSize*10,slotSize*10,slotSize*(10+1),slotSize*(10+1)))); - texturesByName.insert(stringIconMap::value_type(L"expBottle",new SimpleIcon(L"expBottle",slotSize*11,slotSize*10,slotSize*(11+1),slotSize*(10+1)))); texturesByName.insert(stringIconMap::value_type(L"brewingStand",new SimpleIcon(L"brewingStand",slotSize*12,slotSize*10,slotSize*(12+1),slotSize*(10+1)))); texturesByName.insert(stringIconMap::value_type(L"magmaCream",new SimpleIcon(L"magmaCream",slotSize*13,slotSize*10,slotSize*(13+1),slotSize*(10+1)))); texturesByName.insert(stringIconMap::value_type(L"dyePowder_cyan",new SimpleIcon(L"dyePowder_cyan",slotSize*14,slotSize*10,slotSize*(14+1),slotSize*(10+1)))); diff --git a/Minecraft.Client/ServerCommandDispatcher.cpp b/Minecraft.Client/ServerCommandDispatcher.cpp index 51dd42fe..ec267a21 100644 --- a/Minecraft.Client/ServerCommandDispatcher.cpp +++ b/Minecraft.Client/ServerCommandDispatcher.cpp @@ -14,7 +14,6 @@ ServerCommandDispatcher::ServerCommandDispatcher() addCommand(new DefaultGameModeCommand()); addCommand(new KillCommand()); addCommand(new ToggleDownfallCommand()); - addCommand(new ExperienceCommand()); addCommand(new TeleportCommand()); addCommand(new GiveItemCommand()); addCommand(new EnchantItemCommand()); diff --git a/Minecraft.Client/ServerLevel.cpp b/Minecraft.Client/ServerLevel.cpp index de8c66cd..2a43edf3 100644 --- a/Minecraft.Client/ServerLevel.cpp +++ b/Minecraft.Client/ServerLevel.cpp @@ -1228,18 +1228,6 @@ bool ServerLevel::addEntity(shared_ptr e) } LeaveCriticalSection(&m_limiterCS); } - // If its an experience orb entity, and we've got to our capacity, delete the oldest - else if( dynamic_pointer_cast(e) != NULL ) - { -// printf("Adding arrow entity count %d\n",m_arrowEntities.size()); - EnterCriticalSection(&m_limiterCS); - if( m_experienceOrbEntities.size() >= MAX_EXPERIENCEORB_ENTITIES ) - { -// printf("Adding - doing remove\n"); - removeEntityImmediately(m_experienceOrbEntities.front()); - } - LeaveCriticalSection(&m_limiterCS); - } return Level::addEntity(e); } @@ -1267,13 +1255,6 @@ void ServerLevel::entityAddedExtra(shared_ptr e) // printf("entity added: arrow entity count now %d\n",m_arrowEntities.size()); LeaveCriticalSection(&m_limiterCS); } - else if( dynamic_pointer_cast(e) != NULL ) - { - EnterCriticalSection(&m_limiterCS); - m_experienceOrbEntities.push_back(e); -// printf("entity added: experience orb entity count now %d\n",m_arrowEntities.size()); - LeaveCriticalSection(&m_limiterCS); - } else if( dynamic_pointer_cast(e) != NULL ) { EnterCriticalSection(&m_limiterCS); @@ -1330,19 +1311,6 @@ void ServerLevel::entityRemovedExtra(shared_ptr e) // printf("entity removed: arrow entity count now %d\n",m_arrowEntities.size()); LeaveCriticalSection(&m_limiterCS); } - else if( dynamic_pointer_cast(e) != NULL ) - { - EnterCriticalSection(&m_limiterCS); -// printf("entity removed: experience orb entity count %d\n",m_arrowEntities.size()); - AUTO_VAR(it, find(m_experienceOrbEntities.begin(),m_experienceOrbEntities.end(),e)); - if( it != m_experienceOrbEntities.end() ) - { -// printf("Item to remove found\n"); - m_experienceOrbEntities.erase(it); - } -// printf("entity removed: experience orb entity count now %d\n",m_arrowEntities.size()); - LeaveCriticalSection(&m_limiterCS); - } else if( dynamic_pointer_cast(e) != NULL ) { EnterCriticalSection(&m_limiterCS); diff --git a/Minecraft.Client/ServerLevel.h b/Minecraft.Client/ServerLevel.h index 644c15c0..dff3fb96 100644 --- a/Minecraft.Client/ServerLevel.h +++ b/Minecraft.Client/ServerLevel.h @@ -127,7 +127,6 @@ public: static const int MAX_HANGING_ENTITIES = 400; static const int MAX_ITEM_ENTITIES = 200; static const int MAX_ARROW_ENTITIES = 200; - static const int MAX_EXPERIENCEORB_ENTITIES = 50; static const int MAX_PRIMED_TNT = 20; static const int MAX_FALLING_TILE = 20; @@ -137,7 +136,6 @@ public: list< shared_ptr > m_itemEntities; list< shared_ptr > m_hangingEntities; list< shared_ptr > m_arrowEntities; - list< shared_ptr > m_experienceOrbEntities; virtual bool addEntity(shared_ptr e); void entityAddedExtra(shared_ptr e); diff --git a/Minecraft.Client/ServerPlayer.cpp b/Minecraft.Client/ServerPlayer.cpp index 489e6f34..d4aefdb5 100644 --- a/Minecraft.Client/ServerPlayer.cpp +++ b/Minecraft.Client/ServerPlayer.cpp @@ -190,12 +190,6 @@ void ServerPlayer::addAdditonalSaveData(CompoundTag *entityTag) //entityTag->putInt(L"playerGameType", gameMode->getGameModeForPlayer()->getId()); } -void ServerPlayer::withdrawExperienceLevels(int amount) -{ - Player::withdrawExperienceLevels(amount); - lastSentExp = -1; -} - void ServerPlayer::initMenu() { containerMenu->addSlotListener(this); @@ -546,13 +540,6 @@ void ServerPlayer::doTickB(bool ignorePortal) lastSentFood = foodData.getFoodLevel(); lastFoodSaturationZero = foodData.getSaturationLevel() == 0; } - - if (totalExperience != lastSentExp) - { - lastSentExp = totalExperience; - connection->send( shared_ptr( new SetExperiencePacket(experienceProgress, totalExperience, experienceLevel) ) ); - } - } shared_ptr ServerPlayer::getCarried(int slot) @@ -760,10 +747,6 @@ void ServerPlayer::take(shared_ptr e, int orgCount) { entityTracker->broadcast(e, shared_ptr( new TakeItemEntityPacket(e->entityId, entityId) ) ); } - if (e->GetType() == eTYPE_EXPERIENCEORB) - { - entityTracker->broadcast(e, shared_ptr( new TakeItemEntityPacket(e->entityId, entityId) ) ); - } } Player::take(e, orgCount); containerMenu->broadcastChanges(); diff --git a/Minecraft.Client/ServerPlayer.h b/Minecraft.Client/ServerPlayer.h index a9b37594..b6832a42 100644 --- a/Minecraft.Client/ServerPlayer.h +++ b/Minecraft.Client/ServerPlayer.h @@ -45,7 +45,6 @@ public: virtual void readAdditionalSaveData(CompoundTag *entityTag); virtual void addAdditonalSaveData(CompoundTag *entityTag); - virtual void withdrawExperienceLevels(int amount); void initMenu(); private: diff --git a/Minecraft.Client/SurvivalMode.h b/Minecraft.Client/SurvivalMode.h index b4ce5e6d..cf89512d 100644 --- a/Minecraft.Client/SurvivalMode.h +++ b/Minecraft.Client/SurvivalMode.h @@ -28,5 +28,4 @@ public: virtual shared_ptr createPlayer(Level *level); virtual void tick(); virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly=false, bool *pbUsedItem=NULL); - virtual bool hasExperience(); }; \ No newline at end of file diff --git a/Minecraft.Client/Textures.cpp b/Minecraft.Client/Textures.cpp index ce7a9bfc..374737b8 100644 --- a/Minecraft.Client/Textures.cpp +++ b/Minecraft.Client/Textures.cpp @@ -79,7 +79,6 @@ wchar_t *Textures::preLoaded[TN_COUNT] = L"mob/silverfish", L"mob/enderman_eyes", L"misc/explosion", - L"item/xporb", L"item/chest", L"item/largechest", diff --git a/Minecraft.Client/Textures.h b/Minecraft.Client/Textures.h index eb0799e2..5fc36708 100644 --- a/Minecraft.Client/Textures.h +++ b/Minecraft.Client/Textures.h @@ -72,7 +72,6 @@ typedef enum _TEXTURE_NAME TN_MOB_SILVERFISH, TN_MOB_ENDERMAN_EYES, TN_MISC_EXPLOSION, - TN_ITEM_EXPERIENCE_ORB, TN_TILE_CHEST, TN_TILE_LARGE_CHEST, diff --git a/Minecraft.Client/TrackedEntity.cpp b/Minecraft.Client/TrackedEntity.cpp index 70f25c93..bcd1cfed 100644 --- a/Minecraft.Client/TrackedEntity.cpp +++ b/Minecraft.Client/TrackedEntity.cpp @@ -641,11 +641,6 @@ shared_ptr TrackedEntity::getAddEntityPacket() return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_POTION, ((dynamic_pointer_cast(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp)); } break; - case eTYPE_THROWNEXPBOTTLE: - { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp) ); - } - break; case eTYPE_THROWNENDERPEARL: { return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp) ); @@ -754,11 +749,6 @@ shared_ptr TrackedEntity::getAddEntityPacket() return packet; } break; - case eTYPE_EXPERIENCEORB: - { - return shared_ptr( new AddExperienceOrbPacket(dynamic_pointer_cast(e)) ); - } - break; default: assert(false); break; diff --git a/Minecraft.World/AddEntityPacket.h b/Minecraft.World/AddEntityPacket.h index 5ac7286c..d73b44fb 100644 --- a/Minecraft.World/AddEntityPacket.h +++ b/Minecraft.World/AddEntityPacket.h @@ -25,7 +25,6 @@ public: static const int EYEOFENDERSIGNAL = 72; static const int THROWN_POTION = 73; static const int FALLING_EGG = 74; - static const int THROWN_EXPBOTTLE = 75; static const int FISH_HOOK = 90; diff --git a/Minecraft.World/AddExperienceOrbPacket.cpp b/Minecraft.World/AddExperienceOrbPacket.cpp deleted file mode 100644 index a1a22844..00000000 --- a/Minecraft.World/AddExperienceOrbPacket.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "stdafx.h" -#include "net.minecraft.world.entity.h" -#include "InputOutputStream.h" -#include "PacketListener.h" -#include "AddExperienceOrbPacket.h" - - - -AddExperienceOrbPacket::AddExperienceOrbPacket() -{ - id = 0; - x = y = z = 0; - value = 0; -} - -AddExperienceOrbPacket::AddExperienceOrbPacket(shared_ptr e) -{ - id = e->entityId; - x = Mth::floor(e->x * 32); - y = Mth::floor(e->y * 32); - z = Mth::floor(e->z * 32); - value = e->getValue(); -} - -void AddExperienceOrbPacket::read(DataInputStream *dis) -{ - id = dis->readInt(); - x = dis->readInt(); - y = dis->readInt(); - z = dis->readInt(); - value = dis->readShort(); -} - -void AddExperienceOrbPacket::write(DataOutputStream *dos) -{ - dos->writeInt(id); - dos->writeInt(x); - dos->writeInt(y); - dos->writeInt(z); - dos->writeShort(value); -} - -void AddExperienceOrbPacket::handle(PacketListener *listener) -{ - listener->handleAddExperienceOrb(shared_from_this()); -} - -int AddExperienceOrbPacket::getEstimatedSize() -{ - return 18; -} \ No newline at end of file diff --git a/Minecraft.World/AddExperienceOrbPacket.h b/Minecraft.World/AddExperienceOrbPacket.h deleted file mode 100644 index 59accfb3..00000000 --- a/Minecraft.World/AddExperienceOrbPacket.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "Packet.h" - -class ExperienceOrb; - -class AddExperienceOrbPacket : public Packet, public enable_shared_from_this -{ -public: - int id; - int x, y, z; - int value; - - AddExperienceOrbPacket(); - AddExperienceOrbPacket(shared_ptr e); - - virtual void read(DataInputStream *dis); - virtual void write(DataOutputStream *dos); - virtual void handle(PacketListener *listener); - virtual int getEstimatedSize(); - - static shared_ptr create() { return shared_ptr(new AddExperienceOrbPacket()); } - virtual int getId() { return 26; } -}; \ No newline at end of file diff --git a/Minecraft.World/Animal.cpp b/Minecraft.World/Animal.cpp index 45fc304f..e4c9318f 100644 --- a/Minecraft.World/Animal.cpp +++ b/Minecraft.World/Animal.cpp @@ -153,8 +153,6 @@ void Animal::breedWith(shared_ptr target) level->addParticle(eParticleType_heart, x + random->nextFloat() * bbWidth * 2 - bbWidth, y + .5f + random->nextFloat() * bbHeight, z + random->nextFloat() * bbWidth * 2 - bbWidth, xa, ya, za); } level->addEntity(offspring); - - level->addEntity( shared_ptr( new ExperienceOrb(level, x, y, z, random->nextInt(4) + 1) ) ); } setDespawnProtected(); @@ -283,11 +281,6 @@ bool Animal::removeWhenFarAway() return !isDespawnProtected(); // 4J changed - was false } -int Animal::getExperienceReward(shared_ptr killedBy) -{ - return 1 + level->random->nextInt(3); -} - bool Animal::isFood(shared_ptr itemInstance) { return itemInstance->id == Item::wheat_Id; diff --git a/Minecraft.World/Animal.h b/Minecraft.World/Animal.h index 8c0cda8e..f420953e 100644 --- a/Minecraft.World/Animal.h +++ b/Minecraft.World/Animal.h @@ -48,7 +48,6 @@ public: protected: virtual bool removeWhenFarAway(); - virtual int getExperienceReward(shared_ptr killedBy); public: virtual bool isFood(shared_ptr itemInstance); diff --git a/Minecraft.World/BreedGoal.cpp b/Minecraft.World/BreedGoal.cpp index 2145d371..b6d5634b 100644 --- a/Minecraft.World/BreedGoal.cpp +++ b/Minecraft.World/BreedGoal.cpp @@ -5,7 +5,6 @@ #include "net.minecraft.world.level.h" #include "net.minecraft.world.phys.h" #include "BreedGoal.h" -#include "ExperienceOrb.h" #include "GenericStats.h" @@ -111,6 +110,4 @@ void BreedGoal::breed() level->addParticle(eParticleType_heart, animal->x + random->nextFloat() * animal->bbWidth * 2 - animal->bbWidth, animal->y + .5f + random->nextFloat() * animal->bbHeight, animal->z + random->nextFloat() * animal->bbWidth * 2 - animal->bbWidth, xa, ya, za); } - // 4J-PB - Fix for 106869- Customer Encountered: TU12: Content: Gameplay: Breeding animals does not give any Experience Orbs. - level->addEntity( shared_ptr( new ExperienceOrb(level, animal->x, animal->y, animal->z, random->nextInt(7) + 1) ) ); } diff --git a/Minecraft.World/Class.h b/Minecraft.World/Class.h index 5dbbf965..ce76410f 100644 --- a/Minecraft.World/Class.h +++ b/Minecraft.World/Class.h @@ -71,7 +71,6 @@ enum eINSTANCEOF eTYPE_SMALL_FIREBALL = 0x40007, eTYPE_THROWNENDERPEARL = 0x40008, eTYPE_THROWNPOTION = 0x40009, - eTYPE_THROWNEXPBOTTLE = 0x4000A, eTYPE_ANIMALS_SPAWN_LIMIT_CHECK = 0x80000, @@ -138,7 +137,6 @@ enum eINSTANCEOF // 1.8.2 eTYPE_DELAYEDRELEASE, - eTYPE_EXPERIENCEORB, eType_CRITPARTICLE, eType_CRITPARTICLE2, eType_HUGEEXPLOSIONPARTICLE, diff --git a/Minecraft.World/CommandsEnum.h b/Minecraft.World/CommandsEnum.h index 46793e21..3cad459f 100644 --- a/Minecraft.World/CommandsEnum.h +++ b/Minecraft.World/CommandsEnum.h @@ -4,7 +4,6 @@ enum EGameCommand { eGameCommand_DefaultGameMode, eGameCommand_EnchantItem, - eGameCommand_Experience, eGameCommand_GameMode, eGameCommand_Give, eGameCommand_Kill, diff --git a/Minecraft.World/DispenserTile.cpp b/Minecraft.World/DispenserTile.cpp index 286737c9..ca885d11 100644 --- a/Minecraft.World/DispenserTile.cpp +++ b/Minecraft.World/DispenserTile.cpp @@ -375,27 +375,6 @@ int DispenserTile::dispenseItem(shared_ptr trap, Level *lev } } break; - case Item::expBottle_Id: - { - int currentProjectiles = level->countInstanceOf(eTYPE_PROJECTILE,false); - if(currentProjectiles < Level::MAX_DISPENSABLE_PROJECTILES) // 4J - added limit - { - shared_ptr expBottle = shared_ptr( new ThrownExpBottle(level, xp, yp, zp) ); - expBottle->shoot(xd, .1f, zd, power * 1.25f, accuracy * .5f); - level->addEntity(expBottle); - level->levelEvent(LevelEvent::SOUND_LAUNCH, x, y, z, 0); - return REMOVE_ITEM; - } - else - { - // some negative sound effect? - level->levelEvent(LevelEvent::SOUND_CLICK_FAIL, x, y, z, 0); - - // not sending a message here, since we will probably get flooded with them when people have automatic dispensers for spawn eggs - return LEAVE_ITEM; - } - } - break; case Item::fireball_Id: // TU9 { int currentFireballs = level->countInstanceOf(eTYPE_SMALL_FIREBALL,true); diff --git a/Minecraft.World/EnchantmentMenu.cpp b/Minecraft.World/EnchantmentMenu.cpp index 23b366ce..88376018 100644 --- a/Minecraft.World/EnchantmentMenu.cpp +++ b/Minecraft.World/EnchantmentMenu.cpp @@ -153,7 +153,7 @@ void EnchantmentMenu::slotsChanged() // 4J used to take a shared_ptr bool EnchantmentMenu::clickMenuButton(shared_ptr player, int i) { shared_ptr item = enchantSlots->getItem(0); - if (costs[i] > 0 && item != NULL && (player->experienceLevel >= costs[i] || player->abilities.instabuild) ) + if (costs[i] > 0 && item != NULL && (player->abilities.instabuild) ) { if (!level->isClientSide) { @@ -162,7 +162,6 @@ bool EnchantmentMenu::clickMenuButton(shared_ptr player, int i) vector *newEnchantment = EnchantmentHelper::selectEnchantment(&random, item, costs[i]); if (newEnchantment != NULL) { - player->withdrawExperienceLevels(costs[i]); if (isBook) item->id = Item::enchantedBook_Id; int randomIndex = isBook ? random.nextInt(newEnchantment->size()) : -1; //for (EnchantmentInstance e : newEnchantment) diff --git a/Minecraft.World/EnderDragon.cpp b/Minecraft.World/EnderDragon.cpp index 2ccd453c..160f87f7 100644 --- a/Minecraft.World/EnderDragon.cpp +++ b/Minecraft.World/EnderDragon.cpp @@ -1186,16 +1186,6 @@ void EnderDragon::tickDeath() } if (!level->isClientSide) { - if (dragonDeathTime > 150 && dragonDeathTime % 5 == 0) - { - int xpCount = 1000; - while (xpCount > 0) - { - int newCount = ExperienceOrb::getExperienceValue(xpCount); - xpCount -= newCount; - level->addEntity(shared_ptr( new ExperienceOrb(level, x, y, z, newCount) )); - } - } if (dragonDeathTime == 1) { //level->globalLevelEvent(LevelEvent::SOUND_DRAGON_DEATH, (int) x, (int) y, (int) z, 0); @@ -1209,13 +1199,6 @@ void EnderDragon::tickDeath() { //level->levelEvent(NULL, LevelEvent::ENDERDRAGON_KILLED, (int) x, (int) y, (int) z, 0); - int xpCount = 2000; - while (xpCount > 0) - { - int newCount = ExperienceOrb::getExperienceValue(xpCount); - xpCount -= newCount; - level->addEntity(shared_ptr( new ExperienceOrb(level, x, y, z, newCount))); - } int xo = 5 + random->nextInt(2) * 2 - 1; int zo = 5 + random->nextInt(2) * 2 - 1; if (random->nextInt(2) == 0) diff --git a/Minecraft.World/EntityIO.cpp b/Minecraft.World/EntityIO.cpp index d0677d38..4b6ead39 100644 --- a/Minecraft.World/EntityIO.cpp +++ b/Minecraft.World/EntityIO.cpp @@ -42,7 +42,6 @@ void EntityIO::setId(entityCreateFn createFn, eINSTANCEOF clas, const wstring &i void EntityIO::staticCtor() { setId(ItemEntity::create, eTYPE_ITEMENTITY, L"Item", 1); - setId(ExperienceOrb::create, eTYPE_EXPERIENCEORB, L"XPOrb", 2); setId(Painting::create, eTYPE_PAINTING, L"Painting", 9); setId(Arrow::create, eTYPE_ARROW, L"Arrow", 10); @@ -52,7 +51,6 @@ void EntityIO::staticCtor() setId(ThrownEnderpearl::create, eTYPE_THROWNENDERPEARL, L"ThrownEnderpearl", 14); setId(EyeOfEnderSignal::create, eTYPE_EYEOFENDERSIGNAL, L"EyeOfEnderSignal", 15); setId(ThrownPotion::create, eTYPE_THROWNPOTION, L"ThrownPotion", 16); - setId(ThrownExpBottle::create, eTYPE_THROWNEXPBOTTLE, L"ThrownExpBottle", 17); setId(ItemFrame::create, eTYPE_ITEM_FRAME, L"ItemFrame", 18); setId(PrimedTnt::create, eTYPE_PRIMEDTNT, L"PrimedTnt", 20); diff --git a/Minecraft.World/ExperienceCommand.cpp b/Minecraft.World/ExperienceCommand.cpp deleted file mode 100644 index b8ac2efc..00000000 --- a/Minecraft.World/ExperienceCommand.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "stdafx.h" -#include "net.minecraft.commands.h" -#include "..\Minecraft.Client\MinecraftServer.h" -#include "..\Minecraft.Client\PlayerList.h" -#include "ExperienceCommand.h" - -EGameCommand ExperienceCommand::getId() -{ - return eGameCommand_Experience; -} - -void ExperienceCommand::execute(shared_ptr source, byteArray commandData) -{ - //if (args.length > 0) - //{ - // Player player; - // int amount = convertArgToInt(source, args[0], 0, 5000); - - // if (args.length > 1) { - // player = getPlayer(args[1]); - // } else { - // player = convertSourceToPlayer(source); - // } - - // player.increaseXp(amount); - // logAdminAction(source, "commands.xp.success", amount, player.getAName()); - //} -} - -shared_ptr ExperienceCommand::getPlayer(PlayerUID playerId) -{ - return nullptr; - //shared_ptr player = MinecraftServer::getInstance()->getPlayers()->getPlayer(playerId); - - //if (player == null) - //{ - // throw new PlayerNotFoundException(); - //} else { - // return player; - //} -} \ No newline at end of file diff --git a/Minecraft.World/ExperienceCommand.h b/Minecraft.World/ExperienceCommand.h deleted file mode 100644 index b1dd2cbe..00000000 --- a/Minecraft.World/ExperienceCommand.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include "Command.h" - -class CommandSender; - -class ExperienceCommand : public Command -{ -public: - virtual EGameCommand getId(); - virtual void execute(shared_ptr source, byteArray commandData); - -protected: - shared_ptr getPlayer(PlayerUID playerId); -}; \ No newline at end of file diff --git a/Minecraft.World/ExperienceItem.cpp b/Minecraft.World/ExperienceItem.cpp deleted file mode 100644 index 497c2385..00000000 --- a/Minecraft.World/ExperienceItem.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "stdafx.h" -#include "net.minecraft.world.level.h" -#include "net.minecraft.world.entity.projectile.h" -#include "net.minecraft.world.entity.player.h" -#include "net.minecraft.world.item.h" -#include "SoundTypes.h" -#include "ExperienceItem.h" - -ExperienceItem::ExperienceItem(int id) : Item(id) -{ -} - -bool ExperienceItem::isFoil(shared_ptr itemInstance) -{ - return true; -} - -bool ExperienceItem::TestUse(Level *level, shared_ptr player) -{ - return true; -} - -shared_ptr ExperienceItem::use(shared_ptr itemInstance, Level *level, shared_ptr player) -{ - if (!player->abilities.instabuild) - { - itemInstance->count--; - } - level->playSound(player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f)); - if (!level->isClientSide) level->addEntity( shared_ptr( new ThrownExpBottle(level, player) )); - return itemInstance; -} \ No newline at end of file diff --git a/Minecraft.World/ExperienceItem.h b/Minecraft.World/ExperienceItem.h deleted file mode 100644 index c8e95925..00000000 --- a/Minecraft.World/ExperienceItem.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include "Item.h" - -class ItemInstance; - -class ExperienceItem : public Item -{ -public: - ExperienceItem(int id); - - virtual bool isFoil(shared_ptr itemInstance); - virtual shared_ptr use(shared_ptr itemInstance, Level *level, shared_ptr player); - virtual bool TestUse(Level *level, shared_ptr player); -}; \ No newline at end of file diff --git a/Minecraft.World/ExperienceOrb.cpp b/Minecraft.World/ExperienceOrb.cpp deleted file mode 100644 index 76f2a9ae..00000000 --- a/Minecraft.World/ExperienceOrb.cpp +++ /dev/null @@ -1,330 +0,0 @@ -#include "stdafx.h" -#include "net.minecraft.world.level.h" -#include "net.minecraft.world.level.material.h" -#include "net.minecraft.world.phys.h" -#include "net.minecraft.world.level.tile.h" -#include "net.minecraft.world.damagesource.h" -#include "com.mojang.nbt.h" -#include "JavaMath.h" -#include "SharedConstants.h" -#include "ExperienceOrb.h" -#include "SoundTypes.h" - - - -const int ExperienceOrb::LIFETIME = 5 * 60 * SharedConstants::TICKS_PER_SECOND; // Five minutes! - -void ExperienceOrb::_init() -{ - tickCount = 0; - age = 0; - - throwTime = 0; - - health = 5; - value = 0; - followingPlayer = nullptr; - followingTime = 0; -} - -ExperienceOrb::ExperienceOrb(Level *level, double x, double y, double z, int count) : Entity(level) -{ - _init(); - - setSize(0.5f, 0.5f); - heightOffset = bbHeight / 2.0f; - setPos(x, y, z); - - yRot = (float) (Math::random() * 360); - - xd = (float) (Math::random() * 0.2f - 0.1f) * 2; - yd = (float) (Math::random() * 0.2) * 2; - zd = (float) (Math::random() * 0.2f - 0.1f) * 2; - - value = count; -} - -bool ExperienceOrb::makeStepSound() -{ - return false; -} - -ExperienceOrb::ExperienceOrb(Level *level) : Entity( level ) -{ - _init(); - - setSize(0.25f, 0.25f); - heightOffset = bbHeight / 2.0f; -} - -void ExperienceOrb::defineSynchedData() -{ -} - -int ExperienceOrb::getLightColor(float a) -{ - float l = 0.5f; - if (l < 0) l = 0; - if (l > 1) l = 1; - int br = Entity::getLightColor(a); - - int br1 = (br) & 0xff; - int br2 = (br >> 16) & 0xff; - br1 += (int) (l * 15 * 16); - if (br1 > 15 * 16) br1 = 15 * 16; - // br2 = 15*16; - return br1 | br2 << 16; -} - -void ExperienceOrb::tick() -{ - Entity::tick(); - if (throwTime > 0) throwTime--; - xo = x; - yo = y; - zo = z; - - yd -= 0.03f; - if (level->getMaterial(Mth::floor(x), Mth::floor(y), Mth::floor(z)) == Material::lava) - { - yd = 0.2f; - xd = (random->nextFloat() - random->nextFloat()) * 0.2f; - zd = (random->nextFloat() - random->nextFloat()) * 0.2f; - level->playSound(shared_from_this(), eSoundType_RANDOM_FIZZ, 0.4f, 2.0f + random->nextFloat() * 0.4f); - } - checkInTile(x, (bb->y0 + bb->y1) / 2, z); - - double maxDist = 8; - // 4J - PC Comment - // Usually exp orbs will get created at the same time so smoothen the lagspikes - if (followingTime < tickCount - SharedConstants::TICKS_PER_SECOND + (entityId % 100)) - { - if (followingPlayer == NULL || followingPlayer->distanceToSqr(shared_from_this()) > maxDist * maxDist) - { - followingPlayer = level->getNearestPlayer(shared_from_this(), maxDist); - } - followingTime = tickCount; - } - if (followingPlayer != NULL) - { - double xdd = (followingPlayer->x - x) / maxDist; - double ydd = (followingPlayer->y + followingPlayer->getHeadHeight() - y) / maxDist; - double zdd = (followingPlayer->z - z) / maxDist; - double dd = sqrt(xdd * xdd + ydd * ydd + zdd * zdd); - double power = 1 - dd; - if (power > 0) - { - power = power * power; - xd += xdd / dd * power * 0.1; - yd += ydd / dd * power * 0.1; - zd += zdd / dd * power * 0.1; - } - } - - move(xd, yd, zd); - - float friction = 0.98f; - if (onGround) - { - friction = 0.6f * 0.98f; - int t = level->getTile(Mth::floor(x), Mth::floor(bb->y0) - 1, Mth::floor(z)); - if (t > 0) - { - friction = Tile::tiles[t]->friction * 0.98f; - } - } - - xd *= friction; - yd *= 0.98f; - zd *= friction; - - if (onGround) - { - yd *= -0.9f; - } - - tickCount++; - - age++; - if (age >= LIFETIME) - { - remove(); - } -} - -bool ExperienceOrb::updateInWaterState() -{ - return level->checkAndHandleWater(bb, Material::water, shared_from_this()); -} - -void ExperienceOrb::burn(int dmg) -{ - hurt(DamageSource::inFire, dmg); -} - -bool ExperienceOrb::hurt(DamageSource *source, int damage) -{ - markHurt(); - health -= damage; - if (health <= 0) - { - remove(); - } - return false; -} - -void ExperienceOrb::addAdditonalSaveData(CompoundTag *entityTag) -{ - entityTag->putShort(L"Health", (byte) health); - entityTag->putShort(L"Age", (short) age); - entityTag->putShort(L"Value", (short) value); -} - -void ExperienceOrb::readAdditionalSaveData(CompoundTag *tag) -{ - health = tag->getShort(L"Health") & 0xff; - age = tag->getShort(L"Age"); - value = tag->getShort(L"Value"); -} - -void ExperienceOrb::playerTouch(shared_ptr player) -{ - if (level->isClientSide) return; - - if (throwTime == 0 && player->takeXpDelay == 0) - { - player->takeXpDelay = 2; - // 4J - sound change brought forward from 1.2.3 - level->playSound(shared_from_this(), eSoundType_RANDOM_ORB, 0.1f, 0.5f * ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.8f)); - player->take(shared_from_this(), 1); - player->increaseXp(value); - remove(); - } -} - -int ExperienceOrb::getValue() -{ - return value; -} - -int ExperienceOrb::getIcon() -{ - - if (value >= 2477) - { - return 10; - } - else if (value >= 1237) - { - return 9; - } - else if (value >= 617) - { - return 8; - } - else if (value >= 307) - { - return 7; - } - else if (value >= 149) - { - return 6; - } - else if (value >= 73) - { - return 5; - } - else if (value >= 37) - { - return 4; - } - else if (value >= 17) - { - return 3; - } - else if (value >= 7) - { - return 2; - } - else if (value >= 3) - { - return 1; - } - - return 0; -} - -/** -* Fetches the biggest possible experience orb value based on a maximum -* value. The current algorithm is next prime which is at least twice more -* than the previous one. -* -* @param maxValue -* @return -*/ -int ExperienceOrb::getExperienceValue(int maxValue) -{ - - if (maxValue >= 2477) - { - return 2477; - } - else if (maxValue >= 1237) - { - return 1237; - } - else if (maxValue >= 617) - { - return 617; - } - else if (maxValue >= 307) - { - return 307; - } - else if (maxValue >= 149) - { - return 149; - } - else if (maxValue >= 73) - { - return 73; - } - else if (maxValue >= 37) - { - return 37; - } - else if (maxValue >= 17) - { - return 17; - } - else if (maxValue >= 7) - { - return 7; - } - else if (maxValue >= 3) - { - return 3; - } - - return 1; -} - -bool ExperienceOrb::isAttackable() -{ - return false; -} - -// 4J added -bool ExperienceOrb::shouldRender(Vec3 *c) -{ - double xd = x - c->x; - double yd = y - c->y; - double zd = z - c->z; - double distance = xd * xd + yd * yd + zd * zd; - - // 4J - don't render experience orbs that are less than 2 metres away, to try and avoid large particles that are causing us problems with photosensitivity testing - issues when you go - // near a large pile of experience orbs that all rush towards the near clip plane - if( distance < 4 ) return false; - - return Entity::shouldRender(c); -} \ No newline at end of file diff --git a/Minecraft.World/ExperienceOrb.h b/Minecraft.World/ExperienceOrb.h index 524ae52a..48951204 100644 --- a/Minecraft.World/ExperienceOrb.h +++ b/Minecraft.World/ExperienceOrb.h @@ -5,7 +5,7 @@ class ExperienceOrb : public Entity { public: - virtual eINSTANCEOF GetType() { return eTYPE_EXPERIENCEORB; } + //virtual eINSTANCEOF GetType() { return eTYPE_EXPERIENCEORB; } static Entity *create(Level *level) { return new ExperienceOrb(level); } private: diff --git a/Minecraft.World/FishingHook.cpp b/Minecraft.World/FishingHook.cpp index efa2dbc6..f9f603ae 100644 --- a/Minecraft.World/FishingHook.cpp +++ b/Minecraft.World/FishingHook.cpp @@ -432,7 +432,6 @@ int FishingHook::retrieve() ie->Entity::yd = ya * speed + sqrt(dist) * 0.08; ie->Entity::zd = za * speed; level->addEntity(ie); - owner->level->addEntity( shared_ptr( new ExperienceOrb(owner->level, owner->x, owner->y + 0.5f, owner->z + 0.5f, random->nextInt(3) + 1) ) ); // 4J Stu brought forward from 1.4 dmg = 1; } if (inGround) dmg = 2; diff --git a/Minecraft.World/FurnaceResultSlot.cpp b/Minecraft.World/FurnaceResultSlot.cpp index d845dada..1a460406 100644 --- a/Minecraft.World/FurnaceResultSlot.cpp +++ b/Minecraft.World/FurnaceResultSlot.cpp @@ -68,13 +68,6 @@ void FurnaceResultSlot::checkTakeAchievements(shared_ptr carried) } amount = baseValue; } - - while (amount > 0) - { - int newCount = ExperienceOrb::getExperienceValue(amount); - amount -= newCount; - player->level->addEntity(shared_ptr( new ExperienceOrb(player->level, player->x, player->y + .5, player->z + .5, newCount) )); - } } #ifdef _DURANGO diff --git a/Minecraft.World/Item.cpp b/Minecraft.World/Item.cpp index 5d723ec5..6657b64b 100644 --- a/Minecraft.World/Item.cpp +++ b/Minecraft.World/Item.cpp @@ -202,8 +202,6 @@ Item *Item::speckledMelon = NULL; Item *Item::monsterPlacer = NULL; -Item *Item::expBottle = NULL; - // TU9 Item *Item::fireball = NULL; Item *Item::frame = NULL; @@ -417,9 +415,6 @@ void Item::staticCtor() Item::monsterPlacer = (new MonsterPlacerItem(127)) ->setTextureName(L"monsterPlacer")->setDescriptionId(IDS_ITEM_MONSTER_SPAWNER)->setUseDescriptionId(IDS_DESC_MONSTER_SPAWNER); - // 4J Stu - Brought this forward - Item::expBottle = (new ExperienceItem(128)) ->setTextureName(L"expBottle")->setDescriptionId(IDS_ITEM_EXP_BOTTLE)->setUseDescriptionId(IDS_DESC_EXP_BOTTLE); - Item::record_01 = ( new RecordingItem(2000, L"13") ) ->setTextureName(L"record")->setDescriptionId(IDS_ITEM_RECORD_01)->setUseDescriptionId(IDS_DESC_RECORD); Item::record_02 = ( new RecordingItem(2001, L"cat") ) ->setTextureName(L"record")->setDescriptionId(IDS_ITEM_RECORD_02)->setUseDescriptionId(IDS_DESC_RECORD); @@ -1079,7 +1074,6 @@ const int Item::cauldron_Id ; const int Item::eyeOfEnder_Id ; const int Item::speckledMelon_Id ; const int Item::monsterPlacer_Id ; -const int Item::expBottle_Id ; const int Item::skull_Id ; const int Item::record_01_Id ; const int Item::record_02_Id ; diff --git a/Minecraft.World/Item.h b/Minecraft.World/Item.h index 727fc661..dd5eaae6 100644 --- a/Minecraft.World/Item.h +++ b/Minecraft.World/Item.h @@ -342,8 +342,6 @@ public: static Item *monsterPlacer; - static Item *expBottle; - static Item *skull; static Item *record_01; @@ -529,8 +527,6 @@ public: // 1.1 static const int monsterPlacer_Id = 383; - static const int expBottle_Id = 384; - // TU 12 static const int skull_Id = 397; diff --git a/Minecraft.World/Minecraft.World.vcxproj b/Minecraft.World/Minecraft.World.vcxproj index 5dd3bc6b..4ebd414b 100644 --- a/Minecraft.World/Minecraft.World.vcxproj +++ b/Minecraft.World/Minecraft.World.vcxproj @@ -1781,7 +1781,6 @@ - @@ -1998,8 +1997,6 @@ - - @@ -2188,7 +2185,6 @@ - @@ -2197,7 +2193,6 @@ - @@ -2573,7 +2568,6 @@ - @@ -2710,7 +2704,6 @@ - @@ -2931,7 +2924,6 @@ true - @@ -2993,7 +2985,6 @@ - @@ -3154,7 +3145,6 @@ - @@ -3178,7 +3168,6 @@ - @@ -3588,7 +3577,6 @@ - diff --git a/Minecraft.World/Minecraft.World.vcxproj.filters b/Minecraft.World/Minecraft.World.vcxproj.filters index eb5e4a8c..cee420e7 100644 --- a/Minecraft.World/Minecraft.World.vcxproj.filters +++ b/Minecraft.World/Minecraft.World.vcxproj.filters @@ -1747,9 +1747,6 @@ net\minecraft\world\level\levelgen\structure - - net\minecraft\network\packet - net\minecraft\network\packet @@ -1762,9 +1759,6 @@ net\minecraft\network\packet - - net\minecraft\network\packet - net\minecraft\network\packet @@ -1804,9 +1798,6 @@ net\minecraft\world\entity - - net\minecraft\world\entity - net\minecraft\world\food @@ -2176,9 +2167,6 @@ net\minecraft\world\level\newbiome\layer - - net\minecraft\world\entity\projectile - net\minecraft\world\item\enchantment @@ -2191,9 +2179,6 @@ net\minecraft\world\item\enchantment - - net\minecraft\world\item - net\minecraft\network\packet @@ -2728,9 +2713,6 @@ net\minecraft\commands\common - - net\minecraft\commands\common - net\minecraft\commands\common @@ -4026,9 +4008,6 @@ net\minecraft\world\level\levelgen\structure - - net\minecraft\network\packet - net\minecraft\network\packet @@ -4041,9 +4020,6 @@ net\minecraft\network\packet - - net\minecraft\network\packet - net\minecraft\network\packet @@ -4077,9 +4053,6 @@ net\minecraft\world\entity - - net\minecraft\world\entity - net\minecraft\world\food @@ -4419,9 +4392,6 @@ net\minecraft\world\level\newbiome\layer - - net\minecraft\world\entity\projectile - net\minecraft\world\item\enchantment @@ -4434,9 +4404,6 @@ net\minecraft\world\item\enchantment - - net\minecraft\world\item - net\minecraft\network\packet @@ -4878,9 +4845,6 @@ net\minecraft\commands\common - - net\minecraft\commands\common - net\minecraft\commands\common diff --git a/Minecraft.World/Mob.cpp b/Minecraft.World/Mob.cpp index f6325bed..3c527d5f 100644 --- a/Minecraft.World/Mob.cpp +++ b/Minecraft.World/Mob.cpp @@ -444,21 +444,6 @@ void Mob::tickDeath() deathTime++; if (deathTime == 20) { - // 4J Stu - Added level->isClientSide check from 1.2 to fix XP orbs being created client side - if(!level->isClientSide && (lastHurtByPlayerTime > 0 || isAlwaysExperienceDropper()) ) - { - if (!isBaby()) - { - int xpCount = this->getExperienceReward(lastHurtByPlayer); - while (xpCount > 0) - { - int newCount = ExperienceOrb::getExperienceValue(xpCount); - xpCount -= newCount; - level->addEntity(shared_ptr( new ExperienceOrb(level, x, y, z, newCount) ) ); - } - } - } - remove(); for (int i = 0; i < 20; i++) { @@ -475,16 +460,6 @@ int Mob::decreaseAirSupply(int currentSupply) return currentSupply - 1; } -int Mob::getExperienceReward(shared_ptr killedBy) -{ - return xpReward; -} - -bool Mob::isAlwaysExperienceDropper() -{ - return false; -} - void Mob::spawnAnim() { for (int i = 0; i < 20; i++) diff --git a/Minecraft.World/Mob.h b/Minecraft.World/Mob.h index 0e1af2be..cc330f5a 100644 --- a/Minecraft.World/Mob.h +++ b/Minecraft.World/Mob.h @@ -183,8 +183,6 @@ public: protected: virtual void tickDeath(); virtual int decreaseAirSupply(int currentSupply); - virtual int getExperienceReward(shared_ptr killedBy); - virtual bool isAlwaysExperienceDropper(); public: void spawnAnim(); diff --git a/Minecraft.World/MobSpawnerTile.cpp b/Minecraft.World/MobSpawnerTile.cpp index d926fc24..ee680cbe 100644 --- a/Minecraft.World/MobSpawnerTile.cpp +++ b/Minecraft.World/MobSpawnerTile.cpp @@ -35,12 +35,6 @@ bool MobSpawnerTile::blocksLight() void MobSpawnerTile::spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel) { Tile::spawnResources(level, x, y, z, data, odds, playerBonusLevel); - - // also spawn experience if the block is broken - { - int magicCount = 15 + level->random->nextInt(15) + level->random->nextInt(15); - popExperience(level, x, y, z, magicCount); - } } int MobSpawnerTile::cloneTileId(Level *level, int x, int y, int z) diff --git a/Minecraft.World/OreTile.cpp b/Minecraft.World/OreTile.cpp index bd656541..cd0c204e 100644 --- a/Minecraft.World/OreTile.cpp +++ b/Minecraft.World/OreTile.cpp @@ -40,33 +40,6 @@ int OreTile::getResourceCountForLootBonus(int bonusLevel, Random *random) void OreTile::spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel) { Tile::spawnResources(level, x, y, z, data, odds, playerBonusLevel); - - // also spawn experience if the block is broken - if (getResource(data, level->random, playerBonusLevel) != id) - { - int magicCount = 0; - if (id == Tile::coalOre_Id) - { - magicCount = Mth::nextInt(level->random, 0, 2); - } - else if (id == Tile::diamondOre_Id) - { - magicCount = Mth::nextInt(level->random, 3, 7); - } - else if (id == Tile::emeraldOre_Id) - { - magicCount = Mth::nextInt(level->random, 3, 7); - } - else if (id == Tile::lapisOre_Id) - { - magicCount = Mth::nextInt(level->random, 2, 5); - } - else if (id == Tile::netherQuartz_Id) - { - magicCount = Mth::nextInt(level->random, 2, 5); - } - popExperience(level, x, y, z, magicCount); - } } int OreTile::getSpawnResourcesAuxValue(int data) diff --git a/Minecraft.World/Packet.cpp b/Minecraft.World/Packet.cpp index 0a59204c..ed75acef 100644 --- a/Minecraft.World/Packet.cpp +++ b/Minecraft.World/Packet.cpp @@ -51,7 +51,6 @@ void Packet::staticCtor() map(23, true, false, false, true, typeid(AddEntityPacket), AddEntityPacket::create); map(24, true, false, false, true, typeid(AddMobPacket), AddMobPacket::create); map(25, true, false, false, false, typeid(AddPaintingPacket), AddPaintingPacket::create); - map(26, true, false, false, false, typeid(AddExperienceOrbPacket), AddExperienceOrbPacket::create); // TODO New for 1.8.2 - Needs sendToAny? //map(27, false, true, false, false, PlayerInputPacket)); // 4J-PB - needs to go to any player, due to the knockback effect when a played is hit map(28, true, false, true, true, typeid(SetEntityMotionPacket), SetEntityMotionPacket::create); @@ -70,7 +69,6 @@ void Packet::staticCtor() map(40, true, false, true, true, typeid(SetEntityDataPacket), SetEntityDataPacket::create); map(41, true, false, true, false, typeid(UpdateMobEffectPacket), UpdateMobEffectPacket::create); map(42, true, false, true, false, typeid(RemoveMobEffectPacket), RemoveMobEffectPacket::create); - map(43, true, false, true, false, typeid(SetExperiencePacket), SetExperiencePacket::create); map(50, true, false, true, true, typeid(ChunkVisibilityPacket), ChunkVisibilityPacket::create); map(51, true, false, true, true, typeid(BlockRegionUpdatePacket), BlockRegionUpdatePacket::create); // Changed to LevelChunkPacket in Java but we aren't using that diff --git a/Minecraft.World/PacketListener.cpp b/Minecraft.World/PacketListener.cpp index 2f051d7d..abdb04bf 100644 --- a/Minecraft.World/PacketListener.cpp +++ b/Minecraft.World/PacketListener.cpp @@ -295,21 +295,11 @@ void PacketListener::handleKeepAlive(shared_ptr packet) onUnhandledPacket(packet); } -void PacketListener::handleSetExperience(shared_ptr packet) -{ - onUnhandledPacket(packet); -} - void PacketListener::handleSetCreativeModeSlot(shared_ptr packet) { onUnhandledPacket(packet); } -void PacketListener::handleAddExperienceOrb(shared_ptr packet) -{ - onUnhandledPacket(packet); -} - // 1.0.1 void PacketListener::handleContainerButtonClick(shared_ptr packet) { diff --git a/Minecraft.World/PacketListener.h b/Minecraft.World/PacketListener.h index 93b14603..40782e3b 100644 --- a/Minecraft.World/PacketListener.h +++ b/Minecraft.World/PacketListener.h @@ -60,9 +60,7 @@ class GetInfoPacket; class UpdateMobEffectPacket; class RemoveMobEffectPacket; class PlayerInfoPacket; -class SetExperiencePacket; class SetCreativeModeSlotPacket; -class AddExperienceOrbPacket; // 1.0.1 class ContainerButtonClickPacket; @@ -166,9 +164,7 @@ public: virtual void handleRemoveMobEffect(shared_ptr packet); virtual void handlePlayerInfo(shared_ptr packet); virtual void handleKeepAlive(shared_ptr packet); - virtual void handleSetExperience(shared_ptr packet); virtual void handleSetCreativeModeSlot(shared_ptr packet); - virtual void handleAddExperienceOrb(shared_ptr packet); // 1.0.1 virtual void handleContainerButtonClick(shared_ptr packet); diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index 758ec6ec..806e5028 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -96,9 +96,6 @@ void Player::_init() m_uiDebugOptions=0L; jumpTriggerTime = 0; - takeXpDelay = 0; - experienceLevel = totalExperience = 0; - experienceProgress = 0.0f; useItem = nullptr; useItemDuration = 0; @@ -1219,10 +1216,6 @@ void Player::readAdditionalSaveData(CompoundTag *entityTag) m_isSleeping = entityTag->getBoolean(L"Sleeping"); sleepCounter = entityTag->getShort(L"SleepTimer"); - experienceProgress = entityTag->getFloat(L"XpP"); - experienceLevel = entityTag->getInt(L"XpLevel"); - totalExperience = entityTag->getInt(L"XpTotal"); - if (m_isSleeping) { bedPosition = new Pos( Mth::floor(x), Mth::floor(y), Mth::floor(z)); @@ -1255,10 +1248,6 @@ void Player::addAdditonalSaveData(CompoundTag *entityTag) entityTag->putBoolean(L"Sleeping", m_isSleeping); entityTag->putShort(L"SleepTimer", (short) sleepCounter); - entityTag->putFloat(L"XpP", experienceProgress); - entityTag->putInt(L"XpLevel", experienceLevel); - entityTag->putInt(L"XpTotal", totalExperience); - if (respawnPosition != NULL) { entityTag->putInt(L"SpawnX", respawnPosition->x); @@ -2309,53 +2298,6 @@ void Player::handleInsidePortal() isInsidePortal = true; } -void Player::increaseXp(int i) -{ - // Update xp calculations from 1.3 - score += i; - int max = INT_MAX - totalExperience; - if (i > max) - { - i = max; - } - experienceProgress += (float) i / getXpNeededForNextLevel(); - totalExperience += i; - while (experienceProgress >= 1) - { - experienceProgress = (experienceProgress - 1) * getXpNeededForNextLevel(); - levelUp(); - experienceProgress /= getXpNeededForNextLevel(); - } -} - -void Player::withdrawExperienceLevels(int amount) -{ - experienceLevel -= amount; - if (experienceLevel < 0) - { - experienceLevel = 0; - } -} - -int Player::getXpNeededForNextLevel() -{ - // Update xp calculations from 1.3 - if (experienceLevel >= 30) - { - return 17 + 15 * 3 + (experienceLevel - 30) * 7; - } - if (experienceLevel >= 15) - { - return 17 + (experienceLevel - 15) * 3; - } - return 17; -} - -void Player::levelUp() -{ - experienceLevel++; -} - /** * This method adds on to the player's exhaustion, which may decrease the * player's food level. @@ -2419,22 +2361,6 @@ bool Player::mayBuild(int x, int y, int z) return abilities.mayBuild; } -int Player::getExperienceReward(shared_ptr killedBy) -{ - int reward = experienceLevel * 7; - if (reward > 100) - { - return 100; - } - return reward; -} - -bool Player::isAlwaysExperienceDropper() -{ - // players always drop experience - return true; -} - wstring Player::getAName() { return name; @@ -2453,10 +2379,6 @@ void Player::restoreFrom(shared_ptr oldPlayer, bool restoreAll) health = oldPlayer->health; foodData = oldPlayer->foodData; - experienceLevel = oldPlayer->experienceLevel; - totalExperience = oldPlayer->totalExperience; - experienceProgress = oldPlayer->experienceProgress; - score = oldPlayer->score; for(AUTO_VAR(it, oldPlayer->activeEffects.begin()); it != oldPlayer->activeEffects.end(); ++it) diff --git a/Minecraft.World/Player.h b/Minecraft.World/Player.h index c323bf05..7fb5f5f9 100644 --- a/Minecraft.World/Player.h +++ b/Minecraft.World/Player.h @@ -119,9 +119,6 @@ public: Abilities abilities; - int experienceLevel, totalExperience; - float experienceProgress; - // 4J Stu - Made protected so that we can access it from MultiPlayerLocalPlayer protected: shared_ptr useItem; @@ -341,10 +338,6 @@ public: virtual shared_ptr getArmor(int pos); virtual void handleInsidePortal(); - void increaseXp(int i); - virtual void withdrawExperienceLevels(int amount); - int getXpNeededForNextLevel(); - private: void levelUp(); @@ -356,10 +349,6 @@ public: virtual void startUsingItem(shared_ptr instance, int duration); bool mayBuild(int x, int y, int z); -protected: - virtual int getExperienceReward(shared_ptr killedBy); - virtual bool isAlwaysExperienceDropper(); - public: virtual wstring getAName(); diff --git a/Minecraft.World/RedStoneOreTile.cpp b/Minecraft.World/RedStoneOreTile.cpp index 9317ffdd..83031e08 100644 --- a/Minecraft.World/RedStoneOreTile.cpp +++ b/Minecraft.World/RedStoneOreTile.cpp @@ -78,13 +78,6 @@ int RedStoneOreTile::getResourceCount(Random *random) void RedStoneOreTile::spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel) { Tile::spawnResources(level, x, y, z, data, odds, playerBonusLevel); - - // also spawn experience if the block is broken - if (getResource(data, level->random, playerBonusLevel) != id) - { - int magicCount = 1 + level->random->nextInt(5); - popExperience(level, x, y, z, magicCount); - } } void RedStoneOreTile::animateTick(Level *level, int x, int y, int z, Random *random) diff --git a/Minecraft.World/RepairResultSlot.cpp b/Minecraft.World/RepairResultSlot.cpp index 041a64a7..0eaa10a0 100644 --- a/Minecraft.World/RepairResultSlot.cpp +++ b/Minecraft.World/RepairResultSlot.cpp @@ -20,12 +20,11 @@ bool RepairResultSlot::mayPlace(shared_ptr item) bool RepairResultSlot::mayPickup(shared_ptr player) { - return (player->abilities.instabuild || player->experienceLevel >= m_menu->cost) && (m_menu->cost > 0 && hasItem()); + return (player->abilities.instabuild) && (m_menu->cost > 0 && hasItem()); } void RepairResultSlot::onTake(shared_ptr player, shared_ptr carried) { - if (!player->abilities.instabuild) player->withdrawExperienceLevels(m_menu->cost); m_menu->repairSlots->setItem(RepairMenu::INPUT_SLOT, nullptr); if (m_menu->repairItemCountCost > 0) { diff --git a/Minecraft.World/SetExperiencePacket.cpp b/Minecraft.World/SetExperiencePacket.cpp deleted file mode 100644 index ffe90a67..00000000 --- a/Minecraft.World/SetExperiencePacket.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "stdafx.h" -#include "SetExperiencePacket.h" -#include "PacketListener.h" -#include "InputOutputStream.h" - - - -SetExperiencePacket::SetExperiencePacket() -{ - this->experienceProgress = 0; - this->totalExperience = 0; - this->experienceLevel = 0; -} - -SetExperiencePacket::SetExperiencePacket(float experienceProgress, int totalExperience, int experienceLevel) -{ - this->experienceProgress = experienceProgress; - this->totalExperience = totalExperience; - this->experienceLevel = experienceLevel; -} - -void SetExperiencePacket::read(DataInputStream *dis) -{ - experienceProgress = dis->readFloat(); - experienceLevel = dis->readShort(); - totalExperience = dis->readShort(); -} - -void SetExperiencePacket::write(DataOutputStream *dos) -{ - dos->writeFloat(experienceProgress); - dos->writeShort(experienceLevel); - dos->writeShort(totalExperience); -} - -void SetExperiencePacket::handle(PacketListener *listener) -{ - listener->handleSetExperience(shared_from_this()); -} - -int SetExperiencePacket::getEstimatedSize() -{ - return 8; -} - -bool SetExperiencePacket::canBeInvalidated() -{ - return true; -} - -bool SetExperiencePacket::isInvalidatedBy(shared_ptr packet) -{ - return true; -} - -bool SetExperiencePacket::isAync() -{ - return true; -} \ No newline at end of file diff --git a/Minecraft.World/SetExperiencePacket.h b/Minecraft.World/SetExperiencePacket.h deleted file mode 100644 index 499b7efd..00000000 --- a/Minecraft.World/SetExperiencePacket.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "Packet.h" - -class SetExperiencePacket : public Packet, public enable_shared_from_this -{ -public: - float experienceProgress; - int totalExperience; - int experienceLevel; - - SetExperiencePacket(); - SetExperiencePacket(float experienceProgress, int totalExperience, int experienceLevel); - - virtual void read(DataInputStream *dis); - virtual void write(DataOutputStream *dos); - virtual void handle(PacketListener *listener); - virtual int getEstimatedSize(); - virtual bool canBeInvalidated(); - virtual bool isInvalidatedBy(shared_ptr packet); - virtual bool isAync(); - -public: - static shared_ptr create() { return shared_ptr(new SetExperiencePacket()); } - virtual int getId() { return 43; } -}; \ No newline at end of file diff --git a/Minecraft.World/ThrownExpBottle.cpp b/Minecraft.World/ThrownExpBottle.cpp deleted file mode 100644 index 75d3d9a1..00000000 --- a/Minecraft.World/ThrownExpBottle.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "stdafx.h" -#include "net.minecraft.world.entity.h" -#include "net.minecraft.world.level.h" -#include "net.minecraft.world.level.tile.h" -#include "JavaMath.h" -#include "ThrownExpBottle.h" - - - -ThrownExpBottle::ThrownExpBottle(Level *level) : Throwable(level) -{ -} - -ThrownExpBottle::ThrownExpBottle(Level *level, shared_ptr mob) : Throwable(level,mob) -{ -} - -ThrownExpBottle::ThrownExpBottle(Level *level, double x, double y, double z) : Throwable(level, x, y, z) -{ -} - - -float ThrownExpBottle::getGravity() -{ - return 0.07f; -} - -float ThrownExpBottle::getThrowPower() -{ - return 0.7f; -} - -float ThrownExpBottle::getThrowUpAngleOffset() -{ - return -20; -} - -void ThrownExpBottle::onHit(HitResult *res) -{ - - if (!level->isClientSide) - { - level->levelEvent(LevelEvent::PARTICLES_POTION_SPLASH, (int) Math::round(x), (int) Math::round(y), (int) Math::round(z), 0); - - int xpCount = 3 + level->random->nextInt(5) + level->random->nextInt(5); - while (xpCount > 0) - { - int newCount = ExperienceOrb::getExperienceValue(xpCount); - xpCount -= newCount; - level->addEntity(shared_ptr( new ExperienceOrb(level, x, y, z, newCount) ) ); - } - - remove(); - } -} \ No newline at end of file diff --git a/Minecraft.World/ThrownExpBottle.h b/Minecraft.World/ThrownExpBottle.h deleted file mode 100644 index 8430794b..00000000 --- a/Minecraft.World/ThrownExpBottle.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "Throwable.h" - -class HitResult; - -class ThrownExpBottle : public Throwable -{ -public: - eINSTANCEOF GetType() { return eTYPE_THROWNEXPBOTTLE; } - static Entity *create(Level *level) { return new ThrownExpBottle(level); } -public: - ThrownExpBottle(Level *level); - ThrownExpBottle(Level *level, shared_ptr mob); - ThrownExpBottle(Level *level, double x, double y, double z); - -protected: - virtual float getGravity(); - virtual float getThrowPower(); - virtual float getThrowUpAngleOffset(); - virtual void onHit(HitResult *res); -}; \ No newline at end of file diff --git a/Minecraft.World/Tile.cpp b/Minecraft.World/Tile.cpp index e0ef8dd9..33c3ba32 100644 --- a/Minecraft.World/Tile.cpp +++ b/Minecraft.World/Tile.cpp @@ -910,20 +910,6 @@ void Tile::popResource(Level *level, int x, int y, int z, shared_ptraddEntity(item); } -// Brought forward for TU7 -void Tile::popExperience(Level *level, int x, int y, int z, int amount) -{ - if (!level->isClientSide) - { - while (amount > 0) - { - int newCount = ExperienceOrb::getExperienceValue(amount); - amount -= newCount; - level->addEntity(shared_ptr( new ExperienceOrb(level, x + .5, y + .5, z + .5, newCount))); - } - } -} - int Tile::getSpawnResourcesAuxValue(int data) { return 0; diff --git a/Minecraft.World/Tile.h b/Minecraft.World/Tile.h index fa2f5786..a401d965 100644 --- a/Minecraft.World/Tile.h +++ b/Minecraft.World/Tile.h @@ -565,7 +565,6 @@ public: virtual void spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel); protected: virtual void popResource(Level *level, int x, int y, int z, shared_ptr itemInstance); - virtual void popExperience(Level *level, int x, int y, int z, int amount); public: virtual int getSpawnResourcesAuxValue(int data); diff --git a/Minecraft.World/Villager.cpp b/Minecraft.World/Villager.cpp index 328c0c70..7deadc67 100644 --- a/Minecraft.World/Villager.cpp +++ b/Minecraft.World/Villager.cpp @@ -501,7 +501,6 @@ void Villager::addOffers(int addCount) break; case PROFESSION_PRIEST: addItemForPurchase(newOffers, Item::eyeOfEnder_Id, random, getRecipeChance(.3f)); - addItemForPurchase(newOffers, Item::expBottle_Id, random, getRecipeChance(.2f)); addItemForPurchase(newOffers, Item::redStone_Id, random, getRecipeChance(.4f)); addItemForPurchase(newOffers, Tile::lightGem_Id, random, getRecipeChance(.3f)); { @@ -608,7 +607,6 @@ void Villager::staticCtor() MIN_MAX_PRICES[Item::helmet_cloth_Id] = pair(2, 4); MIN_MAX_PRICES[Item::leggings_cloth_Id] = pair(2, 4); MIN_MAX_PRICES[Item::saddle_Id] = pair(6, 8); - MIN_MAX_PRICES[Item::expBottle_Id] = pair(-4, -1); MIN_MAX_PRICES[Item::redStone_Id] = pair(-4, -1); MIN_MAX_PRICES[Item::compass_Id] = pair(10, 12); MIN_MAX_PRICES[Item::clock_Id] = pair(10, 12); diff --git a/Minecraft.World/WaterAnimal.cpp b/Minecraft.World/WaterAnimal.cpp index 0a7313d1..8ddb8758 100644 --- a/Minecraft.World/WaterAnimal.cpp +++ b/Minecraft.World/WaterAnimal.cpp @@ -34,9 +34,4 @@ int WaterAnimal::getAmbientSoundInterval() bool WaterAnimal::removeWhenFarAway() { return true; -} - -int WaterAnimal::getExperienceReward(shared_ptr killedBy) -{ - return 1 + level->random->nextInt(3); } \ No newline at end of file diff --git a/Minecraft.World/WaterAnimal.h b/Minecraft.World/WaterAnimal.h index 23b984f5..67a0de15 100644 --- a/Minecraft.World/WaterAnimal.h +++ b/Minecraft.World/WaterAnimal.h @@ -14,5 +14,4 @@ public: protected: virtual bool removeWhenFarAway(); - virtual int getExperienceReward(shared_ptr killedBy); }; diff --git a/Minecraft.World/net.minecraft.commands.common.h b/Minecraft.World/net.minecraft.commands.common.h index aa2e2f6f..6eb37cf6 100644 --- a/Minecraft.World/net.minecraft.commands.common.h +++ b/Minecraft.World/net.minecraft.commands.common.h @@ -2,7 +2,6 @@ #include "DefaultGameModeCommand.h" #include "EnchantItemCommand.h" -#include "ExperienceCommand.h" #include "GameModeCommand.h" #include "GiveItemCommand.h" #include "KillCommand.h" diff --git a/Minecraft.World/net.minecraft.network.packet.h b/Minecraft.World/net.minecraft.network.packet.h index b7bfee5d..f6975976 100644 --- a/Minecraft.World/net.minecraft.network.packet.h +++ b/Minecraft.World/net.minecraft.network.packet.h @@ -56,12 +56,10 @@ #include "UseItemPacket.h" // 1.8.2 Added -#include "AddExperienceOrbPacket.h" #include "GetInfoPacket.h" #include "PlayerInfoPacket.h" #include "RemoveMobEffectPacket.h" #include "SetCreativeModeSlotPacket.h" -#include "SetExperiencePacket.h" #include "UpdateMobEffectPacket.h" // 1.0.1 Added diff --git a/Minecraft.World/net.minecraft.world.entity.h b/Minecraft.World/net.minecraft.world.entity.h index 9aa62632..ecf05ad1 100644 --- a/Minecraft.World/net.minecraft.world.entity.h +++ b/Minecraft.World/net.minecraft.world.entity.h @@ -14,7 +14,6 @@ // 1.8.2 #include "DelayedRelease.h" -#include "ExperienceOrb.h" // 1.0.1 #include "MobType.h" diff --git a/Minecraft.World/net.minecraft.world.entity.projectile.h b/Minecraft.World/net.minecraft.world.entity.projectile.h index 3e56b04e..6a41c84a 100644 --- a/Minecraft.World/net.minecraft.world.entity.projectile.h +++ b/Minecraft.World/net.minecraft.world.entity.projectile.h @@ -12,7 +12,6 @@ #include "Throwable.h" #include "ThrownEnderpearl.h" #include "ThrownPotion.h" -#include "ThrownExpBottle.h" // Brought forward from 1.2 // Added TU 9 #include "DragonFireball.h" \ No newline at end of file diff --git a/Minecraft.World/net.minecraft.world.item.h b/Minecraft.World/net.minecraft.world.item.h index 0300b954..4e748f1d 100644 --- a/Minecraft.World/net.minecraft.world.item.h +++ b/Minecraft.World/net.minecraft.world.item.h @@ -56,7 +56,6 @@ #include "PotionItem.h" #include "Rarity.h" #include "WaterLilyTileItem.h" -#include "ExperienceItem.h" // 4J Stu brought forward #include "SmoothStoneBrickTileItem.h" // 4J Stu brought forward // TU9