Skip to content

Commit 1a27d33

Browse files
committed
Merge branch 'refs/heads/1.20.6' into 1.21
2 parents 7ce6e84 + e71b44a commit 1a27d33

File tree

3 files changed

+53
-4
lines changed

3 files changed

+53
-4
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package net.irisshaders.iris.mixin.entity_render_context;
2+
3+
import com.mojang.blaze3d.vertex.PoseStack;
4+
import it.unimi.dsi.fastutil.objects.Object2IntFunction;
5+
import net.irisshaders.iris.shaderpack.materialmap.NamespacedId;
6+
import net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings;
7+
import net.irisshaders.iris.uniforms.CapturedRenderingState;
8+
import net.minecraft.client.renderer.MultiBufferSource;
9+
import net.minecraft.client.renderer.entity.EntityRenderer;
10+
import net.minecraft.network.chat.Component;
11+
import net.minecraft.world.entity.Entity;
12+
import org.spongepowered.asm.mixin.Mixin;
13+
import org.spongepowered.asm.mixin.Unique;
14+
import org.spongepowered.asm.mixin.injection.At;
15+
import org.spongepowered.asm.mixin.injection.Inject;
16+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
17+
18+
@Mixin(EntityRenderer.class)
19+
public class MixinEntityRenderer<T extends Entity> {
20+
@Unique
21+
private static final NamespacedId NAME_TAG_ID = new NamespacedId("minecraft", "name_tag");
22+
23+
@Unique
24+
private int lastId = -100;
25+
26+
@Inject(method = "renderNameTag", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;getViewYRot(F)F"))
27+
private void setNameTagId(T entity, Component component, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, float f, CallbackInfo ci) {
28+
Object2IntFunction<NamespacedId> entityIds = WorldRenderingSettings.INSTANCE.getEntityIds();
29+
30+
if (entityIds == null) {
31+
return;
32+
}
33+
34+
this.lastId = CapturedRenderingState.INSTANCE.getCurrentRenderedEntity();
35+
36+
int intId = entityIds.applyAsInt(NAME_TAG_ID);
37+
38+
CapturedRenderingState.INSTANCE.setCurrentEntity(intId);
39+
}
40+
41+
@Inject(method = "renderNameTag", at = @At("RETURN"))
42+
private void resetId(T entity, Component component, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, float f, CallbackInfo ci) {
43+
if (lastId != -100) {
44+
CapturedRenderingState.INSTANCE.setCurrentEntity(lastId);
45+
lastId = -100 ;
46+
}
47+
}
48+
}

src/main/java/net/irisshaders/iris/shaderpack/properties/ShaderProperties.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,9 @@ public ShaderProperties(String contents, ShaderPackOptions shaderPackOptions, It
599599
}
600600

601601
private static void handleBooleanValue(String key, String value, BooleanConsumer handler) {
602-
if ("true".equals(value)) {
602+
if ("true".equals(value) || "1".equals(value)) {
603603
handler.accept(true);
604-
} else if ("false".equals(value)) {
604+
} else if ("false".equals(value) || "0".equals(value)) {
605605
handler.accept(false);
606606
} else {
607607
Iris.logger.warn("Unexpected value for boolean key " + key + " in shaders.properties: got " + value + ", but expected either true or false");
@@ -613,9 +613,9 @@ private static void handleBooleanDirective(String key, String value, String expe
613613
return;
614614
}
615615

616-
if ("true".equals(value)) {
616+
if ("true".equals(value) || "1".equals(value)) {
617617
handler.accept(OptionalBoolean.TRUE);
618-
} else if ("false".equals(value)) {
618+
} else if ("false".equals(value) || "0".equals(value)) {
619619
handler.accept(OptionalBoolean.FALSE);
620620
} else {
621621
Iris.logger.warn("Unexpected value for boolean key " + key + " in shaders.properties: got " + value + ", but expected either true or false");

src/main/resources/mixins.iris.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"entity_render_context.MixinElytraLayer",
6161
"entity_render_context.MixinEnderDragonRenderer",
6262
"entity_render_context.MixinEntityRenderDispatcher",
63+
"entity_render_context.MixinEntityRenderer",
6364
"entity_render_context.MixinHorseArmorLayer",
6465
"entity_render_context.MixinHumanoidArmorLayer",
6566
"entity_render_context.MixinItemRenderer",

0 commit comments

Comments
 (0)