feat: know all aspects from beginning
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Timo Ley 2023-01-05 12:14:11 +01:00
parent a1e998830f
commit 8a6def104b
3 changed files with 47 additions and 1 deletions

View file

@ -11,12 +11,14 @@ public class Config {
public static int nodeRarity = 23;
public static int specialNodeRarity = 75;
public static boolean replaceSilverwood = true;
public static boolean knowAllAspects = true;
public static void load() {
config.load();
nodeRarity = config.get("worldgen", "nodeRarity", nodeRarity).getInt(nodeRarity);
specialNodeRarity = config.get("worldgen", "specialNodeRarity", specialNodeRarity).getInt(specialNodeRarity);
replaceSilverwood = config.getBoolean("replaceSilverwood", "worldgen", replaceSilverwood, "Replace Silverwood trees with TC3 Silverwood");
knowAllAspects = config.getBoolean("knowAllAspects", "research", knowAllAspects, "Know all Aspects from beginning");
config.save();
}

View file

@ -0,0 +1,43 @@
package dev.tilera.auracore.mixins;
import java.util.Map;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import dev.tilera.auracore.Config;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.common.lib.research.PlayerKnowledge;
@Mixin(PlayerKnowledge.class)
public abstract class MixinPlayerKnowledge {
@Shadow(remap = false)
public Map<String, AspectList> aspectsDiscovered;
@Inject(method = "getAspectsDiscovered", at = @At("HEAD"), remap = false)
public void onGetPlayerKnowledge(String player, CallbackInfoReturnable<AspectList> ci) {
AspectList known = (AspectList)this.aspectsDiscovered.get(player);
if (Config.knowAllAspects && (known == null || known.size() < Aspect.aspects.size())) {
addAllAspects(player);
}
}
public void addAllAspects(String player) {
AspectList known = (AspectList)this.aspectsDiscovered.get(player);
if (known == null) {
known = new AspectList();
}
for (Aspect a : Aspect.aspects.values()) {
if (!known.aspects.containsKey(a)) {
known.add(a, 0);
}
}
aspectsDiscovered.put(player, known);
}
}

View file

@ -17,7 +17,8 @@
"MixinBlockTable",
"MixinBlockCrystal",
"MixinEventHandlerEntity",
"MixinThaumcraftWorldGenerator"
"MixinThaumcraftWorldGenerator",
"MixinPlayerKnowledge"
],
"client": [
"MixinBlockCustomOreRenderer",