Skip to content

Commit

Permalink
Port to 1.21.2-pre3
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Oct 12, 2024
1 parent dbcf0cd commit 40a6543
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 20 deletions.
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

plugins {
id("java")
id("fabric-loom") version("1.7.3") apply(false)
id("fabric-loom") version("1.8.6") apply(false)
}

val MINECRAFT_VERSION by extra { "1.21.1" }
val MINECRAFT_VERSION by extra { "1.21.2-pre2" }
val NEOFORGE_VERSION by extra { "21.1.46" }
val FABRIC_LOADER_VERSION by extra { "0.16.4" }
val FABRIC_API_VERSION by extra { "0.103.0+1.21.1" }
val FABRIC_LOADER_VERSION by extra { "0.16.5" }
val FABRIC_API_VERSION by extra { "0.105.3+1.21.2" }

// This value can be set to null to disable Parchment.
// TODO: Re-add Parchment
Expand Down
4 changes: 2 additions & 2 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id("java")
id("idea")
id("fabric-loom") version "1.7.3"
id("fabric-loom") version "1.8.6"
id("com.github.gmazzo.buildconfig") version "5.3.5"
}

Expand Down Expand Up @@ -58,7 +58,7 @@ dependencies {

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

modImplementation("maven.modrinth", "sodium", "mc1.21-0.6.0-beta.2-fabric")
modImplementation(files(rootDir.resolve("custom_sodium").resolve("sodium-fabric-0.6.0-snapshot+mc24w40a-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
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public List<BufferSegment> getSegments() {
if (meshData == null) return;

if (shouldSortOnUpload(renderType)) {
meshData.sortQuads(buffers.get(renderType).getBuffer(), RenderSystem.getVertexSorting());
meshData.sortQuads(buffers.get(renderType).getBuffer(), RenderSystem.getProjectionType().vertexSorting());
}

segments.add(new BufferSegment(meshData, renderType));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public abstract class MixinShaderManager_Overrides {
coreShaderMap.put(CoreShaders.RENDERTYPE_ENTITY_CUTOUT_NO_CULL, p -> getCutout(p));
coreShaderMap.put(CoreShaders.RENDERTYPE_ENTITY_CUTOUT_NO_CULL_Z_OFFSET, p -> getCutout(p));
coreShaderMap.put(CoreShaders.RENDERTYPE_ENTITY_SMOOTH_CUTOUT, p -> getCutout(p));
coreShaderMap.put(CoreShaders.RENDERTYPE_ARMOR_TRANSLUCENT, MixinShaderManager_Overrides::getTranslucent);
coreShaderMap.put(CoreShaders.RENDERTYPE_ENTITY_TRANSLUCENT, MixinShaderManager_Overrides::getTranslucent);
coreShaderMap.put(CoreShaders.RENDERTYPE_ENTITY_TRANSLUCENT_EMISSIVE, p -> ShaderKey.ENTITIES_EYES_TRANS);
coreShaderMap.put(CoreShaders.RENDERTYPE_ENTITY_ALPHA, p -> ShaderKey.ENTITIES_ALPHA);
Expand Down Expand Up @@ -102,6 +103,7 @@ public abstract class MixinShaderManager_Overrides {
coreShaderMapShadow.put(CoreShaders.RENDERTYPE_ENTITY_CUTOUT_NO_CULL, p -> ShaderKey.SHADOW_ENTITIES_CUTOUT);
coreShaderMapShadow.put(CoreShaders.RENDERTYPE_ENTITY_CUTOUT_NO_CULL_Z_OFFSET, p -> ShaderKey.SHADOW_ENTITIES_CUTOUT);
coreShaderMapShadow.put(CoreShaders.RENDERTYPE_ENTITY_SMOOTH_CUTOUT, p -> ShaderKey.SHADOW_ENTITIES_CUTOUT);
coreShaderMapShadow.put(CoreShaders.RENDERTYPE_ARMOR_TRANSLUCENT, p -> ShaderKey.SHADOW_ENTITIES_CUTOUT);
coreShaderMapShadow.put(CoreShaders.RENDERTYPE_ENTITY_TRANSLUCENT, p -> ShaderKey.SHADOW_ENTITIES_CUTOUT);
coreShaderMapShadow.put(CoreShaders.RENDERTYPE_ENTITY_TRANSLUCENT_EMISSIVE, p -> ShaderKey.SHADOW_ENTITIES_CUTOUT);
coreShaderMapShadow.put(CoreShaders.RENDERTYPE_ENTITY_ALPHA, p -> ShaderKey.SHADOW_ENTITIES_CUTOUT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,28 @@

@Mixin(EquipmentLayerRenderer.class)
public abstract class MixinEquipmentLayerRenderer {
@Inject(method = "renderLayers(Lnet/minecraft/world/item/equipment/EquipmentModel$LayerType;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/model/Model;Lnet/minecraft/world/item/ItemStack;Ljava/util/function/Function;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/resources/ResourceLocation;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/layers/EquipmentLayerRenderer;getColorForLayer(Lnet/minecraft/world/item/equipment/EquipmentModel$Layer;I)I"))
private void changeId(EquipmentModel.LayerType layerType, ResourceLocation resourceLocation, Model model, ItemStack itemStack, Function<ResourceLocation, RenderType> function, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, ResourceLocation resourceLocation2, CallbackInfo ci, @Local EquipmentModel.Layer layer) {
@Inject(method = "renderLayers(Lnet/minecraft/world/item/equipment/EquipmentModel$LayerType;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/model/Model;Lnet/minecraft/world/item/ItemStack;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/resources/ResourceLocation;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/layers/EquipmentLayerRenderer;getColorForLayer(Lnet/minecraft/world/item/equipment/EquipmentModel$Layer;I)I"))
private void changeId(EquipmentModel.LayerType layerType, ResourceLocation resourceLocation, Model model, ItemStack itemStack, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, ResourceLocation resourceLocation2, CallbackInfo ci, @Local EquipmentModel.Layer layer) {
if (WorldRenderingSettings.INSTANCE.getItemIds() == null) return;

ResourceLocation location = BuiltInRegistries.ITEM.getKey(itemStack.getItem());

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

@Inject(method = "renderLayers(Lnet/minecraft/world/item/equipment/EquipmentModel$LayerType;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/model/Model;Lnet/minecraft/world/item/ItemStack;Ljava/util/function/Function;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/resources/ResourceLocation;)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/entity/layers/EquipmentLayerRenderer;trimSpriteLookup:Ljava/util/function/Function;"))
private void changeTrimTemp(EquipmentModel.LayerType layerType, ResourceLocation resourceLocation, Model model, ItemStack itemStack, Function<ResourceLocation, RenderType> function, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, @Nullable ResourceLocation resourceLocation2, CallbackInfo ci, @Local ArmorTrim armorTrim) {
@Inject(method = "renderLayers(Lnet/minecraft/world/item/equipment/EquipmentModel$LayerType;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/model/Model;Lnet/minecraft/world/item/ItemStack;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/resources/ResourceLocation;)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/entity/layers/EquipmentLayerRenderer;trimSpriteLookup:Ljava/util/function/Function;"))
private void changeTrimTemp(EquipmentModel.LayerType layerType, ResourceLocation resourceLocation, Model model, ItemStack itemStack, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, @Nullable ResourceLocation resourceLocation2, CallbackInfo ci, @Local ArmorTrim armorTrim) {
if (WorldRenderingSettings.INSTANCE.getItemIds() == null) return;

EntityState.interposeItemId(WorldRenderingSettings.INSTANCE.getItemIds().applyAsInt(new NamespacedId("minecraft", "trim_" + armorTrim.material().value().assetName())));
}

@Inject(method = "renderLayers(Lnet/minecraft/world/item/equipment/EquipmentModel$LayerType;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/model/Model;Lnet/minecraft/world/item/ItemStack;Ljava/util/function/Function;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/resources/ResourceLocation;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/Model;renderToBuffer(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;II)V", shift = At.Shift.AFTER))
private void changeTrimTemp2(EquipmentModel.LayerType layerType, ResourceLocation resourceLocation, Model model, ItemStack itemStack, Function<ResourceLocation, RenderType> function, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, @Nullable ResourceLocation resourceLocation2, CallbackInfo ci) {
@Inject(method = "renderLayers(Lnet/minecraft/world/item/equipment/EquipmentModel$LayerType;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/model/Model;Lnet/minecraft/world/item/ItemStack;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/resources/ResourceLocation;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/Model;renderToBuffer(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;II)V", shift = At.Shift.AFTER))
private void changeTrimTemp2(EquipmentModel.LayerType layerType, ResourceLocation resourceLocation, Model model, ItemStack itemStack, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, @Nullable ResourceLocation resourceLocation2, CallbackInfo ci) {
EntityState.restoreItemId();
}

@Inject(method = "renderLayers(Lnet/minecraft/world/item/equipment/EquipmentModel$LayerType;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/model/Model;Lnet/minecraft/world/item/ItemStack;Ljava/util/function/Function;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/resources/ResourceLocation;)V", at = @At(value = "TAIL"))
@Inject(method = "renderLayers(Lnet/minecraft/world/item/equipment/EquipmentModel$LayerType;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/model/Model;Lnet/minecraft/world/item/ItemStack;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/resources/ResourceLocation;)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
@@ -1,5 +1,6 @@
package net.irisshaders.iris.pathways;

import com.mojang.blaze3d.ProjectionType;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexSorting;
Expand Down Expand Up @@ -38,7 +39,7 @@ private PoseStack setupGlState(GameRenderer gameRenderer, Camera camera, Matrix4
// We need to scale the matrix by 0.125 so the hand doesn't clip through blocks.
Matrix4f scaleMatrix = new Matrix4f().scale(1F, 1F, DEPTH);
scaleMatrix.mul(gameRenderer.getProjectionMatrix(((GameRendererAccessor) gameRenderer).invokeGetFov(camera, tickDelta, false)));
RenderSystem.setProjectionMatrix(scaleMatrix, VertexSorting.DISTANCE_TO_ORIGIN);
RenderSystem.setProjectionMatrix(scaleMatrix, ProjectionType.PERSPECTIVE);

poseStack.setIdentity();

Expand Down Expand Up @@ -102,7 +103,7 @@ public void renderSolid(Matrix4fc modelMatrix, float tickDelta, Camera camera, G
bufferSource.readyUp();
bufferSource.endBatch();

RenderSystem.setProjectionMatrix(new Matrix4f(CapturedRenderingState.INSTANCE.getGbufferProjection()), VertexSorting.DISTANCE_TO_ORIGIN);
RenderSystem.setProjectionMatrix(new Matrix4f(CapturedRenderingState.INSTANCE.getGbufferProjection()), ProjectionType.PERSPECTIVE);

poseStack.popPose();
RenderSystem.getModelViewStack().popMatrix();
Expand Down Expand Up @@ -138,7 +139,7 @@ public void renderTranslucent(Matrix4fc modelMatrix, float tickDelta, Camera cam

Profiler.get().pop();

RenderSystem.setProjectionMatrix(new Matrix4f(CapturedRenderingState.INSTANCE.getGbufferProjection()), VertexSorting.DISTANCE_TO_ORIGIN);
RenderSystem.setProjectionMatrix(new Matrix4f(CapturedRenderingState.INSTANCE.getGbufferProjection()), ProjectionType.PERSPECTIVE);

bufferSource.endBatch();
RenderSystem.getModelViewStack().popMatrix();
Expand Down
11 changes: 9 additions & 2 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id("java")
id("idea")
id("fabric-loom") version ("1.7.3")
id("fabric-loom") version ("1.8.6")
}

val MINECRAFT_VERSION: String by rootProject.extra
Expand Down Expand Up @@ -63,7 +63,7 @@ dependencies {
addRuntimeFabricModule("fabric-rendering-fluids-v1")
addRuntimeFabricModule("fabric-resource-loader-v0")

modImplementation("maven.modrinth", "sodium", "mc1.21-0.6.0-beta.2-fabric")
modImplementation(files(rootDir.resolve("custom_sodium").resolve("sodium-fabric-0.6.0-snapshot+mc24w40a-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 Expand Up @@ -97,6 +97,13 @@ loom {
ideConfigGenerated(true)
runDir("run")
}
create("clientQuickplay") {
client()
configName = "Fabric Client - Quickplay"
ideConfigGenerated(true)
runDir("run")
programArgs("--quickPlaySingleplayer", "\"World on $MINECRAFT_VERSION\"")
}
}
}

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 40a6543

Please sign in to comment.