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 #47

Merged
merged 2 commits into from
Jun 18, 2024
Merged

Dev #47

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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
!contains(github.event.head_commit.message, '[ciskip]')
uses: FTBTeam/mods-meta/.github/workflows/standard-release.yml@main
with:
curse-publish-task: curseforge
curse-publish-task: publishMods
java-version: 21
secrets:
ftb-maven-token: ${{ secrets.FTB_MAVEN_TOKEN }}
Expand Down
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).

[2100.1.0]

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

[2006.1.0]

### Changed
Expand Down
76 changes: 75 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false
id "me.modmuss50.mod-publish-plugin" version "0.5.1"
}

architectury {
Expand Down Expand Up @@ -72,6 +73,79 @@ allprojects {
java {
withSourcesJar()
}

publishing {
repositories {
if (ftbPublishing.ftbToken) {
maven {
url ftbPublishing.ftbURL
credentials {
username = ftbPublishing.ftbUser
password = ftbPublishing.ftbToken
}
}
}

if (ftbPublishing.sapsToken) {
maven {
url ftbPublishing.sapsURL
credentials {
username = ftbPublishing.sapsUser
password = ftbPublishing.sapsToken
}
}
}
}
}
}

publishMods {
dryRun = providers.environmentVariable("CURSEFORGE_KEY").getOrNull() == null
changelog = providers.environmentVariable("CHANGELOG").getOrElse("No changelog provided")
version = mod_version

// TODO: Migrate to something else
def tag = providers.environmentVariable("TAG").getOrElse("release")
type = tag == "beta" ? BETA : (tag == "alpha" ? ALPHA : STABLE)

def createOptions = (String projectName) -> {
publishOptions {
file = project.provider { project(":$projectName").tasks.remapJar }.flatMap { it.archiveFile }
displayName = "[${projectName.toUpperCase()}][${minecraft_version}] ${readable_name} ${mod_version}"
modLoaders.add(projectName.toLowerCase())
}
}

def fabricOptions = createOptions("fabric")
// def forgeOptions = createOptions("forge")
def neoForgeOptions = createOptions("neoforge")

def curseForgeOptions = curseforgeOptions {
accessToken = providers.environmentVariable("CURSEFORGE_KEY")
minecraftVersions.add("${minecraft_version}")
javaVersions.add(JavaVersion.VERSION_21)
}

curseforge("curseforgeFabric") {
from(curseForgeOptions, fabricOptions)
projectId = curseforge_id_fabric
requires('architectury-api')
requires('fabric-api')
requires('ftb-library-fabric')
}

curseforge("curseforgeNeoForge") {
from(curseForgeOptions, neoForgeOptions)
projectId = curseforge_id_forge
requires('architectury-api')
requires('ftb-library-forge')
}

// curseforge("curseforgeForge") {
// from(curseForgeOptions, forgeOptions)
// projectId = curseforge_id_forge
// requires('architectury-api')
// requires('ftb-library-forge')
// }
}

task curseforgePublish
24 changes: 0 additions & 24 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ dependencies {
modApi "dev.ftb.mods:ftb-library:${rootProject.ftb_library_version}"
}

def ENV = System.getenv()

architectury {
common(/* "forge", */ "fabric", "neoforge")
}
Expand All @@ -20,26 +18,4 @@ publishing {
from components.java
}
}

repositories {
if (ftbPublishing.ftbToken) {
maven {
url ftbPublishing.ftbURL
credentials {
username = ftbPublishing.ftbUser
password = ftbPublishing.ftbToken
}
}
}

if (ftbPublishing.sapsToken) {
maven {
url ftbPublishing.sapsURL
credentials {
username = ftbPublishing.sapsUser
password = ftbPublishing.sapsToken
}
}
}
}
}
3 changes: 0 additions & 3 deletions common/src/main/java/dev/ftb/mods/ftbranks/FTBRanks.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
* @author LatvianModder
*/
public class FTBRanks {
public static final String MOD_ID = "ftbranks";
public static final Logger LOGGER = LogManager.getLogger("FTB Ranks");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
import java.util.Collections;
import java.util.concurrent.CompletableFuture;

/**
* @author LatvianModder
*/
public class FTBRanksCommands {
public static final DynamicCommandExceptionType ERROR_UNKNOWN_RANK = new DynamicCommandExceptionType(
(object) -> Component.literal("Unknown rank: " + object.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
import net.minecraft.server.level.ServerLevel;
import org.apache.commons.lang3.math.NumberUtils;

/**
* @author LatvianModder
*/
public class FTBRanksAPIImpl extends FTBRanksAPI {
public static RankManagerImpl manager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
import java.time.format.DateTimeParseException;
import java.util.*;

/**
* @author LatvianModder
*/
public class PlayerRankData {
private final RankManagerImpl manager;
private final UUID playerId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import java.util.function.Predicate;
import java.util.function.Supplier;

/**
* @author LatvianModder
*/
public class RankCommandPredicate implements Predicate<CommandSourceStack> {
private final Predicate<CommandSourceStack> original;
private final String nodeName;
Expand Down
3 changes: 0 additions & 3 deletions common/src/main/java/dev/ftb/mods/ftbranks/impl/RankImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

import java.util.*;

/**
* @author LatvianModder
*/
public class RankImpl implements Rank, Comparable<RankImpl> {
private static final Set<String> SPECIAL_FIELDS = Set.of("name", "power", "condition");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@

import static dev.ftb.mods.ftbranks.FTBRanks.MOD_ID;

/**
* @author LatvianModder
*/
public class RankManagerImpl implements RankManager {
public static final LevelResource FOLDER_NAME = new LevelResource("serverconfig/ftbranks");
private static final Path DEFAULT_RANK_FILE = ConfigUtil.DEFAULT_CONFIG_DIR.resolve(MOD_ID).resolve("ranks.snbt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import dev.ftb.mods.ftbranks.api.RankCondition;
import net.minecraft.server.level.ServerPlayer;

/**
* @author LatvianModder
*/
public class AlwaysActiveCondition implements RankCondition.Simple {
public static final AlwaysActiveCondition INSTANCE = new AlwaysActiveCondition();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
import java.util.ArrayList;
import java.util.List;

/**
* @author LatvianModder
*/
public class AndCondition implements RankCondition {
private final List<RankCondition> conditions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import dev.ftb.mods.ftbranks.api.RankCondition;
import net.minecraft.server.level.ServerPlayer;

/**
* @author LatvianModder
*/
public class CreativeModeCondition implements RankCondition.Simple {
@Override
public String getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import dev.ftb.mods.ftbranks.api.RankCondition;
import net.minecraft.server.level.ServerPlayer;

/**
* @author LatvianModder
*/
public class DefaultCondition implements RankCondition.Simple {
public final Rank original;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class DimensionCondition implements RankCondition {
private final ResourceKey<Level> dimension;

public DimensionCondition(SNBTCompoundTag tag) {
dimension = ResourceKey.create(Registries.DIMENSION, new ResourceLocation(tag.getString("dimension")));
dimension = ResourceKey.create(Registries.DIMENSION, ResourceLocation.parse(tag.getString("dimension")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import dev.ftb.mods.ftbranks.api.RankCondition;
import net.minecraft.server.level.ServerPlayer;

/**
* @author LatvianModder
*/
public class FakePlayerCondition implements RankCondition.Simple {
@Override
public String getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import dev.ftb.mods.ftbranks.api.RankException;
import net.minecraft.server.level.ServerPlayer;

/**
* @author LatvianModder
*/
public class NotCondition implements RankCondition {
private final RankCondition condition;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import dev.ftb.mods.ftbranks.api.RankCondition;
import net.minecraft.server.level.ServerPlayer;

/**
* @author LatvianModder
*/
public class OPCondition implements RankCondition.Simple {
@Override
public String getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
import java.util.ArrayList;
import java.util.List;

/**
* @author LatvianModder
*/
public class OrCondition implements RankCondition {
private final List<RankCondition> conditions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import net.minecraft.stats.Stat;
import net.minecraft.stats.Stats;

/**
* @author LatvianModder
*/
public class PlaytimeCondition implements RankCondition {
public static final int TICKS = 1;
public static final int SECONDS = TICKS * 20;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
import dev.ftb.mods.ftbranks.api.RankCondition;
import net.minecraft.server.level.ServerPlayer;

/**
* @author LatvianModder
*/
public final class RankAddedCondition implements RankCondition {
private final Rank original;
private final String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
import net.minecraft.util.Mth;
import net.minecraft.world.level.Level;

/**
* @author LatvianModder
*/
public class SpawnCondition implements RankCondition.Simple {
@Override
public String getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import dev.ftb.mods.ftblibrary.snbt.SNBTCompoundTag;
import dev.ftb.mods.ftbranks.api.RankCondition;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.stats.Stat;
import net.minecraft.stats.Stats;

/**
* @author LatvianModder
*/
import java.util.NoSuchElementException;

public class StatCondition implements RankCondition {
public static final int EQUALS = 1;
public static final int NOT_EQUALS = 2;
Expand All @@ -24,8 +24,12 @@ public class StatCondition implements RankCondition {
private final Stat<?> stat;

public StatCondition(SNBTCompoundTag tag) {
statId = new ResourceLocation(tag.getString("stat"));
stat = Stats.CUSTOM.get(statId);
statId = ResourceLocation.parse(tag.getString("stat"));
stat = BuiltInRegistries.CUSTOM_STAT.getOptional(statId)
.map(Stats.CUSTOM::get)
.orElseThrow(() ->
new NoSuchElementException(String.format("%s does not match any known stat", statId))
);
value = tag.getInt("value");

switch (tag.getString("value_check")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
import java.util.ArrayList;
import java.util.List;

/**
* @author LatvianModder
*/
public class XorCondition implements RankCondition {
private final List<RankCondition> conditions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

import java.util.function.Function;

/**
* @author LatvianModder
*/
public class TextComponentParser {
public static final Char2ObjectOpenHashMap<ChatFormatting> CODE_TO_FORMATTING = new Char2ObjectOpenHashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

import java.util.Optional;

/**
* @author LatvianModder
*/
public class StringPermissionValue implements PermissionValue {
public static final StringPermissionValue EMPTY = new StringPermissionValue("");

Expand Down
Loading
Loading