Skip to content

Commit

Permalink
Merge pull request #331 from FTBTeam/1.20.1/dev
Browse files Browse the repository at this point in the history
1.20.1/dev
  • Loading branch information
desht authored Nov 19, 2024
2 parents 52d9e4f + e676ff8 commit 1ce4026
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 18 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2001.3.3]

### Fixed
* Do some extra client-side map init checks which should resolve some issues with clients switching server, using technologies like Velocity proxy
* Possibly fixed an issue leading to hangs on server shutdown (hard to know for certain; the issue is difficult to reproduce)

## [2001.3.2]

### Added
Expand Down
3 changes: 0 additions & 3 deletions common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunks.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,11 @@
import org.jetbrains.annotations.Nullable;

import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class FTBChunks {
public static final String MOD_ID = "ftbchunks";
public static final Logger LOGGER = LogManager.getLogger("FTB Chunks");
public static final Gson GSON = new GsonBuilder().disableHtmlEscaping().setLenient().create();
public static final ExecutorService EXECUTOR = Executors.newSingleThreadExecutor();

public static FTBChunks instance;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@
import org.lwjgl.opengl.GL11;

import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Function;
import java.util.stream.Collectors;

Expand All @@ -103,6 +105,7 @@
public enum FTBChunksClient {
INSTANCE;

public static final ExecutorService MAP_EXECUTOR = Executors.newSingleThreadExecutor();
private static final ResourceLocation BUTTON_ID_MAP = new ResourceLocation("ftbchunks:open_gui");
private static final ResourceLocation BUTTON_ID_CLAIM = new ResourceLocation("ftbchunks:open_claim_gui");

Expand Down Expand Up @@ -1089,7 +1092,7 @@ public void handlePacket(ClientboundLevelChunkWithLightPacket p) {

public void queueOrExecute(MapTask task) {
// Implement this config later
FTBChunks.EXECUTOR.execute(task);
MAP_EXECUTOR.execute(task);
}

public void handlePacket(ClientboundBlockUpdatePacket p) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import dev.ftb.mods.ftbchunks.FTBChunks;
import dev.ftb.mods.ftbchunks.api.FTBChunksAPI;
import dev.ftb.mods.ftbchunks.client.ClientTaskQueue;
import dev.ftb.mods.ftbchunks.client.FTBChunksClient;
import dev.ftb.mods.ftblibrary.math.XZ;
import it.unimi.dsi.fastutil.longs.Long2IntMap;
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
Expand Down Expand Up @@ -169,7 +170,7 @@ public void runMapTask() throws Exception {
List<MapRegion> regionList = ImmutableList.copyOf(getRegions().values());

if (!waypoints.isEmpty() || !regionList.isEmpty()) {
FTBChunks.EXECUTOR.execute(() -> {
FTBChunksClient.MAP_EXECUTOR.execute(() -> {
try {
writeData(waypoints, regionList);
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ public static Optional<MapManager> getInstance() {
}

public static void startUp(UUID serverId) {
// Ensure if existing manager instance is cleaned up first
// Necessary if player is switching servers, e.g. with Velocity proxy or similar
shutdown();

Path dir = Platform.getGameFolder().resolve("local/ftbchunks/data/" + serverId);
if (Files.notExists(dir)) {
try {
Expand Down Expand Up @@ -234,7 +238,7 @@ public void runMapTask() throws Exception {
.map(key -> String.format("#%03X %s", key.getIntKey(), key.getValue().location()))
.collect(Collectors.toList());

FTBChunks.EXECUTOR.execute(() -> {
FTBChunksClient.MAP_EXECUTOR.execute(() -> {
try {
Files.write(directory.resolve("dimensions.txt"), dimensionsList);
Files.write(directory.resolve("block_map.txt"), blockColorIndexMapList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public MapRegionData getDataBlockingNoSync() {
public MapRegionData getData() {
if (data == null && !isLoadingData) {
isLoadingData = true;
FTBChunks.EXECUTOR.execute(this::getDataBlocking);
FTBChunksClient.MAP_EXECUTOR.execute(this::getDataBlocking);
}

if (data != null) {
Expand All @@ -115,7 +115,7 @@ public NativeImage getRenderedMapImage() {
updateRenderedMapImage = false;
mapImageLoaded = false;
renderingMapImage = true;
FTBChunks.EXECUTOR.execute(new RenderMapImageTask(this));
FTBChunksClient.MAP_EXECUTOR.execute(new RenderMapImageTask(this));
}

return renderedMapImage;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.ftb.mods.ftbchunks.client.map;

import dev.ftb.mods.ftbchunks.FTBChunks;
import dev.ftb.mods.ftbchunks.client.FTBChunksClient;
import dev.ftb.mods.ftbchunks.util.HeightUtils;
import dev.ftb.mods.ftblibrary.math.XZ;

Expand Down Expand Up @@ -160,7 +161,7 @@ public void write() throws IOException {
}
}

FTBChunks.EXECUTOR.execute(() -> {
FTBChunksClient.MAP_EXECUTOR.execute(() -> {
try {
writeData(chunkList, dataImage, foliageImage, grassImage, waterImage, blocksImage);
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.ftb.mods.ftbchunks.core.mixin;

import dev.ftb.mods.ftbchunks.FTBChunks;
import dev.ftb.mods.ftbchunks.client.FTBChunksClient;
import net.minecraft.Util;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -14,17 +15,17 @@ public abstract class UtilMixin {
@Inject(method = "shutdownExecutors", at = @At("RETURN"))
private static void shutdownExecutorsFTBC(CallbackInfo ci) {
FTBChunks.LOGGER.info("Shutting down map thread");
FTBChunks.EXECUTOR.shutdown();
FTBChunksClient.MAP_EXECUTOR.shutdown();

boolean b;
try {
b = FTBChunks.EXECUTOR.awaitTermination(3L, TimeUnit.SECONDS);
b = FTBChunksClient.MAP_EXECUTOR.awaitTermination(3L, TimeUnit.SECONDS);
} catch (InterruptedException var3) {
b = false;
}

if (!b) {
FTBChunks.EXECUTOR.shutdownNow();
FTBChunksClient.MAP_EXECUTOR.shutdownNow();
}
}
}
6 changes: 3 additions & 3 deletions common/src/main/resources/ftbchunks-common.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"ArmorStandMixin",
"BiomeMixin",
"BlockStateMixin",
"ChunkMapMixin",
"UtilMixin"
"ChunkMapMixin"
],
"client": [
"ClientPacketListenerMixin",
"GuiMixin"
"GuiMixin",
"UtilMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down
2 changes: 1 addition & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ if (ENV.CURSEFORGE_KEY) {
requiredDependency 'ftb-teams-fabric'
optionalDependency 'ftb-ranks-fabric'
}
changelog = ENV.CHANGELOG // expected to exist if ENV.CURSEFORGE_KEY does
changelog = createChangelog(project)
changelogType = 'markdown'
}
}
Expand Down
2 changes: 1 addition & 1 deletion forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ if (ENV.CURSEFORGE_KEY) {
requiredDependency 'ftb-teams-forge'
optionalDependency 'ftb-ranks-forge'
}
changelog = ENV.CHANGELOG // expected to exist if ENV.CURSEFORGE_KEY does
changelog = createChangelog(project)
changelogType = 'markdown'
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.daemon=false
mod_id=ftbchunks
archives_base_name=ftb-chunks
maven_group=dev.ftb.mods
mod_version=2001.3.2
mod_version=2001.3.3
mod_author=FTB Team

minecraft_version=1.20.1
Expand Down

0 comments on commit 1ce4026

Please sign in to comment.