Record Class VfxMaterial
java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcanvas.api.client.vfx.VfxMaterial
- Record Components:
texture- a full texture path, such asmymod:textures/vfx/ember.pngsoftness- over how many blocks the effect fades out as it nears whatever is behind it, so it never ends in a hard line where it passes through a wall or the ground; 0 for a hard edgeshader- the fragment shader the material is drawn with, such asmymod:vfx/portalforassets/mymod/shaders/vfx/portal.fsh; null for the built-in textured one. SeewithShader(net.minecraft.resources.ResourceLocation)smooth- whether the texture is filtered smoothly (linear) or drawn pixel for pixel (nearest), as blocks and items are; smooth by default. SeewithSmoothing(boolean)
public record VfxMaterial(net.minecraft.resources.ResourceLocation texture, VfxBlend blend, float softness, @Nullable net.minecraft.resources.ResourceLocation shader, boolean smooth)
extends Record
What a world effect is drawn with: a texture, how it blends, and how softly it meets solid things. Everything drawn
with equal materials in a frame goes out in one draw call.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatstatic final net.minecraft.resources.ResourceLocationA round, soft glow: the bread and butter of light effects.static final net.minecraft.resources.ResourceLocationThe procedural rift shader CoolCatLib ships (WorldRiftsdraws with it).static final net.minecraft.resources.ResourceLocationA thin ring, for shockwaves and pulses.static final net.minecraft.resources.ResourceLocationA cloudy puff, for smoke and mist.static final net.minecraft.resources.ResourceLocationA small bright core with a wide faint halo.static final net.minecraft.resources.ResourceLocationA four-pointed star with thin rays.static final net.minecraft.resources.ResourceLocationA streak that is bright along its middle and fades to both ends: for sparks, beams and trails. -
Constructor Summary
ConstructorsConstructorDescriptionVfxMaterial(net.minecraft.resources.ResourceLocation texture, VfxBlend blend, float softness) VfxMaterial(net.minecraft.resources.ResourceLocation texture, VfxBlend blend, float softness, @Nullable net.minecraft.resources.ResourceLocation shader) VfxMaterial(net.minecraft.resources.ResourceLocation texture, VfxBlend blend, float softness, @Nullable net.minecraft.resources.ResourceLocation shader, boolean smooth) Creates an instance of aVfxMaterialrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic VfxMaterialadditive(net.minecraft.resources.ResourceLocation texture) An additive material with the default softness.static VfxMaterialalpha(net.minecraft.resources.ResourceLocation texture) blend()Returns the value of theblendrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static VfxMaterialluminous(net.minecraft.resources.ResourceLocation texture) @Nullable net.minecraft.resources.ResourceLocationshader()Returns the value of theshaderrecord component.booleansmooth()Returns the value of thesmoothrecord component.floatsoftness()Returns the value of thesoftnessrecord component.net.minecraft.resources.ResourceLocationtexture()Returns the value of thetexturerecord component.final StringtoString()Returns a string representation of this record class.withShader(net.minecraft.resources.ResourceLocation fragmentShader) The same material drawn with a fragment shader of the mod's own, for what a texture cannot do: portals, rifts, heat haze, anything procedural.withSmoothing(boolean smooth) The same material with its texture filtered smoothly (true, the default: soft glows and smoke) or drawn pixel for pixel (false: pixel art, such as block and item textures, stays crisp up close).withSoftness(float softness)
-
Field Details
-
RIFT_SHADER
public static final net.minecraft.resources.ResourceLocation RIFT_SHADERThe procedural rift shader CoolCatLib ships (WorldRiftsdraws with it). -
GLOW
public static final net.minecraft.resources.ResourceLocation GLOWA round, soft glow: the bread and butter of light effects. -
SPARKLE
public static final net.minecraft.resources.ResourceLocation SPARKLEA small bright core with a wide faint halo. -
STAR
public static final net.minecraft.resources.ResourceLocation STARA four-pointed star with thin rays. -
RING
public static final net.minecraft.resources.ResourceLocation RINGA thin ring, for shockwaves and pulses. -
SMOKE
public static final net.minecraft.resources.ResourceLocation SMOKEA cloudy puff, for smoke and mist. -
STREAK
public static final net.minecraft.resources.ResourceLocation STREAKA streak that is bright along its middle and fades to both ends: for sparks, beams and trails. -
DEFAULT_SOFTNESS
public static final float DEFAULT_SOFTNESS- See Also:
-
-
Constructor Details
-
VfxMaterial
public VfxMaterial(net.minecraft.resources.ResourceLocation texture, VfxBlend blend, float softness) -
VfxMaterial
public VfxMaterial(net.minecraft.resources.ResourceLocation texture, VfxBlend blend, float softness, @Nullable @Nullable net.minecraft.resources.ResourceLocation shader) -
VfxMaterial
public VfxMaterial(net.minecraft.resources.ResourceLocation texture, VfxBlend blend, float softness, @Nullable @Nullable net.minecraft.resources.ResourceLocation shader, boolean smooth) Creates an instance of aVfxMaterialrecord class.
-
-
Method Details
-
additive
An additive material with the default softness. -
alpha
-
luminous
-
withSoftness
-
withSmoothing
The same material with its texture filtered smoothly (true, the default: soft glows and smoke) or drawn pixel for pixel (false: pixel art, such as block and item textures, stays crisp up close). -
withShader
The same material drawn with a fragment shader of the mod's own, for what a texture cannot do: portals, rifts, heat haze, anything procedural. The shader takes the place ofcoolcatcanvas:vfx/quad:
It should multiply its alpha by#version 150 #moj_import <coolcatcanvas:vfx.glsl> // VfxTime.x (seconds), vfx_depth_fade(...) uniform sampler2D Sampler0; // the material's texture uniform sampler2D DepthSampler; // the scene's depth in vec2 texCoord; // the quad's UVs, as given to VfxDraw in vec4 vertexColor; // the colour given to VfxDraw out vec4 fragColor;vfx_depth_fade(texelFetch(DepthSampler, ivec2(gl_FragCoord.xy), 0).r, gl_FragCoord.z)to hide behind solid things. A shader has no uniforms of its own; what changes from one shape to the next travels in the colour and in the UVs (VfxDraw.quad(net.minecraft.world.phys.Vec3, net.minecraft.world.phys.Vec3, net.minecraft.world.phys.Vec3, net.minecraft.world.phys.Vec3, float, float, float, float, int)takes any UV range). -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
texture
public net.minecraft.resources.ResourceLocation texture()Returns the value of thetexturerecord component.- Returns:
- the value of the
texturerecord component
-
blend
Returns the value of theblendrecord component.- Returns:
- the value of the
blendrecord component
-
softness
public float softness()Returns the value of thesoftnessrecord component.- Returns:
- the value of the
softnessrecord component
-
shader
@Nullable public @Nullable net.minecraft.resources.ResourceLocation shader()Returns the value of theshaderrecord component.- Returns:
- the value of the
shaderrecord component
-
smooth
public boolean smooth()Returns the value of thesmoothrecord component.- Returns:
- the value of the
smoothrecord component
-