True Darkness

True Darkness

3M Downloads

Night Vision power from Origins doesn't let you see in the dark with this mod.

SpiderKolo opened this issue ยท 3 comments

commented

Origins let's you play as one of many races with different abilities and disabilities, changing how you play the game.
It introduces 9 new races by default, but you can also make your own origins through datapacks.

For the sake of the issue, all you need to know is that one of the power types that you can give to Origins (and which two of the base ones have) - specifically power which would let you see better in dark - does not work if you play with this mod, making it basically useless.
Normal Night Vision works just fine, but not this.

I would appreciate compatibility with Origins if possible. If it did work with Origins, it would make Origins with natural night vision soo much better in that context.
While you could theoretically make a new power which operates with Night Vision potion effect, it's not as flexible as with the power added by Origins - with which you can make the effect as strong or weak as you want.

commented

A suggestion on how to fix this: Add in a config option where you can set the opacity of the png used for the mod depending on the effect.

commented

Seconded on this one, merling's best trait is invalidated here.

commented

This fell asleep for a while, so we ended up writing a mixin (quilt mappings) with a rudimentary solve of the problem

@Mixin(Darkness.class)
public abstract class DarknessMixin {
	static {
		LoggerFactory.getLogger("OriginsMinus").info("ORIGINS MINUS DARKNESS FIX INVOKED");
	}

	@ModifyArg(
			method = "skyFactor",
			at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;lerp(FFF)F"),
			index = 1
	)
	private static float overrideMoonFactor(float original) {
		List<NightVisionPower> nvs = PowerHolderComponent.KEY.get(MinecraftClient.getInstance().player).getPowers(NightVisionPower.class);
		Optional<Float> strength = nvs.stream().filter(NightVisionPower::isActive).map(NightVisionPower::getStrength).max(Float::compareTo);
		return strength.map(str -> Math.min(original + str, 1.0f)).orElse(original);
	}
}
java_IT7ioMiVTg.mp4

Basically just adds the power nightvision strength (range 0.0f to 1.0f) onto the moon phase (range 0.0f to 1.0f) and clamps it below 1.0f.

An identical mixin could probably be added to darkness itself using mixin plugins for compat checks, but the buildscript is arcane to us and breaks on windows (sorry grondag)

no idea how to handle block light in a friendly way though (besides just disabling true darkness entirely, like normal night vision)