aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2021-10-16 16:13:16 +0300
committerSHsuperCM <shsupercm@gmail.com>2021-10-16 16:13:16 +0300
commit4ba7596ba4a6d4b5e809a25e78acd0b9faabd22f (patch)
treed36e083e4b569f5be6f6c10fae73fd21f37fa622 /src
parent4530fd7aba852b0ad47866ecef1f52764b5a4dfc (diff)
downloadCITResewn-4ba7596ba4a6d4b5e809a25e78acd0b9faabd22f.tar.gz
CITResewn-4ba7596ba4a6d4b5e809a25e78acd0b9faabd22f.tar.bz2
CITResewn-4ba7596ba4a6d4b5e809a25e78acd0b9faabd22f.zip
CIT Enchantment's speed and rotation, added glint speed multiplier to config
Diffstat (limited to 'src')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java1
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java7
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITEnchantment.java54
-rw-r--r--src/main/resources/assets/citresewn/lang/en_us.json4
4 files changed, 44 insertions, 22 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java
index 6cbd62e..04b3166 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java
@@ -13,6 +13,7 @@ public class CITResewnConfig {
public boolean enabled = true;
public boolean mute_errors = false;
public boolean mute_warns = false;
+ public float citenchantment_scroll_multiplier = 8f;
public int cache_ms = 50;
public boolean broken_paths = false;
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java
index 34ab4f3..055c976 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java
@@ -44,6 +44,13 @@ public class CITResewnConfigScreenFactory {
.setDefaultValue(defaultConfig.mute_warns)
.build());
+ category.addEntry(entryBuilder.startFloatField(new TranslatableText("config.citresewn.citenchantment_scroll_multiplier.title"), currentConfig.citenchantment_scroll_multiplier)
+ .setTooltip(new TranslatableText("config.citresewn.citenchantment_scroll_multiplier.tooltip"))
+ .setSaveConsumer(newConfig -> currentConfig.citenchantment_scroll_multiplier = newConfig)
+ .setDefaultValue(defaultConfig.citenchantment_scroll_multiplier)
+ .setMin(0f)
+ .build());
+
category.addEntry(entryBuilder.startIntSlider(new TranslatableText("config.citresewn.cache_ms.title"), currentConfig.cache_ms / 50, 0, 5 * 20)
.setTooltip(new TranslatableText("config.citresewn.cache_ms.tooltip"))
.setSaveConsumer(newConfig -> currentConfig.cache_ms = newConfig * 50)
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 b3b344a..09fbb90 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
@@ -1,10 +1,15 @@
package shcm.shsupercm.fabric.citresewn.pack.cits;
+import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.*;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;
+import net.minecraft.util.Util;
+import net.minecraft.util.math.Matrix4f;
+import net.minecraft.util.math.Vec3f;
import shcm.shsupercm.fabric.citresewn.CITResewn;
+import shcm.shsupercm.fabric.citresewn.config.CITResewnConfig;
import shcm.shsupercm.fabric.citresewn.ex.CITParseException;
import shcm.shsupercm.fabric.citresewn.mixin.citenchantment.BufferBuilderStorageAccessor;
import shcm.shsupercm.fabric.citresewn.mixin.citenchantment.RenderPhaseAccessor;
@@ -82,72 +87,77 @@ public class CITEnchantment extends CIT {
}
public enum GlintRenderLayer {
- ARMOR_GLINT("armor_glint", layer -> layer
+ ARMOR_GLINT("armor_glint", 8f, layer -> layer
.shader(RenderPhaseAccessor.ARMOR_GLINT_SHADER())
.writeMaskState(RenderPhaseAccessor.COLOR_MASK())
.cull(RenderPhaseAccessor.DISABLE_CULLING())
.depthTest(RenderPhaseAccessor.EQUAL_DEPTH_TEST())
.transparency(RenderPhaseAccessor.GLINT_TRANSPARENCY())
- .texturing(RenderPhaseAccessor.GLINT_TEXTURING())
.layering(RenderPhaseAccessor.VIEW_OFFSET_Z_LAYERING())),
- ARMOR_ENTITY_GLINT("armor_entity_glint", layer -> layer
+ ARMOR_ENTITY_GLINT("armor_entity_glint", 0.16f, layer -> layer
.shader(RenderPhaseAccessor.ARMOR_ENTITY_GLINT_SHADER())
.writeMaskState(RenderPhaseAccessor.COLOR_MASK())
.cull(RenderPhaseAccessor.DISABLE_CULLING())
.depthTest(RenderPhaseAccessor.EQUAL_DEPTH_TEST())
.transparency(RenderPhaseAccessor.GLINT_TRANSPARENCY())
- .texturing(RenderPhaseAccessor.ENTITY_GLINT_TEXTURING())
.layering(RenderPhaseAccessor.VIEW_OFFSET_Z_LAYERING())),
- GLINT_TRANSLUCENT("glint_translucent", layer -> layer
+ GLINT_TRANSLUCENT("glint_translucent", 8f, layer -> layer
.shader(RenderPhaseAccessor.TRANSLUCENT_GLINT_SHADER())
.writeMaskState(RenderPhaseAccessor.COLOR_MASK())
.cull(RenderPhaseAccessor.DISABLE_CULLING())
.depthTest(RenderPhaseAccessor.EQUAL_DEPTH_TEST())
.transparency(RenderPhaseAccessor.GLINT_TRANSPARENCY())
- .target(RenderPhaseAccessor.ITEM_TARGET())
- .texturing(RenderPhaseAccessor.GLINT_TEXTURING())),
- GLINT("glint", layer -> layer
+ .target(RenderPhaseAccessor.ITEM_TARGET())),
+ GLINT("glint", 8f, layer -> layer
.shader(RenderPhaseAccessor.GLINT_SHADER())
.writeMaskState(RenderPhaseAccessor.COLOR_MASK())
.cull(RenderPhaseAccessor.DISABLE_CULLING())
.depthTest(RenderPhaseAccessor.EQUAL_DEPTH_TEST())
- .transparency(RenderPhaseAccessor.GLINT_TRANSPARENCY())
- .texturing(RenderPhaseAccessor.GLINT_TEXTURING())),
- DIRECT_GLINT("glint_direct", layer -> layer
+ .transparency(RenderPhaseAccessor.GLINT_TRANSPARENCY())),
+ DIRECT_GLINT("glint_direct", 8f, layer -> layer
.shader(RenderPhaseAccessor.DIRECT_GLINT_SHADER())
.writeMaskState(RenderPhaseAccessor.COLOR_MASK())
.cull(RenderPhaseAccessor.DISABLE_CULLING())
.depthTest(RenderPhaseAccessor.EQUAL_DEPTH_TEST())
- .transparency(RenderPhaseAccessor.GLINT_TRANSPARENCY())
- .texturing(RenderPhaseAccessor.GLINT_TEXTURING())),
- ENTITY_GLINT("entity_glint", layer -> layer
+ .transparency(RenderPhaseAccessor.GLINT_TRANSPARENCY())),
+ ENTITY_GLINT("entity_glint", 0.16f, layer -> layer
.shader(RenderPhaseAccessor.ENTITY_GLINT_SHADER())
.writeMaskState(RenderPhaseAccessor.COLOR_MASK())
.cull(RenderPhaseAccessor.DISABLE_CULLING())
.depthTest(RenderPhaseAccessor.EQUAL_DEPTH_TEST())
.transparency(RenderPhaseAccessor.GLINT_TRANSPARENCY())
- .target(RenderPhaseAccessor.ITEM_TARGET())
- .texturing(RenderPhaseAccessor.ENTITY_GLINT_TEXTURING())),
- DIRECT_ENTITY_GLINT("entity_glint_direct", layer -> layer
+ .target(RenderPhaseAccessor.ITEM_TARGET())),
+ DIRECT_ENTITY_GLINT("entity_glint_direct", 0.16f, layer -> layer
.shader(RenderPhaseAccessor.DIRECT_ENTITY_GLINT_SHADER())
.writeMaskState(RenderPhaseAccessor.COLOR_MASK())
.cull(RenderPhaseAccessor.DISABLE_CULLING())
.depthTest(RenderPhaseAccessor.EQUAL_DEPTH_TEST())
- .transparency(RenderPhaseAccessor.GLINT_TRANSPARENCY())
- .texturing(RenderPhaseAccessor.ENTITY_GLINT_TEXTURING()));
+ .transparency(RenderPhaseAccessor.GLINT_TRANSPARENCY()));
public final String name;
- protected final Consumer<RenderLayer.MultiPhaseParameters.Builder> setup;
+ private final Consumer<RenderLayer.MultiPhaseParameters.Builder> setup;
+ private final float scale;
- GlintRenderLayer(String name, Consumer<RenderLayer.MultiPhaseParameters.Builder> setup) {
+ GlintRenderLayer(String name, float scale, Consumer<RenderLayer.MultiPhaseParameters.Builder> setup) {
this.name = name;
+ this.scale = scale;
this.setup = setup;
}
public RenderLayer build(CITEnchantment enchantment) {
+ final float speed = enchantment.speed, rotation = enchantment.rotation;
//noinspection ConstantConditions
RenderLayer.MultiPhaseParameters.Builder layer = RenderLayer.MultiPhaseParameters.builder()
- .texture(new RenderPhase.Texture(enchantment.textureIdentifier, true, false));
+ .texture(new RenderPhase.Texture(enchantment.textureIdentifier, false, false))
+ .texturing(new RenderPhase.Texturing("citresewn_glint_texturing", () -> {
+ float l = Util.getMeasuringTimeMs() * CITResewnConfig.INSTANCE().citenchantment_scroll_multiplier * speed;
+ float x = (l % 110000f) / 110000f;
+ float y = (l % 30000f) / 30000f;
+ Matrix4f matrix4f = Matrix4f.translate(-x, y, 0.0f);
+ matrix4f.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(rotation + 10f));
+ matrix4f.multiply(Matrix4f.scale(scale, scale, scale));
+ RenderSystem.setTextureMatrix(matrix4f);
+ }, RenderSystem::resetTextureMatrix));
this.setup.accept(layer);
diff --git a/src/main/resources/assets/citresewn/lang/en_us.json b/src/main/resources/assets/citresewn/lang/en_us.json
index 7ab3012..2f90a92 100644
--- a/src/main/resources/assets/citresewn/lang/en_us.json
+++ b/src/main/resources/assets/citresewn/lang/en_us.json
@@ -10,6 +10,9 @@
"config.citresewn.mute_warns.title": "Mute loading warnings",
"config.citresewn.mute_warns.tooltip": "Should CIT Resewn not log cit warnings",
+ "config.citresewn.citenchantment_scroll_multiplier.title": "CIT Enchantment: Scroll Multiplier",
+ "config.citresewn.citenchantment_scroll_multiplier.tooltip": "General multiplier for the scroll speed of the glint textures added by enchantment CITs.",
+
"config.citresewn.broken_paths.title": "Allow broken paths in resourcepacks",
"config.citresewn.broken_paths.tooltip": "Allows packs with illegal resource paths to load.\nMay cause issues!",
@@ -19,6 +22,7 @@
"config.citresewn.cache_ms.ticks.1": "EVERY TICK",
"config.citresewn.cache_ms.ticks.any": "EVERY %s TICKS",
+
"pack.incompatible.broken_paths": "(Contains broken paths)",
"pack.incompatible.confirm.broken_paths": "This pack contains broken paths and support for it may be dropped in the future. Contact pack author to remove this warning. (~ CIT Resewn)"
} \ No newline at end of file