Skip to content

Commit 5e7606e

Browse files
authored
Merge pull request #337 from FTBTeam/dev
Dev
2 parents 476436a + d54d523 commit 5e7606e

23 files changed

+250
-40
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2101.1.4]
8+
9+
### Added
10+
* Added protection for pistons moving blocks, including large block structure (e.g. vanilla-style flying machines)
11+
* Enabled by default; can be disabled via 'piston_protection' server setting
12+
* When enabled, pistons cannot push blocks from the chunk the piston is in to another chunk if the new chunk is owned by a different team, and that team does not have public block-edit permissions
13+
* Similar restrictions apply to blocks which would be destroyed by piston moving
14+
* Add client config setting "Pointer Icon Mode" to control the appearance of the player pointer icon on maps
15+
* Can display the player face, a heading arrow, or both
16+
* Displayed component values for the minimap can now be configured via the client config screen
17+
18+
### Fixed
19+
* Possibly fixed an issue leading to hangs on server shutdown (hard to know for certain; the issue is difficult to reproduce)
20+
* Fixed output of `/ftbchunks admin unload_everything` being misleading
21+
* The command ran correctly, un-forceloading all forceloaded chunks, but reported the number of _all_ claimed chunks, not just the forceloaded ones
22+
* Fixed colouring for some blocks (primarily redstone-related) on the map/minimap leading to an ugly-looking artifacts on the map
23+
* Integrated Dynamics Menril Leaves now show up as light blue on the map instead of the default green
24+
725
## [2101.1.3]
826

927
### Changed

common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunks.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
import dev.architectury.utils.Env;
1313
import dev.architectury.utils.EnvExecutor;
1414
import dev.architectury.utils.value.IntValue;
15-
import dev.ftb.mods.ftbchunks.api.ClaimedChunk;
16-
import dev.ftb.mods.ftbchunks.api.FTBChunksAPI;
17-
import dev.ftb.mods.ftbchunks.api.FTBChunksProperties;
18-
import dev.ftb.mods.ftbchunks.api.Protection;
15+
import dev.ftb.mods.ftbchunks.api.*;
1916
import dev.ftb.mods.ftbchunks.client.FTBChunksClient;
2017
import dev.ftb.mods.ftbchunks.data.*;
2118
import dev.ftb.mods.ftbchunks.net.*;
@@ -62,14 +59,11 @@
6259
import org.jetbrains.annotations.Nullable;
6360

6461
import java.util.*;
65-
import java.util.concurrent.ExecutorService;
66-
import java.util.concurrent.Executors;
6762

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

7468
public static FTBChunks instance;
7569

@@ -600,4 +594,5 @@ private void serverTickPost(MinecraftServer minecraftServer) {
600594
ClaimExpirationManager.INSTANCE.tick(minecraftServer);
601595
LongRangePlayerTracker.INSTANCE.tick(minecraftServer);
602596
}
597+
603598
}

common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunksCommands.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,8 @@ private static int setExtraForceLoadChunks(CommandSourceStack source, ServerPlay
504504

505505
private static int unclaimEverything(CommandSourceStack source) {
506506
int claimedChunks = 0;
507-
for (ClaimedChunkImpl c : new ArrayList<>(claimManager().getAllClaimedChunks())) {
507+
for (ClaimedChunk c : new ArrayList<>(claimManager().getAllClaimedChunks())) {
508508
c.getTeamData().unclaim(source, c.getPos(), false);
509-
c.getTeamData().markDirty();
510509
claimedChunks++;
511510
}
512511
int finalClaimedChunks = claimedChunks;
@@ -516,10 +515,9 @@ private static int unclaimEverything(CommandSourceStack source) {
516515

517516
private static int unclaimDimension(CommandSourceStack source, ResourceKey<Level> dim) {
518517
int claimedChunks = 0;
519-
for (ClaimedChunkImpl c : new ArrayList<>(claimManager().getAllClaimedChunks())) {
518+
for (ClaimedChunk c : new ArrayList<>(claimManager().getAllClaimedChunks())) {
520519
if (source.getLevel().dimension().equals(dim)) {
521520
c.getTeamData().unclaim(source, c.getPos(), false);
522-
c.getTeamData().markDirty();
523521
claimedChunks++;
524522
}
525523
}
@@ -534,13 +532,17 @@ private static int unclaimDimension(CommandSourceStack source) {
534532

535533
private static int unloadEverything(CommandSourceStack source) {
536534
int unloadedChunks = 0;
537-
for (ClaimedChunkImpl c : new ArrayList<>(claimManager().getAllClaimedChunks())) {
538-
c.getTeamData().unForceLoad(source, c.getPos(), false);
539-
c.getTeamData().markDirty();
540-
unloadedChunks++;
535+
int totalChunks = 0;
536+
for (ClaimedChunk c : claimManager().getAllClaimedChunks()) {
537+
if (c.isForceLoaded()) {
538+
c.getTeamData().unForceLoad(source, c.getPos(), false);
539+
unloadedChunks++;
540+
}
541+
totalChunks++;
541542
}
542-
int finalUnloadedChunks = unloadedChunks;
543-
source.sendSuccess(() -> Component.translatable("ftbchunks.command.unloaded", finalUnloadedChunks), true);
543+
final int finalUnloadedChunks = unloadedChunks;
544+
final int finalTotalChunks = totalChunks;
545+
source.sendSuccess(() -> Component.translatable("ftbchunks.commands.unloaded", finalUnloadedChunks, finalTotalChunks), true);
544546
return Command.SINGLE_SUCCESS;
545547
}
546548

common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunksWorldConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public interface FTBChunksWorldConfig {
4141
.comment("If true, the player must have the 'ftbchunks_mapping' Game stage to be able to use the map and minimap.\nRequires KubeJS and/or Gamestages to be installed.");
4242
BooleanValue LOCATION_MODE_OVERRIDE = CONFIG.addBoolean("location_mode_override", false)
4343
.comment("If true, \"Location Visibility\" team settings are ignored, and all players can see each other anywhere on the map.");
44+
BooleanValue PISTON_PROTECTION = CONFIG.addBoolean("piston_protection", true)
45+
.comment("If true, pistons are prevented from pushing/pulling blocks across claims owned by different teams (unless the target claim has public 'edit block' permissions defined). If 'disable_protection' is set to true, this setting is ignored.");
4446

4547
SNBTConfig FAKE_PLAYERS = CONFIG.addGroup("fake_players");
4648
EnumValue<ProtectionPolicy> ALLOW_FAKE_PLAYERS = FAKE_PLAYERS.addEnum("fake_players", NameMap.of(ProtectionPolicy.CHECK, ProtectionPolicy.values()).create())

common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,16 @@
144144
import java.util.Optional;
145145
import java.util.Set;
146146
import java.util.UUID;
147+
import java.util.concurrent.ExecutorService;
148+
import java.util.concurrent.Executors;
147149
import java.util.function.Function;
148150
import java.util.stream.Collectors;
149151

150152
public enum FTBChunksClient {
151153
INSTANCE;
152154

155+
public static final ExecutorService MAP_EXECUTOR = Executors.newSingleThreadExecutor();
156+
153157
public static final ResourceLocation WAYPOINT_BEAM = FTBChunksAPI.rl("textures/waypoint_beam.png");
154158
private static final ResourceLocation BUTTON_ID_MAP = FTBChunksAPI.rl("open_gui");
155159
private static final ResourceLocation BUTTON_ID_CLAIM = FTBChunksAPI.rl("open_claim_gui");
@@ -1106,8 +1110,15 @@ private void mapIcons(MapIconEvent event) {
11061110
}
11071111

11081112
if (!event.getMapType().isMinimap()) {
1109-
event.add(new EntityMapIcon(mc.player, FaceIcon.getFace(mc.player.getGameProfile())));
1110-
event.add(new PointerIcon());
1113+
PointerIconMode pointerIconMode = FTBChunksClientConfig.POINTER_ICON_MODE.get();
1114+
1115+
if (pointerIconMode.showFace()) {
1116+
event.add(new EntityMapIcon(mc.player, FaceIcon.getFace(mc.player.getGameProfile())));
1117+
}
1118+
1119+
if (pointerIconMode.showPointer()) {
1120+
event.add(new PointerIcon());
1121+
}
11111122
}
11121123
}
11131124

@@ -1158,7 +1169,7 @@ public void handlePacket(ClientboundLevelChunkWithLightPacket p) {
11581169

11591170
public void queueOrExecute(MapTask task) {
11601171
// Implement this config later
1161-
FTBChunks.EXECUTOR.execute(task);
1172+
MAP_EXECUTOR.execute(task);
11621173
}
11631174

11641175
public void handlePacket(ClientboundBlockUpdatePacket p) {

common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClientConfig.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
import dev.architectury.networking.NetworkManager;
44
import dev.architectury.platform.Platform;
5+
import dev.ftb.mods.ftbchunks.EntityTypeBoolMapValue;
56
import dev.ftb.mods.ftbchunks.FTBChunks;
67
import dev.ftb.mods.ftbchunks.FTBChunksWorldConfig;
7-
import dev.ftb.mods.ftbchunks.EntityTypeBoolMapValue;
88
import dev.ftb.mods.ftbchunks.client.map.BiomeBlendMode;
99
import dev.ftb.mods.ftbchunks.client.map.MapManager;
1010
import dev.ftb.mods.ftbchunks.client.map.MapMode;
11+
import dev.ftb.mods.ftbchunks.client.minimap.MinimapComponentConfig;
1112
import dev.ftb.mods.ftbchunks.client.minimap.components.BiomeComponent;
1213
import dev.ftb.mods.ftbchunks.client.minimap.components.DebugComponent;
1314
import dev.ftb.mods.ftbchunks.client.minimap.components.FPSComponent;
@@ -19,7 +20,13 @@
1920
import dev.ftb.mods.ftblibrary.config.ConfigGroup;
2021
import dev.ftb.mods.ftblibrary.config.ui.EditConfigScreen;
2122
import dev.ftb.mods.ftblibrary.snbt.SNBTCompoundTag;
22-
import dev.ftb.mods.ftblibrary.snbt.config.*;
23+
import dev.ftb.mods.ftblibrary.snbt.config.BooleanValue;
24+
import dev.ftb.mods.ftblibrary.snbt.config.DoubleValue;
25+
import dev.ftb.mods.ftblibrary.snbt.config.EnumValue;
26+
import dev.ftb.mods.ftblibrary.snbt.config.IntValue;
27+
import dev.ftb.mods.ftblibrary.snbt.config.SNBTConfig;
28+
import dev.ftb.mods.ftblibrary.snbt.config.StringListValue;
29+
import dev.ftb.mods.ftblibrary.snbt.config.StringMapValue;
2330
import net.minecraft.client.Minecraft;
2431
import net.minecraft.client.gui.screens.Screen;
2532
import net.minecraft.resources.ResourceLocation;
@@ -82,8 +89,9 @@ public interface FTBChunksClientConfig {
8289
BooleanValue MINIMAP_PROPORTIONAL = MINIMAP.addBoolean("proportional", true).comment("Size minimap proportional to screen width (and scale)");
8390
StringListValue MINIMAP_INFO_ORDER = MINIMAP.addStringList("info_order", Stream.of(PlayerPosInfoComponent.ID, BiomeComponent.ID, ZoneInfoComponent.ID, FPSComponent.ID, GameTimeComponent.ID, RealTimeComponent.ID, DebugComponent.ID).map(ResourceLocation::toString).toList()).excluded().comment("Info displayed under minimap");
8491
StringListValue MINIMAP_INFO_HIDDEN = MINIMAP.addStringList("info_hidden", Stream.of(FPSComponent.ID, GameTimeComponent.ID, RealTimeComponent.ID, DebugComponent.ID).map(ResourceLocation::toString).toList()).excluded().comment("Info hidden under minimap");
85-
StringMapValue MINIMAP_SETTINGS = MINIMAP.add(new StringMapValue(MINIMAP, "info_settings", Collections.emptyMap())).comment("Settings for minimap info components");
92+
StringMapValue MINIMAP_SETTINGS = MINIMAP.add(new MinimapComponentConfig(MINIMAP, "info_settings", Collections.emptyMap())).comment("Settings for minimap info components");
8693
EntityTypeBoolMapValue ENTITY_ICON = MINIMAP.add(new EntityTypeBoolMapValue(MINIMAP, "entity_icon", Collections.emptyMap())).comment("Entity icons on minimap");
94+
EnumValue<PointerIconMode> POINTER_ICON_MODE = MINIMAP.addEnum("pointer_icon_mode", PointerIconMode.NAME_MAP).comment("Mode for the pointer icon to render on full screen minimap");
8795

8896
SNBTConfig ADVANCED = CONFIG.addGroup("advanced", 3);
8997
BooleanValue DEBUG_INFO = ADVANCED.addBoolean("debug_info", false).comment("Enables debug info");
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package dev.ftb.mods.ftbchunks.client;
2+
3+
import dev.ftb.mods.ftblibrary.config.NameMap;
4+
5+
public enum PointerIconMode {
6+
FACE(true, false),
7+
POINTER(false, true),
8+
BOTH(true, true),
9+
;
10+
11+
public static final NameMap<PointerIconMode> NAME_MAP = NameMap.of(BOTH, values()).baseNameKey("ftbchunks.minimap.pointer_icon_mode").create();
12+
13+
private final boolean face;
14+
private final boolean pointer;
15+
16+
PointerIconMode(boolean face, boolean pointer) {
17+
this.face = face;
18+
this.pointer = pointer;
19+
}
20+
21+
public boolean showFace() {
22+
return face;
23+
}
24+
25+
public boolean showPointer() {
26+
return pointer;
27+
}
28+
}

common/src/main/java/dev/ftb/mods/ftbchunks/client/gui/ChunkScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ protected class CustomTopPanel extends Panel {
137137
public CustomTopPanel() {
138138
super(ChunkScreen.this);
139139

140-
closeButton = new SimpleButton(this, Component.translatable("gui.close"), Icons.CLOSE,
140+
closeButton = new SimpleButton(this, Component.translatable("gui.close"), Icons.CANCEL,
141141
(btn, mb) -> doCancel())
142142
.setForceButtonSize(false);
143143

common/src/main/java/dev/ftb/mods/ftbchunks/client/gui/LargeMapScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ public Component getTitle() {
507507

508508
private class ClearDeathPointButton extends SimpleButton {
509509
public ClearDeathPointButton(Panel panel) {
510-
super(panel, Component.translatable("ftbchunks.gui.clear_deathpoints"), Icons.CLOSE, (b, m) -> {
510+
super(panel, Component.translatable("ftbchunks.gui.clear_deathpoints"), Icons.CANCEL, (b, m) -> {
511511
if (getWaypointManager().removeIf(wp -> wp.getType() == WaypointType.DEATH)) {
512512
refreshWidgets();
513513
}

common/src/main/java/dev/ftb/mods/ftbchunks/client/gui/WaypointShareMenu.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static Optional<ContextMenuItem> makeShareMenu(Player sharingPlayer, Wayp
3131
b -> shareWaypoint(waypoint, ShareWaypointPacket.ShareType.SERVER, List.of())));
3232
}
3333
if (FTBChunksWorldConfig.WAYPOINT_SHARING_PARTY.get()) {
34-
items.add(new ContextMenuItem(Component.translatable("ftbchunks.waypoint.share.party"), Icons.BELL,
34+
items.add(new ContextMenuItem(Component.translatable("ftbchunks.waypoint.share.party"), Icons.FRIENDS_GROUP,
3535
b -> shareWaypoint(waypoint, ShareWaypointPacket.ShareType.PARTY, List.of())));
3636
}
3737
if (FTBChunksWorldConfig.WAYPOINT_SHARING_PLAYERS.get()) {

0 commit comments

Comments
 (0)