Skip to content

Commit

Permalink
25w03a
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Jan 15, 2025
1 parent 576adff commit 4b8fb5d
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 43 deletions.
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ plugins {
id("fabric-loom") version("1.8.10") apply(false)
}

val MINECRAFT_VERSION by extra { "1.21.4" }
val MINECRAFT_VERSION by extra { "25w03a" }
val NEOFORGE_VERSION by extra { "21.4.13-beta" }
val FABRIC_LOADER_VERSION by extra { "0.16.9" }
val FABRIC_API_VERSION by extra { "0.110.5+1.21.4" }
val FABRIC_LOADER_VERSION by extra { "0.16.10" }
val FABRIC_API_VERSION by extra { "0.114.4+1.21.5" }

// This value can be set to null to disable Parchment.
// TODO: Re-add Parchment
Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dependencies {

modCompileOnly("net.fabricmc.fabric-api:fabric-renderer-api-v1:3.2.9+1172e897d7")

modImplementation("maven.modrinth", "sodium", "mc1.21.4-0.6.2-fabric")
modImplementation(files(rootDir.resolve("custom_sodium").resolve("sodium-fabric-0.6.6-snapshot+mc25w03a-local.jar")))
modCompileOnly("org.antlr:antlr4-runtime:4.13.1")
modCompileOnly("io.github.douira:glsl-transformer:2.0.1")
modCompileOnly("org.anarres:jcpp:1.4.14")
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/net/irisshaders/iris/Iris.java
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ private static void handleException(Exception e) {
} else {
if (Minecraft.getInstance().player != null) {
Minecraft.getInstance().player.displayClientMessage(Component.translatable(e instanceof ShaderCompileException ? "iris.load.failure.shader" : "iris.load.failure.generic").append(Component.literal("Copy Info").withStyle(arg -> arg.withUnderlined(true).withColor(
ChatFormatting.BLUE).withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, e.getMessage())).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("chat.copy.click"))))), false);
ChatFormatting.BLUE).withClickEvent(new ClickEvent.CopyToClipboard(e.getMessage())).withHoverEvent(new HoverEvent.ShowText(Component.translatable("chat.copy.click"))))), false);
} else {
storedError = Optional.of(e);
}
Expand Down
17 changes: 15 additions & 2 deletions common/src/main/java/net/irisshaders/iris/UpdateChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
Expand Down Expand Up @@ -182,10 +183,22 @@ public Optional<Component> getUpdateMessage() {
if (textParts.length > 1) {
MutableComponent component1 = Component.literal(textParts[0]);
MutableComponent component2 = Component.literal(textParts[1]);
MutableComponent link = Component.literal(usedIrisInstaller ? "the Iris Installer" : info.modHost).withStyle(arg -> arg.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, usedIrisInstaller ? info.installer : info.modDownload)).withUnderlined(true));
MutableComponent link = Component.literal(usedIrisInstaller ? "the Iris Installer" : info.modHost).withStyle(arg -> {
try {
return arg.withClickEvent(new ClickEvent.OpenUrl(new URI(usedIrisInstaller ? info.installer : info.modDownload))).withUnderlined(true);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
});
return Optional.of(component1.append(link).append(component2));
} else {
MutableComponent link = Component.literal(usedIrisInstaller ? "the Iris Installer" : info.modHost).withStyle(arg -> arg.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, usedIrisInstaller ? info.installer : info.modDownload)).withUnderlined(true));
MutableComponent link = Component.literal(usedIrisInstaller ? "the Iris Installer" : info.modHost).withStyle(arg -> {
try {
return arg.withClickEvent(new ClickEvent.OpenUrl(new URI(usedIrisInstaller ? info.installer : info.modDownload))).withUnderlined(true);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
});
return Optional.of(Component.literal(textParts[0]).append(link));
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class MixinClientPacketListener {
Minecraft.getInstance().player.displayClientMessage(msg, false));

Iris.getStoredError().ifPresent(e ->
Minecraft.getInstance().player.displayClientMessage(Component.translatable(e instanceof ShaderCompileException ? "iris.load.failure.shader" : "iris.load.failure.generic").append(Component.literal("Copy Info").withStyle(arg -> arg.withUnderlined(true).withColor(ChatFormatting.BLUE).withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, e.getMessage())).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("chat.copy.click"))))), false));
Minecraft.getInstance().player.displayClientMessage(Component.translatable(e instanceof ShaderCompileException ? "iris.load.failure.shader" : "iris.load.failure.generic").append(Component.literal("Copy Info").withStyle(arg -> arg.withUnderlined(true).withColor(ChatFormatting.BLUE).withClickEvent(new ClickEvent.CopyToClipboard(e.getMessage())).withHoverEvent(new HoverEvent.ShowText(Component.translatable("chat.copy.click"))))), false));

if (Iris.loadedIncompatiblePack()) {
Minecraft.getInstance().gui.setTimes(10, 70, 140);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package net.irisshaders.iris.mixin;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import com.mojang.blaze3d.vertex.PoseStack;
import net.irisshaders.iris.Iris;
import net.minecraft.client.Camera;
import net.minecraft.client.DeltaTracker;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.util.Mth;
import net.minecraft.world.effect.MobEffects;
Expand Down Expand Up @@ -39,8 +43,7 @@ public abstract class MixinModelViewBobbing {
@Shadow
@Final
private Camera mainCamera;
@Shadow
private int confusionAnimationTick;

@Unique
private Matrix4fc bobbingEffectsModel;
@Unique
Expand All @@ -52,6 +55,12 @@ public abstract class MixinModelViewBobbing {
@Shadow
protected abstract void bobHurt(PoseStack pGameRenderer0, float pFloat1);

@Shadow
private float spinningEffectTime;

@Shadow
private float spinningEffectSpeed;

@Inject(method = "renderLevel", at = @At("HEAD"))
private void iris$saveShadersOn(DeltaTracker deltaTracker, CallbackInfo ci) {
areShadersOn = Iris.isPackInUseQuick();
Expand All @@ -76,6 +85,12 @@ public abstract class MixinModelViewBobbing {
if (!areShadersOn) this.bobView(pGameRenderer0, pFloat1);
}

@WrapOperation(method = "renderLevel", at = @At(value = "INVOKE", target = "Ljava/lang/Double;floatValue()F"))
private float fixNausea(Double instance, Operation<Float> original) {
if (areShadersOn) return 0.0f;
return original.call(instance);
}


@Redirect(method = "renderLevel",
at = @At(value = "INVOKE",
Expand All @@ -95,7 +110,7 @@ public abstract class MixinModelViewBobbing {
@Redirect(method = "renderLevel",
at = @At(value = "INVOKE",
target = "Lorg/joml/Matrix4f;rotation(Lorg/joml/Quaternionfc;)Lorg/joml/Matrix4f;", remap = false))
private Matrix4f iris$applyBobbingToModelView(Matrix4f instance, Quaternionfc quat, DeltaTracker deltaTracker) {
private Matrix4f iris$applyBobbingToModelView(Matrix4f instance, Quaternionfc quat, DeltaTracker deltaTracker, @Local LocalPlayer localPlayer) {
if (!areShadersOn) {
instance.rotation(quat);

Expand All @@ -105,28 +120,28 @@ public abstract class MixinModelViewBobbing {
PoseStack stack = new PoseStack();
stack.last().pose().set(instance);

float tickDelta = this.mainCamera.getPartialTickTime();

this.bobHurt(stack, tickDelta);
this.bobHurt(stack, this.mainCamera.getPartialTickTime());
if (this.minecraft.options.bobView().get()) {
this.bobView(stack, tickDelta);
this.bobView(stack, this.mainCamera.getPartialTickTime());
}

instance.set(stack.last().pose());

float f = deltaTracker.getGameTimeDeltaPartialTick(false);
float h = this.minecraft.options.screenEffectScale().get().floatValue();
float i = Mth.lerp(f, this.minecraft.player.oSpinningEffectIntensity, this.minecraft.player.spinningEffectIntensity) * h * h;
if (i > 0.0F) {
int j = this.minecraft.player.hasEffect(MobEffects.CONFUSION) ? 7 : 20;
float k = 5.0F / (i * i + 5.0F) - i * 0.04F;
k *= k;
Vector3f vector3f = new Vector3f(0.0F, Mth.SQRT_OF_TWO / 2.0F, Mth.SQRT_OF_TWO / 2.0F);
float l = ((float) this.confusionAnimationTick + f) * (float) j * (float) (Math.PI / 180.0);
instance.rotate(l, vector3f);
instance.scale(1.0F / k, 1.0F, 1.0F);
instance.rotate(-l, vector3f);
}
float tickDelta = deltaTracker.getGameTimeDeltaPartialTick(false);
float scale = this.minecraft.options.screenEffectScale().get().floatValue();
float portalIntensity = Mth.lerp(tickDelta, localPlayer.oPortalEffectIntensity, localPlayer.portalEffectIntensity);
float nauseaIntensity = localPlayer.getEffectBlendFactor(MobEffects.NAUSEA, tickDelta);
float finalIntensity = Math.max(portalIntensity, nauseaIntensity) * (scale * scale);
Vector3f transformation;
if (finalIntensity > 0.0f) {
float intensity = 5.0f / (finalIntensity * finalIntensity + 5.0f) - finalIntensity * 0.04f;
intensity *= intensity;
transformation = new Vector3f(0.0f, Mth.SQRT_OF_TWO / 2.0f, Mth.SQRT_OF_TWO / 2.0f);
float rotationAngle = (this.spinningEffectTime + tickDelta * this.spinningEffectSpeed) * ((float)Math.PI / 180);
instance.rotate(rotationAngle, transformation);
instance.scale(1.0f / intensity, 1.0f, 1.0f);
instance.rotate(-rotationAngle, transformation);
}

instance.rotate(quat);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.equipment.trim.ArmorTrim;
import org.jetbrains.annotations.Nullable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
package net.irisshaders.iris.mixin.entity_render_context;

import com.llamalad7.mixinextras.sugar.Local;
import com.mojang.blaze3d.vertex.PoseStack;
import net.irisshaders.iris.shaderpack.materialmap.NamespacedId;
import net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings;
import net.irisshaders.iris.uniforms.CapturedRenderingState;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.layers.HorseArmorLayer;
import net.minecraft.client.renderer.entity.layers.SimpleEquipmentLayer;
import net.minecraft.client.renderer.entity.state.HorseRenderState;
import net.minecraft.client.renderer.entity.state.LivingEntityRenderState;
import net.minecraft.core.component.DataComponents;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.AnimalArmorItem;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(HorseArmorLayer.class)
public class MixinHorseArmorLayer {
@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/client/renderer/entity/state/HorseRenderState;FF)V", at = @At(value = "HEAD"))
private void changeId(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, HorseRenderState horseRenderState, float f, float g, CallbackInfo ci) {
if (WorldRenderingSettings.INSTANCE.getItemIds() == null || !(horseRenderState.bodyArmorItem.getItem() instanceof AnimalArmorItem))
@Mixin(SimpleEquipmentLayer.class)
public class MixinHorseArmorLayer<S extends LivingEntityRenderState> {
@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/client/renderer/entity/state/LivingEntityRenderState;FF)V", at = @At(value = "FIELD", target = "Lnet/minecraft/core/component/DataComponents;EQUIPPABLE:Lnet/minecraft/core/component/DataComponentType;"))
private void changeId(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, S livingEntityRenderState, float f, float g, CallbackInfo ci, @Local ItemStack itemStack) {
if (WorldRenderingSettings.INSTANCE.getItemIds() == null || itemStack == null)
return;

ResourceLocation location = horseRenderState.bodyArmorItem.get(DataComponents.ITEM_MODEL);
if (location == null)
location = BuiltInRegistries.ITEM.getKey((horseRenderState.bodyArmorItem.getItem()));
ResourceLocation location = BuiltInRegistries.ITEM.getKey(itemStack.getItem());

CapturedRenderingState.INSTANCE.setCurrentRenderedItem(WorldRenderingSettings.INSTANCE.getItemIds().applyAsInt(new NamespacedId(location.getNamespace(), location.getPath())));
}

@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/client/renderer/entity/state/HorseRenderState;FF)V", at = @At(value = "TAIL"))
@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/client/renderer/entity/state/LivingEntityRenderState;FF)V", at = @At(value = "TAIL"))
private void changeId2(CallbackInfo ci) {
CapturedRenderingState.INSTANCE.setCurrentRenderedItem(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import net.caffeinemc.mods.sodium.client.gl.GlObject;
import net.caffeinemc.mods.sodium.client.gl.shader.GlProgram;
import net.caffeinemc.mods.sodium.client.gl.shader.GlShader;
import net.caffeinemc.mods.sodium.client.gl.shader.ShaderConstants;
import net.caffeinemc.mods.sodium.client.gl.shader.ShaderParser;
import net.caffeinemc.mods.sodium.client.gl.shader.ShaderType;
import net.caffeinemc.mods.sodium.client.render.chunk.shader.ChunkShaderBindingPoints;
import net.caffeinemc.mods.sodium.client.render.chunk.shader.ChunkShaderInterface;
Expand Down Expand Up @@ -97,7 +99,7 @@ private Map<PatchShaderType, GlShader> createGlShaders(String passName, Map<Patc
for (Map.Entry<PatchShaderType, String> entry : transformed.entrySet()) {
if (entry.getValue() == null) continue;
newMap.put(entry.getKey(), new GlShader(ShaderType.fromGlShaderType(entry.getKey().glShaderType.id),
ResourceLocation.fromNamespaceAndPath("iris", "sodium-shader-" + passName), entry.getValue()));
ResourceLocation.fromNamespaceAndPath("iris", "sodium-shader-" + passName), ShaderParser.parseShader(entry.getValue(), ShaderConstants.builder().build())));
}
return newMap;
}
Expand Down
2 changes: 1 addition & 1 deletion fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dependencies {
addRuntimeFabricModule("fabric-rendering-fluids-v1")
addRuntimeFabricModule("fabric-resource-loader-v0")

modImplementation("maven.modrinth", "sodium", "mc1.21.4-0.6.3-fabric")
modImplementation(files(rootDir.resolve("custom_sodium").resolve("sodium-fabric-0.6.6-snapshot+mc25w03a-local.jar")))
implementAndInclude("org.antlr:antlr4-runtime:4.13.1")
implementAndInclude("io.github.douira:glsl-transformer:2.0.1")
implementAndInclude("org.anarres:jcpp:1.4.14")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public abstract class MixinLevelRenderer {
}

@Inject(method = { "method_62214" }, require = 1, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderBuffers;bufferSource()Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;"))
private void iris$renderOpaqueParticles(FogParameters fogParameters, DeltaTracker deltaTracker, Camera camera, ProfilerFiller profilerFiller, Matrix4f matrix4f, Matrix4f matrix4f2, ResourceHandle resourceHandle, ResourceHandle resourceHandle2, ResourceHandle resourceHandle3, ResourceHandle resourceHandle4, boolean bl, Frustum frustum, ResourceHandle resourceHandle5, CallbackInfo ci) {
private void iris$renderOpaqueParticles(FogParameters fogParameters, DeltaTracker deltaTracker, Camera camera, ProfilerFiller profilerFiller, Matrix4f matrix4f, Matrix4f matrix4f2, ResourceHandle resourceHandle, ResourceHandle resourceHandle2, ResourceHandle resourceHandle3, boolean bl, Frustum frustum, ResourceHandle resourceHandle4, CallbackInfo ci) {
Profiler.get().popPush("opaque_particles");

ParticleRenderingSettings settings = getRenderingSettings();
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ pluginManagement {
}
}

include("common", "fabric", "neoforge")
include("common", "fabric")

0 comments on commit 4b8fb5d

Please sign in to comment.