Compare commits
3 commits
7a45a6f5bf
...
9136660de7
Author | SHA1 | Date | |
---|---|---|---|
9136660de7 | |||
7549757ce3 | |||
a09ddd6488 |
19 changed files with 1243 additions and 529 deletions
|
@ -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')
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
package cc.toph.simplycompat;
|
package cc.toph.simplycompat;
|
||||||
|
|
||||||
|
import cc.toph.simplycompat.config.Config;
|
||||||
|
import cc.toph.simplycompat.registry.ConfigRegistry;
|
||||||
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;
|
||||||
|
@ -24,6 +26,7 @@ public final class SimplyCompat {
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
// TABS.register();
|
// TABS.register();
|
||||||
ItemsRegistry.ITEMS.register();
|
ConfigRegistry.registerConfigs();
|
||||||
|
ItemsRegistry.registerAllSwords();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
48
common/src/main/java/cc/toph/simplycompat/config/Config.java
Normal file
48
common/src/main/java/cc/toph/simplycompat/config/Config.java
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
package cc.toph.simplycompat.config;
|
||||||
|
|
||||||
|
import cc.toph.simplycompat.SimplyCompat;
|
||||||
|
|
||||||
|
public class Config {
|
||||||
|
private SimpleConfig config;
|
||||||
|
private final ConfigProvider provider;
|
||||||
|
|
||||||
|
public Config(ConfigProvider provider) {
|
||||||
|
this.provider = provider;
|
||||||
|
config = SimpleConfig.of(provider.getNamespace()).provider(provider).request();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void register() {
|
||||||
|
config.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overloaded registerProp for float
|
||||||
|
public float registerProp(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 registerProp for int
|
||||||
|
public int registerProp(String key, int defaultValue, String comment) {
|
||||||
|
provider.addKeyValuePair(key, defaultValue, comment);
|
||||||
|
return config.getOrDefault(key, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overloaded registerProp for double
|
||||||
|
public double registerProp(String key, double defaultValue, String comment) {
|
||||||
|
provider.addKeyValuePair(key, defaultValue, comment);
|
||||||
|
return config.getOrDefault(key, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overloaded registerProp for String
|
||||||
|
public String registerProp(String key, String defaultValue, String comment) {
|
||||||
|
provider.addKeyValuePair(key, defaultValue, comment);
|
||||||
|
return config.getOrDefault(key, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overloaded registerProp for boolean
|
||||||
|
public boolean registerProp(String key, boolean defaultValue, String comment) {
|
||||||
|
provider.addKeyValuePair(key, defaultValue, comment);
|
||||||
|
return config.getOrDefault(key, defaultValue);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package cc.toph.simplycompat.config;
|
||||||
|
|
||||||
|
import cc.toph.simplycompat.SimplyCompatExpectPlatform;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class ConfigProvider implements SimpleConfig.DefaultConfig {
|
||||||
|
private final String namespace;
|
||||||
|
private final HashMap<String, String> configMap = new HashMap<>();
|
||||||
|
private String contents = String.format("""
|
||||||
|
## Simply Compat Config
|
||||||
|
## Version: %s
|
||||||
|
|
||||||
|
""", SimplyCompatExpectPlatform.getVersion());
|
||||||
|
|
||||||
|
public ConfigProvider(String namespace) {
|
||||||
|
this.namespace = namespace;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 String get(String namespace) {
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<String, String> getMap() {
|
||||||
|
return configMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNamespace() {
|
||||||
|
return namespace;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,292 @@
|
||||||
|
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.SimplyCompat;
|
||||||
|
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("{} is missing, generating default one...", identifier);
|
||||||
|
|
||||||
|
try {
|
||||||
|
createConfig();
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOGGER.error("{} failed to generate!", identifier);
|
||||||
|
LOGGER.trace(e);
|
||||||
|
broken = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!broken) {
|
||||||
|
try {
|
||||||
|
loadConfig();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("{} failed to load!", identifier);
|
||||||
|
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) {
|
||||||
|
// File
|
||||||
|
// Path path = SimplyCompatExpectPlatform.getConfigDirectory().resolve(filename + FILE_EXTENSION);
|
||||||
|
// Folder
|
||||||
|
Path path = SimplyCompatExpectPlatform.getConfigDirectory().resolve(String.format("%s/%s%s", SimplyCompat.MOD_ID, 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
|
||||||
|
*/
|
||||||
|
public boolean delete() {
|
||||||
|
LOGGER.warn("Config '{}' will rise from the ashes! Please restart game.", request.filename);
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,21 +1,25 @@
|
||||||
package cc.toph.simplycompat.item;
|
package cc.toph.simplycompat.item;
|
||||||
|
|
||||||
|
import cc.toph.simplycompat.registry.ConfigRegistry.WEAPON_ATTRIBUTES;
|
||||||
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, WEAPON_ATTRIBUTES.COPPER, 8, Items.COPPER_INGOT),
|
||||||
STEEL(2, 600, 6.5F, 2.5F, 12, Items.DIAMOND);
|
STEEL(2, 600, 6.5F, 2.5F, WEAPON_ATTRIBUTES.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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package cc.toph.simplycompat.registry;
|
||||||
|
|
||||||
|
import cc.toph.simplycompat.SimplyCompat;
|
||||||
|
import cc.toph.simplycompat.config.Config;
|
||||||
|
import cc.toph.simplycompat.config.ConfigProvider;
|
||||||
|
|
||||||
|
public class ConfigRegistry {
|
||||||
|
public static final class WEAPON_ATTRIBUTES {
|
||||||
|
|
||||||
|
public static float COPPER;
|
||||||
|
public static float STEEL;
|
||||||
|
|
||||||
|
public static final ConfigProvider PROVIDER = new ConfigProvider("weapon_attributes");
|
||||||
|
|
||||||
|
public static void register() {
|
||||||
|
Config common = new Config(PROVIDER);
|
||||||
|
|
||||||
|
COPPER = common.registerProp(
|
||||||
|
"copper_damageModifier",
|
||||||
|
3.0f,
|
||||||
|
"Copper Damage Modifier"
|
||||||
|
);
|
||||||
|
|
||||||
|
STEEL = common.registerProp(
|
||||||
|
"steel_damageModifier",
|
||||||
|
5.0f,
|
||||||
|
"Steel Damage Modifier"
|
||||||
|
);
|
||||||
|
|
||||||
|
common.register();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerConfigs() {
|
||||||
|
WEAPON_ATTRIBUTES.register();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 {
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(
|
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(
|
||||||
SimplyCompat.MOD_ID,
|
SimplyCompat.MOD_ID,
|
||||||
Registries.ITEM
|
Registries.ITEM
|
||||||
);
|
);
|
||||||
|
|
||||||
private static RegistrySupplier<SimplySwordsSwordItem> registerSword(
|
private static void registerSword(
|
||||||
String materialPrefix,
|
|
||||||
SimplyCompatToolMaterials material,
|
SimplyCompatToolMaterials material,
|
||||||
WeaponType type
|
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 = material.getDamageModifier() + type.getPositiveModifier() - type.getNegativeModifier();
|
||||||
|
String name = material.getName() + "_" + type.getWeaponNameSuffix();
|
||||||
|
|
||||||
float finalDamage = 2.0f + type.getPositiveModifier() - type.getNegativeModifier();
|
ITEMS.register(name, () ->
|
||||||
// float finalDamage = baseModifier + type.getPositiveModifier() - type.getNegativeModifier();
|
new SimplySwordsSwordItem(material, (int) finalDamage, type.getAttackSpeed(), material.getIdentifier())
|
||||||
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",
|
* Registers all sword items. Iterate through all available weapon types
|
||||||
SimplyCompatToolMaterials.COPPER,
|
* and tool materials. For each combination, the corresponding sword
|
||||||
WeaponType.CHAKRAM
|
* 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
|
||||||
|
|
||||||
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_CLAYMORE = registerSword(
|
// Register "Vanilla" swords
|
||||||
"copper",
|
for (WeaponType type : WeaponType.values()) {
|
||||||
SimplyCompatToolMaterials.COPPER,
|
for (SimplyCompatToolMaterials material : SimplyCompatToolMaterials.values()) {
|
||||||
WeaponType.CLAYMORE
|
registerSword(material, type);
|
||||||
);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_CUTLASS = registerSword(
|
ITEMS.register();
|
||||||
"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
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
309
common/src/main/java/cc/toph/simplycompat/util/WeaponType.java
Normal file
309
common/src/main/java/cc/toph/simplycompat/util/WeaponType.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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"
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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')
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
249
gradlew
vendored
Executable file
249
gradlew
vendored
Executable file
|
@ -0,0 +1,249 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
Loading…
Add table
Reference in a new issue