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

Dev #45

Merged
merged 6 commits into from
Jun 4, 2024
Merged

Dev #45

Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
with:
curse-publish-task: ""
maven-snapshots: true
java-version: 21
secrets:
ftb-maven-token: ${{ secrets.FTB_MAVEN_TOKEN }}
saps-token: ${{ secrets.SAPS_TOKEN }}
saps-token: ${{ secrets.SAPS_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
uses: FTBTeam/mods-meta/.github/workflows/standard-release.yml@main
with:
curse-publish-task: curseforge
java-version: 21
secrets:
ftb-maven-token: ${{ secrets.FTB_MAVEN_TOKEN }}
saps-token: ${{ secrets.SAPS_TOKEN }}
curse-token: ${{ secrets.CURSEFORGE_KEY }}
curse-token: ${{ secrets.CURSEFORGE_KEY }}
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).

[2006.1.0]

### Changed
* Ported to Minecraft 1.20.6. Support for Fabric and NeoForge.
* Forge support may be re-added if/when Architectury adds support for Forge

[2004.2.0]

### Changed
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false
}

architectury {
Expand Down Expand Up @@ -33,7 +33,7 @@ allprojects {
// needs to be done AFTER version is set
apply from: "https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/publishing.gradle"

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = 17
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = 21

compileJava {
options.encoding = "UTF-8"
Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies {
def ENV = System.getenv()

architectury {
common("forge", "fabric", "neoforge")
common(/* "forge", */ "fabric", "neoforge")
}

publishing {
Expand Down
21 changes: 19 additions & 2 deletions common/src/main/java/dev/ftb/mods/ftbranks/FTBRanksCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
import net.minecraft.commands.arguments.EntityArgument;
import net.minecraft.commands.arguments.GameProfileArgument;
import net.minecraft.nbt.StringTag;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.ClickEvent.Action;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.Style;
import net.minecraft.server.level.ServerPlayer;

import java.io.IOException;
Expand Down Expand Up @@ -176,11 +180,24 @@ private static int refreshReadme(CommandSourceStack source) {
return 1;
}

private static Component makeRankNameClicky(Rank rank) {
boolean isDef = rank.getCondition().isDefaultCondition();
return Component.literal(rank.getName())
.withStyle(isDef ? ChatFormatting.AQUA : ChatFormatting.YELLOW)
.withStyle(Style.EMPTY
.withClickEvent(new ClickEvent(Action.RUN_COMMAND, "/ftbranks show_rank " + rank.getId()))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, isDef ?
Component.literal("Players must be explicitly added to this rank\nwith '/ftbranks add <player> " + rank.getId() + "'").withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC) :
Component.literal("Rank condition: " + rank.getCondition().asString()).withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC))
)
);
}

private static int listAllRanks(CommandSourceStack source) {
source.sendSuccess(() -> Component.literal("Ranks:"), false);

for (Rank rank : FTBRanksAPIImpl.manager.getAllRanks()) {
source.sendSuccess(() -> Component.literal("- " + rank.getName()).withStyle(rank.getCondition().isDefaultCondition() ? ChatFormatting.AQUA : ChatFormatting.YELLOW), false);
source.sendSuccess(() -> Component.literal("- ").append(makeRankNameClicky(rank)), false);
}

return 1;
Expand Down Expand Up @@ -234,7 +251,7 @@ private static int listRanksOf(CommandSourceStack source, ServerPlayer player) {

for (Rank rank : FTBRanksAPIImpl.manager.getAllRanks()) {
if (rank.isActive(player)) {
source.sendSuccess(() -> Component.literal("- " + rank.getName()).withStyle(rank.getCondition().isDefaultCondition() ? ChatFormatting.AQUA : ChatFormatting.YELLOW), false);
source.sendSuccess(() -> Component.literal("- ").append(makeRankNameClicky(rank)), false);
}
}

Expand Down
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ org.gradle.daemon=false
mod_id=ftbranks
archives_base_name=ftb-ranks
maven_group=dev.ftb.mods
mod_version=2004.2.0
mod_version=2006.1.0
mod_author=FTB Team

minecraft_version=1.20.4
minecraft_version=1.20.6

# Deps
forge_version=49.0.31
neoforge_version=20.4.196
forge_version=50.0.9
neoforge_version=20.6.100-beta
neoforge_loader_version=1
fabric_loader_version=0.15.7
fabric_api_version=0.96.4+1.20.4
architectury_version=11.1.17
fabric_loader_version=0.15.10
fabric_api_version=0.97.8+1.20.6
architectury_version=12.1.3

ftb_library_version=2004.2.0
ftb_library_version=2006.1.1

curseforge_id_forge=314905
curseforge_id_fabric=472659
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
4 changes: 2 additions & 2 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
modApi("dev.ftb.mods:ftb-library-neoforge:${rootProject.ftb_library_version}") { transitive false }

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive false }
}

apply from: "https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/extra-local-mods.gradle"
Expand All @@ -47,7 +47,7 @@ processResources {

inputs.property "version", project.version

filesMatching("META-INF/mods.toml") {
filesMatching("META-INF/neoforge.mods.toml") {
expand "version": project.version,
"archversion": project.architectury_version,
"neoforgeversion": project.neoforge_version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import dev.ftb.mods.ftbranks.impl.decorate.MessageDecorator;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.server.level.ServerPlayer;
import net.neoforged.fml.IExtensionPoint.DisplayTest;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.ServerChatEvent;
Expand All @@ -22,8 +20,6 @@ public FTBRanksNeoForge() {

// Nope.
// PermissionAPI.setPermissionHandler(new PermissionAPIWrapper(PermissionAPI.getPermissionHandler()));

ModLoadingContext.get().registerExtensionPoint(DisplayTest.class, () -> new DisplayTest(() -> DisplayTest.IGNORESERVERONLY, (a, b) -> true));
}

private void playerNameFormatting(PlayerEvent.NameFormat event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ authors = "FTB Team"
description = '''
A simple mod that lets you create ranks for players, similar to Discord roles, and manage permissions for them
'''
displayTest="IGNORE_SERVER_VERSION"

[[mixins]]
config = "ftbranks-common.mixins.json"
Expand Down
6 changes: 3 additions & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
pluginManagement {
repositories {
maven { url "https://maven.architectury.dev/" }
maven { url "https://maven.creeperhost.net/" }
maven { url "https://maven.shedaniel.me/" }
gradlePluginPortal()
}
}

include("common")
include("fabric")
include("forge")
//include("forge")
include("neoforge")

rootProject.name = 'FTB-Ranks-1.20.4'
rootProject.name = 'FTB-Ranks-1.20.6'
Loading