Remove now unneeded exceptions

This commit is contained in:
Blue (Lukas Rieger) 2020-07-29 20:11:25 +02:00
parent a33dda0a29
commit ca4fec8c1a
8 changed files with 18 additions and 49 deletions

View File

@ -24,8 +24,6 @@
*/
package de.bluecolored.bluemap.common;
import java.io.IOException;
import com.flowpowered.math.vector.Vector2i;
import com.google.common.base.Preconditions;
@ -68,7 +66,7 @@ public TileRenderer getTileRenderer() {
return tileRenderer;
}
public void renderTile(Vector2i tile) throws IOException {
public void renderTile(Vector2i tile) {
getTileRenderer().render(new WorldTile(getWorld(), tile));
}

View File

@ -161,11 +161,7 @@ private void renderThread() {
}
if (ticket != null) {
try {
ticket.render();
} catch (IOException e) {
Logger.global.logDebug("Failed to render tile " + ticket.getTile() + " of map '" + ticket.getMapType().getId() + "' after " + ticket.getRenderAttempts() + " render-attempts! (" + e.toString() + ")");
}
ticket.render();
} else {
try {
Thread.sleep(1000); // we don't need a super fast response time, so waiting a second is totally fine

View File

@ -24,7 +24,6 @@
*/
package de.bluecolored.bluemap.common;
import java.io.IOException;
import java.util.Objects;
import com.flowpowered.math.vector.Vector2i;
@ -34,25 +33,13 @@ public class RenderTicket {
private final MapType map;
private final Vector2i tile;
private int renderAttempts;
private boolean successfullyRendered;
public RenderTicket(MapType map, Vector2i tile) {
this.map = map;
this.tile = tile;
this.renderAttempts = 0;
this.successfullyRendered = false;
}
public synchronized void render() throws IOException {
renderAttempts++;
if (!successfullyRendered) {
map.renderTile(tile);
successfullyRendered = true;
}
public synchronized void render() {
map.renderTile(tile);
}
public MapType getMapType() {
@ -63,10 +50,6 @@ public Vector2i getTile() {
return tile;
}
public int getRenderAttempts() {
return renderAttempts;
}
@Override
public int hashCode() {
return Objects.hash(map.getId(), tile);

View File

@ -350,14 +350,10 @@ public int debugCommand(CommandContext<S> context) throws CommandSyntaxException
String blockBelowIdMeta = "";
if (world instanceof MCAWorld) {
try {
Chunk chunk = ((MCAWorld) world).getChunk(MCAWorld.blockToChunk(blockPos));
if (chunk instanceof ChunkAnvil112) {
blockIdMeta = " (" + ((ChunkAnvil112) chunk).getBlockIdMeta(blockPos) + ")";
blockBelowIdMeta = " (" + ((ChunkAnvil112) chunk).getBlockIdMeta(blockPos.add(0, -1, 0)) + ")";
}
} catch (IOException ex) {
Logger.global.logError("Failed to read chunk for debug!", ex);
Chunk chunk = ((MCAWorld) world).getChunk(MCAWorld.blockToChunk(blockPos));
if (chunk instanceof ChunkAnvil112) {
blockIdMeta = " (" + ((ChunkAnvil112) chunk).getBlockIdMeta(blockPos) + ")";
blockBelowIdMeta = " (" + ((ChunkAnvil112) chunk).getBlockIdMeta(blockPos.add(0, -1, 0)) + ")";
}
}

View File

@ -268,7 +268,7 @@ private Chunk loadChunk(Vector2i chunkPos) throws IOException {
}
@Override
public boolean isChunkGenerated(Vector2i chunkPos) throws IOException {
public boolean isChunkGenerated(Vector2i chunkPos) {
Chunk chunk = getChunk(chunkPos);
return chunk.isGenerated();
}

View File

@ -24,8 +24,6 @@
*/
package de.bluecolored.bluemap.core.render;
import java.io.IOException;
import de.bluecolored.bluemap.core.render.hires.HiresModel;
import de.bluecolored.bluemap.core.render.hires.HiresModelManager;
import de.bluecolored.bluemap.core.render.lowres.LowresModelManager;
@ -42,9 +40,8 @@ public TileRenderer(HiresModelManager hiresModelManager, LowresModelManager lowr
/**
* Renders the provided WorldTile (only) if the world is generated
* @throws IOException If an IO-Exception occurs during the render
*/
public void render(WorldTile tile) throws IOException {
public void render(WorldTile tile) {
//check if the region is generated before rendering, don't render if it's not generated
AABB area = hiresModelManager.getTileRegion(tile);
if (!tile.getWorld().isAreaGenerated(area)) return;

View File

@ -24,7 +24,6 @@
*/
package de.bluecolored.bluemap.core.world;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Collection;
import java.util.UUID;
@ -114,24 +113,24 @@ public Collection<Vector2i> getChunkList(long modifiedSince, Predicate<Vector2i>
}
@Override
public boolean isChunkGenerated(Vector2i chunkPos) throws IOException {
public boolean isChunkGenerated(Vector2i chunkPos) {
if (!isInside(chunkPos)) return false;
return world.isChunkGenerated(chunkPos);
}
@Override
public boolean isAreaGenerated(AABB area) throws IOException {
public boolean isAreaGenerated(AABB area) {
return isAreaGenerated(area.getMin(), area.getMax());
}
@Override
public boolean isAreaGenerated(Vector3i blockMin, Vector3i blockMax) throws IOException {
public boolean isAreaGenerated(Vector3i blockMin, Vector3i blockMax) {
return isAreaGenerated(blockPosToChunkPos(blockMin), blockPosToChunkPos(blockMax));
}
@Override
public boolean isAreaGenerated(Vector2i chunkMin, Vector2i chunkMax) throws IOException {
public boolean isAreaGenerated(Vector2i chunkMin, Vector2i chunkMax) {
if (!isInside(chunkMin) &&
!isInside(chunkMax) &&
!isInside(new Vector2i(chunkMin.getX(), chunkMax.getY())) &&

View File

@ -110,7 +110,7 @@ public default Collection<Vector2i> getChunkList(long modifiedSince){
/**
* Returns true if and only if that chunk is fully generated and no world-generation or lighting has yet to be done.
*/
public boolean isChunkGenerated(Vector2i chunkPos) throws IOException;
public boolean isChunkGenerated(Vector2i chunkPos);
/**
@ -118,7 +118,7 @@ public default Collection<Vector2i> getChunkList(long modifiedSince){
* @param area The area to check
* @throws IOException
*/
public default boolean isAreaGenerated(AABB area) throws IOException {
public default boolean isAreaGenerated(AABB area) {
return isAreaGenerated(area.getMin(), area.getMax());
}
@ -127,7 +127,7 @@ public default boolean isAreaGenerated(AABB area) throws IOException {
* @param area The area to check
* @throws IOException
*/
public default boolean isAreaGenerated(Vector3i blockMin, Vector3i blockMax) throws IOException {
public default boolean isAreaGenerated(Vector3i blockMin, Vector3i blockMax) {
return isAreaGenerated(blockPosToChunkPos(blockMin), blockPosToChunkPos(blockMax));
}
@ -136,7 +136,7 @@ public default boolean isAreaGenerated(Vector3i blockMin, Vector3i blockMax) thr
* @param area The area to check
* @throws IOException
*/
public default boolean isAreaGenerated(Vector2i chunkMin, Vector2i chunkMax) throws IOException {
public default boolean isAreaGenerated(Vector2i chunkMin, Vector2i chunkMax) {
for (int x = chunkMin.getX(); x <= chunkMax.getX(); x++) {
for (int z = chunkMin.getY(); z <= chunkMax.getY(); z++) {
if (!isChunkGenerated(new Vector2i(x, z))) return false;