Stupid amount of changes to commit at once

- Set up config w/ modified SimpleConfig
- Set up ExpectPlatform
- Set up WeaponTypes
- Added items to ItemRegister
- Added dmg modifier to ToolMaterials
This commit is contained in:
Chris Toph 2025-02-22 22:19:48 -05:00
parent a09ddd6488
commit 7549757ce3
14 changed files with 918 additions and 478 deletions

View file

@ -2,14 +2,16 @@ architectury {
common rootProject.enabled_platforms.split(',') common rootProject.enabled_platforms.split(',')
} }
repositories { repositories {
maven { maven {
url "https://www.cursemaven.com" url "https://www.cursemaven.com"
content { content {
includeGroup "curse.maven" includeGroup "curse.maven"
} }
} }
// maven {
// name = "Team Resourceful Maven"
// url = "https://maven.teamresourceful.com/repository/maven-public/"
// }
maven { url "https://maven.shedaniel.me/" } maven { url "https://maven.shedaniel.me/" }
} }
@ -19,18 +21,19 @@ dependencies {
// Do NOT use other classes from Fabric Loader. // Do NOT use other classes from Fabric Loader.
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version" modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
// Architectury API. This is optional, and you can comment it out if you don't need it. // modImplementation "com.teamresourceful.resourcefulconfig:resourcefulconfig-common-$minecraft_version:$rconfig_version"
modImplementation "curse.maven:simplyswords-659887:5639538"
modImplementation "dev.architectury:architectury:$rootProject.architectury_api_version" modImplementation "dev.architectury:architectury:$rootProject.architectury_api_version"
modApi("me.shedaniel.cloth:cloth-config:$rootProject.cloth_config_version") {
exclude(group: "net.fabricmc.fabric-api")
}
modImplementation "curse.maven:simplyswords-659887:5255981"
// runtimeOnly "curse.maven:better-combat-by-daedelus-639842:5625757" // runtimeOnly "curse.maven:better-combat-by-daedelus-639842:5625757"
// runtimeOnly "curse.maven:playeranimator-658587:4587214" // runtimeOnly "curse.maven:playeranimator-658587:4587214"
// implementation "curse.maven:additional-additions-forge-582387:5155724" // implementation "curse.maven:additional-additions-forge-582387:5155724"
// implementation "curse.maven:create-328085:5838779" // implementation "curse.maven:create-328085:5838779"
// implementation "curse.maven:create-industry-693815:5811638" // implementation "curse.maven:create-industry-693815:5811638"
} }
sourceSets {
main {
resources.srcDir project(':common').file('src/generated')
}
}

View file

@ -1,29 +1,31 @@
package cc.toph.simplycompat; package cc.toph.simplycompat;
import cc.toph.simplycompat.config.Config;
import cc.toph.simplycompat.registry.ItemsRegistry; import cc.toph.simplycompat.registry.ItemsRegistry;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
public final class SimplyCompat { public final class SimplyCompat {
public static final String MOD_ID = "simplycompat"; public static final String MOD_ID = "simplycompat";
// Unused TAB, for now added so SS's Tab registry by SSSwordItem class // Unused TAB, for now added so SS's Tab registry by SSSwordItem class
// public static final DeferredRegister<CreativeModeTab> TABS = DeferredRegister.create( // public static final DeferredRegister<CreativeModeTab> TABS = DeferredRegister.create(
// MOD_ID, // MOD_ID,
// Registries.CREATIVE_MODE_TAB // Registries.CREATIVE_MODE_TAB
// ); // );
// public static final RegistrySupplier<CreativeModeTab> SIMPLYCOMPAT = TABS.register(MOD_ID, () -> // public static final RegistrySupplier<CreativeModeTab> SIMPLYCOMPAT = TABS.register(MOD_ID, () ->
// CreativeTabRegistry.create( // CreativeTabRegistry.create(
// Component.translatable("creativeTab.simplycompat.simplycompat"), // Component.translatable("creativeTab.simplycompat.simplycompat"),
// () -> new ItemStack(Items.AMETHYST_SHARD) // () -> new ItemStack(Items.AMETHYST_SHARD)
// ) // )
// ); // );
public static final Logger LOGGER = LogManager.getLogger(MOD_ID); public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
public static void init() { public static void init() {
// TABS.register(); // TABS.register();
ItemsRegistry.ITEMS.register(); Config.registerConfigs();
} ItemsRegistry.registerAllSwords();
}
} }

View file

@ -0,0 +1,19 @@
package cc.toph.simplycompat;
import dev.architectury.injectables.annotations.ExpectPlatform;
import java.nio.file.Path;
public class SimplyCompatExpectPlatform {
@ExpectPlatform
public static Path getConfigDirectory() {
// Content will be replaced by platform (forge,fabric) implementation at runtime.
throw new AssertionError("This should never run");
}
@ExpectPlatform
public static String getVersion() {
// Content will be replaced by platform (forge,fabric) implementation at runtime.
throw new AssertionError("This should never run");
}
}

View file

@ -0,0 +1,75 @@
package cc.toph.simplycompat.config;
import cc.toph.simplycompat.SimplyCompat;
public class Config {
// public static final String CONFIG_NAME = SimplyCompat.MOD_ID + SimpleConfig.FILE_EXTENSION;
public static SimpleConfig CONFIG;
private static final ConfigProvider PROVIDER = new ConfigProvider();
// TODO: Move some of this stuff into ConfigRegistry
public static final class WeaponAttributes {
public static float COPPER;
public static float STEEL;
public static float TEST;
}
public static void registerConfigs() {
// Load config 'simplycompat.config', if it isn't present create one
// Temp Default Empty Provider to load config
CONFIG = SimpleConfig.of(SimplyCompat.MOD_ID).provider(PROVIDER).request();
initializeConfigs();
CONFIG.update();
}
// Overloaded registerConfig for float
private static float registerConfig(String key, float defaultValue, String comment) {
PROVIDER.addKeyValuePair(key, defaultValue, comment);
// Cast needed because getOrDefault for numbers returns double
return (float) CONFIG.getOrDefault(key, defaultValue);
}
// Overloaded registerConfig for int
private static int registerConfig(String key, int defaultValue, String comment) {
PROVIDER.addKeyValuePair(key, defaultValue, comment);
return CONFIG.getOrDefault(key, defaultValue);
}
// Overloaded registerConfig for double
private static double registerConfig(String key, double defaultValue, String comment) {
PROVIDER.addKeyValuePair(key, defaultValue, comment);
return CONFIG.getOrDefault(key, defaultValue);
}
// Overloaded registerConfig for String
private static String registerConfig(String key, String defaultValue, String comment) {
PROVIDER.addKeyValuePair(key, defaultValue, comment);
return CONFIG.getOrDefault(key, defaultValue);
}
// Overloaded registerConfig for boolean
private static boolean registerConfig(String key, boolean defaultValue, String comment) {
PROVIDER.addKeyValuePair(key, defaultValue, comment);
return CONFIG.getOrDefault(key, defaultValue);
}
// Initialize config fields in one step
private static void initializeConfigs() {
WeaponAttributes.COPPER = registerConfig(
"copper_damageModifier",
3.0f,
"Copper Damage Modifier"
);
WeaponAttributes.STEEL = registerConfig(
"steel_damageModifier",
5.0f,
"Steel Damage Modifier"
);
}
}

View file

@ -0,0 +1,38 @@
package cc.toph.simplycompat.config;
import cc.toph.simplycompat.SimplyCompatExpectPlatform;
import java.util.HashMap;
public class ConfigProvider implements SimpleConfig.DefaultConfig {
// Key: config key (e.g. "copper_damageModifier")
// Value: Pair(value, comment)
private final HashMap<String, String> configMap = new HashMap<>();
private String contents = String.format("""
## Simply Compat Config
## Version: %s
""", SimplyCompatExpectPlatform.getVersion());
public void addKeyValuePair(String key, Object value, String comment) {
String stringValue = String.valueOf(value); // safely handle `null` too
configMap.put(key, stringValue);
contents += String.format("""
# %s
%s = %s
""", comment, key, value);
}
@Override
public HashMap<String, String> getMap() {
return configMap;
}
@Override
public String get(String namespace) {
return contents;
}
}

View file

@ -0,0 +1,291 @@
package cc.toph.simplycompat.config;
/*
* Copyright (c) 2021 magistermaks
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import cc.toph.simplycompat.SimplyCompatExpectPlatform;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import static cc.toph.simplycompat.SimplyCompat.LOGGER;
public class SimpleConfig {
public static final String FILE_EXTENSION = ".config";
private final HashMap<String, String> config = new HashMap<>();
private final ConfigRequest request;
private boolean broken = false;
private SimpleConfig(ConfigRequest request) {
this.request = request;
String identifier = "Config '" + request.filename + "'";
if (!request.file.exists()) {
LOGGER.info(identifier + " is missing, generating default one...");
try {
createConfig();
} catch (IOException e) {
LOGGER.error(identifier + " failed to generate!");
LOGGER.trace(e);
broken = true;
}
}
if (!broken) {
try {
loadConfig();
} catch (Exception e) {
LOGGER.error(identifier + " failed to load!");
LOGGER.trace(e);
broken = true;
}
}
}
/**
* Creates new config request object, ideally `namespace`
* should be the name of the mod id of the requesting mod
*
* @param filename - name of the config file
* @return new config request object
*/
public static ConfigRequest of(String filename) {
// Small edit for use in common, super cool! :D
Path path = SimplyCompatExpectPlatform.getConfigDirectory().resolve(filename + FILE_EXTENSION);
return new ConfigRequest(path.toFile(), filename);
}
public void update() {
// If no provider or if we had an error, do nothing
if (request.provider == null || broken) return;
boolean changed = false;
// For each provider key, see if our config HashMap is missing it
for (var entry : request.getConfigMap().entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
// If it's missing from 'config', add it
if (!config.containsKey(key)) {
config.put(key, value);
changed = true;
}
}
// If new keys were added, regen the file with createConfig()
if (changed) {
try {
delete();
createConfig();
} catch (IOException e) {
e.printStackTrace();
}
}
}
private void createConfig() throws IOException {
// try creating missing files
request.file.getParentFile().mkdirs();
Files.createFile(request.file.toPath());
// write default config data
PrintWriter writer = new PrintWriter(request.file, StandardCharsets.UTF_8);
writer.write(request.getConfig());
writer.close();
}
private void loadConfig() throws IOException {
Scanner reader = new Scanner(request.file);
for (int line = 1; reader.hasNextLine(); line++) {
parseConfigEntry(reader.nextLine(), line);
}
}
private void parseConfigEntry(String entry, int line) {
if (!entry.isEmpty() && !entry.startsWith("#")) {
String[] parts = entry.split("=", 2);
if (parts.length == 2) {
config.put(parts[0].trim(), parts[1].trim());
} else {
throw new RuntimeException("Syntax error in config file on line " + line + "!");
}
}
}
/**
* Queries a value from config, returns `null` if the
* key does not exist.
*
* @return value corresponding to the given key
* @see SimpleConfig#getOrDefault
*/
@Deprecated
public String get(String key) {
return config.get(key);
}
/**
* Returns string value from config corresponding to the given
* key, or the default string if the key is missing.
*
* @return value corresponding to the given key, or the default value
*/
public String getOrDefault(String key, String def) {
String val = get(key);
return val == null ? def : val;
}
/**
* Returns integer value from config corresponding to the given
* key, or the default integer if the key is missing or invalid.
*
* @return value corresponding to the given key, or the default value
*/
public int getOrDefault(String key, int def) {
try {
return Integer.parseInt(get(key));
} catch (Exception e) {
return def;
}
}
/**
* Returns boolean value from config corresponding to the given
* key, or the default boolean if the key is missing.
*
* @return value corresponding to the given key, or the default value
*/
public boolean getOrDefault(String key, boolean def) {
String val = get(key);
if (val != null) {
return val.equalsIgnoreCase("true");
}
return def;
}
/**
* Returns double value from config corresponding to the given
* key, or the default string if the key is missing or invalid.
*
* @return value corresponding to the given key, or the default value
*/
public double getOrDefault(String key, double def) {
try {
return Double.parseDouble(get(key));
} catch (Exception e) {
return def;
}
}
/**
* If any error occurred during loading or reading from the config
* a 'broken' flag is set, indicating that the config's state
* is undefined and should be discarded using `delete()`
*
* @return the 'broken' flag of the configuration
*/
public boolean isBroken() {
return broken;
}
/**
* deletes the config file from the filesystem
*
* @return true if the operation was successful
*/
public boolean delete() {
LOGGER.warn("Config '" + request.filename + "' was removed from existence! Restart the game to regenerate it.");
return request.file.delete();
}
public interface DefaultConfig {
static String empty(String namespace) {
return "";
}
String get(String namespace);
default Map<String, String> getMap() {
return new HashMap<>();
}
}
public static class ConfigRequest {
private final File file;
private final String filename;
private DefaultConfig provider;
private ConfigRequest(File file, String filename) {
this.file = file;
this.filename = filename;
this.provider = DefaultConfig::empty;
}
/**
* Sets the default config provider, used to generate the
* config if it's missing.
*
* @param provider default config provider
* @return current config request object
* @see DefaultConfig
*/
public ConfigRequest provider(DefaultConfig provider) {
this.provider = provider;
return this;
}
/**
* Loads the config from the filesystem.
*
* @return config object
* @see SimpleConfig
*/
public SimpleConfig request() {
return new SimpleConfig(this);
}
private String getConfig() {
return provider.get(filename) + "\n";
}
private Map<String, String> getConfigMap() {
return provider.getMap();
}
}
}

View file

@ -1,21 +1,25 @@
package cc.toph.simplycompat.item; package cc.toph.simplycompat.item;
import cc.toph.simplycompat.config.Config.WeaponAttributes;
import com.google.common.base.Suppliers; import com.google.common.base.Suppliers;
import java.util.function.Supplier;
import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.world.item.Tier; import net.minecraft.world.item.Tier;
import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import org.jetbrains.annotations.NotNull;
import java.util.function.Supplier;
public enum SimplyCompatToolMaterials implements Tier { public enum SimplyCompatToolMaterials implements Tier {
COPPER(1, 125, 4.5F, 1.0F, 8, Items.COPPER_INGOT), COPPER(1, 125, 4.5F, 1.0F, WeaponAttributes.COPPER, 8, Items.COPPER_INGOT),
STEEL(2, 600, 6.5F, 2.5F, 12, Items.DIAMOND); STEEL(2, 600, 6.5F, 2.5F, WeaponAttributes.STEEL, 12, Items.DIAMOND);
private final int level; private final int level;
private final int uses; private final int uses;
private final float speed; private final float speed;
private final float attackDamageBonus; private final float attackDamageBonus;
private final float damageModifier;
private final int enchantmentValue; private final int enchantmentValue;
private final Supplier<Ingredient> repairIngredient; private final Supplier<Ingredient> repairIngredient;
@ -24,6 +28,7 @@ public enum SimplyCompatToolMaterials implements Tier {
int uses, int uses,
float speed, float speed,
float attackDamageBonus, float attackDamageBonus,
float damageModifier,
int enchantmentValue, int enchantmentValue,
Item... repairIngredient Item... repairIngredient
) { ) {
@ -33,10 +38,22 @@ public enum SimplyCompatToolMaterials implements Tier {
this.attackDamageBonus = attackDamageBonus; this.attackDamageBonus = attackDamageBonus;
this.enchantmentValue = enchantmentValue; this.enchantmentValue = enchantmentValue;
this.repairIngredient = Suppliers.memoize(() -> Ingredient.of(repairIngredient)); this.repairIngredient = Suppliers.memoize(() -> Ingredient.of(repairIngredient));
this.damageModifier = damageModifier;
}
/**
* Returns the name of the enum constant in lowercase.
*
* @return the name of the enum constant as a lowercase string
*/
public String getName() {
return this.name().toLowerCase();
} }
/** /**
* Returns RepairIngredient ResourceLocation as a string * Returns RepairIngredient ResourceLocation as a string
*
* @return String ResourceLocation Path (mod:item) * @return String ResourceLocation Path (mod:item)
*/ */
public String getIdentifier() { public String getIdentifier() {
@ -60,6 +77,17 @@ public enum SimplyCompatToolMaterials implements Tier {
return attackDamageBonus; return attackDamageBonus;
} }
/**
* Retrieves the base damage modifier associated with the tool material.
* <p>
* Simply Swords specific value, not related to {@link Tier#getAttackDamageBonus()}
*
* @return the base damage modifier as a float value
*/
public float getDamageModifier() {
return damageModifier;
}
@Override @Override
public int getLevel() { public int getLevel() {
return level; return level;
@ -71,7 +99,7 @@ public enum SimplyCompatToolMaterials implements Tier {
} }
@Override @Override
public Ingredient getRepairIngredient() { public @NotNull Ingredient getRepairIngredient() {
return this.repairIngredient.get(); return this.repairIngredient.get();
} }
} }

View file

@ -2,435 +2,49 @@ package cc.toph.simplycompat.registry;
import cc.toph.simplycompat.SimplyCompat; import cc.toph.simplycompat.SimplyCompat;
import cc.toph.simplycompat.item.SimplyCompatToolMaterials; import cc.toph.simplycompat.item.SimplyCompatToolMaterials;
import cc.toph.simplycompat.util.WeaponType;
import dev.architectury.registry.registries.DeferredRegister; import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.RegistrySupplier;
import net.minecraft.core.registries.Registries; import net.minecraft.core.registries.Registries;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.sweenus.simplyswords.config.ConfigDefaultValues;
import net.sweenus.simplyswords.item.SimplySwordsSwordItem; import net.sweenus.simplyswords.item.SimplySwordsSwordItem;
public class ItemsRegistry { public class ItemsRegistry {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(
enum WeaponType { SimplyCompat.MOD_ID,
CHAKRAM( Registries.ITEM
"chakram",
net.sweenus.simplyswords.config.Config.getFloat(
"chakram_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.chakram_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"chakram_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.chakram_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"chakram_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.chakram_attackSpeed
)
),
CLAYMORE(
"claymore",
net.sweenus.simplyswords.config.Config.getFloat(
"claymore_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.claymore_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"claymore_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.claymore_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"claymore_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.claymore_attackSpeed
)
),
CUTLASS(
"cutlass",
net.sweenus.simplyswords.config.Config.getFloat(
"cutlass_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.cutlass_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"cutlass_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.cutlass_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"cutlass_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.cutlass_attackSpeed
)
),
GLAIVE(
"glaive",
net.sweenus.simplyswords.config.Config.getFloat(
"glaive_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.glaive_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"glaive_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.glaive_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"glaive_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.glaive_attackSpeed
)
),
GREATAXE(
"greataxe",
net.sweenus.simplyswords.config.Config.getFloat(
"greataxe_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.greataxe_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"greataxe_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.greataxe_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"greataxe_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.greataxe_attackSpeed
)
),
GREATHAMMER(
"greathammer",
net.sweenus.simplyswords.config.Config.getFloat(
"greathammer_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.greathammer_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"greathammer_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.greathammer_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"greathammer_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.greathammer_attackSpeed
)
),
HALBERD(
"halberd",
net.sweenus.simplyswords.config.Config.getFloat(
"halberd_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.halberd_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"halberd_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.halberd_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"halberd_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.halberd_attackSpeed
)
),
KATANA(
"katana",
net.sweenus.simplyswords.config.Config.getFloat(
"katana_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.katana_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"katana_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.katana_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"katana_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.katana_attackSpeed
)
),
LONGSWORD(
"longsword",
net.sweenus.simplyswords.config.Config.getFloat(
"longsword_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.longsword_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"longsword_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.longsword_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"longsword_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.longsword_attackSpeed
)
),
RAPIER(
"rapier",
net.sweenus.simplyswords.config.Config.getFloat(
"rapier_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.rapier_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"rapier_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.rapier_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"rapier_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.rapier_attackSpeed
)
),
SAI(
"sai",
net.sweenus.simplyswords.config.Config.getFloat(
"sai_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.sai_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"sai_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.sai_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"sai_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.sai_attackSpeed
)
),
SCYTHE(
"scythe",
net.sweenus.simplyswords.config.Config.getFloat(
"scythe_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.scythe_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"scythe_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.scythe_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"scythe_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.scythe_attackSpeed
)
),
SPEAR(
"spear",
net.sweenus.simplyswords.config.Config.getFloat(
"spear_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.spear_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"spear_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.spear_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"spear_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.spear_attackSpeed
)
),
TWINBLADE(
"twinblade",
net.sweenus.simplyswords.config.Config.getFloat(
"twinblade_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.twinblade_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"twinblade_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.twinblade_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"twinblade_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.twinblade_attackSpeed
)
),
WARGLAIVE(
"warglaive",
net.sweenus.simplyswords.config.Config.getFloat(
"warglaive_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.warglaive_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"warglaive_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.warglaive_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"warglaive_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.warglaive_attackSpeed
)
); );
final String weaponNameSuffix; private static void registerSword(
final float positiveModifier; SimplyCompatToolMaterials material,
final float negativeModifier; WeaponType type
final float attackSpeed;
WeaponType(
String weaponNameSuffix,
float positiveModifier,
float negativeModifier,
float attackSpeed
) { ) {
this.weaponNameSuffix = weaponNameSuffix;
this.positiveModifier = positiveModifier; float finalDamage = material.getDamageModifier() + type.getPositiveModifier() - type.getNegativeModifier();
this.negativeModifier = negativeModifier; String name = material.getName() + "_" + type.getWeaponNameSuffix();
this.attackSpeed = attackSpeed;
ITEMS.register(name, () ->
new SimplySwordsSwordItem(material, (int) finalDamage, type.getAttackSpeed(), material.getIdentifier())
);
} }
public String getWeaponNameSuffix() { /**
return weaponNameSuffix; * Registers all sword items. Iterate through all available weapon types
* and tool materials. For each combination, the corresponding sword
* is registered using the private {@code registerSword} method.
* <br>
* This ensures that each defined material and weapon type combination is
* registered within the item registry for use within the mod.
*/
public static void registerAllSwords() {
// TODO: Register Compat Swords
// Register "Vanilla" swords
for (WeaponType type : WeaponType.values()) {
for (SimplyCompatToolMaterials material : SimplyCompatToolMaterials.values()) {
registerSword(material, type);
}
}
ITEMS.register();
} }
public float getPositiveModifier() {
return positiveModifier;
}
public float getNegativeModifier() {
return negativeModifier;
}
public float getAttackSpeed() {
return attackSpeed;
}
}
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(
SimplyCompat.MOD_ID,
Registries.ITEM
);
private static RegistrySupplier<SimplySwordsSwordItem> registerSword(
String materialPrefix,
SimplyCompatToolMaterials material,
WeaponType type
) {
// Get the base modifier from config by constructing the key "<materialPrefix>_damageModifier"
// float baseModifier = Config.getFloat(
// materialPrefix + "_damageModifier",
// "WeaponAttributes",
// 1.0F // TODO: Change config to a data structure, or at least have one available for accessing here, Since we cant `ConfigDefaultValues.material_damageModifier` here
// );
var materialTag = material.getIdentifier();
float finalDamage = 2.0f + type.getPositiveModifier() - type.getNegativeModifier();
// float finalDamage = baseModifier + type.getPositiveModifier() - type.getNegativeModifier();
String name = materialPrefix + "_" + type.getWeaponNameSuffix();
return ITEMS.register(name, () ->
new SimplySwordsSwordItem(material, (int) finalDamage, type.getAttackSpeed(), materialTag)
);
}
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_CHAKRAM = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.CHAKRAM
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_CLAYMORE = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.CLAYMORE
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_CUTLASS = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.CUTLASS
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_GLAIVE = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.GLAIVE
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_GREATAXE = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.GREATAXE
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_GREATHAMMER = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.GREATHAMMER
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_HALBERD = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.HALBERD
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_KATANA = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.KATANA
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_LONGSWORD = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.LONGSWORD
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_RAPIER = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.RAPIER
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_SAI = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.SAI
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_SCYTHE = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.SCYTHE
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_SPEAR = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.SPEAR
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_TWINBLADE = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.TWINBLADE
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_WARGLAIVE = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.WARGLAIVE
);
} }

View file

@ -0,0 +1,309 @@
package cc.toph.simplycompat.util;
import net.sweenus.simplyswords.config.ConfigDefaultValues;
public enum WeaponType {
CHAKRAM(
"chakram",
net.sweenus.simplyswords.config.Config.getFloat(
"chakram_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.chakram_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"chakram_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.chakram_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"chakram_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.chakram_attackSpeed
)
),
CLAYMORE(
"claymore",
net.sweenus.simplyswords.config.Config.getFloat(
"claymore_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.claymore_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"claymore_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.claymore_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"claymore_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.claymore_attackSpeed
)
),
CUTLASS(
"cutlass",
net.sweenus.simplyswords.config.Config.getFloat(
"cutlass_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.cutlass_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"cutlass_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.cutlass_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"cutlass_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.cutlass_attackSpeed
)
),
GLAIVE(
"glaive",
net.sweenus.simplyswords.config.Config.getFloat(
"glaive_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.glaive_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"glaive_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.glaive_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"glaive_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.glaive_attackSpeed
)
),
GREATAXE(
"greataxe",
net.sweenus.simplyswords.config.Config.getFloat(
"greataxe_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.greataxe_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"greataxe_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.greataxe_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"greataxe_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.greataxe_attackSpeed
)
),
GREATHAMMER(
"greathammer",
net.sweenus.simplyswords.config.Config.getFloat(
"greathammer_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.greathammer_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"greathammer_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.greathammer_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"greathammer_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.greathammer_attackSpeed
)
),
HALBERD(
"halberd",
net.sweenus.simplyswords.config.Config.getFloat(
"halberd_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.halberd_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"halberd_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.halberd_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"halberd_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.halberd_attackSpeed
)
),
KATANA(
"katana",
net.sweenus.simplyswords.config.Config.getFloat(
"katana_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.katana_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"katana_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.katana_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"katana_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.katana_attackSpeed
)
),
LONGSWORD(
"longsword",
net.sweenus.simplyswords.config.Config.getFloat(
"longsword_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.longsword_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"longsword_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.longsword_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"longsword_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.longsword_attackSpeed
)
),
RAPIER(
"rapier",
net.sweenus.simplyswords.config.Config.getFloat(
"rapier_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.rapier_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"rapier_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.rapier_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"rapier_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.rapier_attackSpeed
)
),
SAI(
"sai",
net.sweenus.simplyswords.config.Config.getFloat(
"sai_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.sai_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"sai_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.sai_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"sai_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.sai_attackSpeed
)
),
SCYTHE(
"scythe",
net.sweenus.simplyswords.config.Config.getFloat(
"scythe_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.scythe_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"scythe_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.scythe_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"scythe_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.scythe_attackSpeed
)
),
SPEAR(
"spear",
net.sweenus.simplyswords.config.Config.getFloat(
"spear_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.spear_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"spear_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.spear_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"spear_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.spear_attackSpeed
)
),
TWINBLADE(
"twinblade",
net.sweenus.simplyswords.config.Config.getFloat(
"twinblade_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.twinblade_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"twinblade_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.twinblade_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"twinblade_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.twinblade_attackSpeed
)
),
WARGLAIVE(
"warglaive",
net.sweenus.simplyswords.config.Config.getFloat(
"warglaive_positiveDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.warglaive_positiveDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"warglaive_negativeDamageModifier",
"WeaponAttributes",
ConfigDefaultValues.warglaive_negativeDamageModifier
),
net.sweenus.simplyswords.config.Config.getFloat(
"warglaive_attackSpeed",
"WeaponAttributes",
ConfigDefaultValues.warglaive_attackSpeed
)
);
final String weaponNameSuffix;
final float positiveModifier;
final float negativeModifier;
final float attackSpeed;
WeaponType(
String weaponNameSuffix,
float positiveModifier,
float negativeModifier,
float attackSpeed
) {
this.weaponNameSuffix = weaponNameSuffix;
this.positiveModifier = positiveModifier;
this.negativeModifier = negativeModifier;
this.attackSpeed = attackSpeed;
}
public String getWeaponNameSuffix() {
return weaponNameSuffix;
}
public float getPositiveModifier() {
return positiveModifier;
}
public float getNegativeModifier() {
return negativeModifier;
}
public float getAttackSpeed() {
return attackSpeed;
}
}

View file

@ -32,24 +32,23 @@ repositories {
includeGroup "curse.maven" includeGroup "curse.maven"
} }
} }
// maven {
// name = "Team Resourceful Maven"
// url = "https://maven.teamresourceful.com/repository/maven-public/"
// }
maven { url "https://maven.shedaniel.me/" } maven { url "https://maven.shedaniel.me/" }
} }
dependencies { dependencies {
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version" modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version" modImplementation "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version"
// Architectury API. This is optional, and you can comment it out if you don't need it.
modImplementation "dev.architectury:architectury-fabric:$rootProject.architectury_api_version" modImplementation "dev.architectury:architectury-fabric:$rootProject.architectury_api_version"
modApi("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") { // modImplementation "com.teamresourceful.resourcefulconfig:resourcefulconfig-fabric-$minecraft_version:$rconfig_version"
exclude(group: "net.fabricmc.fabric-api")
}
modImplementation "curse.maven:simplyswords-659887:5255981" modImplementation "curse.maven:simplyswords-659887:5255981"
modLocalRuntime "me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}"
// runtimeOnly "curse.maven:better-combat-by-daedelus-639842:5625757" // runtimeOnly "curse.maven:better-combat-by-daedelus-639842:5625757"
// runtimeOnly "curse.maven:playeranimator-658587:4587214" // runtimeOnly "curse.maven:playeranimator-658587:4587214"
// implementation "curse.maven:additional-additions-forge-582387:5155724" // implementation "curse.maven:additional-additions-forge-582387:5155724"

View file

@ -0,0 +1,25 @@
package cc.toph.simplycompat.fabric;
import cc.toph.simplycompat.SimplyCompat;
import cc.toph.simplycompat.SimplyCompatExpectPlatform;
import net.fabricmc.loader.api.FabricLoader;
import java.nio.file.Path;
public class SimplyCompatExpectPlatformImpl {
/**
* Implementation of {@link SimplyCompatExpectPlatform#getConfigDirectory()}.
*/
public static Path getConfigDirectory() {
return FabricLoader.getInstance().getConfigDir();
}
/**
* Implementation of {@link SimplyCompatExpectPlatform#getConfigDirectory()}.
*/
public static String getVersion() {
return FabricLoader.getInstance().getModContainer(SimplyCompat.MOD_ID).get().getMetadata().getVersion().toString();
}
}

View file

@ -2,7 +2,18 @@ plugins {
id 'com.github.johnrengelman.shadow' id 'com.github.johnrengelman.shadow'
} }
def generatedResources = project(':common').file('src/generated');
def existingResources = project(':common').file('src/main/resources');
loom { loom {
runs {
data {
data()
programArgs "--all", "--mod", "simplycompat"
programArgs "--output", generatedResources.absolutePath
programArgs "--existing", existingResources.absolutePath
}
}
forge { forge {
mixinConfig "simplycompat.mixins.json" mixinConfig "simplycompat.mixins.json"
} }
@ -49,27 +60,29 @@ repositories {
includeGroup "curse.maven" includeGroup "curse.maven"
} }
} }
// maven {
// name = "Team Resourceful Maven"
// url = "https://maven.teamresourceful.com/repository/maven-public/"
// }
maven { url "https://maven.shedaniel.me/" } maven { url "https://maven.shedaniel.me/" }
} }
dependencies { dependencies {
forge "net.minecraftforge:forge:$rootProject.forge_version" forge "net.minecraftforge:forge:$rootProject.forge_version"
// Architectury API. This is optional, and you can comment it out if you don't need it.
modImplementation "dev.architectury:architectury-forge:$rootProject.architectury_api_version" modImplementation "dev.architectury:architectury-forge:$rootProject.architectury_api_version"
modApi("me.shedaniel.cloth:cloth-config-forge:${rootProject.cloth_config_version}")
modImplementation "curse.maven:simplyswords-659887:5639538" modImplementation "curse.maven:simplyswords-659887:5639538"
modLocalRuntime("me.shedaniel.cloth:cloth-config-forge:${rootProject.cloth_config_version}")
modLocalRuntime "curse.maven:better-combat-by-daedelus-639842:5625757" modLocalRuntime "curse.maven:better-combat-by-daedelus-639842:5625757"
modLocalRuntime "curse.maven:playeranimator-658587:4587214" modLocalRuntime "curse.maven:playeranimator-658587:4587214"
// compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.4.1"))
localRuntime(include("io.github.llamalad7:mixinextras-forge:0.4.1")) localRuntime(include("io.github.llamalad7:mixinextras-forge:0.4.1"))
// modImplementation "com.teamresourceful.resourcefulconfig:resourcefulconfig-forge-$minecraft_version:$rconfig_version"
// implementation "curse.maven:additional-additions-forge-582387:ID" // implementation "curse.maven:additional-additions-forge-582387:ID"
// implementation "curse.maven:create-328085:ID" // implementation "curse.maven:create-328085:ID"
// implementation "curse.maven:create-industry-693815:ID" // implementation "curse.maven:create-industry-693815:ID"
common(project(path: ':common', configuration: 'namedElements')) { transitive false } common(project(path: ':common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':common', configuration: 'transformProductionForge') shadowBundle project(path: ':common', configuration: 'transformProductionForge')
} }

View file

@ -0,0 +1,27 @@
package cc.toph.simplycompat.forge;
import cc.toph.simplycompat.SimplyCompat;
import cc.toph.simplycompat.SimplyCompatExpectPlatform;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.loading.FMLPaths;
import java.nio.file.Path;
public class SimplyCompatExpectPlatformImpl {
/**
* Implementation of {@link SimplyCompatExpectPlatform#getConfigDirectory()}.
*/
public static Path getConfigDirectory() {
return FMLPaths.CONFIGDIR.get();
}
/**
* Implementation of {@link SimplyCompatExpectPlatform#getConfigDirectory()}.
*/
public static String getVersion() {
return ModList.get().getModContainerById(SimplyCompat.MOD_ID).map(it -> it.getModInfo().getVersion().toString()).orElseThrow();
}
}

View file

@ -1,20 +1,17 @@
# Done to increase the memory available to Gradle. # Done to increase the memory available to Gradle.
org.gradle.jvmargs=-Xmx6G org.gradle.jvmargs=-Xmx6G
org.gradle.parallel=true org.gradle.parallel=true
# Mod properties # Mod properties
mod_version = 1.0.0 mod_version=1.0.0
maven_group = cc.toph.simplycompat maven_group=cc.toph.simplycompat
archives_name = simplycompat archives_name=simplycompat
enabled_platforms = fabric,forge enabled_platforms=fabric,forge
# Minecraft properties # Minecraft properties
minecraft_version = 1.20.1 minecraft_version=1.20.1
# Dependencies # Dependencies
architectury_api_version = 9.2.14 architectury_api_version=9.2.14
cloth_config_version=11.1.106 cloth_config_version=11.1.106
fabric_loader_version = 0.16.10 fabric_loader_version=0.16.10
fabric_api_version = 0.92.3+1.20.1 fabric_api_version=0.92.3+1.20.1
forge_version=1.20.1-47.3.22 forge_version=1.20.1-47.3.22
parchment_version = 1.20.1:2023.09.03 parchment_version=1.20.1:2023.09.03