Skip to content

Commit

Permalink
v3.3.0 - Added config option
Browse files Browse the repository at this point in the history
  • Loading branch information
EwyBoy committed Apr 18, 2022
1 parent c896cda commit 2317de4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/java/com/ewyboy/oretweaker/config/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public static class ServerConfig {
public final ForgeConfigSpec.ConfigValue<Boolean> regenerateDefaultSettings;
public final ForgeConfigSpec.ConfigValue<Boolean> autoGenerateDeepslateVariants;

public final ForgeConfigSpec.ConfigValue<Boolean> disbaleLargeVeins;

public static void setFalse(ForgeConfigSpec.ConfigValue<Boolean> booleanConfigValue) {
if (booleanConfigValue.get()) booleanConfigValue.set(Boolean.FALSE);
}
Expand All @@ -37,6 +39,7 @@ public static void setFalse(ForgeConfigSpec.ConfigValue<Boolean> booleanConfigVa
this.regenerateDefaultSettings = builder.comment("Attempts to generate default settings if not present").translation("oretweaker.templates.generate_default_settings").define("generate_default_settings", true);
builder.pop();
builder.push("GENERATOR");
this.disbaleLargeVeins = builder.comment("Disables large veins from generating").translation("oretweaker.generator.disable_large_veins").define("disable_large_veins", false);
this.autoGenerateDeepslateVariants = builder.comment("Attempts to auto generate deepslate variants if present").translation("oretweaker.generator.auto_generate_deepslate_variants").define("auto_generate_deepslate_variants", true);
builder.pop();
builder.build();
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/com/ewyboy/oretweaker/mixin/VeinKiller.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ewyboy.oretweaker.mixin;

import com.ewyboy.oretweaker.config.Settings;
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -11,7 +12,9 @@ public class VeinKiller {

@Inject(method = "oreVeinsEnabled", at = @At("RETURN"), cancellable = true)
private void oreVeinsEnabled(CallbackInfoReturnable<Boolean> callbackReturnable) {
callbackReturnable.setReturnValue(false);
if (Settings.SETTINGS.disbaleLargeVeins.get()) {
callbackReturnable.setReturnValue(false);
}
}

}

0 comments on commit 2317de4

Please sign in to comment.