Skip to content

Commit

Permalink
feat: this is probably a bad idea
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed Jun 19, 2024
1 parent a0abb6b commit ff5fb2b
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/main/java/net/zepalesque/redux/Redux.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public void packSetup(AddPackFindersEvent event) {
PackUtils.setupPack(event, pathString, id, true, ReduxPackConfig::generate);
} else if (event.getPackType() == PackType.SERVER_DATA) {
if (ReduxConfig.COMMON.bronze_dungeon_upgrade.get()) { PackUtils.setupPack(event, "dungeon_upgrades/bronze", "bronze_upgrade", true); }
if (ReduxConfig.COMMON.bronze_dungeon_upgrade.get()) { PackUtils.setupPack(event, "dungeon_upgrades/bronze", "bronze_upgrade", true); }
}
}

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/net/zepalesque/redux/config/enums/AACompatType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package net.zepalesque.redux.config.enums;

public enum AACompatType implements NamedConfig {
TRUE, FALSE, WITHOUT_AA;

@Override
public String serialize() {
return this.name().toLowerCase();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package net.zepalesque.redux.config.enums;

public interface NamedConfig {

public String serialize();
}
6 changes: 3 additions & 3 deletions src/main/java/net/zepalesque/redux/data/ReduxData.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ public static void dataSetup(GatherDataEvent event) {
DetectedVersion.BUILT_IN.getPackVersion(PackType.SERVER_DATA),
Optional.of(new InclusiveRange<>(0, Integer.MAX_VALUE)))));

Path builtinData = packOutput.getOutputFolder().resolve("packs").resolve("data");


Path builtinData = packOutput.getOutputFolder().resolve("packs").resolve("data");

DataGenerator.PackGenerator noisePack = generator.new PackGenerator(true, "reduxnoise", new PackOutput(builtinData.resolve("redux_noise")));
noisePack.addProvider(output -> new ReduxRegistrySets.NoisePack(output, lookupProvider, Redux.MODID));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package net.zepalesque.redux.mixin.mixins.common;

import com.electronwill.nightconfig.core.io.CharacterOutput;
import com.electronwill.nightconfig.toml.TomlWriter;
import net.zepalesque.redux.config.enums.NamedConfig;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

// TODO: FIND A BETTER WAY PLEASE GOD
// TODO: FIND A BETTER WAY PLEASE GOD
// TODO: FIND A BETTER WAY PLEASE GOD
// TODO: FIND A BETTER WAY PLEASE GOD
// TODO: FIND A BETTER WAY PLEASE GOD
// TODO: FIND A BETTER WAY PLEASE GOD
@Mixin(targets = "com.electronwill.nightconfig.toml.ValueWriter")
public abstract class ValueWriterMixin {
@Shadow
private static void writeString(String string, CharacterOutput output, TomlWriter writer) {}

@Inject(method = "write", at = @At("HEAD"), cancellable = true)
private static void redux$write(Object value, CharacterOutput output, TomlWriter writer, CallbackInfo ci) {
if (value instanceof NamedConfig config) {
writeString(config.serialize(), output, writer);
ci.cancel();
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/aether_redux.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"refmap": "aether_redux.refmap.json",
"mixins": [
"common.TabUtilMixin",
"common.ValueWriterMixin",
"common.accessor.AetherNoiseBuildersMixin",
"common.accessor.EntityAccessor",
"common.accessor.WallBlockAccessor",
Expand Down

0 comments on commit ff5fb2b

Please sign in to comment.