Skip to content

Commit

Permalink
Merge branch 'mc/1.13' into mc/1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
TBlueF committed Mar 29, 2020
2 parents 533d5e8 + de8031e commit 0ffd46c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion BlueMapBukkit/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: BlueMap
description: "A 3d-map of your Minecraft worlds view-able in your browser using three.js (WebGL)"
main: de.bluecolored.bluemap.bukkit.BukkitPlugin
version: "0.5.0-mc1.12"
version: "0.5.1-mc1.12"
author: "Blue (TBlueF / Lukas Rieger)"
authors: [Blue (TBlueF / Lukas Rieger)]
website: "https://github.com/BlueMap-Minecraft"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ public void addRenderTask(RenderTask task) {
}

public RenderTicket createTicket(MapType mapType, Vector2i tile) {
RenderTicket ticket = new RenderTicket(mapType, tile);
return createTicket(new RenderTicket(mapType, tile));
}

private RenderTicket createTicket(RenderTicket ticket) {
synchronized (renderTickets) {
if (renderTicketMap.putIfAbsent(ticket, ticket) == null) {
renderTickets.add(ticket);
Expand Down Expand Up @@ -138,7 +141,12 @@ private void renderThread() {
try {
ticket.render();
} catch (IOException e) {
Logger.global.logError("Failed to render tile " + ticket.getTile() + " of map '" + ticket.getMapType().getId() + "'!", e);
if (ticket.getRenderAttempts() < 3) {
Logger.global.logDebug("Failed to render tile " + ticket.getTile() + " of map '" + ticket.getMapType().getId() + "', rescheduling for " + (ticket.getRenderAttempts() + 1) + ". attempt..");
createTicket(ticket); //this might be a temporary issue, so we reschedule ticket for another attempt
} else {
Logger.global.logError("Failed to render tile " + ticket.getTile() + " of map '" + ticket.getMapType().getId() + "'!", e);
}
}
} else {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ public class RenderTicket {
private final MapType map;
private final Vector2i tile;

private int renderAttempts;
private boolean finished;

public RenderTicket(MapType map, Vector2i tile) {
this.map = map;
this.tile = tile;

this.renderAttempts = 0;
this.finished = false;
}

public synchronized void render() throws IOException {
renderAttempts++;

if (!finished) {
map.renderTile(tile);

Expand All @@ -34,6 +39,10 @@ public Vector2i getTile() {
return tile;
}

public int getRenderAttempts() {
return renderAttempts;
}

public boolean isFinished() {
return finished;
}
Expand Down
2 changes: 1 addition & 1 deletion BlueMapCommon/src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"modid": "bluemap",
"name": "BlueMap",
"version": "0.5.0-mc1.12",
"version": "0.5.1-mc1.12",
"description": "A 3d-map of your Minecraft worlds view-able in your browser using three.js (WebGL)",
"url": "https://github.com/BlueMap-Minecraft",
"authorList": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

public class BlueMap {

public static final String VERSION = "0.5.0-mc1.12";
public static final String VERSION = "0.5.1-mc1.12";

}
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public Chunk getChunk(Vector2i chunkPos) throws IOException {
private Chunk loadChunk(Vector2i chunkPos) throws IOException {
Vector2i regionPos = chunkToRegion(chunkPos);
Path regionPath = getMCAFilePath(regionPos);

try (RandomAccessFile raf = new RandomAccessFile(regionPath.toFile(), "r")) {

int xzChunk = Math.floorMod(chunkPos.getY(), 32) * 32 + Math.floorMod(chunkPos.getX(), 32);
Expand Down Expand Up @@ -248,9 +248,6 @@ private Chunk loadChunk(Vector2i chunkPos) throws IOException {
} else {
throw new IOException("invalid data tag: " + (tag == null ? "null" : tag.getClass().getName()));
}

} catch (FileNotFoundException ex) {
return Chunk.empty(this, chunkPos);
}
}

Expand Down

0 comments on commit 0ffd46c

Please sign in to comment.