diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-08-02 00:14:05 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-08-02 00:14:05 +0200 |
commit | 3b4255dbfe6dc0fa2ecd861221a2ed5b124a81ad (patch) | |
tree | 91b4dfb63a419f88333b2c7bfc0beacd431d2d22 | |
parent | Fixed issues with autocomplete and time loading (diff) | |
download | cuberite-3b4255dbfe6dc0fa2ecd861221a2ed5b124a81ad.tar cuberite-3b4255dbfe6dc0fa2ecd861221a2ed5b124a81ad.tar.gz cuberite-3b4255dbfe6dc0fa2ecd861221a2ed5b124a81ad.tar.bz2 cuberite-3b4255dbfe6dc0fa2ecd861221a2ed5b124a81ad.tar.lz cuberite-3b4255dbfe6dc0fa2ecd861221a2ed5b124a81ad.tar.xz cuberite-3b4255dbfe6dc0fa2ecd861221a2ed5b124a81ad.tar.zst cuberite-3b4255dbfe6dc0fa2ecd861221a2ed5b124a81ad.zip |
-rw-r--r-- | src/BlockEntities/BeaconEntity.cpp | 2 | ||||
-rw-r--r-- | src/ClientHandle.cpp | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/BlockEntities/BeaconEntity.cpp b/src/BlockEntities/BeaconEntity.cpp index 805e5e61f..dcf659f47 100644 --- a/src/BlockEntities/BeaconEntity.cpp +++ b/src/BlockEntities/BeaconEntity.cpp @@ -90,6 +90,7 @@ bool cBeaconEntity::SetPrimaryEffect(cEntityEffect::eType a_Effect) { if (!IsValidEffect(a_Effect, m_BeaconLevel)) { + m_PrimaryEffect = cEntityEffect::effNoEffect; return false; } @@ -111,6 +112,7 @@ bool cBeaconEntity::SetSecondaryEffect(cEntityEffect::eType a_Effect) { if (!IsValidEffect(a_Effect, m_BeaconLevel)) { + m_SecondaryEffect = cEntityEffect::effNoEffect; return false; } diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index d71c6a9d8..72257028a 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -795,7 +795,22 @@ void cClientHandle::HandleBeaconSelection(const char * a_Data, size_t a_Length) Window->SetSlot(*m_Player, 0, cItem()); BeaconWindow->GetBeaconEntity()->SetPrimaryEffect(PrimaryEffect); - BeaconWindow->GetBeaconEntity()->SetSecondaryEffect(SecondaryEffect); + + // Valid effect check. Vanilla don't check this, but we do it :) + if ( + (SecondaryEffect == cEntityEffect::effNoEffect) || + (SecondaryEffect == cEntityEffect::effRegeneration) || + (SecondaryEffect == BeaconWindow->GetBeaconEntity()->GetPrimaryEffect()) + ) + { + BeaconWindow->GetBeaconEntity()->SetSecondaryEffect(SecondaryEffect); + } + else + { + BeaconWindow->GetBeaconEntity()->SetSecondaryEffect(cEntityEffect::effNoEffect); + } + + m_Player->CloseWindow(true); } |