THE MESS™

This commit is contained in:
Chris Toph 2025-02-19 17:40:58 -05:00
parent 2d37944e33
commit b24bf0d8f2
33 changed files with 1327 additions and 426 deletions

4
.vscode/launch.json vendored
View file

@ -9,7 +9,7 @@
"console": "integratedTerminal", "console": "integratedTerminal",
"stopOnEntry": false, "stopOnEntry": false,
"mainClass": "dev.architectury.transformer.TransformerRuntime", "mainClass": "dev.architectury.transformer.TransformerRuntime",
"vmArgs": "-Dfabric.dli.config\u003d/pool/git/SimplyCompat/forge/.gradle/loom-cache/launch.cfg -Dfabric.dli.env\u003dclient -Djava.net.preferIPv6Addresses\u003dsystem -p /home/toph/.gradle/caches/modules-2/files-2.1/cpw.mods/securejarhandler/2.1.10/51e6a22c6c716beb11e244bf5b8be480f51dd6b5/securejarhandler-2.1.10.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-commons/9.5/19ab5b5800a3910d30d3a3e64fdb00fd0cb42de0/asm-commons-9.5.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-util/9.5/64b5a1fc8c1b15ed2efd6a063e976bc8d3dc5ffe/asm-util-9.5.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/9.5/490bacc77de7cbc0be1a30bb3471072d705be4a4/asm-analysis-9.5.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-tree/9.5/fd33c8b6373abaa675be407082fdfda35021254a/asm-tree-9.5.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/9.5/dc6ea1875f4d64fbc85e1691c95b96a3d8569c90/asm-9.5.jar:/home/toph/.gradle/caches/modules-2/files-2.1/net.minecraftforge/JarJarFileSystems/0.3.19/2464eb7d6b9ddb9db36a82cf8a95193e5c6fe020/JarJarFileSystems-0.3.19.jar --add-modules ALL-MODULE-PATH --add-opens java.base/java.util.jar\u003dcpw.mods.securejarhandler --add-opens java.base/java.lang.invoke\u003dcpw.mods.securejarhandler --add-exports java.base/sun.security.util\u003dcpw.mods.securejarhandler --add-exports jdk.naming.dns/com.sun.jndi.dns\u003djava.naming -Dfabric.dli.main\u003dcpw.mods.bootstraplauncher.BootstrapLauncher -Darchitectury.main.class\u003d/pool/git/SimplyCompat/forge/.gradle/architectury/.main_class -Darchitectury.runtime.transformer\u003d/pool/git/SimplyCompat/forge/.gradle/architectury/.transforms -Darchitectury.properties\u003d/pool/git/SimplyCompat/forge/.gradle/architectury/.properties -Djdk.attach.allowAttachSelf\u003dtrue -javaagent:/pool/git/SimplyCompat/.gradle/architectury/architectury-transformer-agent.jar", "vmArgs": "-Dfabric.dli.config\u003d/pool/git/SimplyCompat/forge/.gradle/loom-cache/launch.cfg -Dfabric.dli.env\u003dclient -Djava.net.preferIPv6Addresses\u003dsystem -p /home/toph/.gradle/caches/modules-2/files-2.1/cpw.mods/securejarhandler/2.1.10/51e6a22c6c716beb11e244bf5b8be480f51dd6b5/securejarhandler-2.1.10.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-commons/9.7.1/406c6a2225cfe1819f102a161e54cc16a5c24f75/asm-commons-9.7.1.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-util/9.7.1/9e23359b598ec6b74b23e53110dd5c577adf2243/asm-util-9.7.1.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/9.7.1/f97a3b319f0ed6a8cd944dc79060d3912a28985f/asm-analysis-9.7.1.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-tree/9.7.1/3a53139787663b139de76b627fca0084ab60d32c/asm-tree-9.7.1.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/9.7.1/f0ed132a49244b042cd0e15702ab9f2ce3cc8436/asm-9.7.1.jar:/home/toph/.gradle/caches/modules-2/files-2.1/net.minecraftforge/JarJarFileSystems/0.3.19/2464eb7d6b9ddb9db36a82cf8a95193e5c6fe020/JarJarFileSystems-0.3.19.jar --add-modules ALL-MODULE-PATH --add-opens java.base/java.util.jar\u003dcpw.mods.securejarhandler --add-opens java.base/java.lang.invoke\u003dcpw.mods.securejarhandler --add-exports java.base/sun.security.util\u003dcpw.mods.securejarhandler --add-exports jdk.naming.dns/com.sun.jndi.dns\u003djava.naming -Dfabric.dli.main\u003dcpw.mods.bootstraplauncher.BootstrapLauncher -Darchitectury.main.class\u003d/pool/git/SimplyCompat/forge/.gradle/architectury/.main_class -Darchitectury.runtime.transformer\u003d/pool/git/SimplyCompat/forge/.gradle/architectury/.transforms -Darchitectury.properties\u003d/pool/git/SimplyCompat/forge/.gradle/architectury/.properties -Djdk.attach.allowAttachSelf\u003dtrue -javaagent:/pool/git/SimplyCompat/.gradle/architectury/architectury-transformer-agent.jar",
"args": "", "args": "",
"env": { "env": {
"MOD_CLASSES": "main%%/pool/git/SimplyCompat/forge/build/resources/main:main%%/pool/git/SimplyCompat/forge/build/classes/java/main", "MOD_CLASSES": "main%%/pool/git/SimplyCompat/forge/build/resources/main:main%%/pool/git/SimplyCompat/forge/build/classes/java/main",
@ -25,7 +25,7 @@
"console": "integratedTerminal", "console": "integratedTerminal",
"stopOnEntry": false, "stopOnEntry": false,
"mainClass": "dev.architectury.transformer.TransformerRuntime", "mainClass": "dev.architectury.transformer.TransformerRuntime",
"vmArgs": "-Dfabric.dli.config\u003d/pool/git/SimplyCompat/forge/.gradle/loom-cache/launch.cfg -Dfabric.dli.env\u003dserver -Djava.net.preferIPv6Addresses\u003dsystem -p /home/toph/.gradle/caches/modules-2/files-2.1/cpw.mods/securejarhandler/2.1.10/51e6a22c6c716beb11e244bf5b8be480f51dd6b5/securejarhandler-2.1.10.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-commons/9.5/19ab5b5800a3910d30d3a3e64fdb00fd0cb42de0/asm-commons-9.5.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-util/9.5/64b5a1fc8c1b15ed2efd6a063e976bc8d3dc5ffe/asm-util-9.5.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/9.5/490bacc77de7cbc0be1a30bb3471072d705be4a4/asm-analysis-9.5.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-tree/9.5/fd33c8b6373abaa675be407082fdfda35021254a/asm-tree-9.5.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/9.5/dc6ea1875f4d64fbc85e1691c95b96a3d8569c90/asm-9.5.jar:/home/toph/.gradle/caches/modules-2/files-2.1/net.minecraftforge/JarJarFileSystems/0.3.19/2464eb7d6b9ddb9db36a82cf8a95193e5c6fe020/JarJarFileSystems-0.3.19.jar --add-modules ALL-MODULE-PATH --add-opens java.base/java.util.jar\u003dcpw.mods.securejarhandler --add-opens java.base/java.lang.invoke\u003dcpw.mods.securejarhandler --add-exports java.base/sun.security.util\u003dcpw.mods.securejarhandler --add-exports jdk.naming.dns/com.sun.jndi.dns\u003djava.naming -Dfabric.dli.main\u003dcpw.mods.bootstraplauncher.BootstrapLauncher -Darchitectury.main.class\u003d/pool/git/SimplyCompat/forge/.gradle/architectury/.main_class -Darchitectury.runtime.transformer\u003d/pool/git/SimplyCompat/forge/.gradle/architectury/.transforms -Darchitectury.properties\u003d/pool/git/SimplyCompat/forge/.gradle/architectury/.properties -Djdk.attach.allowAttachSelf\u003dtrue -javaagent:/pool/git/SimplyCompat/.gradle/architectury/architectury-transformer-agent.jar", "vmArgs": "-Dfabric.dli.config\u003d/pool/git/SimplyCompat/forge/.gradle/loom-cache/launch.cfg -Dfabric.dli.env\u003dserver -Djava.net.preferIPv6Addresses\u003dsystem -p /home/toph/.gradle/caches/modules-2/files-2.1/cpw.mods/securejarhandler/2.1.10/51e6a22c6c716beb11e244bf5b8be480f51dd6b5/securejarhandler-2.1.10.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-commons/9.7.1/406c6a2225cfe1819f102a161e54cc16a5c24f75/asm-commons-9.7.1.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-util/9.7.1/9e23359b598ec6b74b23e53110dd5c577adf2243/asm-util-9.7.1.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/9.7.1/f97a3b319f0ed6a8cd944dc79060d3912a28985f/asm-analysis-9.7.1.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-tree/9.7.1/3a53139787663b139de76b627fca0084ab60d32c/asm-tree-9.7.1.jar:/home/toph/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/9.7.1/f0ed132a49244b042cd0e15702ab9f2ce3cc8436/asm-9.7.1.jar:/home/toph/.gradle/caches/modules-2/files-2.1/net.minecraftforge/JarJarFileSystems/0.3.19/2464eb7d6b9ddb9db36a82cf8a95193e5c6fe020/JarJarFileSystems-0.3.19.jar --add-modules ALL-MODULE-PATH --add-opens java.base/java.util.jar\u003dcpw.mods.securejarhandler --add-opens java.base/java.lang.invoke\u003dcpw.mods.securejarhandler --add-exports java.base/sun.security.util\u003dcpw.mods.securejarhandler --add-exports jdk.naming.dns/com.sun.jndi.dns\u003djava.naming -Dfabric.dli.main\u003dcpw.mods.bootstraplauncher.BootstrapLauncher -Darchitectury.main.class\u003d/pool/git/SimplyCompat/forge/.gradle/architectury/.main_class -Darchitectury.runtime.transformer\u003d/pool/git/SimplyCompat/forge/.gradle/architectury/.transforms -Darchitectury.properties\u003d/pool/git/SimplyCompat/forge/.gradle/architectury/.properties -Djdk.attach.allowAttachSelf\u003dtrue -javaagent:/pool/git/SimplyCompat/.gradle/architectury/architectury-transformer-agent.jar",
"args": "nogui", "args": "nogui",
"env": { "env": {
"MOD_CLASSES": "main%%/pool/git/SimplyCompat/forge/build/resources/main:main%%/pool/git/SimplyCompat/forge/build/classes/java/main", "MOD_CLASSES": "main%%/pool/git/SimplyCompat/forge/build/resources/main:main%%/pool/git/SimplyCompat/forge/build/classes/java/main",

34
.vscode/settings.json vendored
View file

@ -1,23 +1,25 @@
{ {
"java.compile.nullAnalysis.mode": "automatic",
"editor.formatOnSave": true,
"java.format.settings.url": ".vscode/java-formatter.xml",
"[java]": { "[java]": {
"editor.detectIndentation": false,
"editor.insertSpaces": false, "editor.insertSpaces": false,
"editor.tabSize": 2, "editor.tabSize": 2
"editor.detectIndentation": false
}, },
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable",
"java.configuration.updateBuildConfiguration": "interactive",
"java.jdt.ls.java.home": "/home/toph/.asdf/installs/java/openjdk-17",
"explorer.fileNesting.patterns": {
"gradlew": "build.gradle, gradle.properties, gradlew.bat, settings.gradle",
".gitignore": ".gitattributes, .tool-versions, LICENSE.txt, README.md, .prettierrc.yaml"
},
"workbench.iconTheme": "material-icon-theme",
"editor.fontSize": 15,
"editor.cursorStyle": "block", "editor.cursorStyle": "block",
"editor.fontLigatures": true,
"editor.fontFamily": "'Monocraft Nerd Font', 'monospace', monospace", "editor.fontFamily": "'Monocraft Nerd Font', 'monospace', monospace",
"prettier-plugin-java-vscode.prettierConfigPath": "${workspaceFolder}/.prettierrc.yaml" "editor.fontLigatures": true,
"editor.fontSize": 15,
"editor.formatOnSave": true,
"explorer.fileNesting.patterns": {
".gitignore": ".gitattributes, .tool-versions, LICENSE.txt, README.md, .prettierrc.yaml",
"build.gradle": "gradle.properties, gradlew.bat, settings.gradle"
},
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "interactive",
"java.format.settings.url": ".vscode/java-formatter.xml",
"java.import.gradle.home": "/home/toph/.asdf/installs/gradle/8.8",
"java.jdt.ls.java.home": "/home/toph/.asdf/installs/java/openjdk-17",
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx4G -Xms100m -Xlog:disable",
"jdk.jdkhome": "/home/toph/.asdf/installs/java/openjdk-17",
"prettier-plugin-java-vscode.prettierConfigPath": "${workspaceFolder}/.prettierrc.yaml",
"workbench.iconTheme": "material-icon-theme"
} }

View file

@ -1,6 +1,6 @@
plugins { plugins {
id "architectury-plugin" version "3.4-SNAPSHOT" id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.3-SNAPSHOT" apply false id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
} }
architectury { architectury {
@ -19,7 +19,7 @@ subprojects {
// The following line declares the mojmap mappings, you may use other mappings as well // The following line declares the mojmap mappings, you may use other mappings as well
// mappings loom.officialMojangMappings() // mappings loom.officialMojangMappings()
// The following line declares the yarn mappings you may select this one as well. // The following line declares the yarn mappings you may select this one as well.
mappings "net.fabricmc:yarn:1.20.1+build.10:v2" mappings "net.fabricmc:yarn:${rootProject.yarn_mappings}:v2"
} }
} }

View file

@ -7,6 +7,7 @@ loom {
} }
repositories { repositories {
exclusiveContent { exclusiveContent {
forRepository { forRepository {
maven { maven {
@ -17,6 +18,8 @@ repositories {
includeGroup "curse.maven" includeGroup "curse.maven"
} }
} }
maven { url "https://maven.shedaniel.me/" }
} }
dependencies { dependencies {
@ -26,10 +29,18 @@ dependencies {
// Remove the next line if you don't want to depend on the API // Remove the next line if you don't want to depend on the API
modApi "dev.architectury:architectury:${rootProject.architectury_version}" modApi "dev.architectury:architectury:${rootProject.architectury_version}"
implementation "curse.maven:additional-additions-forge-582387:5155724"
implementation "curse.maven:create-328085:5838779" modApi("me.shedaniel.cloth:cloth-config:${rootProject.cloth_config_version}") {
implementation "curse.maven:create-industry-693815:5811638" exclude(group: "net.fabricmc.fabric-api")
implementation "curse.maven:simplyswords-659887:5255981" }
modImplementation("curse.maven:simplyswords-659887:5255981")
// runtimeOnly "curse.maven:better-combat-by-daedelus-639842:5625757"
// runtimeOnly "curse.maven:playeranimator-658587:4587214"
// implementation "curse.maven:additional-additions-forge-582387:5155724"
// implementation "curse.maven:create-328085:5838779"
// implementation "curse.maven:create-industry-693815:5811638"
} }
publishing { publishing {

View file

@ -1,24 +1,111 @@
package cc.toph.simplycompat; package cc.toph.simplycompat;
import cc.toph.simplycompat.registry.ItemsRegistry;
import dev.architectury.platform.Platform;
import dev.architectury.registry.CreativeTabRegistry;
import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.RegistrySupplier;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.text.Text;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class SimplyCompat { public class SimplyCompat {
public static final String MOD_ID = "simplycompat"; public static final String MOD_ID = "simplycompat";
// We can use this if we don't want to use DeferredRegister
// public static final Supplier<RegistrarManager> REGISTRIES = Suppliers.memoize(() -> RegistrarManager.get(MOD_ID)); public static final DeferredRegister<ItemGroup> TABS = DeferredRegister.create(
// SimplyCompat.MOD_ID,
// // Registering a new creative tab RegistryKeys.ITEM_GROUP
// public static final DeferredRegister<ItemGroups> TABS = DeferredRegister.create(MOD_ID, Registries.CREATIVE_MODE_TAB); );
// public static final RegistrySupplier<ItemGroups> EXAMPLE_TAB = TABS.register("example_tab", () ->
// CreativeTabRegistry.create(Component.translatable("itemGroup." + MOD_ID + ".example_tab"), public static final RegistrySupplier<ItemGroup> SIMPLYCOMPAT = TABS.register(
// () -> new ItemStack(ExampleMod.EXAMPLE_ITEM.get()))); "simplycompat", // Tab ID
// () ->
// public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(MOD_ID, Registries.ITEM); CreativeTabRegistry.create(
// public static final RegistrySupplier<Item> EXAMPLE_ITEM = ITEMS.register("example_item", () -> Text.translatable("itemGroup.simplycompat.simplycompat"), // Tab Name
// new Item(new Item.Properties().arch$tab(ExampleMod.EXAMPLE_TAB))); () -> new ItemStack(Items.AMETHYST_SHARD) // TODO: Icon
// )
);
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
public static boolean isConfigOutdated;
// public static GeneralConfig generalConfig;
// public static LootConfig lootConfig;
// public static GemEffectsConfig gemEffectsConfig;
// public static RunicEffectsConfig runicEffectsConfig;
// public static StatusEffectsConfig statusEffectsConfig;
// public static UniqueEffectsConfig uniqueEffectsConfig;
// public static WeaponAttributesConfig weaponAttributesConfig;
//
// public static String minimumEldritchEndVersion = "0.2.40";
// public static String minimumSpellPowerVersion = "0.10.0+1.20.1";
public static void init() { public static void init() {
// TABS.register(); //CONFIG
// ITEMS.register();
// // SimplyCompatConfig.init();
System.out.println(ExpectPlatform.getConfigDirectory().toAbsolutePath().normalize().toString()); //
// AutoConfig.register(ConfigWrapper.class, PartitioningSerializer.wrap(JanksonConfigSerializer::new));
// generalConfig = AutoConfig.getConfigHolder(ConfigWrapper.class).getConfig().general;
//// lootConfig = AutoConfig.getConfigHolder(ConfigWrapper.class).getConfig().loot;
//// gemEffectsConfig = AutoConfig.getConfigHolder(ConfigWrapper.class).getConfig().gem_effects;
//// runicEffectsConfig = AutoConfig.getConfigHolder(ConfigWrapper.class).getConfig().runic_effects;
//// statusEffectsConfig = AutoConfig.getConfigHolder(ConfigWrapper.class).getConfig().status_effects;
//// uniqueEffectsConfig = AutoConfig.getConfigHolder(ConfigWrapper.class).getConfig().unique_effects;
// weaponAttributesConfig = AutoConfig.getConfigHolder(ConfigWrapper.class).getConfig().weapon_attributes;
String version = SimplyCompatExpectPlatform.getVersion();
String defaultConfig = String.format(
"""
{
"regen_simplycompat_config_file": false,
"config_version": %s
}""",
version.substring(0, 4)
);
// File configFile = Config.createFile("config/simplycompat_extra/backupconfig.json", defaultConfig, false);
// JsonObject json = Config.getJsonObject(Config.readFile(configFile));
// isConfigOutdated = !json.has("config_version") || !version.startsWith(json.get("config_version").getAsString());
//
// SimplySwordsConfig.generateConfigs(json == null || !json.has("regen_simplyswords_config_file") || json.get("regen_simplyswords_config_file").getAsBoolean());
// SimplySwordsConfig.loadConfig();
SimplyCompat.TABS.register();
ItemsRegistry.ITEMS.register();
// SoundRegistry.SOUND.register();
// EffectRegistry.EFFECT.register();
// EntityRegistry.ENTITIES.register();
// ModLootTableModifiers.init();
// if (passVersionCheck("eldritch_end", minimumEldritchEndVersion)) {
// EldritchEndCompat.registerModItems();
// EldritchEndCompatRegistry.EFFECT.register();
// }
// try {
// FileCopier.copyFileToConfigDirectory();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
//Don't announce via in-game chat because that's kinda annoying
//ClientPlayerEvent.CLIENT_PLAYER_JOIN.register(new EventGameStart());
System.out.println(
SimplyCompatExpectPlatform.getConfigDirectory().toAbsolutePath().normalize().toString()
);
}
public static boolean passVersionCheck(String modId, String requiredVersion) {
if (Platform.isModLoaded(modId)) {
return Platform.getMod(modId).getVersion().compareTo(requiredVersion) >= 0;
}
return false;
} }
} }

View file

@ -0,0 +1,36 @@
package cc.toph.simplycompat;
public class SimplyCompat {
public static final String MOD_ID = "simplycompat";
// We can use this if we don't want to use DeferredRegister
public static final Supplier<RegistrarManager> REGISTRIES = Suppliers.memoize(() ->
RegistrarManager.get(MOD_ID)
);
// Registering a new creative tab
public static final DeferredRegister<ItemGroups> TABS = DeferredRegister.create(
MOD_ID,
Registries.CREATIVE_MODE_TAB
);
public static final RegistrySupplier<ItemGroups> EXAMPLE_TAB = TABS.register("example_tab", () ->
CreativeTabRegistry.create(Component.translatable("itemGroup." + MOD_ID + ".example_tab"), () ->
new ItemStack(ExampleMod.EXAMPLE_ITEM.get())
)
);
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(
MOD_ID,
Registries.ITEM
);
public static final RegistrySupplier<Item> EXAMPLE_ITEM = ITEMS.register("example_item", () ->
new Item(new Item.Properties().arch$tab(ExampleMod.EXAMPLE_TAB))
);
public static void init() {
// TABS.register();
// ITEMS.register();
//
System.out.println(ExpectPlatform.getConfigDirectory().toAbsolutePath().normalize().toString());
}
}

View file

@ -0,0 +1,43 @@
package cc.toph.simplycompat;
import dev.architectury.injectables.annotations.ExpectPlatform;
import java.nio.file.Path;
import net.minecraft.entity.player.PlayerEntity;
public class SimplyCompatExpectPlatform {
/**
* We can use {@link Platform#getConfigFolder()} but this is just an example of {@link ExpectPlatform}.
* <p>
* This must be a <b>public static</b> method. The platform-implemented solution must be placed under a
* platform sub-package, with its class suffixed with {@code Impl}.
* <p>
* Example:
* Expect: net.examplemod.ExampleExpectPlatform#getConfigDirectory()
* Actual Fabric: net.examplemod.fabric.ExampleExpectPlatformImpl#getConfigDirectory()
* Actual Forge: net.examplemod.forge.ExampleExpectPlatformImpl#getConfigDirectory()
* <p>
* <a href="https://plugins.jetbrains.com/plugin/16210-architectury">You should also get the IntelliJ plugin to help with @ExpectPlatform.</a>
*/
@ExpectPlatform
public static Path getConfigDirectory() {
// Just throw an error, the content should get replaced at runtime.
throw new AssertionError();
}
@ExpectPlatform
public static String getVersion() {
// Just throw an error, the content should get replaced at runtime.
throw new AssertionError();
}
@ExpectPlatform
public static float getSpellPowerDamage(
float damageModifier,
PlayerEntity player,
String magicSchool
) {
// Just throw an error, the content should get replaced at runtime.
throw new AssertionError();
}
}

View file

@ -0,0 +1,190 @@
package cc.toph.simplycompat.config;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;
public class Config {
public static File createFile(String path, String contents, boolean overwrite) {
File file = new File(path);
if (file.exists() && !overwrite) {
return file;
}
file.getParentFile().mkdirs();
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
file.setReadable(true);
file.setWritable(true);
file.setExecutable(true);
if (contents == null || "".equals(contents)) {
return file;
}
try (FileWriter writer = new FileWriter(file)) {
writer.write(contents);
} catch (IOException e) {
e.printStackTrace();
}
return file;
}
public static String readFile(File file) {
String output = "";
try (Scanner scanner = new Scanner(file)) {
scanner.useDelimiter("\\Z");
output = scanner.next();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return output;
}
public static JsonObject getJsonObject(String json) {
try {
return new JsonParser().parse(json).getAsJsonObject();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
// -- Safe Config Fetching --
// Allows safely fetching config values in a scenario where we do not know if they exist.
// EG. Addon mod for Simply Swords attempting to load config values before Simply Swords has initialised.
private static final HashMap<String, Boolean> BOOLEAN = new LinkedHashMap<>();
private static final HashMap<String, Float> FLOAT = new LinkedHashMap<>();
private static final HashMap<String, Double> DOUBLE = new LinkedHashMap<>();
private static final HashMap<String, Integer> INT = new LinkedHashMap<>();
public static boolean getBoolean(String key, String parent, boolean defaultValue) {
//System.out.println("Trying to fetch config value for " + key + " from " + parent);
safeValueFetch("boolean", parent);
if (!BOOLEAN.isEmpty()) {
if (BOOLEAN.containsKey(key)) {
//System.out.println("Successfully fetched value for " + key + " : " + BOOLEAN.get(key));
return BOOLEAN.get(key);
}
}
System.out.println("Failed to fetch config value for " + key + ". Loading default value.\nIt is recommended that you restart your game.");
return defaultValue;
}
public static float getFloat(String key, String parent, float defaultValue) {
//System.out.println("Trying to fetch config value for " + key + " from " + parent);
safeValueFetch("float", parent);
if (!FLOAT.isEmpty()) {
if (FLOAT.containsKey(key)) {
//System.out.println("Successfully fetched value for " + key + " : " + FLOAT.get(key));
return FLOAT.get(key);
}
}
System.out.println("Failed to fetch config value for " + key + ". Loading default value.\nIt is recommended that you restart your game.");
//System.out.print(FLOAT);
return defaultValue;
}
public static double getDouble(String key, String parent, double defaultValue) {
safeValueFetch("double", parent);
if (!DOUBLE.isEmpty()) {
if (DOUBLE.containsKey(key))
return DOUBLE.get(key);
}
System.out.println("Failed to fetch config value for " + key + ". Loading default value.\nIt is recommended that you restart your game.");
return defaultValue;
}
public static int getInt(String key, String parent, int defaultValue) {
safeValueFetch("int", parent);
if (!INT.isEmpty()) {
if (INT.containsKey(key))
return INT.get(key);
}
System.out.println("Failed to fetch config value for " + key + ". Loading default value.\nIt is recommended that you restart your game.");
return defaultValue;
}
public static void safeValueFetch(String type, String parent) {
Path path = Paths.get("config/simplycompat_main/");
JsonObject json = null;
if (Files.exists(path)) {
json = switch (parent) {
// case "GemEffects" ->
// Config.getJsonObject(Config.readFile(new File("config/simplyswords_main/gem_effects.json5")));
// case "General" ->
// Config.getJsonObject(Config.readFile(new File("config/simplyswords_main/general.json5")));
// case "Loot" -> Config.getJsonObject(Config.readFile(new File("config/simplyswords_main/loot.json5")));
// case "RunicEffects" ->
//// Config.getJsonObject(Config.readFile(new File("config/simplyswords_main/runic_effects.json5")));
// case "StatusEffects" ->
// Config.getJsonObject(Config.readFile(new File("config/simplyswords_main/status_effects.json5")));
// case "UniqueEffects" ->
// Config.getJsonObject(Config.readFile(new File("config/simplyswords_main/unique_effects.json5")));
case "WeaponAttributes" ->
Config.getJsonObject(Config.readFile(new File("config/simplycompat_main/weapon_attributes.json5")));
default -> null;
};
}
if (json != null) {
switch (type) {
case "boolean" -> {
for (Map.Entry<String, JsonElement> entry : json.entrySet()) {
try {
BOOLEAN.put(entry.getKey(), entry.getValue().getAsBoolean());
} catch (Exception e) {
//System.out.println(entry.getKey() + ": " + entry.getValue() + " is not a valid value. Skipping this entry.");
}
}
}
case "float" -> {
for (Map.Entry<String, JsonElement> entry : json.entrySet()) {
try {
FLOAT.put(entry.getKey(), entry.getValue().getAsFloat());
} catch (Exception e) {
//System.out.println(entry.getKey() + ": " + entry.getValue() + " is not a valid value. Skipping this entry.");
}
}
}
case "double" -> {
for (Map.Entry<String, JsonElement> entry : json.entrySet()) {
try {
DOUBLE.put(entry.getKey(), entry.getValue().getAsDouble());
} catch (Exception e) {
//System.out.println(entry.getKey() + ": " + entry.getValue() + " is not a valid value. Skipping this entry.");
}
}
}
case "int" -> {
for (Map.Entry<String, JsonElement> entry : json.entrySet()) {
try {
INT.put(entry.getKey(), entry.getValue().getAsInt());
} catch (Exception e) {
//System.out.println(entry.getKey() + ": " + entry.getValue() + " is not a valid value. Skipping this entry.");
}
}
}
}
}
}
}

View file

@ -0,0 +1,59 @@
package cc.toph.simplycompat.config;
public class ConfigDefaultValues {
// public static float bronze_damageModifier = 3.0f;
public static float copper_damageModifier = 3.0f;
// public static float steel_damageModifier = 3.0f;
// // -- LOOT CONFIG --
//
// public static boolean enableLootDrops = true;
//
// public static boolean enableLootInVillages = false;
// public static boolean enableTheWatcher = true;
//
// public static float standardLootTableWeight = 0.01f;
//
// public static float rareLootTableWeight = 0.004f;
//
// public static float runicLootTableWeight = 0.007f;
//
// public static float uniqueLootTableWeight = 0.001f;
// public static boolean enableWatchingWarglaive = true;
// public static boolean enableContainedRemnants = true;
// public static boolean enableLongswordOfThePlague = true;
// public static boolean enableSwordOnAStick = true;
// public static boolean enableBramblethorn = true;
// public static boolean enableStormsEdge = true;
// public static boolean enableStormbringer = true;
// public static boolean enableMjolnir = true;
// public static boolean enableEmberblade = true;
// public static boolean enableHearthflame = true;
// public static boolean enableTwistedBlade = true;
// public static boolean enableSoulrender = true;
// public static boolean enableSoulpyre = true;
// public static boolean enableSoulkeeper = true;
// public static boolean enableSoulstealer = true;
// public static boolean enableFrostfall = true;
// public static boolean enableMoltenEdge = true;
// public static boolean enableLivyatan = true;
// public static boolean enableIcewhisper = true;
// public static boolean enableArcanethyst = true;
// public static boolean enableThunderbrand = true;
// public static boolean enableBrimstone = true;
// public static boolean enableSlumberingLichblade = true;
// public static boolean enableShadowsting = true;
// public static boolean enableDormantRelic = true;
// public static boolean enableWhisperwind = true;
// public static boolean enableEmberlash = true;
// public static boolean enableWaxweaver = true;
// public static boolean enableHiveheart = true;
// public static boolean enableStarsEdge = true;
// public static boolean enableWickpiercer = true;
// public static boolean enableTempest = true;
// public static boolean enableFlamewind = true;
// public static boolean enableRibboncleaver = true;
// public static boolean enableCaelestis = true;
}

View file

@ -0,0 +1,33 @@
package cc.toph.simplycompat.config;
import cc.toph.simplycompat.SimplyCompat;
import me.shedaniel.autoconfig.annotation.Config;
import me.shedaniel.autoconfig.annotation.ConfigEntry;
import me.shedaniel.autoconfig.serializer.PartitioningSerializer;
@Config(name = SimplyCompat.MOD_ID + "_main")
@Config.Gui.Background("cloth-config2:transparent")
public class ConfigWrapper extends PartitioningSerializer.GlobalData {
// @ConfigEntry.Category("general")
// @ConfigEntry.Gui.TransitiveObject
// public GeneralConfig general = new GeneralConfig();
// @ConfigEntry.Category("loot")
// @ConfigEntry.Gui.TransitiveObject
// public LootConfig loot = new LootConfig();
// @ConfigEntry.Category("gem_effects")
// @ConfigEntry.Gui.TransitiveObject
// public GemEffectsConfig gem_effects = new GemEffectsConfig();
// @ConfigEntry.Category("runic_effects")
// @ConfigEntry.Gui.TransitiveObject
// public RunicEffectsConfig runic_effects = new RunicEffectsConfig();
// @ConfigEntry.Category("status_effects")
// @ConfigEntry.Gui.TransitiveObject
// public StatusEffectsConfig status_effects = new StatusEffectsConfig();
// @ConfigEntry.Category("unique_effects")
// @ConfigEntry.Gui.TransitiveObject
// public UniqueEffectsConfig unique_effects = new UniqueEffectsConfig();
@ConfigEntry.Category("weapon_attributes")
@ConfigEntry.Gui.TransitiveObject
public WeaponAttributesConfig weapon_attributes = new WeaponAttributesConfig();
}

View file

@ -0,0 +1,62 @@
package cc.toph.simplycompat.config;
import me.shedaniel.autoconfig.ConfigData;
import me.shedaniel.autoconfig.annotation.Config;
import me.shedaniel.autoconfig.annotation.ConfigEntry;
@Config(name = "loot")
public class LootConfig implements ConfigData {
@ConfigEntry.Gui.PrefixText
@ConfigEntry.Gui.Tooltip
public boolean enableLootDrops = true;
@ConfigEntry.Gui.Tooltip
public boolean enableLootInVillages = false;
public boolean enableTheWatcher = true;
@ConfigEntry.Gui.Tooltip
public float standardLootTableWeight = 0.01f;
@ConfigEntry.Gui.Tooltip
public float rareLootTableWeight = 0.004f;
@ConfigEntry.Gui.Tooltip
public float runicLootTableWeight = 0.007f;
@ConfigEntry.Gui.Tooltip
public float uniqueLootTableWeight = 0.001f;
@ConfigEntry.Gui.Tooltip
public boolean enableContainedRemnants = true;
public boolean enableWatchingWarglaive = true;
public boolean enableLongswordOfThePlague = true;
public boolean enableSwordOnAStick = true;
public boolean enableBramblethorn = true;
public boolean enableStormsEdge = true;
public boolean enableStormbringer = true;
public boolean enableMjolnir = true;
public boolean enableEmberblade = true;
public boolean enableHearthflame = true;
public boolean enableTwistedBlade = true;
public boolean enableSoulrender = true;
public boolean enableSoulpyre = true;
public boolean enableSoulkeeper = true;
public boolean enableSoulstealer = true;
public boolean enableFrostfall = true;
public boolean enableMoltenEdge = true;
public boolean enableLivyatan = true;
public boolean enableIcewhisper = true;
public boolean enableArcanethyst = true;
public boolean enableThunderbrand = true;
public boolean enableBrimstone = true;
public boolean enableSlumberingLichblade = true;
public boolean enableShadowsting = true;
public boolean enableDormantRelic = true;
public boolean enableWhisperwind = true;
public boolean enableEmberlash = true;
public boolean enableWaxweaver = true;
public boolean enableHiveheart = true;
public boolean enableStarsEdge = true;
public boolean enableWickpiercer = true;
public boolean enableTempest = true;
public boolean enableFlamewind = true;
public boolean enableRibboncleaver = true;
public boolean enableCaelestis = true;
}

View file

@ -0,0 +1,99 @@
package cc.toph.simplycompat.config;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.io.File;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
public class SimplyCompatConfig {
private static final HashMap<String, Float> LOOT_OPTIONS = new LinkedHashMap<>();
public static float getLootModifiers(String key) {
if (!LOOT_OPTIONS.containsKey(key)) {
//System.out.println(key);
return 0f;
}
return LOOT_OPTIONS.get(key);
}
public static boolean getLootList(String id) {
if (!LOOT_OPTIONS.isEmpty()) {
//System.out.println(id);
return LOOT_OPTIONS.toString().contains(id);
}
return false;
}
public static void init() {
LOOT_OPTIONS.put("minecraft:entities/wither", 0.05f);
LOOT_OPTIONS.put("minecraft:entities/ender_dragon", 0.5f);
LOOT_OPTIONS.put("minecraft:chests/ruined_portal", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_armorer", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_butcher", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_cartographer", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_desert_house", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_fisher", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_fletcher", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_mason", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_plains_house", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_savanna_house", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_shepard", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_snowy_house", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_taiga_house", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_tannery", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_temple", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_toolsmith", 0f);
LOOT_OPTIONS.put("minecraft:chests/village/village_weaponsmith", 0f);
}
public static void loadConfig() {
//System.out.println("Loading common Simply Swords config");
JsonObject json;
json = Config.getJsonObject(Config.readFile(new File("config/simplyswords_extra/loot_config.json5")));
for (Map.Entry<String, JsonElement> entry : json.entrySet()) {
LOOT_OPTIONS.put(entry.getKey(), entry.getValue().getAsFloat());
}
}
public static void generateConfigs(boolean overwrite) {
//System.out.println("Generating common Simply Swords config");
StringBuilder config;
int i;
config = new StringBuilder("{\n");
i = 0;
for (String key : LOOT_OPTIONS.keySet()) {
if (i == 0) {
config.append("// --------------------------------------------- LOOT CONFIGURATION ----------------------------------------------------------------- \n");
config.append("// This config allows for the tweaking of loot injection for UNIQUE weapons. \n");
config.append("// Standard iron > diamond gear, and Runic Tablets, are controlled by the loot modifiers in the general_config, not here. \n");
config.append("// ---------------------------------------------------------------------------------------------------------------------------------- \n");
config.append("// --------------------------------------------- How does it work? ------------------------------------------------------------------ \n");
config.append("// If 'add_weapons_to_loot_tables' is enabled in the simplyswords_main config, Simply Swords will attempt to inject its loot into \n");
config.append("// any loot table that contains 'chests' in its filepath. This includes loot tables from other mods.\n");
config.append("// Any values provided in this config will override the aforementioned process, acting as both a whitelist, and a blacklist.\n");
config.append("\n");
config.append("// Each line must be made up of a string containing the namespace, path, and filename, in addition to a float value. \n");
config.append("// The float value provided will determine the chance of the loot appearing in the loot table. Where 0.0 is %0, and 1.0 is %100.\n");
config.append("// If the float value provided is 0.0 the items will be blacklisted from this loot table and skipped entirely by the loot injection.\n");
config.append("\n");
config.append("// Items can also be injected into entity loot tables, as seen in the Wither example below.\n");
config.append("// ---------------------------------------------------------------------------------------------------------------------------------- \n");
config.append("\n");
}
config.append(" \"").append(key).append("\": ").append(LOOT_OPTIONS.get(key));
++i;
if (i < LOOT_OPTIONS.size()) {
config.append(",");
}
config.append("\n");
}
config.append("}");
Config.createFile("config/simplyswords_extra/loot_config.json5", config.toString(), overwrite);
}
}

View file

@ -0,0 +1,15 @@
package cc.toph.simplycompat.config;
import me.shedaniel.autoconfig.ConfigData;
import me.shedaniel.autoconfig.annotation.Config;
import me.shedaniel.autoconfig.annotation.ConfigEntry;
@Config(name = "weapon_attributes")
public class WeaponAttributesConfig implements ConfigData {
@ConfigEntry.Gui.PrefixText
public float bronze_damageModifier = 3.0f;
public float copper_damageModifier = 3.0f;
public float steel_damageModifier = 3.0f;
}

View file

@ -0,0 +1,71 @@
package cc.toph.simplycompat.item;
import com.google.common.base.Suppliers;
import java.util.function.Supplier;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterial;
import net.minecraft.recipe.Ingredient;
public enum SimplyCompatToolMaterials implements ToolMaterial {
COPPER(1, 125, 4.5F, 1.0F, 8, Items.COPPER_INGOT),
STEEL(2, 600, 6.5F, 2.5F, 12, Items.DIAMOND);
private final int miningLevel;
private final int itemDurability;
private final float miningSpeed;
private final float attackDamage;
private final int enchantability;
private final Supplier<Ingredient> repairIngredient;
SimplyCompatToolMaterials(
int miningLevel,
int itemDurability,
float miningSpeed,
float attackDamage,
int enchantability,
Item... repairIngredient
) {
this.miningLevel = miningLevel;
this.itemDurability = itemDurability;
this.miningSpeed = miningSpeed;
this.attackDamage = attackDamage;
this.enchantability = enchantability;
this.repairIngredient = Suppliers.memoize(() -> Ingredient.ofItems(repairIngredient));
}
@Override
public int getDurability() {
return this.itemDurability;
}
@Override
public float getMiningSpeedMultiplier() {
return this.miningSpeed;
}
@Override
public float getAttackDamage() {
return this.attackDamage;
}
@Override
public int getMiningLevel() {
return this.miningLevel;
}
@Override
public int getEnchantability() {
return this.enchantability;
}
@Override
public Ingredient getRepairIngredient() {
repairIngredient.get().getMatchingItemIds();
return this.repairIngredient.get();
}
public void getIdenfier() {
System.out.println(this.repairIngredient.get().toJson().getAsString());
}
}

View file

@ -0,0 +1,452 @@
package cc.toph.simplycompat.registry;
import cc.toph.simplycompat.SimplyCompat;
import cc.toph.simplycompat.item.SimplyCompatToolMaterials;
import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.RegistrySupplier;
import net.minecraft.item.Item;
import net.minecraft.registry.RegistryKeys;
import net.sweenus.simplyswords.config.ConfigDefaultValues;
import net.sweenus.simplyswords.item.SimplySwordsSwordItem;
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(
SimplyCompat.MOD_ID,
RegistryKeys.ITEM
);
private static RegistrySupplier<SimplySwordsSwordItem> registerSword(
String materialPrefix,
SimplyCompatToolMaterials material,
WeaponType type,
String... materialTag
) {
// 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
// );
material.getIdenfier(); // DELETE
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,
"minecraft:copper_ingot"
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_CLAYMORE = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.CLAYMORE,
"minecraft:copper_ingot"
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_CUTLASS = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.CUTLASS,
"minecraft:copper_ingot"
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_GLAIVE = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.GLAIVE,
"minecraft:copper_ingot"
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_GREATAXE = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.GREATAXE,
"minecraft:copper_ingot"
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_GREATHAMMER = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.GREATHAMMER,
"minecraft:copper_ingot"
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_HALBERD = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.HALBERD,
"minecraft:copper_ingot"
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_KATANA = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.KATANA,
"minecraft:copper_ingot"
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_LONGSWORD = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.LONGSWORD,
"minecraft:copper_ingot"
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_RAPIER = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.RAPIER,
"minecraft:copper_ingot"
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_SAI = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.SAI,
"minecraft:copper_ingot"
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_SCYTHE = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.SCYTHE,
"minecraft:copper_ingot"
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_SPEAR = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.SPEAR,
"minecraft:copper_ingot"
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_TWINBLADE = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.TWINBLADE,
"minecraft:copper_ingot"
);
public static final RegistrySupplier<SimplySwordsSwordItem> COPPER_WARGLAIVE = registerSword(
"copper",
SimplyCompatToolMaterials.COPPER,
WeaponType.WARGLAIVE,
"minecraft:copper_ingot"
);
}

View file

@ -1,3 +1,4 @@
{ {
"item.examplemod.example_item": "Example Item" "item.simplycompat.copper_longsword": "Copper Longsword",
"item.simplycompat.copper_scythe": "Copper Scythe"
} }

View file

@ -0,0 +1,6 @@
{
"parent": "simplycompat:item/copper_longsword",
"textures": {
"layer0": "simplycompat:item/copper_longsword"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "simplycompat:item/copper_scythe",
"textures": {
"layer0": "simplycompat:item/copper_scythe"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

View file

@ -0,0 +1,4 @@
{
"replace": false,
"values": ["simplycompat:copper_longsword", "simplycompat:copper_scythe"]
}

View file

@ -0,0 +1,39 @@
{
"attributes": {
"attack_range": 2.9,
"category": "sword",
"attacks": [
{
"hitbox": "HORIZONTAL_PLANE",
"damage_multiplier": 1,
"angle": 120,
"upswing": 0.5,
"animation": "bettercombat:one_handed_slash_horizontal_right",
"swing_sound": {
"id": "bettercombat:sword_slash"
}
},
{
"hitbox": "HORIZONTAL_PLANE",
"damage_multiplier": 1,
"angle": 120,
"upswing": 0.5,
"animation": "bettercombat:one_handed_slash_horizontal_left",
"swing_sound": {
"id": "bettercombat:sword_slash"
}
},
{
"hitbox": "FORWARD_BOX",
"damage_multiplier": 1.4,
"angle": 0,
"upswing": 0.5,
"animation": "bettercombat:one_handed_stab",
"swing_sound": {
"id": "bettercombat:sword_slash",
"pitch": 1.2
}
}
]
}
}

View file

@ -1,15 +0,0 @@
package cc.toph.simplycompat.fabric;
import cc.toph.simplycompat.ExpectPlatform;
import net.fabricmc.loader.api.FabricLoader;
import java.nio.file.Path;
public class ExpectPlatformImpl {
/**
* This is our actual method to {@link ExpectPlatform#getConfigDirectory()}.
*/
public static Path getConfigDirectory() {
return FabricLoader.getInstance().getConfigDir();
}
}

View file

@ -0,0 +1,15 @@
package cc.toph.simplycompat.fabric;
import cc.toph.simplycompat.ExpectPlatform;
import java.nio.file.Path;
import net.fabricmc.loader.api.FabricLoader;
public class SimplyCompatExpectPlatformImpl {
/**
* This is our actual method to {@link ExpectPlatform#getConfigDirectory()}.
*/
public static Path getConfigDirectory() {
return FabricLoader.getInstance().getConfigDir();
}
}

View file

@ -15,6 +15,18 @@ loom {
extraAccessWideners.add loom.accessWidenerPath.get().asFile.name extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
mixinConfig "simplycompat.forge.mixins.json" mixinConfig "simplycompat.forge.mixins.json"
mixinConfig "simplycompat.mixins.json"
}
}
def localModsDir = project.rootProject.file('./run/mods/')
if (localModsDir.exists() && localModsDir.isDirectory()) {
def localMods = localModsDir
.listFiles({ file -> file.isFile() && file.name.endsWith('.jar') } as FileFilter)
localMods.each { mod ->
dependencies {
modLocalRuntime files(mod)
}
} }
} }

View file

@ -1,15 +0,0 @@
package cc.toph.simplycompat.forge;
import cc.toph.simplycompat.ExpectPlatform;
import net.minecraftforge.fml.loading.FMLPaths;
import java.nio.file.Path;
public class ExpectPlatformImpl {
/**
* This is our actual method to {@link ExpectPlatform#getConfigDirectory()}.
*/
public static Path getConfigDirectory() {
return FMLPaths.CONFIGDIR.get();
}
}

View file

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

View file

@ -7,9 +7,13 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@Mod(SimplyCompat.MOD_ID) @Mod(SimplyCompat.MOD_ID)
public class SimplyCompatForge { public class SimplyCompatForge {
public SimplyCompatForge() { public SimplyCompatForge() {
// Submit our event bus to let architectury register our content on the right time // Submit our event bus to let architectury register our content on the right time
EventBuses.registerModEventBus(SimplyCompat.MOD_ID, FMLJavaModLoadingContext.get().getModEventBus()); EventBuses.registerModEventBus(
SimplyCompat.MOD_ID,
FMLJavaModLoadingContext.get().getModEventBus()
);
SimplyCompat.init(); SimplyCompat.init();
} }
} }

View file

@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx2048M org.gradle.jvmargs=-Xmx6g
minecraft_version=1.20.1 minecraft_version=1.20.1
enabled_platforms=fabric,forge enabled_platforms=fabric,forge
@ -7,12 +7,14 @@ archives_base_name=simplycompat
mod_version=0.0.1 mod_version=0.0.1
maven_group=cc.toph maven_group=cc.toph
architectury_version=9.1.12 architectury_version=9.2.14
fabric_loader_version=0.14.23 fabric_loader_version=0.14.23
fabric_api_version=0.90.4+1.20.1 fabric_api_version=0.90.4+1.20.1
forge_version=1.20.1-47.2.1 forge_version=1.20.1-47.3.22
cloth_config_version=11.1.106
yarn_mappings=1.20.1+build.10

Binary file not shown.

View file

@ -1,6 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

244
gradlew vendored
View file

@ -1,244 +0,0 @@
#!/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##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# 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"'
# 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
which java >/dev/null 2>&1 || 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
# 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=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=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
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
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" "$@"

92
gradlew.bat vendored
View file

@ -1,92 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega