Skip to content

Commit

Permalink
update to 1.21.3
Browse files Browse the repository at this point in the history
way2muchnoise committed Nov 8, 2024
1 parent 7d961a2 commit 96ee068
Showing 7 changed files with 37 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
import net.minecraft.advancements.DisplayInfo;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
@@ -90,9 +91,9 @@ public void drawContents(GuiGraphics guiGraphics, int left, int top, int width,
for (; k <= 1 + width / 16; k++) {
int l = -1;
for (;l <= height / 16; l++) {
guiGraphics.blit(resourcelocation, i + 16 * k, j + 16 * l, 0.0F, 0.0F, 16, 16, 16, 16);
guiGraphics.blit(RenderType::guiTextured, resourcelocation, i + 16 * k, j + 16 * l, 0.0F, 0.0F, 16, 16, 16, 16);
}
guiGraphics.blit(resourcelocation, i + 16 * k, j + 16 * l, 0.0F, 0.0F, 16, height % 16, 16, 16);
guiGraphics.blit(RenderType::guiTextured, resourcelocation, i + 16 * k, j + 16 * l, 0.0F, 0.0F, 16, height % 16, 16, 16);
}


Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
import betteradvancements.common.reference.Resources;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.advancements.AdvancementTabType;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.item.ItemStack;

import java.util.List;
@@ -62,7 +63,7 @@ public void draw(GuiGraphics guiGraphics, int x, int y, int width, int height, b
}

int j = selected ? this.textureY + this.height : this.textureY;
guiGraphics.blit(Resources.Gui.TABS, x + this.getX(index, width, height), y + this.getY(index, width, height), i, j, this.width, this.height);
guiGraphics.blit(RenderType::guiTextured, Resources.Gui.TABS, x + this.getX(index, width, height), y + this.getY(index, width, height), i, j, this.width, this.height, 256, 256);
}

public void drawIcon(GuiGraphics guiGraphics, int left, int top, int width, int height, int index, ItemStack stack) {
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.advancements.AdvancementWidgetType;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.locale.Language;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentUtils;
@@ -227,7 +228,7 @@ public void draw(GuiGraphics guiGraphics, int scrollX, int scrollY) {

RenderUtil.setColor(betterDisplayInfo.getIconColor(advancementState));
RenderSystem.enableBlend();
guiGraphics.blitSprite(advancementState.frameSprite(this.displayInfo.getType()), scrollX + this.x + 3, scrollY + this.y, ICON_SIZE, ICON_SIZE);
guiGraphics.blitSprite(RenderType::guiTextured, advancementState.frameSprite(this.displayInfo.getType()), scrollX + this.x + 3, scrollY + this.y, ICON_SIZE, ICON_SIZE);
RenderUtil.setColor(betterDisplayInfo.defaultIconColor());
guiGraphics.renderFakeItem(this.displayInfo.getIcon(), scrollX + this.x + 8, scrollY + this.y + 5);
}
@@ -322,21 +323,21 @@ public void drawHover(GuiGraphics guiGraphics, int scrollX, int scrollY, float f
// Title left side
RenderUtil.setColor(betterDisplayInfo.getTitleColor(stateTitleLeft));
int left_side = Math.min(j, WIDGET_WIDTH - 16);
guiGraphics.blit(Resources.Gui.WIDGETS, drawX, drawY, 0, betterDisplayInfo.getTitleYMultiplier(stateTitleLeft) * WIDGET_HEIGHT, left_side, WIDGET_HEIGHT);
guiGraphics.blit(RenderType::guiTextured, Resources.Gui.WIDGETS, drawX, drawY, 0, betterDisplayInfo.getTitleYMultiplier(stateTitleLeft) * WIDGET_HEIGHT, left_side, WIDGET_HEIGHT, 256, 256);
if (left_side < j) {
guiGraphics.blit(Resources.Gui.WIDGETS, drawX + left_side, drawY, 16, betterDisplayInfo.getTitleYMultiplier(stateTitleLeft) * WIDGET_HEIGHT, j - left_side, WIDGET_HEIGHT);
guiGraphics.blit(RenderType::guiTextured, Resources.Gui.WIDGETS, drawX + left_side, drawY, 16, betterDisplayInfo.getTitleYMultiplier(stateTitleLeft) * WIDGET_HEIGHT, j - left_side, WIDGET_HEIGHT, 256, 256);
}
// Title right side
RenderUtil.setColor(betterDisplayInfo.getTitleColor(stateTitleRight));
int right_side = Math.min(k, WIDGET_WIDTH - 16);
guiGraphics.blit(Resources.Gui.WIDGETS, drawX + j, drawY, WIDGET_WIDTH - right_side, betterDisplayInfo.getTitleYMultiplier(stateTitleRight) * WIDGET_HEIGHT, right_side, WIDGET_HEIGHT);
guiGraphics.blit(RenderType::guiTextured, Resources.Gui.WIDGETS, drawX + j, drawY, WIDGET_WIDTH - right_side, betterDisplayInfo.getTitleYMultiplier(stateTitleRight) * WIDGET_HEIGHT, right_side, WIDGET_HEIGHT, 256, 256);
if (right_side < k) {
// + and - 2 is to create some overlap in the drawing when it extends past the max length of the texture
guiGraphics.blit(Resources.Gui.WIDGETS, drawX + j + right_side - 2, drawY, WIDGET_WIDTH - k + right_side - 2, betterDisplayInfo.getTitleYMultiplier(stateTitleRight) * WIDGET_HEIGHT, k - right_side + 2, WIDGET_HEIGHT);
guiGraphics.blit(RenderType::guiTextured, Resources.Gui.WIDGETS, drawX + j + right_side - 2, drawY, WIDGET_WIDTH - k + right_side - 2, betterDisplayInfo.getTitleYMultiplier(stateTitleRight) * WIDGET_HEIGHT, k - right_side + 2, WIDGET_HEIGHT, 256, 256);
}
// Advancement icon
RenderUtil.setColor(betterDisplayInfo.getIconColor(stateIcon));
guiGraphics.blitSprite(stateIcon.frameSprite(this.displayInfo.getType()), scrollX + this.x + 3, scrollY + this.y, ICON_SIZE, ICON_SIZE);
guiGraphics.blitSprite(RenderType::guiTextured, stateIcon.frameSprite(this.displayInfo.getType()), scrollX + this.x + 3, scrollY + this.y, ICON_SIZE, ICON_SIZE);
RenderUtil.setColor(betterDisplayInfo.defaultIconColor());

if (drawLeft) {
@@ -379,17 +380,17 @@ public void drawHover(GuiGraphics guiGraphics, int scrollX, int scrollY, float f

protected void render9Sprite(GuiGraphics guiGraphics, int x, int y, int width, int height, int textureHeight, int textureWidth, int textureDistance, int textureX, int textureY) {
// Top left corner
guiGraphics.blit(Resources.Gui.WIDGETS, x, y, textureX, textureY, textureHeight, textureHeight);
guiGraphics.blit(RenderType::guiTextured, Resources.Gui.WIDGETS, x, y, textureX, textureY, textureHeight, textureHeight, 256, 256);
// Top side
RenderUtil.renderRepeating(Resources.Gui.WIDGETS, guiGraphics, x + textureHeight, y, width - textureHeight - textureHeight, textureHeight, textureX + textureHeight, textureY, textureWidth - textureHeight - textureHeight, textureDistance);
// Top right corner
guiGraphics.blit(Resources.Gui.WIDGETS, x + width - textureHeight, y, textureX + textureWidth - textureHeight, textureY, textureHeight, textureHeight);
guiGraphics.blit(RenderType::guiTextured, Resources.Gui.WIDGETS, x + width - textureHeight, y, textureX + textureWidth - textureHeight, textureY, textureHeight, textureHeight, 256, 256);
// Bottom left corner
guiGraphics.blit(Resources.Gui.WIDGETS, x, y + height - textureHeight, textureX, textureY + textureDistance - textureHeight, textureHeight, textureHeight);
guiGraphics.blit(RenderType::guiTextured, Resources.Gui.WIDGETS, x, y + height - textureHeight, textureX, textureY + textureDistance - textureHeight, textureHeight, textureHeight, 256, 256);
// Bottom side
RenderUtil.renderRepeating(Resources.Gui.WIDGETS, guiGraphics, x + textureHeight, y + height - textureHeight, width - textureHeight - textureHeight, textureHeight, textureX + textureHeight, textureY + textureDistance - textureHeight, textureWidth - textureHeight - textureHeight, textureDistance);
// Bottom right corner
guiGraphics.blit(Resources.Gui.WIDGETS, x + width - textureHeight, y + height - textureHeight, textureX + textureWidth - textureHeight, textureY + textureDistance - textureHeight, textureHeight, textureHeight);
guiGraphics.blit(RenderType::guiTextured, Resources.Gui.WIDGETS, x + width - textureHeight, y + height - textureHeight, textureX + textureWidth - textureHeight, textureY + textureDistance - textureHeight, textureHeight, textureHeight, 256, 256);
// Left side
RenderUtil.renderRepeating(Resources.Gui.WIDGETS, guiGraphics, x, y + textureHeight, textureHeight, height - textureHeight - textureHeight, textureX, textureY + textureHeight, textureWidth, textureDistance - textureHeight - textureHeight);
// Center
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.multiplayer.ClientAdvancements;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.ServerboundSeenAdvancementsPacket;
import net.minecraft.util.FormattedCharSequence;
@@ -389,21 +390,21 @@ private void renderInside(GuiGraphics guiGraphics, int mouseX, int mouseY, int l
public void renderWindow(GuiGraphics guiGraphics, int left, int top, int right, int bottom, int maxTabs, int skip) {
RenderSystem.enableBlend();
// Top left corner
guiGraphics.blit(Resources.Gui.WINDOW, left, top, 0, 0, CORNER_SIZE, CORNER_SIZE);
guiGraphics.blit(RenderType::guiTextured, Resources.Gui.WINDOW, left, top, 0, 0, CORNER_SIZE, CORNER_SIZE, 256, 256);
// Top side
RenderUtil.renderRepeating(Resources.Gui.WINDOW, guiGraphics, left + CORNER_SIZE, top, internalWidth - CORNER_SIZE - 2*SIDE - CORNER_SIZE, CORNER_SIZE, CORNER_SIZE, 0, WIDTH - CORNER_SIZE - CORNER_SIZE, CORNER_SIZE);
// Top right corner
guiGraphics.blit(Resources.Gui.WINDOW, right - CORNER_SIZE, top, WIDTH - CORNER_SIZE, 0, CORNER_SIZE, CORNER_SIZE);
guiGraphics.blit(RenderType::guiTextured, Resources.Gui.WINDOW, right - CORNER_SIZE, top, WIDTH - CORNER_SIZE, 0, CORNER_SIZE, CORNER_SIZE, 256, 256);
// Left side
RenderUtil.renderRepeating(Resources.Gui.WINDOW, guiGraphics, left, top + CORNER_SIZE, CORNER_SIZE, bottom - top - 2 * CORNER_SIZE, 0, CORNER_SIZE, CORNER_SIZE, HEIGHT - CORNER_SIZE - CORNER_SIZE);
// Right side
RenderUtil.renderRepeating(Resources.Gui.WINDOW, guiGraphics, right - CORNER_SIZE, top + CORNER_SIZE, CORNER_SIZE, bottom - top - 2 * CORNER_SIZE, WIDTH - CORNER_SIZE, CORNER_SIZE, CORNER_SIZE, HEIGHT - CORNER_SIZE - CORNER_SIZE);
// Bottom left corner
guiGraphics.blit(Resources.Gui.WINDOW, left, bottom - CORNER_SIZE, 0, HEIGHT - CORNER_SIZE, CORNER_SIZE, CORNER_SIZE);
guiGraphics.blit(RenderType::guiTextured, Resources.Gui.WINDOW, left, bottom - CORNER_SIZE, 0, HEIGHT - CORNER_SIZE, CORNER_SIZE, CORNER_SIZE, 256, 256);
// Bottom side
RenderUtil.renderRepeating(Resources.Gui.WINDOW, guiGraphics, left + CORNER_SIZE, bottom - CORNER_SIZE, internalWidth - CORNER_SIZE - 2*SIDE - CORNER_SIZE, CORNER_SIZE, CORNER_SIZE, HEIGHT - CORNER_SIZE, WIDTH - CORNER_SIZE - CORNER_SIZE, CORNER_SIZE);
// Bottom right corner
guiGraphics.blit(Resources.Gui.WINDOW, right - CORNER_SIZE, bottom - CORNER_SIZE, WIDTH - CORNER_SIZE, HEIGHT - CORNER_SIZE, CORNER_SIZE, CORNER_SIZE);
guiGraphics.blit(RenderType::guiTextured, Resources.Gui.WINDOW, right - CORNER_SIZE, bottom - CORNER_SIZE, WIDTH - CORNER_SIZE, HEIGHT - CORNER_SIZE, CORNER_SIZE, CORNER_SIZE, 256, 256);

int width = right - left;
int height = bottom - top;
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.AbstractButton;
import net.minecraft.client.gui.narration.NarrationElementOutput;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
@@ -25,7 +26,7 @@ public void renderWidget(@NotNull GuiGraphics guiGraphics, int mouseX, int mouse
{
Minecraft mc = Minecraft.getInstance();
this.isHovered = mouseX >= this.getX() && mouseY >= this.getY() && mouseX < this.getX() + this.getWidth() && mouseY < this.getY() + this.getHeight();
guiGraphics.blit(Resources.Gui.TABS, this.getX(), this.getY(), 56, 0, 28, 32);
guiGraphics.blit(RenderType::guiTextured, Resources.Gui.TABS, this.getX(), this.getY(), 56, 0, 28, 32, 256, 256);
if (this.isHovered) {
guiGraphics.renderTooltip(mc.font, Component.translatable("gui.advancements"), mouseX, mouseY);
}
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.*;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation;

public class RenderUtil {
@@ -17,7 +18,7 @@ public static void renderRepeating(ResourceLocation texture, GuiGraphics guiGrap
for (int l = 0; l < height; l += textureHeight) {
int drawY = y + l;
int drawHeight = Math.min(textureHeight, height - l);
guiGraphics.blit(texture, drawX, drawY, textureX, textureY, drawWidth, drawHeight);
guiGraphics.blit(RenderType::guiTextured, texture, drawX, drawY, textureX, textureY, drawWidth, drawHeight, 256, 256);
}
}
}
24 changes: 12 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -15,26 +15,26 @@ githubUrl=way2muchnoise/BetterAdvancements
platforms=fabric,forge,neoforge

# Minecraft
minecraftVersion=1.21.1
minecraftVersionRange=[1.21.1, 1.22)
minecraftVersion=1.21.3
minecraftVersionRange=[1.21.3, 1.22)

# Forge
forgeVersion=52.0.24
loaderVersionRange=[52,)
forgeVersionRange=[52.0.0,)
forgeVersion=53.0.10
loaderVersionRange=[53,)
forgeVersionRange=[53.0.0,)

# Fabric
fabricVersion=0.107.0+1.21.1
fabricLoaderVersion=0.16.7
fabricVersion=0.107.3+1.21.3
fabricLoaderVersion=0.16.9

# NeoForge
neoforgeVersion=21.1.73
neoforgeVersion=21.3.12-beta
neoforgeLoaderVersionRange=[4,)
neoforgeVersionRange=[21.1.0,)
neoforgeVersionRange=[21.3.0,)

# Fabric Config screen
clothVersion=15.0.140
modMenuVersion=11.0.3
clothVersion=16.0.141
modMenuVersion=12.0.0-beta.1

# Mappings
mappingsChannel=parchment
@@ -47,4 +47,4 @@ curseHomepageLink=https://www.curseforge.com/minecraft/mc-mods/better-advancemen
modrinthProjectId=Q2OqKxDG

# Version
specificationVersion=0.4.3
specificationVersion=0.4.4

0 comments on commit 96ee068

Please sign in to comment.