Skip to content

Commit

Permalink
Update to Minecraft 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
EnnuiL committed Oct 28, 2024
1 parent 24ae449 commit 8753237
Show file tree
Hide file tree
Showing 62 changed files with 341 additions and 439 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
alias(libs.plugins.quilt.loom)
}

project.version = "0.2.0-beta.4+1.21.1"
project.version = "0.3.0-beta.1+1.21.3"
project.group = "io.github.ennuil"

loom {
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# The latest versions are available at https://quiltmc.org/en/usage/latest-versions/
[versions]
minecraft = "1.21.1"
minecraft = "1.21.3"

quilt_loom = "1.8.4"
quilt_loader = "0.27.0-beta.1"

fabric_api = "0.107.0+1.21.1"
fabric_api = "0.107.0+1.21.3"

[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,16 @@ public TenfoursizedContainerMenu(MenuType<?> type, int syncId, Inventory invento
this.container = container;
this.containerRows = containerRows;
container.startOpen(inventory.player);
int inventoryOffsetY = (this.containerRows - 4) * 18;
int inventoryOffsetY = 18 + this.containerRows * 18 + 13;

// TODO - Split me into a method!
for (int i = 0; i < this.containerRows; i++) {
for (int j = 0; j < 10; j++) {
this.addSlot(new Slot(container, j + i * 10, 8 + j * 18, 18 + i * 18));
}
}

for (int i = 0; i < 3; i++) {
for (int j = 0; j < 10; j++) {
this.addSlot(new Slot(inventory, j + i * 10 + 10, 8 + j * 18, 103 + i * 18 + inventoryOffsetY));
}
}

for (int i = 0; i < 10; i++) {
this.addSlot(new Slot(inventory, i, 8 + i * 18, 161 + inventoryOffsetY));
}
this.addStandardInventorySlots(inventory, 8, inventoryOffsetY);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.gui.screens.inventory.MenuAccess;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
Expand Down Expand Up @@ -32,7 +33,7 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
protected void renderBg(GuiGraphics graphics, float delta, int mouseX, int mouseY) {
int x = (this.width - this.imageWidth) / 2;
int y = (this.height - this.imageHeight) / 2;
graphics.blit(TEXTURE, x, y, 0, 0, this.imageWidth, this.rows * 18 + 17);
graphics.blit(TEXTURE, x, y + this.rows * 18 + 17, 0, 126, this.imageWidth, 96);
graphics.blit(RenderType::guiTextured, TEXTURE, x, y, 0, 0, this.imageWidth, this.rows * 18 + 17, 256, 256);
graphics.blit(RenderType::guiTextured, TEXTURE, x, y + this.rows * 18 + 17, 0, 126, this.imageWidth, 96, 256, 256);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,30 @@

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.world.Container;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(AbstractContainerMenu.class)
public abstract class AbstractContainerMenuMixin {
@ModifyExpressionValue(
method = {
"addInventoryHotbarSlots",
"addInventoryExtendedSlots"
},
at = @At(
value = "CONSTANT",
args = "intValue=9"
)
)
private int modifyNines(int original, @Local(argsOnly = true) Container container) {
return container instanceof Inventory inventory && inventory.isTenfoursized() ? 10 : original;
}

@ModifyExpressionValue(method = "doClick", at = @At(value = "CONSTANT", args = "intValue=9"))
private int modifyNine(int original, @Local Inventory inventory) {
private int modifyNineOnClick(int original, @Local Inventory inventory) {
return inventory.isTenfoursized() ? 10 : original;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ private int modifyResultSlotX(int original) {
return this.owner.getInventory().isTenfoursized() ? 172 : original;
}

@ModifyExpressionValue(method = "<init>", at = @At(value = "CONSTANT", args = "intValue=9"))
private int modifyNines(int original) {
return this.owner.getInventory().isTenfoursized() ? 10 : original;
}

@ModifyExpressionValue(method = "<init>", at = @At(value = "CONSTANT", args = "intValue=39"))
private int modify39(int original) {
return this.owner.getInventory().isTenfoursized() ? 39 + 4 : original;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private static int modifyNinesOnIsValidHotbarIndex(int original) {
return 10;
}

@ModifyExpressionValue(method = {"getSuitableHotbarSlot", "swapPaint"}, at = @At(value = "CONSTANT", args = "intValue=9"))
@ModifyExpressionValue(method = {"getSuitableHotbarSlot"}, at = @At(value = "CONSTANT", args = "intValue=9"))
private int modifyNines(int original) {
return this.isTenfoursized() ? 10 : original;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public abstract class GuiMixin {
method = "renderItemHotbar",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V"
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIII)V",
ordinal = 0
)
)
private ResourceLocation modifyHotbar(ResourceLocation original) {
Expand All @@ -45,7 +46,7 @@ private ResourceLocation modifyHotbar(ResourceLocation original) {
method = "renderItemHotbar",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIII)V",
ordinal = 1
)
)
Expand All @@ -57,7 +58,7 @@ private ResourceLocation modifyHotbarSelection(ResourceLocation original) {
method = "renderItemHotbar",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIII)V",
ordinal = 2
)
)
Expand All @@ -69,7 +70,7 @@ private ResourceLocation modifyHotbarOffhandLeft(ResourceLocation original) {
method = "renderItemHotbar",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIII)V",
ordinal = 3
)
)
Expand All @@ -81,7 +82,7 @@ private ResourceLocation modifyHotbarOffhandRight(ResourceLocation original) {
method = "renderExperienceBar",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V"
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIII)V"
)
)
private ResourceLocation modifyExperienceBarBackground(ResourceLocation original) {
Expand All @@ -92,7 +93,7 @@ private ResourceLocation modifyExperienceBarBackground(ResourceLocation original
method = "renderExperienceBar",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIIIIIII)V"
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIIIIIII)V"
)
)
private ResourceLocation modifyExperienceBarProgress(ResourceLocation original) {
Expand All @@ -103,7 +104,7 @@ private ResourceLocation modifyExperienceBarProgress(ResourceLocation original)
method = "renderJumpMeter",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIII)V",
ordinal = 0
)
)
Expand All @@ -115,7 +116,7 @@ private ResourceLocation modifyJumpBarBackground(ResourceLocation original) {
method = "renderJumpMeter",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIII)V",
ordinal = 1
)
)
Expand All @@ -127,7 +128,7 @@ private ResourceLocation modifyJumpBarCooldown(ResourceLocation original) {
method = "renderJumpMeter",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIIIIIII)V"
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIIIIIII)V"
)
)
private ResourceLocation modifyJumpBarProgress(ResourceLocation original) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import io.github.ennuil.ennuis_bigger_inventories.impl.ModUtils;
import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen;
import net.minecraft.client.gui.screens.inventory.AbstractRecipeBookScreen;
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
Expand All @@ -17,11 +18,11 @@

@ClientOnly
@Mixin(InventoryScreen.class)
public abstract class InventoryScreenMixin extends EffectRenderingInventoryScreen<InventoryMenu> {
public abstract class InventoryScreenMixin extends AbstractRecipeBookScreen<InventoryMenu> {
@Unique private static final ResourceLocation EBI_TEXTURE = ModUtils.id("textures/gui/container/inventory.png");

private InventoryScreenMixin(InventoryMenu menu, Inventory inventory, Component title) {
super(menu, inventory, title);
private InventoryScreenMixin(InventoryMenu recipeBookMenu, RecipeBookComponent<?> recipeBookComponent, Inventory inventory, Component title) {
super(recipeBookMenu, recipeBookComponent, inventory, title);
}

@ModifyExpressionValue(method = "<init>", at = @At(value = "CONSTANT", args = "intValue=97"))
Expand All @@ -33,7 +34,7 @@ private int modify97(int original, Player player) {
return original;
}

@ModifyExpressionValue(method = {"init", "method_19891"}, at = @At(value = "CONSTANT", args = "intValue=104"))
@ModifyExpressionValue(method = {"init", "getRecipeBookButtonPosition"}, at = @At(value = "CONSTANT", args = "intValue=104"))
private int modify104(int original) {
return this.minecraft.gameMode.isTenfoursized() ? 122 : original;
}
Expand All @@ -42,7 +43,7 @@ private int modify104(int original) {
method = "renderBg",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V"
target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIFFIIII)V"
)
)
private ResourceLocation modifyTexture(ResourceLocation original) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package io.github.ennuil.ennuis_bigger_inventories.mixin.core.client;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.client.MouseHandler;
import net.minecraft.world.entity.player.Inventory;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(MouseHandler.class)
public abstract class MouseHandlerMixin {
@ModifyExpressionValue(
method = "onScroll",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/entity/player/Inventory;getSelectionSize()I"
)
)
private int modifyGetSelectionSizeOnScroll(int original, @Local Inventory inventory) {
return inventory.isTenfoursized() ? 10 : original;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private void modifyTitleX(ChestMenu menu, Inventory inventory, Component title,
method = "renderBg",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V"
target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIFFIIII)V"
)
)
private ResourceLocation modifyTexture(ResourceLocation original) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private DispenserScreenMixin(DispenserMenu menu, Inventory inventory, Component
method = "renderBg",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V"
target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIFFIIII)V"
)
)
private ResourceLocation modifyTexture(ResourceLocation original) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private HopperScreenMixin(HopperMenu menu, Inventory inventory, Component title)
method = "renderBg",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V"
target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIFFIIII)V"
)
)
private ResourceLocation modifyTexture(ResourceLocation original) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private ShulkerBoxScreenMixin(ShulkerBoxMenu menu, Inventory inventory, Componen
method = "renderBg",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V"
target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIFFIIII)V"
)
)
private ResourceLocation modifyTexture(ResourceLocation original) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
import io.github.ennuil.ennuis_bigger_inventories.impl.ModUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen;
import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
import net.minecraft.core.NonNullList;
import net.minecraft.network.chat.Component;
Expand All @@ -29,10 +30,11 @@
import org.spongepowered.asm.mixin.injection.Slice;

import java.util.Collection;
import java.util.function.Function;

@ClientOnly
@Mixin(CreativeModeInventoryScreen.class)
public abstract class CreativeModeInventoryScreenMixin extends EffectRenderingInventoryScreen<CreativeModeInventoryScreen.ItemPickerMenu> {
public abstract class CreativeModeInventoryScreenMixin extends AbstractContainerScreen<CreativeModeInventoryScreen.ItemPickerMenu> {
@Unique private static final ResourceLocation EBI_SCROLLER_SPRITE = ModUtils.id("container/creative_inventory/scroller");
@Unique private static final ResourceLocation EBI_SCROLLER_DISABLED_SPRITE = ModUtils.id("container/creative_inventory/scroller_disabled");

Expand Down Expand Up @@ -248,7 +250,7 @@ private int modifyPlayerX2(int original) {
method = "renderBg",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V",
target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIFFIIII)V",
ordinal = 0
)
)
Expand All @@ -262,33 +264,33 @@ private ResourceLocation modifyTexture(ResourceLocation original) {
method = "renderBg",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V"
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIII)V"
)
)
private void modifyScrollerTexture(GuiGraphics graphics, ResourceLocation texture, int x, int y, int width, int height, Operation<Void> original) {
private void modifyScrollerTexture(GuiGraphics graphics, Function<ResourceLocation, RenderType> function, ResourceLocation texture, int x, int y, int width, int height, Operation<Void> original) {
if (this.minecraft.gameMode.isTenfoursized()) {
var scrollerTexture = this.canScroll() ? EBI_SCROLLER_SPRITE : EBI_SCROLLER_DISABLED_SPRITE;
graphics.blitSprite(scrollerTexture, x + 18, y, width, height);
graphics.blitSprite(function, scrollerTexture, x + 18, y, width, height);
} else {
original.call(graphics, texture, x, y, width, height);
original.call(graphics, function, texture, x, y, width, height);
}
}

@WrapOperation(
method = "renderTabButton",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V"
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIII)V"
)
)
private void modifyTabTexture(GuiGraphics graphics, ResourceLocation texture, int x, int y, int width, int height, Operation<Void> original, @Local(ordinal = 0) boolean bl, @Local(ordinal = 1) boolean bl2, @Local(ordinal = 0) int i) {
private void modifyTabTexture(GuiGraphics graphics, Function<ResourceLocation, RenderType> function, ResourceLocation texture, int x, int y, int width, int height, Operation<Void> original, @Local(ordinal = 0) boolean bl, @Local(ordinal = 1) boolean bl2, @Local(ordinal = 0) int i) {
if (this.minecraft.gameMode.isTenfoursized()) {
var tabTextures = bl2
? (bl ? EBI_SELECTED_TOP_TABS : EBI_UNSELECTED_TOP_TABS)
: (bl ? EBI_SELECTED_BOTTOM_TABS : EBI_UNSELECTED_BOTTOM_TABS);
graphics.blitSprite(tabTextures[Mth.clamp(i, 0, tabTextures.length)], x, y, width, height);
graphics.blitSprite(function, tabTextures[Mth.clamp(i, 0, tabTextures.length)], x, y, width, height);
} else {
original.call(graphics, texture, x, y, width, height);
original.call(graphics, function, texture, x, y, width, height);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ private int modifyInitNine1(int original, Player player) {
return player.level().inferTenfoursized() ? 10 : original;
}

@ModifyExpressionValue(method = "<init>", at = @At(value = "CONSTANT", args = "intValue=9", ordinal = 3))
private int modifyInitNine3(int original, Player player) {
return player.level().inferTenfoursized() ? 10 : original;
}

@ModifyExpressionValue(
method = {
"calculateRowCount",
Expand Down
Loading

0 comments on commit 8753237

Please sign in to comment.