-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
1,012 additions
and
665 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
src/client/java/com/bawnorton/bettertrims/client/mixin/BackgroundRendererMixin.java
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
src/client/java/com/bawnorton/bettertrims/client/mixin/GameRendererMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bawnorton.bettertrims.client.mixin; | ||
|
||
import com.bawnorton.bettertrims.client.config.ClientConfigManager; | ||
import com.bawnorton.bettertrims.effect.ArmorTrimEffects; | ||
import com.bawnorton.bettertrims.extend.LivingEntityExtender; | ||
import com.bawnorton.bettertrims.util.NumberWrapper; | ||
import com.llamalad7.mixinextras.injector.ModifyReturnValue; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import net.minecraft.client.render.GameRenderer; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.effect.StatusEffectInstance; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(GameRenderer.class) | ||
public abstract class GameRendererMixin { | ||
@WrapOperation(method = "getNightVisionStrength", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/effect/StatusEffectInstance;isDurationBelow(I)Z")) | ||
private static boolean letsNotCrashThanks(StatusEffectInstance instance, int duration, Operation<Boolean> original) { | ||
if(instance == null) return false; | ||
return original.call(instance, duration); | ||
} | ||
|
||
@ModifyReturnValue(method = "getNightVisionStrength", at = @At("RETURN")) | ||
private static float improveNightVisionWhenWearingSilver(float original, LivingEntity entity, float tickDelta) { | ||
NumberWrapper increase = NumberWrapper.zero(); | ||
if (entity instanceof LivingEntityExtender extender && extender.betterTrims$shouldSilverApply()) { | ||
ArmorTrimEffects.SILVER.apply(extender.betterTrims$getTrimmables(), () -> increase.increment(ClientConfigManager.getConfig().silverEffects.improveVision)); | ||
} | ||
return Math.min(original + increase.getFloat(), 1.0F); | ||
} | ||
} |
Oops, something went wrong.