Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for 1.13 #310

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ find_package(ZLIB REQUIRED)
find_package(PNG 1.2 REQUIRED)
find_package(Freetype 2 REQUIRED)
find_package(Threads REQUIRED)
find_package(Boost 1.46 COMPONENTS thread filesystem system REQUIRED)
find_package(Boost 1.46 COMPONENTS thread filesystem system regex REQUIRED)

include_directories(${CMAKE_SOURCE_DIR}/src)
include_directories(${ZLIB_INCLUDE_DIR})
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Requirements
* libz (?)
* libpng (>= 1.2)
* libfreetype (>= 2)
* libboost (thread, filesystem, system and test) (>= 1.46)
* libboost (thread, filesystem, system, regex and test) (>= 1.46)

Features
--------
Expand Down
101 changes: 99 additions & 2 deletions palette.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
"darken": false,
"legacy_id": 0
},
{
"namespace": "minecraft",
"material": "cave_air",
"mode": "block",
"top_color": [255, 255, 255, 0],
"darken": false
},
{
"namespace": "minecraft",
"material": "stone",
Expand Down Expand Up @@ -627,9 +634,18 @@
"material": "grass",
"mode": "block",
"top_color": [144, 188, 39, 255],
"side_color": [144, 188, 39, 255],
"darken": false,
"legacy_id": 31
"legacy_id": 31,
"legacy_meta": 0
},
{
"namespace": "minecraft",
"material": "fern",
"mode": "block",
"top_color": [120, 164, 13, 255],
"darken": false,
"legacy_id": 31,
"legacy_meta": 2
},
{
"namespace": "minecraft",
Expand Down Expand Up @@ -896,6 +912,24 @@
"legacy_id": 38,
"legacy_meta": 8
},
{
"namespace": "minecraft",
"material": "cornflower",
"mode": "block",
"top_color": [18, 136, 204, 245],
"darken": true,
"legacy_id": 38,
"legacy_meta": 9
},
{
"namespace": "minecraft",
"material": "lily_of_the_valley",
"mode": "block",
"top_color": [231, 231, 231, 255],
"darken": true,
"legacy_id": 38,
"legacy_meta": 10
},
{
"namespace": "minecraft",
"material": "brown_mushroom",
Expand Down Expand Up @@ -1055,6 +1089,13 @@
"top_color": [255, 225, 96, 208],
"darken": false
},
{
"namespace": "minecraft",
"material": "lantern",
"mode": "torch_block",
"top_color": [255, 225, 96, 208],
"darken": false
},
{
"namespace": "minecraft",
"material": "fire",
Expand Down Expand Up @@ -1154,6 +1195,7 @@
"namespace": "minecraft",
"material": "oak_door",
"mode": "block",
"top_color": [157, 128, 79, 255],
"darken": false,
"legacy_id": 64
},
Expand Down Expand Up @@ -1201,6 +1243,7 @@
"namespace": "minecraft",
"material": "iron_door",
"mode": "block",
"top_color": [217, 217, 217, 255],
"darken": false,
"legacy_id": 71
},
Expand Down Expand Up @@ -2953,34 +2996,39 @@
"namespace": "minecraft",
"material": "spruce_door",
"mode": "block",
"top_color": [102, 77, 46, 255],
"darken": false,
"legacy_id": 193
},
{
"namespace": "minecraft",
"material": "birch_door",
"mode": "block",
"top_color": [193, 177, 122, 255],
"darken": false,
"legacy_id": 194
},
{
"namespace": "minecraft",
"material": "jungle_door",
"mode": "block",
"top_color": [152, 109, 76, 255],
"darken": false,
"legacy_id": 195
},
{
"namespace": "minecraft",
"material": "acacia_door",
"mode": "block",
"top_color": [168, 91, 50, 255],
"darken": false,
"legacy_id": 196
},
{
"namespace": "minecraft",
"material": "dark_oak_door",
"mode": "block",
"top_color": [60, 39, 18, 255],
"darken": false,
"legacy_id": 197
},
Expand Down Expand Up @@ -3647,5 +3695,54 @@
"top_color": [98, 74, 98, 255],
"darken": true,
"legacy_id": 255
},
{
"namespace": "minecraft",
"material": "seagrass",
"mode": "block",
"top_color": [9, 161, 62, 64],
"darken": false
},
{
"namespace": "minecraft",
"material": "tall_seagrass",
"mode": "block",
"top_color": [9, 161, 62, 64],
"darken": false
},
{
"namespace": "minecraft",
"material": "sweet_berry_bush",
"mode": "block",
"top_color": [120, 164, 13, 255],
"darken": false
},
{
"namespace": "minecraft",
"material": "bamboo",
"mode": "block",
"top_color": [45, 125, 15, 255],
"darken": false
},
{
"namespace": "minecraft",
"material": "bamboo_sapling",
"top_color": [58, 111, 38, 255],
"mode": "block",
"darken": false
},
{
"namespace": "minecraft",
"material": "kelp",
"mode": "block",
"top_color": [9, 161, 62, 64],
"darken": false
},
{
"namespace": "minecraft",
"material": "kelp_plant",
"mode": "block",
"top_color": [9, 161, 62, 64],
"darken": false
}
]
12 changes: 6 additions & 6 deletions src/dirlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ bool dirlist::has_next(dir_filter_func dir_filter, file_filter_func file_filter)
if (directories.empty()) {
return false;
}

// work until you find any files
while (!directories.empty()) {
fs::path dir_path = directories.front();
directories.pop();

if (!fs::is_directory(dir_path)) {
continue;
}

fs::directory_iterator end_itr;

for ( fs::directory_iterator itr(dir_path);
Expand All @@ -35,19 +35,19 @@ bool dirlist::has_next(dir_filter_func dir_filter, file_filter_func file_filter)
if (!dir_filter(itr->path().stem().string())) {
continue;
}

directories.push(itr->path());
}
else if (fs::is_regular_file(itr->status())) {
if (!file_filter(path_string(itr->path().filename()))) {
continue;
}

files.push(itr->path());
}
}
}

return !files.empty();
}

Expand Down
32 changes: 2 additions & 30 deletions src/engine/block_rotation.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
#include "engine/block_rotation.hpp"

block_rotation::block_rotation(
int rotation,
boost::shared_ptr<nbt::ByteArray> array)
: x(0), z(0), rotation(rotation), array(array)
block_rotation::block_rotation(int rotation)
: rotation(rotation)
{
}

void block_rotation::set_xz(int x, int z) {
transform_xz(x, z);
this->x = x;
this->z = z;
}

void block_rotation::transform_xz(int& x, int& z) {
int t = x;

Expand All @@ -31,23 +23,3 @@ void block_rotation::transform_xz(int& x, int& z) {
break;
};
}

/**
*/
int block_rotation::get8(int y, int d) {
int p = ((y * 16 + z) * 16 + x);
if (!(p >= 0 && p < array->length)) return d;
return array->values[p] & 0xff;
}

/**
* Data values are packed two by two and the position LSB decides which
* half-byte contains the requested block data value.
*/
int block_rotation::get4(int y, int d) {
int tmp = (y * 16 + z) * 16 + x;
int p = tmp >> 1;
int b = tmp & 0x1;
if (!(p >= 0 && p < array->length)) return d;
return (array->values[p] >> (b * 4)) & 0xf;
}
8 changes: 2 additions & 6 deletions src/engine/block_rotation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,13 @@

class block_rotation {
public:
block_rotation(int rotation, boost::shared_ptr<nbt::ByteArray> array);
block_rotation(int rotation);

void set_xz(int x, int z);
void transform_xz(int& x, int& z);

int get8(int y, int d=-1);
int get4(int y, int d=-1);
private:
int x, z;
int rotation;
boost::shared_ptr<nbt::ByteArray> array;

};

#endif /* _ENGINE_BLOCK_ROTATION_HPP */
Loading