diff options
-rw-r--r-- | Tools/ProtoProxy/Connection.cpp | 5 | ||||
-rw-r--r-- | src/ClientHandle.cpp | 7 | ||||
-rw-r--r-- | src/Entities/ExpOrb.cpp | 2 | ||||
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 2 | ||||
-rw-r--r-- | src/Simulator/RedstoneSimulator.cpp | 34 |
5 files changed, 39 insertions, 11 deletions
diff --git a/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp index 0b49859cb..10f2b4073 100644 --- a/Tools/ProtoProxy/Connection.cpp +++ b/Tools/ProtoProxy/Connection.cpp @@ -2384,10 +2384,11 @@ bool cConnection::HandleServerStatusResponse(void) Log(" Response: %s", Response.c_str()); // Modify the response to show that it's being proto-proxied: - size_t idx = Response.find("\"description\":\""); + const char DescSearch[] = "\"description\":{\"text\":\""; + size_t idx = Response.find(DescSearch); if (idx != AString::npos) { - Response.assign(Response.substr(0, idx + 15) + "ProtoProxy: " + Response.substr(idx + 15)); + Response.assign(Response.substr(0, idx + sizeof(DescSearch) - 1) + "ProtoProxy: " + Response.substr(idx + sizeof(DescSearch) - 1)); } cByteBuffer Packet(1000); Packet.WriteVarInt(0); // Packet type - status response diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 0d70b2a2b..f3deefe0b 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1498,13 +1498,8 @@ void cClientHandle::Tick(float a_Dt) } // If the chunk the player's in was just sent, spawn the player: - if (m_HasSentPlayerChunk && (m_State != csPlaying) && !IsDestroying()) + if (m_HasSentPlayerChunk && (m_State == csDownloadingWorld)) { - if (!cRoot::Get()->GetPluginManager()->CallHookPlayerJoined(*m_Player)) - { - // Broadcast that this player has joined the game! Yay~ - m_Player->GetWorld()->BroadcastChat(m_Username + " joined the game!", this); - } m_Protocol->SendPlayerMoveLook(); m_State = csPlaying; } diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp index 248fb7278..04ee85823 100644 --- a/src/Entities/ExpOrb.cpp +++ b/src/Entities/ExpOrb.cpp @@ -54,7 +54,7 @@ void cExpOrb::Tick(float a_Dt, cChunk & a_Chunk) Destroy(true); } a_Distance.Normalize(); - a_Distance *= ((float) (5.5 - Distance)); + a_Distance *= ((float) (5.5 - Distance)); SetSpeedX( a_Distance.x ); SetSpeedY( a_Distance.y ); SetSpeedZ( a_Distance.z ); diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index edf7d2529..5f939be1e 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -562,7 +562,7 @@ void cProtocol172::SendPlayerMoveLook(void) { cPacketizer Pkt(*this, 0x08); // Player Position And Look packet Pkt.WriteDouble(m_Client->GetPlayer()->GetPosX()); - Pkt.WriteDouble(m_Client->GetPlayer()->GetPosY()); + Pkt.WriteDouble(m_Client->GetPlayer()->GetStance()); // Protocol docs say this is PosY, but #323 says this is eye-pos Pkt.WriteDouble(m_Client->GetPlayer()->GetPosZ()); Pkt.WriteFloat((float)m_Client->GetPlayer()->GetYaw()); Pkt.WriteFloat((float)m_Client->GetPlayer()->GetPitch()); diff --git a/src/Simulator/RedstoneSimulator.cpp b/src/Simulator/RedstoneSimulator.cpp index fc9471b91..77301aafa 100644 --- a/src/Simulator/RedstoneSimulator.cpp +++ b/src/Simulator/RedstoneSimulator.cpp @@ -82,10 +82,16 @@ void cRedstoneSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, c { int RelX = itr->a_SourcePos.x - a_ChunkX * cChunkDef::Width; int RelZ = itr->a_SourcePos.z - a_ChunkZ * cChunkDef::Width; + int DestRelX = itr->a_BlockPos.x - a_ChunkX * cChunkDef::Width; + int DestRelZ = itr->a_BlockPos.z - a_ChunkZ * cChunkDef::Width; BLOCKTYPE SourceBlockType; NIBBLETYPE SourceBlockMeta; - if (!a_Chunk->UnboundedRelGetBlock(RelX, itr->a_SourcePos.y, RelZ, SourceBlockType, SourceBlockMeta)) + BLOCKTYPE DestBlockType; + if ( + !a_Chunk->UnboundedRelGetBlock(RelX, itr->a_SourcePos.y, RelZ, SourceBlockType, SourceBlockMeta) || + !a_Chunk->UnboundedRelGetBlockType(DestRelX, itr->a_SourcePos.y, DestRelZ, DestBlockType) + ) { continue; } @@ -106,6 +112,12 @@ void cRedstoneSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, c LOGD("cRedstoneSimulator: Erased block %s from powered blocks list due to present/past metadata mismatch", ItemToFullString(itr->a_SourceBlock).c_str()); itr = m_PoweredBlocks.erase(itr); } + else if ((SourceBlockType == E_BLOCK_REDSTONE_WIRE) && (DestBlockType == E_BLOCK_REDSTONE_WIRE)) + { + // It is simply not allowed that a wire powers another wire, presuming that data here is sane and a dest and source are beside each other + LOGD("cRedstoneSimulator: Erased redstone wire from powered blocks list because it's source was also wire"); + itr = m_PoweredBlocks.erase(itr); + } else { itr++; @@ -408,6 +420,18 @@ void cRedstoneSimulator::HandleRedstoneWire(int a_BlockX, int a_BlockY, int a_Bl { 0,-1, -1}, /* Wires one lower, surrounding self stop */ } ; + static const struct // Define which directions the wire will check for repeater prescence + { + int x, y, z; + } gSideCoords[] = + { + { 1, 0, 0 }, + {-1, 0, 0 }, + { 0, 0, 1 }, + { 0, 0,-1 }, + { 0, 1, 0 }, + }; + // Check to see if directly beside a power source if (AreCoordsPowered(a_BlockX, a_BlockY, a_BlockZ)) { @@ -478,6 +502,14 @@ void cRedstoneSimulator::HandleRedstoneWire(int a_BlockX, int a_BlockY, int a_Bl if (m_World.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) != 0) // A powered wire { + for (size_t i = 0; i < ARRAYCOUNT(gSideCoords); i++) // Look for repeaters immediately surrounding self and try to power them + { + if (m_World.GetBlock(a_BlockX + gSideCoords[i].x, a_BlockY + gSideCoords[i].y, a_BlockZ + gSideCoords[i].z) == E_BLOCK_REDSTONE_REPEATER_OFF) + { + SetBlockPowered(a_BlockX + gSideCoords[i].x, a_BlockY + gSideCoords[i].y, a_BlockZ + gSideCoords[i].z, a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_REDSTONE_WIRE); + } + } + // Wire still powered, power blocks beneath SetBlockPowered(a_BlockX, a_BlockY - 1, a_BlockZ, a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_REDSTONE_WIRE); SetDirectionLinkedPowered(a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_YM, E_BLOCK_REDSTONE_WIRE); |