Skip to content

Commit

Permalink
Make gradle a bit more happy. The dependencies now load. It's time to…
Browse files Browse the repository at this point in the history
… port
  • Loading branch information
SirEndii committed Apr 22, 2024
1 parent 2766015 commit 4282602
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ plugins {
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

wrapper {
gradleVersion = '8.6'
gradleVersion = '8.7'
distributionType = Wrapper.DistributionType.BIN
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

import de.srendi.advancedperipherals.network.APNetworking;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.common.MinecraftForge;
import net.neoforged.eventbus.api.IEventBus;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
Expand All @@ -26,15 +25,13 @@ public class AdvancedPeripherals {
public static final Logger LOGGER = LogManager.getLogger(NAME);
public static final Random RANDOM = new Random();

public AdvancedPeripherals() {
public AdvancedPeripherals(IEventBus modBus) {
LOGGER.info("AdvancedPeripherals says hello!");
IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus();

APConfig.register(ModLoadingContext.get());

modBus.addListener(this::commonSetup);
Registration.register();
MinecraftForge.EVENT_BUS.register(this);
}

public static void debug(String message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public Function<ModConfig, CommentedFileConfig> reader(Path configBasePath) {
}

@Override
public void unload(Path configBasePath, ModConfig config) {
public void unload(ModConfig config) {
super.unload(getPath(configBasePath), config);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
import de.srendi.advancedperipherals.lib.LibConfig;
import net.minecraft.FieldsAreNonnullByDefault;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.neoforge.common.ModConfigSpec;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.common.NeoForgeConfig;

@FieldsAreNonnullByDefault
public class GeneralConfig implements IAPConfig {

public final ForgeConfigSpec.BooleanValue enableDebugMode;
private final ForgeConfigSpec configSpec;
public final ModConfigSpec.BooleanValue enableDebugMode;
private final ModConfigSpec configSpec;

GeneralConfig() {
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
ModConfigSpec.Builder builder = new ModConfigSpec.Builder();

builder.comment("Config to adjust general mod settings").push("General");

Expand All @@ -29,7 +32,7 @@ public class GeneralConfig implements IAPConfig {


@Override
public ForgeConfigSpec getConfigSpec() {
public ModConfigSpec getConfigSpec() {
return configSpec;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@
import de.srendi.advancedperipherals.lib.misc.IConfigHandler;
import net.neoforged.common.ForgeConfigSpec;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.neoforge.common.ModConfigSpec;

public interface IAPConfig {

ForgeConfigSpec getConfigSpec();
ModConfigSpec getConfigSpec();

String getFileName();

ModConfig.Type getType();

default void register(IConfigHandler[] data, final ForgeConfigSpec.Builder builder) {
default void register(IConfigHandler[] data, final ModConfigSpec.Builder builder) {
for (IConfigHandler handler : data) {
handler.addToConfig(builder);
}
}

default void pop(String name, ForgeConfigSpec.Builder builder) {
default void pop(String name, ModConfigSpec.Builder builder) {
builder.pop();
builder.push(name);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.srendi.advancedperipherals.lib;

import net.neoforged.common.ForgeConfigSpec;
import net.neoforged.neoforge.common.ModConfigSpec;

/**
* Configuration class for tweaks of library
Expand All @@ -10,8 +10,8 @@ public class LibConfig {
public static boolean initialCooldownEnabled = true;
public static int initialCooldownSensitivity = 6_000;
private static boolean testMode = false;
private static ForgeConfigSpec.BooleanValue isInitialCooldownEnabled;
private static ForgeConfigSpec.IntValue initialCooldownSensitiveLevel;
private static ModConfigSpec.BooleanValue isInitialCooldownEnabled;
private static ModConfigSpec.IntValue initialCooldownSensitiveLevel;

public static void setTestMode(boolean mode) {
testMode = mode;
Expand All @@ -26,7 +26,7 @@ public static void setTestMode(boolean mode) {
}
}

public static void build(final ForgeConfigSpec.Builder builder) {
public static void build(final ModConfigSpec.Builder builder) {
isInitialCooldownEnabled = builder.comment("Enables initial cooldown on peripheral initialization").define("isInitialCooldownEnabled", true);
initialCooldownSensitiveLevel = builder.comment("Determinates initial cooldown sensitive level, values lower then this value will not trigger initial cooldown").defineInRange("initialCooldownSensitiveLevel", 6_000, 0, Integer.MAX_VALUE);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package de.srendi.advancedperipherals.lib.misc;

import net.neoforged.common.ForgeConfigSpec;
import net.neoforged.neoforge.common.ModConfigSpec;

import java.util.Arrays;
import java.util.stream.Collectors;

public interface IConfigHandler {
void addToConfig(ForgeConfigSpec.Builder builder);
void addToConfig(ModConfigSpec.Builder builder);

String name();

Expand Down

0 comments on commit 4282602

Please sign in to comment.