Class ScreenEffectImpl
java.lang.Object
net.ixdarklord.coolcatcanvas.internal.client.effect.ScreenEffectImpl
- All Implemented Interfaces:
ScreenEffect
-
Method Summary
Modifier and TypeMethodDescriptionactiveWhen(@Nullable Predicate<EffectContext> condition) Enables the effect when the condition starts holding and disables it when it stops, checked every frame.animateStrength(float target, int ticks, Easing easing) Moves the manual strength totargetoverticks.autoBlend(boolean autoBlend) Blends the effect's output with the unprocessed image by its strength, so any shader fades smoothly, including vanilla-style ones that ignoreStrength.@Nullable net.minecraft.resources.ResourceLocationThepost_effectJSON it's loaded from, or null for a definition built in code.@Nullable net.minecraft.network.chat.ComponentA line or two shown in the effects screen, or null.description(@Nullable net.minecraft.network.chat.Component description) disable()Fades out.Hides the effect right away, skipping the fade-out.net.minecraft.network.chat.ComponentThe name shown in the effects screen: by defaultscreen_effect.<namespace>.<path>, else the path.displayName(net.minecraft.network.chat.Component name) enable()Fades in, or keeps the effect on if it's already.enableFor(int ticks) Fades in, stays forticks, then fades out: a flash, a pulse, a hit.Shows the effect at full fade right away, skipping the fade-in.@Nullable Stringerror()Why it failed to load or draw, if it did.How it fades in and out.net.minecraft.resources.ResourceLocationid()booleanWhether it has anScreenEffect.activeWhen(java.util.function.Predicate<net.ixdarklord.coolcatcanvas.api.client.effect.EffectContext>)condition deciding when it's on.booleanWhether it's enabled; it may still be fading in.booleanisLoaded()Whether its shaders compiled and it can be drawn.booleanWhether players can turn it on and off from the effects screen, where their choice is remembered.booleanWhether it's drawn this frame: enabled or still fading out, with a strength above 0.floatThe manual strength, or where its animation is heading.onFrame(@Nullable Consumer<EffectContext> callback) Runs every frame before drawing, while the effect is visible: a place to drive uniforms.intpriority()priority(int priority) Where the effect starts in the layer order: lower priorities are drawn first, so later effects process their output.Resets every uniform to its definition's default.scope()scope(ScreenEffectScope scope) Where in the frame it's drawn.selectable(boolean selectable) setStrength(float strength) Sets the manual strength, clamped to[0, 1].floatstrength()The strength the effect is drawn with this frame.strength(@Nullable EffectContext.StrengthFunction function) Scales the strength by a function of the frame, clamped to[0, 1]; null to stop.The uniform namednamein any of the definition's uniform blocks.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.ixdarklord.coolcatcanvas.api.client.effect.ScreenEffect
bindUniform, bindUniform, fade, setEnabled, setUniform, setUniformInt, toggle
-
Method Details
-
id
public net.minecraft.resources.ResourceLocation id()- Specified by:
idin interfaceScreenEffect
-
definitionId
@Nullable public @Nullable net.minecraft.resources.ResourceLocation definitionId()Description copied from interface:ScreenEffectThepost_effectJSON it's loaded from, or null for a definition built in code.- Specified by:
definitionIdin interfaceScreenEffect
-
displayName
public net.minecraft.network.chat.Component displayName()Description copied from interface:ScreenEffectThe name shown in the effects screen: by defaultscreen_effect.<namespace>.<path>, else the path.- Specified by:
displayNamein interfaceScreenEffect
-
displayName
- Specified by:
displayNamein interfaceScreenEffect
-
description
@Nullable public @Nullable net.minecraft.network.chat.Component description()Description copied from interface:ScreenEffectA line or two shown in the effects screen, or null.- Specified by:
descriptionin interfaceScreenEffect
-
description
public ScreenEffect description(@Nullable @Nullable net.minecraft.network.chat.Component description) - Specified by:
descriptionin interfaceScreenEffect
-
isSelectable
public boolean isSelectable()Description copied from interface:ScreenEffectWhether players can turn it on and off from the effects screen, where their choice is remembered. True by default; turn it off for effects the mod drives on its own (an effect with anScreenEffect.activeWhen(java.util.function.Predicate<net.ixdarklord.coolcatcanvas.api.client.effect.EffectContext>)condition is listed but can't be toggled there).- Specified by:
isSelectablein interfaceScreenEffect
-
selectable
- Specified by:
selectablein interfaceScreenEffect
-
isAutomatic
public boolean isAutomatic()Description copied from interface:ScreenEffectWhether it has anScreenEffect.activeWhen(java.util.function.Predicate<net.ixdarklord.coolcatcanvas.api.client.effect.EffectContext>)condition deciding when it's on.- Specified by:
isAutomaticin interfaceScreenEffect
-
scope
- Specified by:
scopein interfaceScreenEffect
-
scope
Description copied from interface:ScreenEffectWhere in the frame it's drawn. Defaults toScreenEffectScope.WORLD.- Specified by:
scopein interfaceScreenEffect
-
priority
public int priority()- Specified by:
priorityin interfaceScreenEffect
-
priority
Description copied from interface:ScreenEffectWhere the effect starts in the layer order: lower priorities are drawn first, so later effects process their output. Defaults to 0. Once the order is rearranged (by code or by a player), it's kept untilScreenEffectLayers.resetOrder().- Specified by:
priorityin interfaceScreenEffect
-
fade
Description copied from interface:ScreenEffectHow it fades in and out. Both default to 10 ticks withEasing.SINE_IN_OUT.- Specified by:
fadein interfaceScreenEffect
-
autoBlend
Description copied from interface:ScreenEffectBlends the effect's output with the unprocessed image by its strength, so any shader fades smoothly, including vanilla-style ones that ignoreStrength. Costs three extra full-screen copies. Off by default.- Specified by:
autoBlendin interfaceScreenEffect
-
activeWhen
Description copied from interface:ScreenEffectEnables the effect when the condition starts holding and disables it when it stops, checked every frame. In between, the effect can still be toggled by hand (or vetoed throughScreenEffectEvents.BEFORE_TOGGLE), and stays so until the condition changes again. Pass null to stop.- Specified by:
activeWhenin interfaceScreenEffect
-
strength
Description copied from interface:ScreenEffectScales the strength by a function of the frame, clamped to[0, 1]; null to stop.- Specified by:
strengthin interfaceScreenEffect
-
onFrame
Description copied from interface:ScreenEffectRuns every frame before drawing, while the effect is visible: a place to drive uniforms.- Specified by:
onFramein interfaceScreenEffect
-
enable
Description copied from interface:ScreenEffectFades in, or keeps the effect on if it's already. Cancels a pendingScreenEffect.enableFor(int)timeout.- Specified by:
enablein interfaceScreenEffect
-
disable
Description copied from interface:ScreenEffectFades out.- Specified by:
disablein interfaceScreenEffect
-
enableFor
Description copied from interface:ScreenEffectFades in, stays forticks, then fades out: a flash, a pulse, a hit.- Specified by:
enableForin interfaceScreenEffect
-
enableInstantly
Description copied from interface:ScreenEffectShows the effect at full fade right away, skipping the fade-in.- Specified by:
enableInstantlyin interfaceScreenEffect
-
disableInstantly
Description copied from interface:ScreenEffectHides the effect right away, skipping the fade-out.- Specified by:
disableInstantlyin interfaceScreenEffect
-
isEnabled
public boolean isEnabled()Description copied from interface:ScreenEffectWhether it's enabled; it may still be fading in.- Specified by:
isEnabledin interfaceScreenEffect
-
isVisible
public boolean isVisible()Description copied from interface:ScreenEffectWhether it's drawn this frame: enabled or still fading out, with a strength above 0.- Specified by:
isVisiblein interfaceScreenEffect
-
setStrength
Description copied from interface:ScreenEffectSets the manual strength, clamped to[0, 1].- Specified by:
setStrengthin interfaceScreenEffect
-
animateStrength
Description copied from interface:ScreenEffectMoves the manual strength totargetoverticks.- Specified by:
animateStrengthin interfaceScreenEffect
-
manualStrength
public float manualStrength()The manual strength, or where its animation is heading. -
strength
public float strength()Description copied from interface:ScreenEffectThe strength the effect is drawn with this frame.- Specified by:
strengthin interfaceScreenEffect
-
uniform
Description copied from interface:ScreenEffectThe uniform namednamein any of the definition's uniform blocks.- Specified by:
uniformin interfaceScreenEffect
-
resetUniforms
Description copied from interface:ScreenEffectResets every uniform to its definition's default.- Specified by:
resetUniformsin interfaceScreenEffect
-
isLoaded
public boolean isLoaded()Description copied from interface:ScreenEffectWhether its shaders compiled and it can be drawn. False until the first resource load, and after errors.- Specified by:
isLoadedin interfaceScreenEffect
-
error
Description copied from interface:ScreenEffectWhy it failed to load or draw, if it did. Fixed by a resource reload.- Specified by:
errorin interfaceScreenEffect
-