Skip to content
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
23 changes: 18 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#
# Build Image
#
ARG ALPINE_VERSION=3.15.0

FROM alpine:latest as builder
FROM alpine:${ALPINE_VERSION} AS alpine

# Add the git repo
ADD . /git/mapcrafter
#
# Build environment
#

FROM alpine as buildenv

# Dependencies needed for building Mapcrafter
# (not sure how many of these are actually needed)
Expand All @@ -19,6 +23,15 @@ RUN apk add \
libjpeg-turbo-dev \
boost-dev

#
# Build Mapcrafter from source
#

FROM buildenv as builder

# Add the git repo
ADD . /git/mapcrafter

# Build mapcrafter from source
RUN cd /git/mapcrafter && \
mkdir build && cd build && \
Expand All @@ -27,12 +40,11 @@ RUN cd /git/mapcrafter && \
mkdir /tmp/mapcrafter && \
make DESTDIR=/tmp/mapcrafter install


#
# Final Image
#

FROM alpine:latest
FROM alpine

# Mapcrafter, built in previous stage
COPY --from=builder /tmp/mapcrafter/ /
Expand All @@ -50,4 +62,5 @@ RUN apk add \

# Entrypoint
ADD entrypoint.sh /
ADD marker_entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
2 changes: 1 addition & 1 deletion MCVERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.16
1.18
4 changes: 4 additions & 0 deletions mapcrafter-cron/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM mapcrafter-fix:118

ADD generate_map.sh /
ENTRYPOINT ["/usr/sbin/crond", "-f", "-l", "8"]
2 changes: 2 additions & 0 deletions mapcrafter-cron/crontab
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# min hour day month weekday command
*/15 * * * * /generate_map.sh
12 changes: 12 additions & 0 deletions mapcrafter-cron/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3.9"
services:
mapcrafter-cron:
image: mapcrafter-cron:118
container_name: mapcrafter_hc_fabric118
environment:
- threads=16
volumes:
- ./crontab:/etc/crontabs/root
- /var/www:/output
- /etc/mapcrafter/config:/config
- /home/minecraft/1.18.0:/world
5 changes: 5 additions & 0 deletions mapcrafter-cron/generate_map.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

/marker_entrypoint.sh -c /config/render.conf
/entrypoint.sh -b -j $threads -c /config/render.conf

9 changes: 9 additions & 0 deletions marker_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

USER_ID=${LOCAL_USER_ID:-1000}
echo "Running as user $USER_ID"

useradd --shell /bin/sh -u $USER_ID -o -d /home/user -m user
mkdir -p /home/user && chown -R user:user /home/user

su -c "/usr/local/bin/mapcrafter_markers $*" user
8 changes: 4 additions & 4 deletions src/mapcraftercore/mc/worldentities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,12 @@ void WorldEntitiesCache::update(util::IProgressHandler* progress) {
const std::vector<uint8_t>& data = region.getChunkData(*chunk_it);
nbt.readNBT(reinterpret_cast<const char*>(&data[0]), data.size(),
mc::nbt::Compression::ZLIB);

nbt::TagCompound& level = nbt.findTag<nbt::TagCompound>("Level");
if (!level.hasTag<nbt::TagList>("TileEntities")) {

if (!nbt.hasTag<nbt::TagList>("block_entities")) {
continue;
}
nbt::TagList& entities = level.findTag<nbt::TagList>("TileEntities");

nbt::TagList& entities = nbt.findTag<nbt::TagList>("block_entities");
for (auto entity_it = entities.payload.begin();
entity_it != entities.payload.end(); ++entity_it) {
nbt::TagCompound entity = (*entity_it)->cast<nbt::TagCompound>();
Expand Down