Skip to content

Commit

Permalink
Merge pull request #288 from FTBTeam/dev
Browse files Browse the repository at this point in the history
Port to 1.21
  • Loading branch information
desht authored Jun 17, 2024
2 parents 80a4dd3 + 88d1de6 commit 07bd1e0
Show file tree
Hide file tree
Showing 27 changed files with 259 additions and 362 deletions.
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ 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.1]

### Fixed
* Fixed the sidebar map buttons ignoring any GameStages restrictions in force

## [2006.1.0]

### Changed
Expand Down
81 changes: 80 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 @@ -68,6 +69,84 @@ 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
}
}
}
}
}
}

task curseforgePublish
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 neoForgeOptions = createOptions("neoforge")
// def forgeOptions = createOptions("forge")

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')
requires('ftb-teams-fabric')
optional('ftb-ranks-fabric')
}

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

// curseforge("curseforgeForge") {
// from(curseForgeOptions, forgeOptions)
// projectId = curseforge_id_forge
// requires('architectury-api')
// requires('ftb-library-forge')
// requires('ftb-teams-forge')
// optional('ftb-ranks-forge')
// }
}
35 changes: 1 addition & 34 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "dev.architectury:architectury:${rootProject.architectury_version}"
modApi "dev.architectury:architectury:${rootProject.architectury_api_version}"

modImplementation("dev.ftb.mods:ftb-library:${rootProject.ftb_library_version}") { transitive = false }
modImplementation("dev.ftb.mods:ftb-teams:${rootProject.ftb_teams_version}") { transitive = false }
}

def ENV = System.getenv()

architectury {
common(/* "forge", */ "fabric", "neoforge")
}
Expand All @@ -32,35 +30,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
}
}
}
}
}

// TODO: ask @maxneedssnacks
//afterEvaluate {
// tasks {
// remapJar {
// remapAccessWidener = false
// }
// }
//}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected JsonObject prepare(ResourceManager resourceManager, ProfilerFiller pro

for (String namespace : resourceManager.getNamespaces()) {
try {
for (Resource resource : resourceManager.getResourceStack(new ResourceLocation(namespace, "ftbchunks_block_colors.json"))) {
for (Resource resource : resourceManager.getResourceStack(ResourceLocation.fromNamespaceAndPath(namespace, "ftbchunks_block_colors.json"))) {
try (Reader reader = new InputStreamReader(resource.open(), StandardCharsets.UTF_8)) {
for (Map.Entry<String, JsonElement> entry : gson.fromJson(reader, JsonObject.class).entrySet()) {
if (entry.getKey().startsWith("#")) {
Expand Down Expand Up @@ -91,7 +91,7 @@ protected void apply(JsonObject object, ResourceManager resourceManager, Profile
BlockColor col = BlockColors.getFromType(entry.getValue().getAsString());

if (col != null) {
BLOCK_ID_TO_COLOR_MAP.put(new ResourceLocation(entry.getKey()), col);
BLOCK_ID_TO_COLOR_MAP.put(ResourceLocation.tryParse(entry.getKey()), col);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static FTBChunksClientAPI clientApi() {
* @return a new resource location
*/
public static ResourceLocation rl(String path) {
return new ResourceLocation(MOD_ID, path);
return ResourceLocation.fromNamespaceAndPath(MOD_ID, path);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package dev.ftb.mods.ftbchunks.api;

import dev.ftb.mods.ftbchunks.FTBChunks;
import dev.ftb.mods.ftbteams.api.property.BooleanProperty;
import dev.ftb.mods.ftbteams.api.property.PrivacyMode;
import dev.ftb.mods.ftbteams.api.property.PrivacyProperty;
import dev.ftb.mods.ftbteams.api.property.StringListProperty;
import net.minecraft.resources.ResourceLocation;

import java.util.ArrayList;

Expand All @@ -14,34 +12,34 @@
*/
public class FTBChunksProperties {
public static final BooleanProperty ALLOW_ALL_FAKE_PLAYERS
= new BooleanProperty(new ResourceLocation(FTBChunks.MOD_ID, "allow_fake_players"), false);
= new BooleanProperty(FTBChunksAPI.rl("allow_fake_players"), false);
public static final StringListProperty ALLOW_NAMED_FAKE_PLAYERS
= new StringListProperty(new ResourceLocation(FTBChunks.MOD_ID, "allow_named_fake_players"), new ArrayList<>());
= new StringListProperty(FTBChunksAPI.rl("allow_named_fake_players"), new ArrayList<>());
public static final BooleanProperty ALLOW_FAKE_PLAYERS_BY_ID
= new BooleanProperty(new ResourceLocation(FTBChunks.MOD_ID, "allow_fake_players_by_id"), true);
= new BooleanProperty(FTBChunksAPI.rl("allow_fake_players_by_id"), true);
public static final PrivacyProperty ENTITY_INTERACT_MODE
= new PrivacyProperty(new ResourceLocation(FTBChunks.MOD_ID, "entity_interact_mode"), PrivacyMode.ALLIES);
= new PrivacyProperty(FTBChunksAPI.rl("entity_interact_mode"), PrivacyMode.ALLIES);
public static final PrivacyProperty NONLIVING_ENTITY_ATTACK_MODE
= new PrivacyProperty(new ResourceLocation(FTBChunks.MOD_ID, "nonliving_entity_attack_mode"), PrivacyMode.ALLIES);
= new PrivacyProperty(FTBChunksAPI.rl("nonliving_entity_attack_mode"), PrivacyMode.ALLIES);
public static final BooleanProperty ALLOW_EXPLOSIONS
= new BooleanProperty(new ResourceLocation(FTBChunks.MOD_ID, "allow_explosions"), false);
= new BooleanProperty(FTBChunksAPI.rl("allow_explosions"), false);
public static final BooleanProperty ALLOW_MOB_GRIEFING
= new BooleanProperty(new ResourceLocation(FTBChunks.MOD_ID, "allow_mob_griefing"), false);
= new BooleanProperty(FTBChunksAPI.rl("allow_mob_griefing"), false);
public static final PrivacyProperty CLAIM_VISIBILITY
= new PrivacyProperty(new ResourceLocation(FTBChunks.MOD_ID, "claim_visibility"), PrivacyMode.PUBLIC);
= new PrivacyProperty(FTBChunksAPI.rl("claim_visibility"), PrivacyMode.PUBLIC);
public static final PrivacyProperty LOCATION_MODE
= new PrivacyProperty(new ResourceLocation(FTBChunks.MOD_ID, "location_mode"), PrivacyMode.ALLIES);
= new PrivacyProperty(FTBChunksAPI.rl("location_mode"), PrivacyMode.ALLIES);
public static final BooleanProperty ALLOW_PVP
= new BooleanProperty(new ResourceLocation(FTBChunks.MOD_ID, "allow_pvp"), true);
= new BooleanProperty(FTBChunksAPI.rl("allow_pvp"), true);

// FTB Chunks on Forge adds two separate block edit & interact properties
public static final PrivacyProperty BLOCK_EDIT_MODE
= new PrivacyProperty(new ResourceLocation(FTBChunks.MOD_ID, "block_edit_mode"), PrivacyMode.ALLIES);
= new PrivacyProperty(FTBChunksAPI.rl("block_edit_mode"), PrivacyMode.ALLIES);
public static final PrivacyProperty BLOCK_INTERACT_MODE
= new PrivacyProperty(new ResourceLocation(FTBChunks.MOD_ID, "block_interact_mode"), PrivacyMode.ALLIES);
= new PrivacyProperty(FTBChunksAPI.rl("block_interact_mode"), PrivacyMode.ALLIES);

// FTB Chunks on Fabric adds a combined block edit & interact property
public static final PrivacyProperty BLOCK_EDIT_AND_INTERACT_MODE
= new PrivacyProperty(new ResourceLocation(FTBChunks.MOD_ID, "block_edit_and_interact_mode"), PrivacyMode.ALLIES);
= new PrivacyProperty(FTBChunksAPI.rl("block_edit_and_interact_mode"), PrivacyMode.ALLIES);

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package dev.ftb.mods.ftbchunks.api;

import dev.ftb.mods.ftbchunks.FTBChunks;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.Item;
Expand All @@ -11,22 +9,22 @@
public class FTBChunksTags {
public static class Blocks {
public static final TagKey<Block> EDIT_WHITELIST_TAG
= TagKey.create(Registries.BLOCK, new ResourceLocation(FTBChunks.MOD_ID, "edit_whitelist"));
= TagKey.create(Registries.BLOCK, FTBChunksAPI.rl("edit_whitelist"));
public static final TagKey<Block> INTERACT_WHITELIST_TAG
= TagKey.create(Registries.BLOCK, new ResourceLocation(FTBChunks.MOD_ID, "interact_whitelist"));
= TagKey.create(Registries.BLOCK, FTBChunksAPI.rl("interact_whitelist"));
}

public static class Items {
public static final TagKey<Item> RIGHT_CLICK_BLACKLIST_TAG
= TagKey.create(Registries.ITEM, new ResourceLocation(FTBChunks.MOD_ID, "right_click_blacklist"));
= TagKey.create(Registries.ITEM, FTBChunksAPI.rl("right_click_blacklist"));
public static final TagKey<Item> RIGHT_CLICK_WHITELIST_TAG
= TagKey.create(Registries.ITEM, new ResourceLocation(FTBChunks.MOD_ID, "right_click_whitelist"));
= TagKey.create(Registries.ITEM, FTBChunksAPI.rl("right_click_whitelist"));
}

public static class Entities {
public static final TagKey<EntityType<?>> ENTITY_INTERACT_WHITELIST_TAG
= TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation(FTBChunks.MOD_ID, "entity_interact_whitelist"));
= TagKey.create(Registries.ENTITY_TYPE, FTBChunksAPI.rl("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"));
= TagKey.create(Registries.ENTITY_TYPE, FTBChunksAPI.rl("nonliving_entity_attack_whitelist"));
}
}
Loading

0 comments on commit 07bd1e0

Please sign in to comment.