diff options
author | SHsuperCM <shsupercm@gmail.com> | 2021-10-23 18:10:41 +0300 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2021-10-23 18:10:41 +0300 |
commit | 1d9d6a3de56202deb6e18a9538f82aa24ea2bca9 (patch) | |
tree | 8ef6aea555724174ea6f3cf2b5a1acdc36db9703 /src | |
parent | 0c7a3befc58c21984e3c1c66cdeb9a221347dfcc (diff) | |
download | CITResewn-1d9d6a3de56202deb6e18a9538f82aa24ea2bca9.tar.gz CITResewn-1d9d6a3de56202deb6e18a9538f82aa24ea2bca9.tar.bz2 CITResewn-1d9d6a3de56202deb6e18a9538f82aa24ea2bca9.zip |
Added rgba multipliers to enchantments
#15
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITEnchantment.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITEnchantment.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITEnchantment.java index f018433..70ad618 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITEnchantment.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITEnchantment.java @@ -27,7 +27,7 @@ public class CITEnchantment extends CIT { public static boolean shouldApply = false; public final Identifier textureIdentifier; - public final float speed, rotation, duration; + public final float speed, rotation, duration, r, g, b, a; public final int layer; public final boolean useGlint, blur; public final Blend blend; @@ -49,6 +49,11 @@ public class CITEnchantment extends CIT { layer = Integer.parseInt(properties.getProperty("layer", "0")); + r = Math.max(0f, Float.parseFloat(properties.getProperty("r", "1"))); + g = Math.max(0f, Float.parseFloat(properties.getProperty("g", "1"))); + b = Math.max(0f, Float.parseFloat(properties.getProperty("b", "1"))); + a = Math.max(0f, Float.parseFloat(properties.getProperty("a", "1"))); + useGlint = switch (properties.getProperty("useGlint", "false").toLowerCase(Locale.ENGLISH)) { case "true" -> true; case "false" -> false; @@ -135,7 +140,7 @@ public class CITEnchantment extends CIT { } public RenderLayer build(CITEnchantment enchantment) { - final float speed = enchantment.speed, rotation = enchantment.rotation; + final float speed = enchantment.speed, rotation = enchantment.rotation, r = enchantment.r, g = enchantment.g, b = enchantment.b, a = enchantment.a; //noinspection ConstantConditions RenderLayer.MultiPhaseParameters.Builder layer = RenderLayer.MultiPhaseParameters.builder() .texture(new RenderPhase.Texture(enchantment.textureIdentifier, enchantment.blur, false)) @@ -147,7 +152,13 @@ public class CITEnchantment extends CIT { matrix4f.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(rotation + 10f)); matrix4f.multiply(Matrix4f.scale(scale, scale, scale)); setTextureMatrix(matrix4f); - }, RenderSystem::resetTextureMatrix)) + + setShaderColor(r, g, b, a); + }, () -> { + RenderSystem.resetTextureMatrix(); + + setShaderColor(1f, 1f, 1f, 1f); + })) .transparency(enchantment.blend); this.setup.accept(layer); |