Skip to content

Commit 2a57409

Browse files
committed
Update to Minecraft 1.21.6
1 parent e34c5c1 commit 2a57409

File tree

72 files changed

+505
-447
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+505
-447
lines changed

Common/src/main/java/mezz/jei/common/gui/elements/DrawableResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import mezz.jei.api.gui.drawable.IDrawableStatic;
44
import net.minecraft.client.gui.GuiGraphics;
5-
import net.minecraft.client.renderer.RenderType;
5+
import net.minecraft.client.renderer.RenderPipelines;
66
import net.minecraft.resources.ResourceLocation;
77

88
public class DrawableResource implements IDrawableStatic {
@@ -57,7 +57,7 @@ public void draw(GuiGraphics guiGraphics, int xOffset, int yOffset, int maskTop,
5757
int vHeight = this.height - (maskBottom + maskTop);
5858

5959
guiGraphics.blit(
60-
RenderType::guiTextured,
60+
RenderPipelines.GUI_TEXTURED,
6161
this.resourceLocation,
6262
xOffset + maskLeft,
6363
yOffset + maskTop,

Common/src/main/java/mezz/jei/common/gui/elements/DrawableSprite.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import mezz.jei.common.platform.IPlatformRenderHelper;
66
import mezz.jei.common.platform.Services;
77
import net.minecraft.client.gui.GuiGraphics;
8-
import net.minecraft.client.renderer.RenderType;
8+
import net.minecraft.client.renderer.RenderPipelines;
99
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
1010
import net.minecraft.resources.ResourceLocation;
1111

@@ -64,7 +64,7 @@ public void draw(GuiGraphics guiGraphics, int xOffset, int yOffset, int maskTop,
6464
IPlatformRenderHelper renderHelper = Services.PLATFORM.getRenderHelper();
6565
renderHelper.blitSprite(
6666
guiGraphics,
67-
RenderType::guiTextured,
67+
RenderPipelines.GUI_TEXTURED,
6868
sprite,
6969
this.width,
7070
this.height,

Common/src/main/java/mezz/jei/common/gui/elements/HighResolutionDrawable.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,23 @@ public int getHeight() {
4040
@Override
4141
public void draw(GuiGraphics guiGraphics, int xOffset, int yOffset) {
4242
var poseStack = guiGraphics.pose();
43-
poseStack.pushPose();
43+
poseStack.pushMatrix();
4444
{
45-
poseStack.translate(xOffset, yOffset, 0);
46-
poseStack.scale(1 / (float) scale, 1 / (float) scale, 1);
45+
poseStack.translate(xOffset, yOffset);
46+
poseStack.scale(1 / (float) scale, 1 / (float) scale);
4747
this.drawable.draw(guiGraphics);
4848
}
49-
poseStack.popPose();
49+
poseStack.popMatrix();
5050
}
5151

5252
@Override
5353
public void draw(GuiGraphics guiGraphics) {
5454
var poseStack = guiGraphics.pose();
55-
poseStack.pushPose();
55+
poseStack.pushMatrix();
5656
{
57-
poseStack.scale(1 / (float) scale, 1 / (float) scale, 1);
57+
poseStack.scale(1 / (float) scale, 1 / (float) scale);
5858
this.drawable.draw(guiGraphics);
5959
}
60-
poseStack.popPose();
60+
poseStack.popMatrix();
6161
}
6262
}

Common/src/main/java/mezz/jei/common/gui/elements/ScalableDrawable.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import mezz.jei.common.platform.Services;
77
import mezz.jei.common.util.ImmutableRect2i;
88
import net.minecraft.client.gui.GuiGraphics;
9-
import net.minecraft.client.renderer.RenderType;
9+
import net.minecraft.client.renderer.RenderPipelines;
1010
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
1111
import net.minecraft.client.resources.metadata.gui.GuiSpriteScaling;
1212
import net.minecraft.resources.ResourceLocation;
@@ -34,7 +34,7 @@ public void draw(GuiGraphics guiGraphics, int xOffset, int yOffset, int width, i
3434
IPlatformRenderHelper renderHelper = Services.PLATFORM.getRenderHelper();
3535
renderHelper.blitTiledSprite(
3636
guiGraphics,
37-
RenderType::guiTextured,
37+
RenderPipelines.GUI_TEXTURED,
3838
sprite,
3939
tileScaling,
4040
xOffset,
@@ -48,7 +48,7 @@ public void draw(GuiGraphics guiGraphics, int xOffset, int yOffset, int width, i
4848
IPlatformRenderHelper renderHelper = Services.PLATFORM.getRenderHelper();
4949
renderHelper.blitNineSlicedSprite(
5050
guiGraphics,
51-
RenderType::guiTextured,
51+
RenderPipelines.GUI_TEXTURED,
5252
sprite,
5353
nineSliceScaling,
5454
xOffset,
@@ -59,7 +59,7 @@ public void draw(GuiGraphics guiGraphics, int xOffset, int yOffset, int width, i
5959
}
6060
default -> {
6161
guiGraphics.blitSprite(
62-
RenderType::guiTextured,
62+
RenderPipelines.GUI_TEXTURED,
6363
sprite,
6464
xOffset,
6565
yOffset,
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
package mezz.jei.common.platform;
22

3+
import com.mojang.blaze3d.pipeline.RenderPipeline;
34
import com.mojang.blaze3d.platform.NativeImage;
45
import com.mojang.datafixers.util.Either;
56
import net.minecraft.client.Minecraft;
67
import net.minecraft.client.gui.Font;
78
import net.minecraft.client.gui.GuiGraphics;
8-
import net.minecraft.client.renderer.MultiBufferSource;
9-
import net.minecraft.client.renderer.RenderType;
109
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
1110
import net.minecraft.client.resources.metadata.gui.GuiSpriteScaling;
1211
import net.minecraft.network.chat.Component;
1312
import net.minecraft.network.chat.FormattedText;
14-
import net.minecraft.resources.ResourceLocation;
1513
import net.minecraft.tags.TagKey;
1614
import net.minecraft.world.effect.MobEffectInstance;
1715
import net.minecraft.world.inventory.tooltip.TooltipComponent;
@@ -21,7 +19,6 @@
2119

2220
import java.util.List;
2321
import java.util.Optional;
24-
import java.util.function.Function;
2522

2623
public interface IPlatformRenderHelper {
2724
Font getFontRenderer(Minecraft minecraft, ItemStack itemStack);
@@ -34,14 +31,12 @@ public interface IPlatformRenderHelper {
3431

3532
Component getName(TagKey<?> tagKey);
3633

37-
MultiBufferSource getBufferSource(GuiGraphics guiGraphics);
38-
3934
@Nullable
4035
TextureAtlasSprite getTextureAtlasSprite(BlockState blockState);
4136

42-
void blitSprite(GuiGraphics guiGraphics, Function<ResourceLocation, RenderType> renderType, TextureAtlasSprite sprite, int textureWidth, int textureHeight, int uPosition, int vPosition, int x, int y, int uWidth, int vHeight);
37+
void blitSprite(GuiGraphics guiGraphics, RenderPipeline renderPipeline, TextureAtlasSprite sprite, int textureWidth, int textureHeight, int uPosition, int vPosition, int x, int y, int uWidth, int vHeight);
4338

44-
void blitNineSlicedSprite(GuiGraphics guiGraphics, Function<ResourceLocation, RenderType> renderType, TextureAtlasSprite sprite, GuiSpriteScaling.NineSlice scaling, int xOffset, int yOffset, int width, int height);
39+
void blitNineSlicedSprite(GuiGraphics guiGraphics, RenderPipeline renderPipeline, TextureAtlasSprite sprite, GuiSpriteScaling.NineSlice scaling, int xOffset, int yOffset, int width, int height);
4540

46-
void blitTiledSprite(GuiGraphics guiGraphics, Function<ResourceLocation, RenderType> renderType, TextureAtlasSprite sprite, GuiSpriteScaling.Tile scaling, int xOffset, int yOffset, int width, int height, int color);
41+
void blitTiledSprite(GuiGraphics guiGraphics, RenderPipeline renderPipeline, TextureAtlasSprite sprite, GuiSpriteScaling.Tile scaling, int xOffset, int yOffset, int width, int height, int color);
4742
}

Common/src/main/java/mezz/jei/common/util/RectDebugger.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package mezz.jei.common.util;
22

33
import net.minecraft.client.gui.GuiGraphics;
4-
import net.minecraft.client.renderer.RenderType;
54

65
import java.util.HashMap;
76
import java.util.Map;
@@ -27,7 +26,6 @@ public void draw(GuiGraphics guiGraphics) {
2726
for (Rect rect : rects.values()) {
2827
ImmutableRect2i rect1 = rect.rect;
2928
guiGraphics.fill(
30-
RenderType.guiOverlay(),
3129
rect1.getX(),
3230
rect1.getY(),
3331
rect1.getX() + rect1.getWidth(),

CommonApi/src/main/java/mezz/jei/api/ingredients/IIngredientRenderer.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package mezz.jei.api.ingredients;
22

3-
import com.mojang.blaze3d.vertex.PoseStack;
43
import mezz.jei.api.gui.builder.ITooltipBuilder;
54
import mezz.jei.api.ingredients.rendering.BatchRenderElement;
65
import mezz.jei.api.registration.IModIngredientRegistration;
@@ -41,13 +40,13 @@ public interface IIngredientRenderer<T> {
4140
* @since 19.5.5
4241
*/
4342
default void render(GuiGraphics guiGraphics, T ingredient, int posX, int posY) {
44-
PoseStack poseStack = guiGraphics.pose();
45-
poseStack.pushPose();
43+
var poseStack = guiGraphics.pose();
44+
poseStack.pushMatrix();
4645
{
47-
poseStack.translate(posX, posY, 0);
46+
poseStack.translate(posX, posY);
4847
render(guiGraphics, ingredient);
4948
}
50-
poseStack.popPose();
49+
poseStack.popMatrix();
5150
}
5251

5352
/**

CommonApi/src/main/java/mezz/jei/api/registration/IGuiHandlerRegistration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ public interface IGuiHandlerRegistration {
4141
*/
4242
<T extends Screen> void addGuiScreenHandler(Class<T> guiClass, IScreenHandler<T> handler);
4343

44+
/**
45+
* Same as {@link #addGuiScreenHandler(Class, IScreenHandler)} but for handlers that use Java Generics to
46+
* support multiple types of containers. This type of handler runs into type issues with the regular method.
47+
* @since 22.0.0
48+
*/
49+
<T extends Screen> void addGenericGuiScreenHandler(Class<T> guiClass, IScreenHandler<?> handler);
50+
4451
/**
4552
* Add a handler to give JEI extra information about how to layout the ingredient list.
4653
* Used for guis that display next to GUIs and would normally intersect with JEI.

Fabric/src/main/java/mezz/jei/fabric/events/JeiScreenEvents.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import net.fabricmc.fabric.api.event.Event;
66
import net.fabricmc.fabric.api.event.EventFactory;
77
import net.minecraft.client.gui.GuiGraphics;
8+
import net.minecraft.client.gui.screens.Screen;
89
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
910

1011
public class JeiScreenEvents {
@@ -20,4 +21,17 @@ public class JeiScreenEvents {
2021
public interface DrawForeground {
2122
void drawForeground(AbstractContainerScreen<?> screen, GuiGraphics guiGraphics, int mouseX, int mouseY);
2223
}
24+
25+
public static final Event<DrawBackground> DRAW_BACKGROUND =
26+
EventFactory.createArrayBacked(DrawBackground.class, callbacks -> (screen, guiGraphics, mouseX, mouseY, partialTicks) -> {
27+
for (DrawBackground callback : callbacks) {
28+
callback.drawBackground(screen, guiGraphics, mouseX, mouseY, partialTicks);
29+
}
30+
});
31+
32+
@Environment(EnvType.CLIENT)
33+
@FunctionalInterface
34+
public interface DrawBackground {
35+
void drawBackground(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks);
36+
}
2337
}

Fabric/src/main/java/mezz/jei/fabric/mixin/AbstractContainerScreenMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
@Mixin(AbstractContainerScreen.class)
1212
public class AbstractContainerScreenMixin {
1313
@Inject(
14-
method = "render(Lnet/minecraft/client/gui/GuiGraphics;IIF)V",
14+
method = "renderContents",
1515
at = @At(
1616
value = "INVOKE",
17-
target = "Lnet/minecraft/client/gui/screens/inventory/AbstractContainerScreen;renderLabels(Lnet/minecraft/client/gui/GuiGraphics;II)V",
17+
target = "Lnet/minecraft/client/gui/screens/inventory/AbstractContainerScreen;renderSlotHighlightFront(Lnet/minecraft/client/gui/GuiGraphics;)V",
1818
ordinal = 0,
1919
shift = At.Shift.AFTER
2020
)

0 commit comments

Comments
 (0)