-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- config - qodana - rebuild .idea folder lol
- Loading branch information
Showing
20 changed files
with
683 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Qodana | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- multiversion | ||
|
||
jobs: | ||
qodana: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: 'Qodana Scan' | ||
uses: JetBrains/[email protected] | ||
env: | ||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +0,0 @@ | ||
# Ranplate | ||
A template repo for my minecraft mods which is multi-loader & multi-versioned | ||
|
||
Current Preprocessor System: | ||
- MC_`<version>` | ||
- so `MC_1_19_2` would mean if 1.19.2 is the current version | ||
- POST_MC_`<version>` | ||
- so `POST_MC_1_19_2` would mean if the version is after 1.19.2 | ||
- POST_CURRENT_MC_`<version>` | ||
- so `POST_CURRENT_MC_1_19_2` would mean if the current version is after 1.19.2 or is 1.19.2 | ||
- PRE_MC_`<version>` | ||
- so `PRE_MC_1_19_2` would mean if the version is before 1.19.2 | ||
- PRE_CURRENT_MC_`<version>` | ||
- so `PRE_CURRENT_MC_1_19_2` would mean if the current version is before 1.19.2 or is 1.19.2 | ||
|
||
Remember to install the [Manifold](https://plugins.jetbrains.com/plugin/10057-manifold) plugin in IntelliJ!\ | ||
Also could look in this [class](https://github.com/Ran-helo/Ranplate/blob/master/common/src/main/java/net/examplemod/ExampleMod.java) if you need an example of how to use it! | ||
|
||
This repo contains [MixinExtras](https://github.com/LlamaLad7/MixinExtras) so remember to [check](https://github.com/LlamaLad7/MixinExtras/wiki) that out!\ | ||
It also contains a lot of optimization mods to run the development environment a bit better.\ | ||
And also contains [Forgix](https://github.com/PacifistMC/Forgix) which basically merges the mod-loaders into one jar! | ||
|
||
--- | ||
When adding more versions, remember to edit the `.github/workflows/build.yml` file and make sure the merged jars doesn't overwrite each other!\ | ||
And do note that if you're going to use Architectury API then `dev.architectury` is `me.shedaniel.architectury` in 1.16.5 and below. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 29 additions & 1 deletion
30
common/src/main/java/dev/rdh/createunlimited/CreateUnlimited.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,37 @@ | ||
package dev.rdh.createunlimited; | ||
|
||
import com.simibubi.create.Create; | ||
|
||
import dev.rdh.createunlimited.config.CUConfig; | ||
|
||
import dev.rdh.createunlimited.config.command.CUCommands; | ||
import dev.rdh.createunlimited.config.command.EnumArgument; | ||
import dev.rdh.createunlimited.util.Util; | ||
|
||
import net.minecraft.resources.ResourceLocation; | ||
|
||
import net.minecraftforge.fml.config.ModConfig; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class CreateUnlimited { | ||
public static final String ID = "createunlimited"; | ||
public static final String ID = "createunlimited"; | ||
public static final String NAME = "Create Unlimited"; | ||
public static final String VERSION = "0.4.1"; | ||
public static final Logger LOGGER = LoggerFactory.getLogger(NAME); | ||
|
||
public static void init() { | ||
LOGGER.info("{} initializing! Create version: {} on platform: {}", NAME, Create.VERSION, Util.platformName()); | ||
|
||
Util.registerConfig(ID, ModConfig.Type.SERVER, CUConfig.SPEC, "createunlimited.toml"); | ||
CUConfig.init(Util.getConfigDirectory().resolve("createunlimited-IGNOREME.toml")); | ||
|
||
CUCommands.registerConfigCommand(); | ||
Util.registerArgument("enumargument", EnumArgument.class, new EnumArgument.Info(), asResource("enumargument")); | ||
} | ||
|
||
public static ResourceLocation asResource(String path) { | ||
return new ResourceLocation(ID, path); | ||
} | ||
} |
136 changes: 136 additions & 0 deletions
136
common/src/main/java/dev/rdh/createunlimited/config/CUConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
package dev.rdh.createunlimited.config; | ||
|
||
import com.electronwill.nightconfig.core.file.CommentedFileConfig; | ||
import com.electronwill.nightconfig.core.io.WritingMode; | ||
|
||
import com.simibubi.create.foundation.config.ui.BaseConfigScreen; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.screens.Screen; | ||
|
||
import net.minecraftforge.common.ForgeConfigSpec; | ||
|
||
import dev.rdh.createunlimited.CreateUnlimited; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.nio.file.Path; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class CUConfig { | ||
private CUConfig() { throw new UnsupportedOperationException(); } | ||
public static final ForgeConfigSpec SPEC; | ||
public static ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); | ||
|
||
public enum PlacementCheck { | ||
ON, | ||
SURVIVAL_ONLY, | ||
OFF, | ||
} | ||
|
||
public static final Map<String, String> comments = new HashMap<>(); | ||
static { | ||
comments.put("trains", "Train Settings"); | ||
comments.put("placementChecks", "Whether or not to enable the placement checks for train tracks."); | ||
comments.put("extendedDriving", "Whether or not to allow trains to drive on tracks with very small turn radii. Slightly buggy."); | ||
comments.put("extendedDrivingValue", "The minimum turn that trains can drive on. Only works if extendedDriving is enabled."); | ||
comments.put("maxTrainRelocationDistance", "Maximum distance a train can be relocated using the wrench."); | ||
comments.put("maxAllowedStress", "Maximum stress from couplings before train derails. Set to -1 to disable."); | ||
|
||
comments.put("glue", "Glue Settings"); | ||
comments.put("maxGlueConnectionRange", "Maximum distance between two blocks for them to be considered for glue connections."); | ||
comments.put("physicalBlockConnection", "Require blocks to be connected for glue connections."); | ||
|
||
comments.put("extendo", "Extendo Grip Settings"); | ||
comments.put("singleExtendoGripRange", "How much to extend your reach when holding an Extendo-Grip. Adds to your base reach."); | ||
comments.put("doubleExtendoGripRange", "How much to extend your reach when holding two Extendo-Grips. Adds to your base reach."); | ||
|
||
comments.put("copycat", "Copycat Settings"); | ||
comments.put("allowAllCopycatBlocks", "Whether or not to allow all blocks to be inserted into Copycat blocks."); | ||
} | ||
|
||
public static String trains; | ||
public static ForgeConfigSpec.EnumValue<PlacementCheck> placementChecks; | ||
public static ForgeConfigSpec.BooleanValue extendedDriving; | ||
public static ForgeConfigSpec.DoubleValue extendedDrivingValue; | ||
public static ForgeConfigSpec.IntValue maxTrainRelocationDistance; | ||
public static ForgeConfigSpec.DoubleValue maxAllowedStress; | ||
|
||
public static String glue; | ||
public static ForgeConfigSpec.IntValue maxGlueConnectionRange; | ||
public static ForgeConfigSpec.BooleanValue physicalBlockConnection; | ||
|
||
// public static String extendo; | ||
// public static ForgeConfigSpec.IntValue singleExtendoGripRange; | ||
// public static ForgeConfigSpec.IntValue doubleExtendoGripRange; | ||
|
||
public static String copycat; | ||
public static ForgeConfigSpec.BooleanValue allowAllCopycatBlocks; | ||
|
||
static { | ||
BUILDER.comment("Create Unlimited Config").push("CreateUnlimited"); | ||
|
||
cat("Trains"); | ||
placementChecks = BUILDER.comment(comments.get("placementChecks")).defineEnum("placementChecks", PlacementCheck.ON); | ||
extendedDriving = b(false, "extendedDriving"); | ||
extendedDrivingValue = d(0.1, 0.0, 0.875, "extendedDrivingValue"); | ||
maxTrainRelocationDistance = i(24, 0, "maxTrainRelocationDistance"); | ||
maxAllowedStress = d(4.0, -1.0, "maxAllowedStress"); | ||
|
||
BUILDER.pop(); | ||
cat("Glue"); | ||
maxGlueConnectionRange = i(24, 0, "maxGlueConnectionRange"); | ||
physicalBlockConnection = b(true, "physicalBlockConnection"); | ||
|
||
// BUILDER.pop().comment(comments.get("extendo")).push("ExtendoGrip"); | ||
// singleExtendoGripRange = i(3, 0, "singleExtendoGripRange", comments.get("singleExtendoGripRange")); | ||
// doubleExtendoGripRange = i(5, 0, "doubleExtendoGripRange", comments.get("doubleExtendoGripRange")); | ||
|
||
BUILDER.pop(); | ||
cat("Copycat"); | ||
allowAllCopycatBlocks = b(false, "allowAllCopycatBlocks"); | ||
BUILDER.pop(2); | ||
|
||
SPEC = BUILDER.build(); | ||
} | ||
|
||
public static void init(Path path) { | ||
CreateUnlimited.LOGGER.info("Loading Create Unlimited config!"); | ||
final CommentedFileConfig configData = CommentedFileConfig.builder(path) | ||
.sync() | ||
.autosave() | ||
.writingMode(WritingMode.REPLACE) | ||
.build(); | ||
configData.load(); | ||
SPEC.setConfig(configData); | ||
} | ||
|
||
// helper methods for initializing config values | ||
private static ForgeConfigSpec.BooleanValue b(boolean normal, String path) { | ||
return BUILDER.comment(comments.get(path)).define(path, normal); | ||
} | ||
private static ForgeConfigSpec.IntValue i(int normal, int min, String path) { | ||
return BUILDER.comment(comments.get(path)).defineInRange(path, normal, min, Integer.MAX_VALUE); | ||
} | ||
private static ForgeConfigSpec.DoubleValue d(double normal, double min, String path) { | ||
return d(normal, min, Double.MAX_VALUE, path); | ||
} | ||
private static ForgeConfigSpec.DoubleValue d(double normal, double min, double max, String path) { | ||
return BUILDER.comment(comments.get(path)).defineInRange(path, normal, min, max); | ||
} | ||
private static void cat(String path) { | ||
BUILDER.comment(comments.get(path.toLowerCase())).push(path); | ||
} | ||
|
||
public static BaseConfigScreen createConfigScreen(Screen parent) { | ||
BaseConfigScreen.setDefaultActionFor(CreateUnlimited.ID, (base) -> | ||
base.withSpecs(null, null, CUConfig.SPEC) | ||
.withTitles("", "", "Settings") | ||
); | ||
return new BaseConfigScreen(parent, CreateUnlimited.ID); | ||
} | ||
public static BaseConfigScreen createConfigScreen(@Nullable Minecraft mc, Screen parent) { | ||
return createConfigScreen(parent); | ||
} | ||
} |
Oops, something went wrong.