Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

1.5 updates (Open Window 0x64 packet changed and moved to protocol.h)

  • Loading branch information...
commit 1a7f98e4e7ba7418ee7ab551b667772a8d3bede0 1 parent df027bf
Marko Viitanen authored
6 README.md
View
@@ -5,7 +5,7 @@ Custom Minecraft server software written in C++.
You can find the core team from #mineserver @ irc.freenode.net Also mail to developers@mineserver.be will reach us.
- Copyright (c) 2010-2012, The Mineserver Project
+ Copyright (c) 2010-2013, The Mineserver Project
**NOTICE:** Server still lacks features compared to original minecraft server.
@@ -25,7 +25,7 @@ C++ compiler. MS Visual C++ 10 and GCC 4.4 should be sufficient. The build syste
### Supported Minecraft version
- * Working with 1.4.6 client (protocol 51)
+ * Working with 1.5.0 client (protocol 60)
### Features
@@ -39,7 +39,7 @@ C++ compiler. MS Visual C++ 10 and GCC 4.4 should be sufficient. The build syste
* Flatland and terrain map generation (Also biomegen!)
* Working chests, furnaces & signs
* User validation from minecraft.net
- * Protocol Encryption (NEW)
+ * Protocol Encryption
### Configuration Notes
2  include/packets.h
View
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2012, The Mineserver Project
+ Copyright (c) 2013, The Mineserver Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
7 include/protocol.h
View
@@ -62,6 +62,13 @@ class Protocol
}
#endif
+ static Packet openWindow(int8_t windowId, int8_t type, std::string title, int8_t slots, int8_t useCustomTitle = 0)
+ {
+ Packet ret;
+ ret << (int8_t)PACKET_OPEN_WINDOW << windowId << type << title << slots << useCustomTitle;
+ return ret;
+ }
+
static Packet animation(int eid, int aid)
{
Packet ret;
6 src/constants.cpp
View
@@ -34,10 +34,10 @@ std::map<uint8_t, DropPtr> BLOCKDROPS;
const unsigned int SERVER_CONSOLE_UID = -1;
-const std::string VERSION = "0.1.18 (Alpha)";
+const std::string VERSION = "0.1.19 (Alpha)";
-const int PROTOCOL_VERSION = 51;
-const std::string MINECRAFT_VERSION = "1.4.6";
+const int PROTOCOL_VERSION = 60;
+const std::string MINECRAFT_VERSION = "1.5.0";
const char COMMENTPREFIX = '#';
23 src/inventory.cpp
View
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2011, The Mineserver Project
+ Copyright (c) 2013, The Mineserver Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -975,15 +975,17 @@ bool Inventory::windowOpen(User* user, int8_t type, int32_t x, int32_t y, int32_
}
if(_chestData == NULL)
break;
-
- user->buffer << (int8_t)PACKET_OPEN_WINDOW << (int8_t)type << (int8_t)INVENTORYTYPE_CHEST;
+ std::string windowName;
+
if(_chestData->large())
{
- user->buffer << std::string("Large chest");
- } else {
- user->buffer << std::string("Chest");
+ windowName = "Large chest";
+ }
+ else
+ {
+ windowName = "Chest";
}
- user->buffer << (int8_t)(_chestData->size()); // size.. not a very good idea. lets just hope this will only return 27 or 54
+ user->buffer << Protocol::openWindow(type,INVENTORYTYPE_CHEST,windowName, _chestData->size());
for (size_t j = 0; j < _chestData->size(); j++)
{
@@ -999,8 +1001,7 @@ bool Inventory::windowOpen(User* user, int8_t type, int32_t x, int32_t y, int32_
break;
case WINDOW_WORKBENCH:
- user->buffer << (int8_t)PACKET_OPEN_WINDOW << (int8_t)WINDOW_WORKBENCH << (int8_t)INVENTORYTYPE_WORKBENCH;
- user->buffer << std::string("Workbench") << (int8_t)0;
+ user->buffer << Protocol::openWindow(WINDOW_WORKBENCH,INVENTORYTYPE_WORKBENCH,std::string("Workbench"), 0);
for (uint32_t i = 0; i < openWorkbenches.size(); i++)
{
@@ -1024,9 +1025,7 @@ bool Inventory::windowOpen(User* user, int8_t type, int32_t x, int32_t y, int32_
}
break;
case WINDOW_FURNACE:
-
- user->buffer << (int8_t)PACKET_OPEN_WINDOW << (int8_t)WINDOW_FURNACE << (int8_t)INVENTORYTYPE_FURNACE;
- user->buffer << std::string("Furnace") << (int8_t)0;
+ user->buffer << Protocol::openWindow(WINDOW_FURNACE,INVENTORYTYPE_FURNACE,std::string("Furnace"), 0);
for (uint32_t i = 0; i < chunk->furnaces.size(); i++)
{
23 src/redstoneSimulation.cpp
View
@@ -204,14 +204,14 @@ RedstoneSimulation::Power RedstoneSimulation::getPower(int32_t x, int16_t y, int
{
uint8_t block;
uint8_t meta = 0;
- bool weak = false;
// Check block type
if (!ServerInstance->map(map)->getBlock(x + 1, y, z, &block, &meta))
{
return POWER_NONE;
}
- if (!isBlockSolid(block)) {
+ if (!isBlockSolid(block))
+ {
return POWER_NONE;
}
@@ -232,7 +232,7 @@ RedstoneSimulation::Power RedstoneSimulation::getPower(int32_t x, int16_t y, int
else if (block == BLOCK_REDSTONE_WIRE && meta != 0)
{
// TODO: Check if wire ends here
- weak = true;
+ return POWER_WEAK;
}
// South
@@ -247,7 +247,7 @@ RedstoneSimulation::Power RedstoneSimulation::getPower(int32_t x, int16_t y, int
}
else if (block == BLOCK_REDSTONE_WIRE && meta != 0)
{
- weak = true;
+ return POWER_WEAK;
}
// East
@@ -262,7 +262,7 @@ RedstoneSimulation::Power RedstoneSimulation::getPower(int32_t x, int16_t y, int
}
else if (block == BLOCK_REDSTONE_WIRE && meta != 0)
{
- weak = true;
+ return POWER_WEAK;
}
// West
@@ -277,16 +277,17 @@ RedstoneSimulation::Power RedstoneSimulation::getPower(int32_t x, int16_t y, int
}
else if (block == BLOCK_REDSTONE_WIRE && meta != 0)
{
- weak = true;
+ return POWER_WEAK;
}
- // Switch or pressure plate on top of the block
+
if (!ServerInstance->map(map)->getBlock(x, y + 1, z, &block, &meta))
{
return POWER_NONE;
}
- if (block == BLOCK_WOODEN_PRESSURE_PLATE || block == BLOCK_STONE_PRESSURE_PLATE && (meta & 0x1) == 0x1)
+ // Switch or pressure plate on top of the block
+ if ((block == BLOCK_WOODEN_PRESSURE_PLATE || block == BLOCK_STONE_PRESSURE_PLATE) && (meta & 0x1) == 0x1)
{
return POWER_NORMAL;
}
@@ -298,7 +299,7 @@ RedstoneSimulation::Power RedstoneSimulation::getPower(int32_t x, int16_t y, int
// Wire on top of the block
else if (block == BLOCK_REDSTONE_WIRE && meta != 0)
{
- weak = true;
+ return POWER_WEAK;
}
// Torch beneath the block
@@ -311,10 +312,6 @@ RedstoneSimulation::Power RedstoneSimulation::getPower(int32_t x, int16_t y, int
return POWER_NORMAL;
}
- if (weak) {
- return POWER_WEAK;
- }
-
// No power
return POWER_NONE;
}
Please sign in to comment.
Something went wrong with that request. Please try again.