From b19b3742aa63cb30710e360669f7f8493d20e325 Mon Sep 17 00:00:00 2001 From: SrdjanV Date: Tue, 11 Oct 2022 21:09:03 +0200 Subject: [PATCH] Updated: Examples Configs GHA fixes #1 --- .github/workflows/curseforge_release.yml | 23 +++++++- exampels/exampels.zs | 54 ------------------- examples/examples.zs | 50 +++++++++++++++++ gradle.properties | 2 +- .../tweakedexcavation/common/Configs.java | 28 ++++++---- .../common/DefaultMineralPower.java | 28 ++++++++++ .../mixin/MixinExcavatorHandler.java | 5 +- .../util/TweakedExcavationErrorLogging.java | 9 ++-- 8 files changed, 126 insertions(+), 73 deletions(-) delete mode 100644 exampels/exampels.zs create mode 100644 examples/examples.zs create mode 100644 src/main/java/srki2k/tweakedexcavation/common/DefaultMineralPower.java diff --git a/.github/workflows/curseforge_release.yml b/.github/workflows/curseforge_release.yml index c8c3999..a6c16f5 100644 --- a/.github/workflows/curseforge_release.yml +++ b/.github/workflows/curseforge_release.yml @@ -32,16 +32,35 @@ jobs: file: "${{ steps.get_mod_name.outputs.mod_name }}-${{ steps.get_version.outputs.version }}.jar" token: ${{ secrets.GITHUB_TOKEN }} + - name: Retrieve Source from Latest Release + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: "${{ github.repository }}" + version: "tags/v${{ steps.get_version.outputs.version }}" + file: "${{ steps.get_mod_name.outputs.mod_name }}-${{ steps.get_version.outputs.version }}-sources.jar" + token: ${{ secrets.GITHUB_TOKEN }} + #See https://github.com/itsmeow/curseforge-upload#usagearguments for more information - name: Create CurseForge Release + id: "release-curseforge" uses: itsmeow/curseforge-upload@v3 with: - game_versions: "Minecraft 1.12.2,Forge" + game_versions: "Minecraft 1.12:1.12.2,Forge" game_endpoint: "minecraft" release_type: "release" changelog: "Changelog is available [here](https://github.com/${{ github.repository }}/releases/tag/v${{ steps.get_version.outputs.version }})." changelog_type: "markdown" - relations: "" + relations: "crafttweaker:requiredDependency,immersive-petroleum:requiredDependency,mixin-booter:requiredDependency,had-enough-items:optionalDependency" file_path: "${{ steps.get_mod_name.outputs.mod_name }}-${{ steps.get_version.outputs.version }}.jar" project_id: "${{ secrets.CURSEFORGE_PROJECT_ID }}" token: "${{ secrets.CURSEFORGE_API_KEY }}" + + - name: Create CurseForge Sources Release + uses: itsmeow/curseforge-upload@v3 + with: + game_endpoint: "minecraft" + release_type: "release" + parent_file_id: "${{ steps.release-curseforge.outputs.id }}" + file_path: "${{ steps.get_mod_name.outputs.mod_name }}-${{ steps.get_version.outputs.version }}-sources.jar" + project_id: "${{ secrets.CURSEFORGE_PROJECT_ID }}" + token: "${{ secrets.CURSEFORGE_API_KEY }}" diff --git a/exampels/exampels.zs b/exampels/exampels.zs deleted file mode 100644 index 68c11c4..0000000 --- a/exampels/exampels.zs +++ /dev/null @@ -1,54 +0,0 @@ -import mods.TweakedLib.TweakedPowerTier; -import mods.TweakedExcavation.TweakedExcavator; -import mods.TweakedExcavation.TweakedMineral; - -/* - TweakedExcavator.addMineral(String name, int mineralWeight, float failChance, String[] ores, float[] chances, int powerTier, - @Optional int[] dimBlacklist, @Optional int[] dimWhitelist) - - ores Syntax: - "OreDict Item" - this will used the default IE method of searching - "ModID:OreDict Item" - This will search for a oredict item/block of a specific mod - "ModID:Mod Item" - this will search for items/blocks from a mod - "ModID:Mod Item:Metadata" this will search for items/blocks from a mod with metadata - - "minecraft:oreIron" - will get minecraft's oredict version of iron - "minecraft:woolYellow" - will get minecraft's oredict version of yellow wool - "minecraft:wool:14" - will get minecraft's wool with metadata 13 (red wool) -*/ - -TweakedExcavator.addMineral("Test1", 2000000, 0.0,["minecraft:oreIron", "minecraft:wool:14", "immersiveengineering:connector:0"] ,[1.0,1.0,1.0], 1); - -/* -TweakedExcavator.addMineralWithCustomYield(String name, int mineralWeight, float failChance, String[] ores, float[] chances, int powerTier, int oreYield, - @Optional int[] dimBlacklist, @Optional int[] dimWhitelist) - - oreYield - is the size of the mineral vein - -*/ - -TweakedExcavator.addMineralWithCustomYield("Test2", 2000000, 0.0,["minecraft:oreIron", "minecraft:woolYellow", "immersiveengineering:connector:0"] ,[1.0,1.0,1.0], 1, 1000000); - -/* -mods.TweakedExcavation.TweakedMineral is used for modifying default IE minerals - - available fields: - -powerTier - -yield - - A TweakedMineral object can be obtained with this method: - TweakedExcavator.getTweakedMineral(String name); -*/ - - - -var mineral1 = TweakedExcavator.getTweakedMineral("Test1"); -mineral1.yield = 180; - -/* - By default TweakedLib is registering a powerTier(default id: 1) if it detects that IE is loaded(and if its configuration is enabled see the configs for TweakedLib) -*/ - -TweakedPowerTier.registerPowerTier(60, 160000, 10240); -var mineral2 = TweakedExcavator.getTweakedMineral("Test2"); -mineral1.powerTier = 60; diff --git a/examples/examples.zs b/examples/examples.zs new file mode 100644 index 0000000..0126fb6 --- /dev/null +++ b/examples/examples.zs @@ -0,0 +1,50 @@ +import mods.TweakedLib.TweakedPowerTier; +import mods.TweakedExcavation.TweakedExcavator; +import mods.TweakedExcavation.TweakedMineral; + +/* + TweakedExcavator.addMineral(String name, int mineralWeight, float failChance, String[] ores, float[] chances, int powerTier, + @Optional int[] dimBlacklist, @Optional int[] dimWhitelist) + + ores Syntax: + "OreDict Item" - this will used the default IE method of searching + "ModID:OreDict Item" - This will search for a oredict item/block of a specific mod + "ModID:Mod Item" - this will search for items/blocks from a mod + "ModID:Mod Item:Metadata" this will search for items/blocks from a mod with metadata + + "minecraft:oreIron" - will get minecraft's oredict version of iron + "minecraft:woolYellow" - will get minecraft's oredict version of yellow wool + "minecraft:wool:14" - will get minecraft's wool with metadata 13 (red wool) + + + TweakedExcavator.addMineralWithCustomYield(String name, int mineralWeight, float failChance, String[] ores, float[] chances, int powerTier, int oreYield, + @Optional int[] dimBlacklist, @Optional int[] dimWhitelist) + oreYield - is the size of the mineral vein + + + TweakedPowerTier.registerPowerTier(int capacity, int rft) +*/ + + var powerTier = TweakedPowerTier.registerPowerTier(64000, 4096); + TweakedExcavator.addMineral("Test1", 2000000, 0.0,["minecraft:oreIron", "minecraft:wool:14", "immersiveengineering:connector:0"] ,[1.0,1.0,1.0], powerTier); + + var powerTier2 = TweakedPowerTier.registerPowerTier(640000, 40960); + TweakedExcavator.addMineralWithCustomYield("Test2", 2000000, 0.0,["minecraft:oreIron", "minecraft:woolYellow", "immersiveengineering:connector:0"] ,[1.0,1.0,1.0], powerTier2, 1000000); + +/* + mods.TweakedExcavation.TweakedMineral is used for modifying default IE minerals and custom ones + + available fields: + -powerTier + -yield + + A TweakedMineral object can be obtained with this method: + TweakedExcavator.getTweakedMineral(String name); +*/ + + var powerTier3 = TweakedPowerTier.registerPowerTier(6400000080000, 4096000); + var mineral1 = TweakedExcavator.getTweakedMineral("Test1"); + mineral1.powerTier = powerTier3; + + var mineral2 = TweakedExcavator.getTweakedMineral("Test2"); + mineral2.yield = 180; diff --git a/gradle.properties b/gradle.properties index 53267d4..a1a0002 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs = -Xmx3G org.gradle.daemon = false # Mod Information -tweaked_lib_version = 0.1.22 +tweaked_lib_version = 1.0.0 mod_version = 1.0.0 maven_group = srki2k diff --git a/src/main/java/srki2k/tweakedexcavation/common/Configs.java b/src/main/java/srki2k/tweakedexcavation/common/Configs.java index 613796d..cb770d4 100644 --- a/src/main/java/srki2k/tweakedexcavation/common/Configs.java +++ b/src/main/java/srki2k/tweakedexcavation/common/Configs.java @@ -8,16 +8,24 @@ public class Configs { @Config(modid = TweakedExcavation.MODID) public static class TPConfig { - @Config.Name("Default Power Tiers") - public static PowerTiers powerTiers; - - public static class PowerTiers { - @Config.Comment({"This will set the power tier of the default IE Minerals, default=1"}) - @Config.Name("Default Minerals PowerTier") - @Config.RangeInt(min = 0) - @Config.RequiresMcRestart - public static int defaultPowerTier = 1; - } + @Config.Name("Default Excavator Power Tiers") + public static DefaultExcavatorPowerTiers defaultExcavatorPowerTiers; + + public static class DefaultExcavatorPowerTiers { + + @Config.Comment({"This will set the capacity of the excavator, default=64000"}) + @Config.Name("Default capacity") + @Config.RangeInt(min = 1) + @Config.RequiresMcRestart + public static int capacity = 64000; + + @Config.Comment({"This will set the power consumption of the excavator, default=4096"}) + @Config.Name("Default consumption") + @Config.RangeInt(min = 1) + @Config.RequiresMcRestart + public static int rft = 4096; + + } } diff --git a/src/main/java/srki2k/tweakedexcavation/common/DefaultMineralPower.java b/src/main/java/srki2k/tweakedexcavation/common/DefaultMineralPower.java new file mode 100644 index 0000000..2181f39 --- /dev/null +++ b/src/main/java/srki2k/tweakedexcavation/common/DefaultMineralPower.java @@ -0,0 +1,28 @@ +package srki2k.tweakedexcavation.common; + +import srki2k.tweakedlib.api.powertier.PowerTierHandler; + +public class DefaultMineralPower { + + public static DefaultMineralPower instance; + + public static DefaultMineralPower getInstance() { + if (instance == null) { + instance = new DefaultMineralPower(); + } + return instance; + } + private DefaultMineralPower() { + powerTier = PowerTierHandler.registerPowerTier( + Configs.TPConfig.DefaultExcavatorPowerTiers.capacity, + Configs.TPConfig.DefaultExcavatorPowerTiers.rft + ); + } + + private final int powerTier; + + public int getPowerTier() { + return powerTier; + } + +} diff --git a/src/main/java/srki2k/tweakedexcavation/mixin/MixinExcavatorHandler.java b/src/main/java/srki2k/tweakedexcavation/mixin/MixinExcavatorHandler.java index 4221076..c3a3828 100644 --- a/src/main/java/srki2k/tweakedexcavation/mixin/MixinExcavatorHandler.java +++ b/src/main/java/srki2k/tweakedexcavation/mixin/MixinExcavatorHandler.java @@ -9,10 +9,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import srki2k.tweakedexcavation.api.ihelpers.IMineralMix; import srki2k.tweakedexcavation.api.ihelpers.IMineralWorldInfo; -import srki2k.tweakedexcavation.common.Configs; +import srki2k.tweakedexcavation.common.DefaultMineralPower; import static blusunrize.immersiveengineering.api.tool.ExcavatorHandler.getMineralWorldInfo; -import static blusunrize.immersiveengineering.api.tool.ExcavatorHandler.mineralVeinCapacity; @Mixin(value = ExcavatorHandler.class, remap = false) public class MixinExcavatorHandler { @@ -45,6 +44,6 @@ public static ExcavatorHandler.MineralMix getRandomMineral(World world, int chun @Inject(method = "addMineral", at = @At("RETURN")) private static void addMineral(String name, int mineralWeight, float failChance, String[] ores, float[] chances, CallbackInfoReturnable cir) { - ((IMineralMix) cir.getReturnValue()).setPowerTier(Configs.TPConfig.PowerTiers.defaultPowerTier); + ((IMineralMix) cir.getReturnValue()).setPowerTier(DefaultMineralPower.getInstance().getPowerTier()); } } diff --git a/src/main/java/srki2k/tweakedexcavation/util/TweakedExcavationErrorLogging.java b/src/main/java/srki2k/tweakedexcavation/util/TweakedExcavationErrorLogging.java index 13fee31..6e9e1f0 100644 --- a/src/main/java/srki2k/tweakedexcavation/util/TweakedExcavationErrorLogging.java +++ b/src/main/java/srki2k/tweakedexcavation/util/TweakedExcavationErrorLogging.java @@ -11,7 +11,8 @@ import java.util.List; import static blusunrize.immersiveengineering.api.tool.ExcavatorHandler.mineralList; -import static srki2k.tweakedexcavation.common.Configs.TPConfig.PowerTiers.defaultPowerTier; +import static srki2k.tweakedexcavation.common.Configs.TPConfig.DefaultExcavatorPowerTiers.capacity; +import static srki2k.tweakedexcavation.common.Configs.TPConfig.DefaultExcavatorPowerTiers.rft; public final class TweakedExcavationErrorLogging implements ICustomLogger { public static void register() { @@ -52,9 +53,11 @@ public Logger getModLogger() { @Override public String[] getConfigs() { - String[] strings = new String[1]; + String[] strings = new String[3]; - strings[0] = "Default Minerals PowerTier: " + defaultPowerTier; + strings[0] = "Default Excavator Power Tiers:"; + strings[1] = "Default capacity: " + capacity; + strings[2] = "Default consumption: " + rft; return strings; }