Skip to content
Merged
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
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).

## [21.1.8]

### Changed
* Updated [SG Economy API support](https://www.curseforge.com/minecraft/mc-mods/sg-economy-api) to 1.0.2 of the mod - 1.0.2+ now required
* Note that this was formerly supported by Magic Coins, but SG Economy API was separated into its own mod

## [21.1.7]

### Changed
Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies {
modCompileOnly("mezz.jei:jei-${rootProject.minecraft_version}-common-api:${rootProject.jei_version}")
modCompileOnly("curse.maven:jade-324717:${jade_neoforge_version}")

modCompileOnly("curse.maven:magic_coins-597281:${magic_coins_version}")
modCompileOnly("curse.maven:sg-economy-api-1446971:${sg_economy_version}")

compileOnly("net.luckperms:api:${rootProject.luckperms_api_version}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class FTBXModCompat {
public static boolean isLuckPermsLoaded;
public static boolean isWaystonesLoaded;
public static boolean isCommonProtLoaded;
public static boolean isMagicCoinsLoaded;
public static boolean isSGEconomyLoaded;

public static void init() {
detectLoadedMods();
Expand Down Expand Up @@ -68,6 +68,6 @@ private static void detectLoadedMods() {
isLuckPermsLoaded = Platform.isModLoaded("luckperms");
isWaystonesLoaded = Platform.isModLoaded("waystones");
isCommonProtLoaded = Platform.isModLoaded("common-protection-api");
isMagicCoinsLoaded = Platform.isModLoaded("magic_coins");
isSGEconomyLoaded = Platform.isModLoaded("sg_economy");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface FTBXModConfig {
.comment("Select the permissions implementation to use", "DEFAULT: use FTB Ranks then Luckperms in preference order, depending on mod availability");

EnumValue<CurrencySelector> CURRENCY_SELECTOR = CONFIG.addEnum("currency_selector", NameMap.of(CurrencySelector.DEFAULT, CurrencySelector.values()).create())
.comment("Select the currency implementation to use", "Note: currently Neoforge-only", "DEFAULT: use Magic Coins if installed, otherwise no currency plugin");
.comment("Select the currency implementation to use", "Note: currently Neoforge-only", "DEFAULT: use SG Economy if installed, otherwise no currency plugin");

BooleanValue ONLY_SHOW_KNOWN_WAYSTONES = CONFIG.addBoolean("only_show_known_waystones", true)
.comment("Only show waystones that have been discovered");
Expand Down Expand Up @@ -58,7 +58,7 @@ public boolean isUsable() {

enum CurrencySelector {
DEFAULT(() -> true),
MAGIC_COINS(() -> FTBXModCompat.isMagicCoinsLoaded);
SG_ECONOMY_API(() -> FTBXModCompat.isSGEconomyLoaded);

private final BooleanSupplier usable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public static void init() {

CurrencyHelper helper = CurrencyHelper.getInstance();
switch (sel) {
case MAGIC_COINS -> helper.setActiveImpl(MagicCoinsProvider.INSTANCE);
case SG_ECONOMY_API -> helper.setActiveImpl(SGEconomyProvider.INSTANCE);
case DEFAULT -> {
if (FTBXModCompat.isMagicCoinsLoaded) {
helper.setActiveImpl(MagicCoinsProvider.INSTANCE);
if (FTBXModCompat.isSGEconomyLoaded) {
helper.setActiveImpl(SGEconomyProvider.INSTANCE);
} else {
helper.setActiveImpl(FallbackCurrencyProvider.INSTANCE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,41 @@
import dev.ftb.mods.ftblibrary.integration.currency.CurrencyProvider;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.sirgrantd.magic_coins.api.MagicCoinsApi;
import net.sirgrantd.sg_economy.api.EconomyEventProvider;
import net.sirgrantd.sg_economy.api.SGEconomyApi;

public enum MagicCoinsProvider implements CurrencyProvider {
public enum SGEconomyProvider implements CurrencyProvider {
INSTANCE;

private final EconomyEventProvider sgEconomy = SGEconomyApi.get();

@Override
public String getName() {
return "Magic Coins";
return "SG Economy";
}

@Override
public int getTotalCurrency(Player player) {
return MagicCoinsApi.getTotalCoins(player);
return sgEconomy.getBalanceAsInt(player);
}

@Override
public boolean takeCurrency(Player player, int amount) {
if (getTotalCurrency(player) >= amount) {
MagicCoinsApi.removeCoins(player, amount);
int coins = getTotalCurrency(player);
if (coins >= amount) {
sgEconomy.withdrawBalanceAsInt(player, amount);
return true;
}
return false;
}

@Override
public void giveCurrency(Player player, int amount) {
MagicCoinsApi.addCoins(player, amount);
sgEconomy.depositBalanceAsInt(player, amount);
}

@Override
public Component coinName(boolean plural) {
return Component.translatable(plural ? "text.coins" : "text.coin");
}
}
}
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ enabled_platforms=fabric,neoforge

archives_base_name=ftb-xmod-compat
readable_name=FTB XMod Compat
mod_version=21.1.7
mod_version=21.1.8
maven_group=dev.ftb.mods
curseforge_id=889915

Expand All @@ -21,12 +21,12 @@ fabric_api_version_range=>=0.100.1+1.21
architectury_version=13.0.8

ftb_library_version=2101.1.20
ftb_quests_version=2101.1.21-SNAPSHOT
ftb_quests_version=2101.1.21
ftb_chunks_version=2101.1.13
ftb_ranks_version=2101.1.2
ftb_essentials_version=2101.1.6
ftb_teams_version=2101.1.9
ftb_filter_system_version=21.1.4-SNAPSHOT
ftb_filter_system_version=21.1.4

rei_version=16.0.799
common_prot_api_version=1.0.0
Expand All @@ -42,10 +42,10 @@ kubejs_version=2101.7.2-build.295
jade_neoforge_version=6853386
jade_fabric_version=6738760
curios_version=9.4.2+1.21.1
magic_coins_version=6905939
sg_economy_version=7604579

required_waystones_version=21.1.5
required_magic_coins_version=1.0.9
required_sg_economy_version=1.0.2

# TODO compiling against 1.20.4 version for now
gamestages_version=15.0.1
4 changes: 2 additions & 2 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ dependencies {

modRuntimeOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}"
modCompileOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}:api"
modImplementation("curse.maven:magic_coins-597281:${magic_coins_version}")
modImplementation("curse.maven:sg-economy-1446971:${sg_economy_version}")

// TODO below here is compile-only for now
modCompileOnlyApi("net.darkhax.gamestages:GameStages-Forge-1.20.1:${rootProject.gamestages_version}") { transitive false }
Expand Down Expand Up @@ -84,7 +84,7 @@ processResources {
"ftbranksversion": project.ftb_ranks_version,
"ftbteamsversion": project.ftb_teams_version,
"required_waystones_version": project.required_waystones_version,
"required_magic_coins_version": project.required_magic_coins_version
"required_sg_economy_version": project.required_sg_economy_version
}
}

Expand Down
4 changes: 2 additions & 2 deletions neoforge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ type = "optional"
versionRange = "[${required_waystones_version},)"

[[dependencies.ftbxmodcompat]]
modId = "magic_coins"
modId = "sg_economy"
type = "optional"
versionRange = "[${required_magic_coins_version},)"
versionRange = "[${required_sg_economy_version},)"