Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.20.1/dev #325

Merged
merged 27 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b9a8997
Backport gui button to teleport to waypoint
UnRealDinnerbone Jul 3, 2024
5d30d2d
Merge pull request #291 from FTBTeam/feature/1.20.1/waypoint-tp-gui
desht Jul 3, 2024
0156198
Backport more map info 1.20.1
UnRealDinnerbone Jul 5, 2024
fb75e78
Update changelog
UnRealDinnerbone Jul 5, 2024
18bd2c5
Backport waypoint sharing to 1.20.1
UnRealDinnerbone Jul 5, 2024
312f78e
Merge pull request #295 from FTBTeam/feature/1.20.1/more-minimap-info
desht Jul 8, 2024
c05eaae
Merge branch '1.20.1/dev' into feature/1.20.1/waypoint-sharin
desht Jul 8, 2024
7e99805
Merge pull request #296 from FTBTeam/feature/1.20.1/waypoint-sharin
desht Jul 8, 2024
fc4a8fa
Backport mob griefing tag to 1.20.1
UnRealDinnerbone Jul 9, 2024
6cb5ea2
Fix waypoint add command only working with loaded pos
UnRealDinnerbone Jul 9, 2024
7eb7a25
Fix lang after other merges
UnRealDinnerbone Jul 9, 2024
a1a13f4
Merge pull request #300 from FTBTeam/bugfix/1.20.1/stop-other-griefing
desht Jul 10, 2024
e150c8f
Merge branch '1.20.1/dev' into bugfix/1.20.1/waypoint-add-command
desht Jul 10, 2024
0bc1255
Merge pull request #302 from FTBTeam/bugfix/1.20.1/lang-fix
desht Jul 10, 2024
bd3929a
Merge pull request #301 from FTBTeam/bugfix/1.20.1/waypoint-add-command
desht Jul 10, 2024
2c9b710
Backport Pointer icon
UnRealDinnerbone Jul 12, 2024
7bdeba9
Backport waypoint manger
UnRealDinnerbone Jul 12, 2024
fdd2105
Backport more 1.21 changes
UnRealDinnerbone Jul 15, 2024
647c1dd
Merge pull request #306 from FTBTeam/feature/1.20.1/more-backport
desht Jul 16, 2024
5337f92
chore: backport recent 1.21 improvements
UnRealDinnerbone Jul 25, 2024
219aaab
build: version -> 2001.3.2
desht Jul 26, 2024
5368ddb
fix: no addFirst() in java 17!
desht Jul 26, 2024
9c08087
fix: fixed a couple of keybind issues
desht Jul 26, 2024
7dd0a22
fix: possible fix for issue of occasional non-rendering regions
desht Sep 27, 2024
36d4869
chore: tiny logging change, keep IDE happy
desht Oct 29, 2024
dcd3d86
chore: changelog updated
desht Oct 29, 2024
93d17f4
build: move to tag-based releases
desht Oct 29, 2024
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
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Java CI - Build Release

on:
release:
types: [ published ]
push:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
- 'v[0-9]+\.[0-9]+\.[0-9]+-[a-z]+'
- 'v[0-9]+\.[0-9]+\.[0-9]+-[a-z]+\.[0-9]+'

jobs:
build:
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ 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.2]

### Added
* The waypoint manager screen has had a facelift
* No longer a full-screen GUI
* Added a delete button alongside the visibility toggle button on the manager screen
* Added waypoint sharing; there is now a "Share" option on the context menus for waypoints on the large map, and in the waypoint manager screen
* Player icon on the large map screen is now combined with a pointer indicating the player's facing direction
* Added new entity tag: `ftbchunks:entity_mob_griefing_blacklist`
* Prevents mob griefing by any entities in this tag if mob griefing protection is enabled in team settings
* Note: only works on Forge at this time (Fabric remains limited to Endermen only)
* Info text lines under the minimap are now highly configurable
* Configure with the "Minimap Info" book icon on the left of the large map screen
* Entries can be enabled/disabled/reordered/configured
* Added new real time, game time and FPS lines in addition to existing zone/biome/player-pos/debug lines

### Fixed
* Fixed the `/ftbchunks waypoint add` command only working for loaded chunks
* Fixed block/item/entity tags not being detected
* If the minimap is being displayed in top-right of screen (the default), then any potion effect icons are moved to the left of the minimap to avoid overlap
* Possible fix for occasional problem where some regions just don't render on the map or minimap
* Can't be sure, the problem is very hard to reproduce

## [2001.3.1]

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ plugins {
id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false
}

apply from: 'https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/changelog.gradle'

architectury {
minecraft = rootProject.minecraft_version
}
Expand All @@ -24,7 +26,6 @@ allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
apply from: "https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/git-md-changelog.gradle"

version = project.mod_version
group = project.maven_group
Expand Down
37 changes: 32 additions & 5 deletions common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunksCommands.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.ftb.mods.ftbchunks;

import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.BoolArgumentType;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
Expand Down Expand Up @@ -37,6 +38,7 @@
import net.minecraft.commands.arguments.coordinates.ColumnPosArgument;
import net.minecraft.commands.arguments.coordinates.Coordinates;
import net.minecraft.core.BlockPos;
import net.minecraft.core.GlobalPos;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -188,9 +190,25 @@ public static void registerCommands(CommandDispatcher<CommandSourceStack> dispat
.then(Commands.literal("add")
.then(Commands.argument("name", StringArgumentType.string())
.then(Commands.argument("position", BlockPosArgument.blockPos())
.executes(context -> addWaypoint(context.getSource(), StringArgumentType.getString(context, "name"), BlockPosArgument.getLoadedBlockPos(context, "position")))
.executes(context -> addWaypoint(context.getSource(), StringArgumentType.getString(context, "name"), BlockPosArgument.getBlockPos(context, "position")))
.then(Commands.argument("color", ColorArgument.color())
.executes(context -> addWaypoint(context.getSource(), StringArgumentType.getString(context, "name"), BlockPosArgument.getLoadedBlockPos(context, "position"), ColorArgument.getColor(context, "color")))
.executes(context -> addWaypoint(context.getSource(), StringArgumentType.getString(context, "name"), context.getSource().getLevel(), BlockPosArgument.getBlockPos(context, "position"), ColorArgument.getColor(context, "color")))
)
)
)
)
.then(Commands.literal("add-dim")
.then(Commands.argument("name", StringArgumentType.string())
.then(Commands.argument("position", BlockPosArgument.blockPos())
.executes(context -> addWaypoint(context.getSource(), StringArgumentType.getString(context, "name"), BlockPosArgument.getBlockPos(context, "position")))
.then(Commands.argument("dimension", DimensionArgument.dimension())
.executes(context -> addWaypoint(context.getSource(), StringArgumentType.getString(context, "name"), DimensionArgument.getDimension(context, "dimension"), BlockPosArgument.getBlockPos(context, "position")))
.then(Commands.argument("color", ColorArgument.color())
.executes(context -> addWaypoint(context.getSource(), StringArgumentType.getString(context, "name"), DimensionArgument.getDimension(context, "dimension"), BlockPosArgument.getBlockPos(context, "position"), ColorArgument.getColor(context, "color")))
.then(Commands.argument("gui", BoolArgumentType.bool())
.executes(context -> addWaypoint(context.getSource(), StringArgumentType.getString(context, "name"), DimensionArgument.getDimension(context, "dimension"), BlockPosArgument.getBlockPos(context, "position"), ColorArgument.getColor(context, "color"), BoolArgumentType.getBool(context, "gui")))
)
)
)
)
)
Expand All @@ -201,17 +219,26 @@ public static void registerCommands(CommandDispatcher<CommandSourceStack> dispat
dispatcher.register(Commands.literal("chunks").redirect(command));
}

private static int addWaypoint(CommandSourceStack source, String name, BlockPos position, ChatFormatting color) throws CommandSyntaxException {
private static int addWaypoint(CommandSourceStack source, String name, ServerLevel level, BlockPos position, ChatFormatting color, boolean useGui) throws CommandSyntaxException {
if (color.getColor() != null) {
ServerPlayer player = source.getPlayerOrException();
new AddWaypointPacket(name, position, color.getColor()).sendTo(player);
new AddWaypointPacket(name, GlobalPos.of(level.dimension(), position), color.getColor(), useGui).sendTo(player);
}
return 1;
}

private static int addWaypoint(CommandSourceStack source, String name, ServerLevel level, BlockPos position, ChatFormatting color) throws CommandSyntaxException {
return addWaypoint(source, name, level ,position, color, false);
}

private static int addWaypoint(CommandSourceStack source, String name, BlockPos position) throws CommandSyntaxException {
int idx = source.getPlayerOrException().getRandom().nextInt(ChatFormatting.values().length);
return addWaypoint(source, name, position, ChatFormatting.values()[idx]);
return addWaypoint(source, name, source.getLevel(), position, ChatFormatting.values()[idx], false);
}

private static int addWaypoint(CommandSourceStack source, String name, ServerLevel level, BlockPos position) throws CommandSyntaxException {
int idx = source.getPlayerOrException().getRandom().nextInt(ChatFormatting.values().length);
return addWaypoint(source, name, level ,position, ChatFormatting.values()[idx], false);
}

private static int bypassProtection(CommandSourceStack source) throws CommandSyntaxException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public interface FTBChunksWorldConfig {
BooleanValue LOCATION_MODE_OVERRIDE = CONFIG.addBoolean("location_mode_override", false).comment("If true, \"Location Visibility\" team settings are ignored, and all players can see each other anywhere on the map.");
IntValue MAX_PREVENTED_LOG_AGE = CONFIG.addInt("max_prevented_log_age", 7, 1, Integer.MAX_VALUE).comment("Maximum time in days to keep logs of prevented fakeplayer access to a team's claims.");

SNBTConfig WAYPOINT_SHARING = CONFIG.addGroup("waypoint_sharing");
BooleanValue WAYPOINT_SHARING_SERVER = WAYPOINT_SHARING.addBoolean("waypoint_sharing_server", true).comment("Allow players to share waypoints with the entire server.");
BooleanValue WAYPOINT_SHARING_PARTY = WAYPOINT_SHARING.addBoolean("waypoint_sharing_party", true).comment("Allow players to share waypoints with their party.");
BooleanValue WAYPOINT_SHARING_PLAYERS = WAYPOINT_SHARING.addBoolean("waypoint_sharing_players", true).comment("Allow players to share waypoints with other players.");

static int getMaxClaimedChunks(ChunkTeamData playerData, ServerPlayer player) {
if (player != null) {
return PermissionsHelper.getMaxClaimedChunks(player, MAX_CLAIMED_CHUNKS.get()) + playerData.getExtraClaimChunks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ enum StandardProblem implements ClaimResult {
NOT_LOADED("not_loaded"),
;

public static final NameMap<StandardProblem> NAME_MAP = NameMap.of(NOT_OWNER, values()).create();
public static final NameMap<StandardProblem> NAME_MAP = NameMap.of(NOT_OWNER, values()).baseNameKey("ftbchunks.standard_problem").create();

private final String resultName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ public static class Entities {
= TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation(FTBChunks.MOD_ID, "entity_interact_whitelist"));
public static final TagKey<EntityType<?>> NONLIVING_ENTITY_ATTACK_WHITELIST_TAG
= TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation(FTBChunks.MOD_ID, "nonliving_entity_attack_whitelist"));
public static final TagKey<EntityType<?>> ENTITY_MOB_GRIEFING_BLACKLIST_TAG
= TagKey.create(Registries.ENTITY_TYPE, FTBChunksAPI.rl("entity_mob_griefing_blacklist"));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dev.ftb.mods.ftbchunks.api.client;

import com.google.common.collect.ImmutableList;
import dev.ftb.mods.ftbchunks.api.client.minimap.MinimapInfoComponent;
import dev.ftb.mods.ftbchunks.api.client.waypoint.WaypointManager;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.Level;
Expand Down Expand Up @@ -27,4 +29,33 @@ public interface FTBChunksClientAPI {
* entities...)
*/
void requestMinimapIconRefresh();

/**
* Register a custom minimap info component {@link MinimapInfoComponent} to be rendered on the minimap.
*
* This should be called during mod initialization as this list will be finalized once Minecraft has "started"
* per the client lifecycle events
*
* @param component the component to register
*/
void registerMinimapComponent(MinimapInfoComponent component);


/**
* @param component the component to check if it is enabled
* @return is the component enabled and will render under the minimap
*/
boolean isMinimapComponentEnabled(MinimapInfoComponent component);

/**
* Enable or disable a specific minimap component for rendering under the minimap
* @param component the component to enable or disable to that shoul
* @param enabled the state to set the component to
*/
void setMinimapComponentEnabled(MinimapInfoComponent component, boolean enabled);

/**
* Provides an immutable list of all registered minimap components.
*/
ImmutableList<MinimapInfoComponent> getMinimapComponents();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package dev.ftb.mods.ftbchunks.api.client.minimap;

import dev.ftb.mods.ftbchunks.client.map.MapDimension;
import dev.ftb.mods.ftblibrary.math.XZ;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.world.phys.Vec3;

import java.util.Map;

/**
* Minimal context for Minimap Info Components
*
* @param minecraft The Minecraft instance (Helper)
* @param player The client player
* @param mapDimension The dimension of the players location
* @param mapChunksPos The chunk for the players location
* @param playerPos the players pos
* @param infoSettings raw settings for this component
*/
public record MinimapContext(
Minecraft minecraft,
LocalPlayer player,
MapDimension mapDimension,
XZ mapChunksPos,
Vec3 playerPos,
Map<String, String> infoSettings
) {

public String getSetting(MinimapInfoComponent infoComponent) {
return infoSettings.getOrDefault(infoComponent.id().toString(), "");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package dev.ftb.mods.ftbchunks.api.client.minimap;

import dev.ftb.mods.ftbchunks.client.FTBChunksClientConfig;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;

import java.util.Set;

/**
* An entry point for developers to create custom minimap info components.
*/
public interface MinimapInfoComponent {
/**
* The ID of this component.
*/
ResourceLocation id();

/**
* Render your component here, the {@link com.mojang.blaze3d.vertex.PoseStack} will already be scaled and
* translated to the correct position (centered by default). We do not provide an X and Y position as
* 0, 0 is the center of the correct location. Use 0, 0 as the center of the component and {@link #height(MinimapContext)}
* to allocate the correct height for the component.
*
* @param context The minimap context
* @param graphics The graphics object see {@link GuiGraphics}
* @param font The font object
*/
void render(MinimapContext context, GuiGraphics graphics, Font font);

/**
* Set of Info {@link TranslatedOption} that are used to configure options for rendering the waypoint
* this is exposed in the right click action of Minimap Info GUI
* @return the set of {@link TranslatedOption}.
*/
default Set<TranslatedOption> getConfigComponents() {
return Set.of();
}

/**
* The height of the component is used to allocate the correct space for the component. Failure to return the correct
* height will result in the component overlapping with other components.
*
* @param context The minimap context
* @return The height of the component
*/
default int height(MinimapContext context) {
return computeLineHeight(context.minecraft(), 1) + 1;
}

/**
* Checked on each render frame to determine if the height for the component should be allocated
*/
default boolean shouldRender(MinimapContext context) {
return true;
}

/**
* Helper method to compute the height of a text component whilst taking into account the font scale
*/
default int computeLineHeight(Minecraft minecraft, int lines) {
final float fontScale = FTBChunksClientConfig.MINIMAP_FONT_SCALE.get().floatValue();
return (int) ((minecraft.font.lineHeight + 2) * lines * fontScale);
}

/**
* Helper method to draw centered text without the faff of calculating the width of the text
*/
default void drawCenteredText(Font font, GuiGraphics graphics, Component text, int y) {
int textWidth = font.width(text.getVisualOrderText());
graphics.drawString(font, text, -textWidth / 2, y, 0xFFFFFFFF, true);
}


/**
* @return display name render in the Minimap Info Settings GUI
*/
default Component displayName() {
return Component.translatable("minimap.info." + id().getNamespace() + "." + id().getPath() + ".title");
}

/**
* @return hover texted displayed render in the Minimap Info Settings GUI
*/
default Component description() {
return Component.translatable("minimap.info." + id().getNamespace() + "." + id().getPath() + ".description");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package dev.ftb.mods.ftbchunks.api.client.minimap;

public record TranslatedOption(
String optionName,
String translationKey
) {

public static TranslatedOption of(String optionName) {
String translatedKey = optionName.toLowerCase().replaceAll("[^a-z0-9]", "_");
return new TranslatedOption(optionName, "minimap.option." + translatedKey);
}
}
Loading
Loading