Skip to content

Commit faf8ab2

Browse files
committed
1.21.2
1 parent 94ce06f commit faf8ab2

19 files changed

+161
-123
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//file:noinspection GradlePackageVersionRange
22
plugins {
3-
id 'fabric-loom' version '1.6-SNAPSHOT'
3+
id 'fabric-loom' version '1.8-SNAPSHOT'
44
id 'maven-publish'
55
}
66

gradle.properties

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
org.gradle.jvmargs=-Xmx1G
33
# Fabric Properties
44
# check these on https://fabricmc.net/develop
5-
minecraft_base_version=1.21
6-
minecraft_version=1.21
7-
yarn_mappings=1.21+build.2
8-
loader_version=0.15.11
5+
minecraft_base_version=1.21.2
6+
minecraft_version=1.21.3
7+
yarn_mappings=1.21.3+build.2
8+
loader_version=0.16.9
99
# Mod Properties
1010
mod_version=0.4.7
1111
maven_group=com.glisco
1212
archives_base_name=isometric-renders
1313

1414
# Dependencies
15-
fabric_version=0.100.1+1.21
15+
fabric_version=0.109.0+1.21.3
1616

1717
# https://maven.wispforest.io/io/wispforest/worldmesher/
18-
worldmesher_version=0.4.6+1.21
18+
worldmesher_version=0.4.7+1.21.2
1919

2020
# https://maven.wispforest.io/io/wispforest/exo/
2121
exo_version=0.1.5+1.19
2222

23-
# https://maven.wispforest.io/io/wispforest/owo-lib/
24-
owo_version=0.12.10+1.21
23+
# https://maven.wispforest.io/#/releases/io/wispforest/owo-lib/
24+
owo_version=0.12.18+1.21.2
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/java/com/glisco/isometricrenders/IsometricRenders.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.glisco.isometricrenders;
22

33
import com.glisco.isometricrenders.command.IsorenderCommand;
4-
import com.glisco.isometricrenders.render.TooltipRenderable;
54
import com.glisco.isometricrenders.util.AreaSelectionHelper;
65
import com.glisco.isometricrenders.util.ImageIO;
76
import com.glisco.isometricrenders.util.ParticleRestriction;
@@ -16,12 +15,12 @@
1615
import net.fabricmc.api.EnvType;
1716
import net.fabricmc.api.Environment;
1817
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
19-
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
2018
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
2119
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
2220
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
2321
import net.fabricmc.loader.api.FabricLoader;
2422
import net.minecraft.client.MinecraftClient;
23+
import net.minecraft.client.gl.Framebuffer;
2524
import net.minecraft.client.option.KeyBinding;
2625
import net.minecraft.util.Identifier;
2726
import org.apache.logging.log4j.LogManager;
@@ -41,6 +40,8 @@ public class IsometricRenders implements ClientModInitializer {
4140
public static boolean skipWorldRender = false;
4241
public static boolean centerNextTooltip = false;
4342

43+
public static Framebuffer mainTargetOverride = null;
44+
4445
public static final KeyBinding SELECT = new KeyBinding("key.isometric-renders.area_select", GLFW.GLFW_KEY_C, KeyBinding.MISC_CATEGORY);
4546

4647
@Override

src/main/java/com/glisco/isometricrenders/command/TagArgumentType.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class TagArgumentType implements ArgumentType<TagArgumentType.TagArgument
2828
private final RegistryWrapper<Item> registryWrapper;
2929

3030
public TagArgumentType(CommandRegistryAccess registryAccess) {
31-
this.registryWrapper = registryAccess.getWrapperOrThrow(RegistryKeys.ITEM);
31+
this.registryWrapper = registryAccess.getOrThrow(RegistryKeys.ITEM);
3232
}
3333

3434
public static <S> TagArgument getTag(String name, CommandContext<S> context) {
@@ -46,7 +46,7 @@ public TagArgument parse(StringReader reader) throws CommandSyntaxException {
4646

4747
@Override
4848
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
49-
return CommandSource.suggestIdentifiers(this.registryWrapper.streamTags().map(named -> named.getTag().id()), builder, String.valueOf('#'));
49+
return CommandSource.suggestIdentifiers(this.registryWrapper.getTags().map(named -> named.getTag().id()), builder, String.valueOf('#'));
5050
}
5151

5252
public record TagArgument(Identifier id, RegistryEntryList<Item> entries) {}
Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
package com.glisco.isometricrenders.mixin;
22

33
import com.glisco.isometricrenders.IsometricRenders;
4+
import com.llamalad7.mixinextras.sugar.Local;
45
import net.minecraft.client.font.TextRenderer;
56
import net.minecraft.client.gui.DrawContext;
67
import net.minecraft.client.gui.tooltip.TooltipComponent;
78
import net.minecraft.client.gui.tooltip.TooltipPositioner;
9+
import net.minecraft.util.Identifier;
10+
import org.jetbrains.annotations.Nullable;
11+
import org.joml.Vector2ic;
812
import org.spongepowered.asm.mixin.Mixin;
913
import org.spongepowered.asm.mixin.Unique;
1014
import org.spongepowered.asm.mixin.injection.At;
@@ -18,32 +22,20 @@
1822
@Mixin(DrawContext.class)
1923
public class DrawContextMixin {
2024

21-
@Unique
22-
private int isometric$tooltipWidth = 0;
23-
@Unique
24-
private int isometric$tooltipHeight = 0;
25-
26-
@Inject(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;IILnet/minecraft/client/gui/tooltip/TooltipPositioner;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V"), locals = LocalCapture.CAPTURE_FAILHARD)
27-
private void captureTooltipDimensions(TextRenderer textRenderer, List<TooltipComponent> components, int x, int y, TooltipPositioner positioner, CallbackInfo ci, int width, int height) {
28-
this.isometric$tooltipWidth = width;
29-
this.isometric$tooltipHeight = height;
30-
}
31-
32-
@ModifyVariable(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;IILnet/minecraft/client/gui/tooltip/TooltipPositioner;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V"), ordinal = 6)
33-
private int centerXIfNeeded(int orig) {
25+
@ModifyVariable(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;IILnet/minecraft/client/gui/tooltip/TooltipPositioner;Lnet/minecraft/util/Identifier;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V"), ordinal = 6)
26+
private int centerXIfNeeded(int orig, @Local(ordinal = 2) int width) {
3427
if (!IsometricRenders.centerNextTooltip) return orig;
35-
return orig - 12 - isometric$tooltipWidth / 2;
28+
return orig - 12 - width / 2;
3629
}
3730

38-
@ModifyVariable(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;IILnet/minecraft/client/gui/tooltip/TooltipPositioner;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V"), ordinal = 7)
39-
private int centerYIfNeeded(int orig) {
31+
@ModifyVariable(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;IILnet/minecraft/client/gui/tooltip/TooltipPositioner;Lnet/minecraft/util/Identifier;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V"), ordinal = 7)
32+
private int centerYIfNeeded(int orig, @Local(ordinal = 3) int height) {
4033
if (!IsometricRenders.centerNextTooltip) return orig;
41-
return orig + 12 - isometric$tooltipHeight / 2;
34+
return orig + 12 - height / 2;
4235
}
4336

44-
@Inject(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;IILnet/minecraft/client/gui/tooltip/TooltipPositioner;)V", at = @At("TAIL"))
45-
private void resetCenterState(TextRenderer textRenderer, List<TooltipComponent> components, int x, int y, TooltipPositioner positioner, CallbackInfo ci) {
37+
@Inject(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;IILnet/minecraft/client/gui/tooltip/TooltipPositioner;Lnet/minecraft/util/Identifier;)V", at = @At("TAIL"))
38+
private void resetCenterState(TextRenderer textRenderer, List<TooltipComponent> components, int x, int y, TooltipPositioner positioner, @Nullable Identifier texture, CallbackInfo ci) {
4639
IsometricRenders.centerNextTooltip = false;
4740
}
48-
4941
}

src/main/java/com/glisco/isometricrenders/mixin/LivingEntityRendererMixin.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
import com.glisco.isometricrenders.IsometricRenders;
44
import net.minecraft.client.render.entity.LivingEntityRenderer;
55
import net.minecraft.client.render.entity.model.EntityModel;
6+
import net.minecraft.client.render.entity.state.LivingEntityRenderState;
67
import net.minecraft.entity.LivingEntity;
78
import org.spongepowered.asm.mixin.Mixin;
89
import org.spongepowered.asm.mixin.injection.At;
910
import org.spongepowered.asm.mixin.injection.Inject;
1011
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
1112

1213
@Mixin(LivingEntityRenderer.class)
13-
public class LivingEntityRendererMixin<T extends LivingEntity, M extends EntityModel<T>> {
14+
public class LivingEntityRendererMixin<T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> {
1415

15-
@Inject(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;)Z", at = @At("HEAD"), cancellable = true)
16-
private void disablePlayerLabels(T livingEntity, CallbackInfoReturnable<Boolean> cir) {
16+
@Inject(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;D)Z", at = @At("HEAD"), cancellable = true)
17+
private void disablePlayerLabels(T livingEntity, double d, CallbackInfoReturnable<Boolean> cir) {
1718
if (IsometricRenders.inRenderableDraw) {
1819
cir.setReturnValue(false);
1920
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.glisco.isometricrenders.mixin;
2+
3+
import com.glisco.isometricrenders.IsometricRenders;
4+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
5+
import net.minecraft.client.gl.Framebuffer;
6+
import net.minecraft.client.render.RenderPhase;
7+
import org.spongepowered.asm.mixin.Mixin;
8+
import org.spongepowered.asm.mixin.injection.At;
9+
10+
@Mixin(RenderPhase.class)
11+
public class RenderPhaseMixin {
12+
13+
@ModifyExpressionValue(method = {"method_62272", "method_34555", "method_29377"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;getFramebuffer()Lnet/minecraft/client/gl/Framebuffer;"))
14+
private static Framebuffer injectProperRenderTarget(Framebuffer original) {
15+
if (IsometricRenders.mainTargetOverride != null) {
16+
return IsometricRenders.mainTargetOverride;
17+
}
18+
19+
return original;
20+
}
21+
22+
}

src/main/java/com/glisco/isometricrenders/mixin/WorldRendererMixin.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,30 @@
33
import com.glisco.isometricrenders.IsometricRenders;
44
import com.glisco.isometricrenders.util.AreaSelectionHelper;
55
import com.llamalad7.mixinextras.sugar.Local;
6-
import net.minecraft.client.MinecraftClient;
76
import net.minecraft.client.render.*;
7+
import net.minecraft.client.util.Handle;
8+
import net.minecraft.client.util.ObjectAllocator;
89
import net.minecraft.client.util.math.MatrixStack;
10+
import net.minecraft.util.profiler.Profiler;
911
import org.joml.Matrix4f;
10-
import org.objectweb.asm.Opcodes;
11-
import org.spongepowered.asm.mixin.Final;
1212
import org.spongepowered.asm.mixin.Mixin;
13-
import org.spongepowered.asm.mixin.Shadow;
1413
import org.spongepowered.asm.mixin.injection.At;
1514
import org.spongepowered.asm.mixin.injection.Inject;
1615
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1716

1817
@Mixin(WorldRenderer.class)
1918
public class WorldRendererMixin {
2019

21-
@Shadow
22-
@Final
23-
private MinecraftClient client;
24-
2520
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
26-
public void dontRenderInScreen(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) {
21+
public void dontRenderInScreen(ObjectAllocator allocator, RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, Matrix4f projectionMatrix, CallbackInfo ci) {
2722
if (!IsometricRenders.skipWorldRender) return;
2823

2924
IsometricRenders.skipWorldRender = false;
3025
ci.cancel();
3126
}
3227

33-
@Inject(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;crosshairTarget:Lnet/minecraft/util/hit/HitResult;", opcode = Opcodes.GETFIELD, ordinal = 1))
34-
public void drawAreaSelection(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci, @Local(ordinal = 0) MatrixStack matrices) {
28+
@Inject(method = "method_62214", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;renderTargetBlockOutline(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;Lnet/minecraft/client/util/math/MatrixStack;Z)V"))
29+
public void drawAreaSelection(Fog fog, RenderTickCounter renderTickCounter, Camera camera, Profiler profiler, Matrix4f matrix4f, Matrix4f matrix4f2, Handle<?> handle, Handle<?> handle2, Handle<?> handle3, Handle<?> handle4, boolean bl, Frustum frustum, Handle<?> handle5, CallbackInfo ci, @Local(ordinal = 0) MatrixStack matrices) {
3530
AreaSelectionHelper.renderSelectionBox(matrices, camera);
3631
}
37-
3832
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.glisco.isometricrenders.mixin.access;
2+
3+
import net.minecraft.client.texture.NativeImage;
4+
import org.spongepowered.asm.mixin.Mixin;
5+
import org.spongepowered.asm.mixin.gen.Invoker;
6+
7+
import java.nio.channels.WritableByteChannel;
8+
9+
@Mixin(NativeImage.class)
10+
public interface NativeImageInvoker {
11+
12+
@Invoker("write")
13+
boolean isometric$write(WritableByteChannel channel);
14+
15+
}

0 commit comments

Comments
 (0)